PluginProbe ʕ •ᴥ•ʔ
Transferito: WP Migration / trunk
Transferito: WP Migration vtrunk
trunk 11.4.0 12.0.0 13.1.0 14.0.0 14.0.11 14.0.7 14.1.0 14.1.1 14.1.2 14.1.3 14.1.4
transferito / vendor / aws / aws-sdk-php / src / S3Control / S3ControlClient.php
transferito / vendor / aws / aws-sdk-php / src / S3Control Last commit date
Exception 10 months ago EndpointArnMiddleware.php 10 months ago S3ControlClient.php 10 months ago
S3ControlClient.php
336 lines
1 <?php
2 namespace Aws\S3Control;
3
4 use Aws\AwsClient;
5 use Aws\CacheInterface;
6 use Aws\HandlerList;
7 use Aws\S3\UseArnRegion\Configuration;
8 use Aws\S3\UseArnRegion\ConfigurationInterface;
9 use Aws\S3\UseArnRegion\ConfigurationProvider as UseArnRegionConfigurationProvider;
10 use GuzzleHttp\Promise\PromiseInterface;
11
12 /**
13 * This client is used to interact with the **AWS S3 Control** service.
14 * @method \Aws\Result associateAccessGrantsIdentityCenter(array $args = [])
15 * @method \GuzzleHttp\Promise\Promise associateAccessGrantsIdentityCenterAsync(array $args = [])
16 * @method \Aws\Result createAccessGrant(array $args = [])
17 * @method \GuzzleHttp\Promise\Promise createAccessGrantAsync(array $args = [])
18 * @method \Aws\Result createAccessGrantsInstance(array $args = [])
19 * @method \GuzzleHttp\Promise\Promise createAccessGrantsInstanceAsync(array $args = [])
20 * @method \Aws\Result createAccessGrantsLocation(array $args = [])
21 * @method \GuzzleHttp\Promise\Promise createAccessGrantsLocationAsync(array $args = [])
22 * @method \Aws\Result createAccessPoint(array $args = [])
23 * @method \GuzzleHttp\Promise\Promise createAccessPointAsync(array $args = [])
24 * @method \Aws\Result createAccessPointForObjectLambda(array $args = [])
25 * @method \GuzzleHttp\Promise\Promise createAccessPointForObjectLambdaAsync(array $args = [])
26 * @method \Aws\Result createBucket(array $args = [])
27 * @method \GuzzleHttp\Promise\Promise createBucketAsync(array $args = [])
28 * @method \Aws\Result createJob(array $args = [])
29 * @method \GuzzleHttp\Promise\Promise createJobAsync(array $args = [])
30 * @method \Aws\Result createMultiRegionAccessPoint(array $args = [])
31 * @method \GuzzleHttp\Promise\Promise createMultiRegionAccessPointAsync(array $args = [])
32 * @method \Aws\Result createStorageLensGroup(array $args = [])
33 * @method \GuzzleHttp\Promise\Promise createStorageLensGroupAsync(array $args = [])
34 * @method \Aws\Result deleteAccessGrant(array $args = [])
35 * @method \GuzzleHttp\Promise\Promise deleteAccessGrantAsync(array $args = [])
36 * @method \Aws\Result deleteAccessGrantsInstance(array $args = [])
37 * @method \GuzzleHttp\Promise\Promise deleteAccessGrantsInstanceAsync(array $args = [])
38 * @method \Aws\Result deleteAccessGrantsInstanceResourcePolicy(array $args = [])
39 * @method \GuzzleHttp\Promise\Promise deleteAccessGrantsInstanceResourcePolicyAsync(array $args = [])
40 * @method \Aws\Result deleteAccessGrantsLocation(array $args = [])
41 * @method \GuzzleHttp\Promise\Promise deleteAccessGrantsLocationAsync(array $args = [])
42 * @method \Aws\Result deleteAccessPoint(array $args = [])
43 * @method \GuzzleHttp\Promise\Promise deleteAccessPointAsync(array $args = [])
44 * @method \Aws\Result deleteAccessPointForObjectLambda(array $args = [])
45 * @method \GuzzleHttp\Promise\Promise deleteAccessPointForObjectLambdaAsync(array $args = [])
46 * @method \Aws\Result deleteAccessPointPolicy(array $args = [])
47 * @method \GuzzleHttp\Promise\Promise deleteAccessPointPolicyAsync(array $args = [])
48 * @method \Aws\Result deleteAccessPointPolicyForObjectLambda(array $args = [])
49 * @method \GuzzleHttp\Promise\Promise deleteAccessPointPolicyForObjectLambdaAsync(array $args = [])
50 * @method \Aws\Result deleteBucket(array $args = [])
51 * @method \GuzzleHttp\Promise\Promise deleteBucketAsync(array $args = [])
52 * @method \Aws\Result deleteBucketLifecycleConfiguration(array $args = [])
53 * @method \GuzzleHttp\Promise\Promise deleteBucketLifecycleConfigurationAsync(array $args = [])
54 * @method \Aws\Result deleteBucketPolicy(array $args = [])
55 * @method \GuzzleHttp\Promise\Promise deleteBucketPolicyAsync(array $args = [])
56 * @method \Aws\Result deleteBucketReplication(array $args = [])
57 * @method \GuzzleHttp\Promise\Promise deleteBucketReplicationAsync(array $args = [])
58 * @method \Aws\Result deleteBucketTagging(array $args = [])
59 * @method \GuzzleHttp\Promise\Promise deleteBucketTaggingAsync(array $args = [])
60 * @method \Aws\Result deleteJobTagging(array $args = [])
61 * @method \GuzzleHttp\Promise\Promise deleteJobTaggingAsync(array $args = [])
62 * @method \Aws\Result deleteMultiRegionAccessPoint(array $args = [])
63 * @method \GuzzleHttp\Promise\Promise deleteMultiRegionAccessPointAsync(array $args = [])
64 * @method \Aws\Result deletePublicAccessBlock(array $args = [])
65 * @method \GuzzleHttp\Promise\Promise deletePublicAccessBlockAsync(array $args = [])
66 * @method \Aws\Result deleteStorageLensConfiguration(array $args = [])
67 * @method \GuzzleHttp\Promise\Promise deleteStorageLensConfigurationAsync(array $args = [])
68 * @method \Aws\Result deleteStorageLensConfigurationTagging(array $args = [])
69 * @method \GuzzleHttp\Promise\Promise deleteStorageLensConfigurationTaggingAsync(array $args = [])
70 * @method \Aws\Result deleteStorageLensGroup(array $args = [])
71 * @method \GuzzleHttp\Promise\Promise deleteStorageLensGroupAsync(array $args = [])
72 * @method \Aws\Result describeJob(array $args = [])
73 * @method \GuzzleHttp\Promise\Promise describeJobAsync(array $args = [])
74 * @method \Aws\Result describeMultiRegionAccessPointOperation(array $args = [])
75 * @method \GuzzleHttp\Promise\Promise describeMultiRegionAccessPointOperationAsync(array $args = [])
76 * @method \Aws\Result dissociateAccessGrantsIdentityCenter(array $args = [])
77 * @method \GuzzleHttp\Promise\Promise dissociateAccessGrantsIdentityCenterAsync(array $args = [])
78 * @method \Aws\Result getAccessGrant(array $args = [])
79 * @method \GuzzleHttp\Promise\Promise getAccessGrantAsync(array $args = [])
80 * @method \Aws\Result getAccessGrantsInstance(array $args = [])
81 * @method \GuzzleHttp\Promise\Promise getAccessGrantsInstanceAsync(array $args = [])
82 * @method \Aws\Result getAccessGrantsInstanceForPrefix(array $args = [])
83 * @method \GuzzleHttp\Promise\Promise getAccessGrantsInstanceForPrefixAsync(array $args = [])
84 * @method \Aws\Result getAccessGrantsInstanceResourcePolicy(array $args = [])
85 * @method \GuzzleHttp\Promise\Promise getAccessGrantsInstanceResourcePolicyAsync(array $args = [])
86 * @method \Aws\Result getAccessGrantsLocation(array $args = [])
87 * @method \GuzzleHttp\Promise\Promise getAccessGrantsLocationAsync(array $args = [])
88 * @method \Aws\Result getAccessPoint(array $args = [])
89 * @method \GuzzleHttp\Promise\Promise getAccessPointAsync(array $args = [])
90 * @method \Aws\Result getAccessPointConfigurationForObjectLambda(array $args = [])
91 * @method \GuzzleHttp\Promise\Promise getAccessPointConfigurationForObjectLambdaAsync(array $args = [])
92 * @method \Aws\Result getAccessPointForObjectLambda(array $args = [])
93 * @method \GuzzleHttp\Promise\Promise getAccessPointForObjectLambdaAsync(array $args = [])
94 * @method \Aws\Result getAccessPointPolicy(array $args = [])
95 * @method \GuzzleHttp\Promise\Promise getAccessPointPolicyAsync(array $args = [])
96 * @method \Aws\Result getAccessPointPolicyForObjectLambda(array $args = [])
97 * @method \GuzzleHttp\Promise\Promise getAccessPointPolicyForObjectLambdaAsync(array $args = [])
98 * @method \Aws\Result getAccessPointPolicyStatus(array $args = [])
99 * @method \GuzzleHttp\Promise\Promise getAccessPointPolicyStatusAsync(array $args = [])
100 * @method \Aws\Result getAccessPointPolicyStatusForObjectLambda(array $args = [])
101 * @method \GuzzleHttp\Promise\Promise getAccessPointPolicyStatusForObjectLambdaAsync(array $args = [])
102 * @method \Aws\Result getBucket(array $args = [])
103 * @method \GuzzleHttp\Promise\Promise getBucketAsync(array $args = [])
104 * @method \Aws\Result getBucketLifecycleConfiguration(array $args = [])
105 * @method \GuzzleHttp\Promise\Promise getBucketLifecycleConfigurationAsync(array $args = [])
106 * @method \Aws\Result getBucketPolicy(array $args = [])
107 * @method \GuzzleHttp\Promise\Promise getBucketPolicyAsync(array $args = [])
108 * @method \Aws\Result getBucketReplication(array $args = [])
109 * @method \GuzzleHttp\Promise\Promise getBucketReplicationAsync(array $args = [])
110 * @method \Aws\Result getBucketTagging(array $args = [])
111 * @method \GuzzleHttp\Promise\Promise getBucketTaggingAsync(array $args = [])
112 * @method \Aws\Result getBucketVersioning(array $args = [])
113 * @method \GuzzleHttp\Promise\Promise getBucketVersioningAsync(array $args = [])
114 * @method \Aws\Result getDataAccess(array $args = [])
115 * @method \GuzzleHttp\Promise\Promise getDataAccessAsync(array $args = [])
116 * @method \Aws\Result getJobTagging(array $args = [])
117 * @method \GuzzleHttp\Promise\Promise getJobTaggingAsync(array $args = [])
118 * @method \Aws\Result getMultiRegionAccessPoint(array $args = [])
119 * @method \GuzzleHttp\Promise\Promise getMultiRegionAccessPointAsync(array $args = [])
120 * @method \Aws\Result getMultiRegionAccessPointPolicy(array $args = [])
121 * @method \GuzzleHttp\Promise\Promise getMultiRegionAccessPointPolicyAsync(array $args = [])
122 * @method \Aws\Result getMultiRegionAccessPointPolicyStatus(array $args = [])
123 * @method \GuzzleHttp\Promise\Promise getMultiRegionAccessPointPolicyStatusAsync(array $args = [])
124 * @method \Aws\Result getMultiRegionAccessPointRoutes(array $args = [])
125 * @method \GuzzleHttp\Promise\Promise getMultiRegionAccessPointRoutesAsync(array $args = [])
126 * @method \Aws\Result getPublicAccessBlock(array $args = [])
127 * @method \GuzzleHttp\Promise\Promise getPublicAccessBlockAsync(array $args = [])
128 * @method \Aws\Result getStorageLensConfiguration(array $args = [])
129 * @method \GuzzleHttp\Promise\Promise getStorageLensConfigurationAsync(array $args = [])
130 * @method \Aws\Result getStorageLensConfigurationTagging(array $args = [])
131 * @method \GuzzleHttp\Promise\Promise getStorageLensConfigurationTaggingAsync(array $args = [])
132 * @method \Aws\Result getStorageLensGroup(array $args = [])
133 * @method \GuzzleHttp\Promise\Promise getStorageLensGroupAsync(array $args = [])
134 * @method \Aws\Result listAccessGrants(array $args = [])
135 * @method \GuzzleHttp\Promise\Promise listAccessGrantsAsync(array $args = [])
136 * @method \Aws\Result listAccessGrantsInstances(array $args = [])
137 * @method \GuzzleHttp\Promise\Promise listAccessGrantsInstancesAsync(array $args = [])
138 * @method \Aws\Result listAccessGrantsLocations(array $args = [])
139 * @method \GuzzleHttp\Promise\Promise listAccessGrantsLocationsAsync(array $args = [])
140 * @method \Aws\Result listAccessPoints(array $args = [])
141 * @method \GuzzleHttp\Promise\Promise listAccessPointsAsync(array $args = [])
142 * @method \Aws\Result listAccessPointsForObjectLambda(array $args = [])
143 * @method \GuzzleHttp\Promise\Promise listAccessPointsForObjectLambdaAsync(array $args = [])
144 * @method \Aws\Result listJobs(array $args = [])
145 * @method \GuzzleHttp\Promise\Promise listJobsAsync(array $args = [])
146 * @method \Aws\Result listMultiRegionAccessPoints(array $args = [])
147 * @method \GuzzleHttp\Promise\Promise listMultiRegionAccessPointsAsync(array $args = [])
148 * @method \Aws\Result listRegionalBuckets(array $args = [])
149 * @method \GuzzleHttp\Promise\Promise listRegionalBucketsAsync(array $args = [])
150 * @method \Aws\Result listStorageLensConfigurations(array $args = [])
151 * @method \GuzzleHttp\Promise\Promise listStorageLensConfigurationsAsync(array $args = [])
152 * @method \Aws\Result listStorageLensGroups(array $args = [])
153 * @method \GuzzleHttp\Promise\Promise listStorageLensGroupsAsync(array $args = [])
154 * @method \Aws\Result listTagsForResource(array $args = [])
155 * @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
156 * @method \Aws\Result putAccessGrantsInstanceResourcePolicy(array $args = [])
157 * @method \GuzzleHttp\Promise\Promise putAccessGrantsInstanceResourcePolicyAsync(array $args = [])
158 * @method \Aws\Result putAccessPointConfigurationForObjectLambda(array $args = [])
159 * @method \GuzzleHttp\Promise\Promise putAccessPointConfigurationForObjectLambdaAsync(array $args = [])
160 * @method \Aws\Result putAccessPointPolicy(array $args = [])
161 * @method \GuzzleHttp\Promise\Promise putAccessPointPolicyAsync(array $args = [])
162 * @method \Aws\Result putAccessPointPolicyForObjectLambda(array $args = [])
163 * @method \GuzzleHttp\Promise\Promise putAccessPointPolicyForObjectLambdaAsync(array $args = [])
164 * @method \Aws\Result putBucketLifecycleConfiguration(array $args = [])
165 * @method \GuzzleHttp\Promise\Promise putBucketLifecycleConfigurationAsync(array $args = [])
166 * @method \Aws\Result putBucketPolicy(array $args = [])
167 * @method \GuzzleHttp\Promise\Promise putBucketPolicyAsync(array $args = [])
168 * @method \Aws\Result putBucketReplication(array $args = [])
169 * @method \GuzzleHttp\Promise\Promise putBucketReplicationAsync(array $args = [])
170 * @method \Aws\Result putBucketTagging(array $args = [])
171 * @method \GuzzleHttp\Promise\Promise putBucketTaggingAsync(array $args = [])
172 * @method \Aws\Result putBucketVersioning(array $args = [])
173 * @method \GuzzleHttp\Promise\Promise putBucketVersioningAsync(array $args = [])
174 * @method \Aws\Result putJobTagging(array $args = [])
175 * @method \GuzzleHttp\Promise\Promise putJobTaggingAsync(array $args = [])
176 * @method \Aws\Result putMultiRegionAccessPointPolicy(array $args = [])
177 * @method \GuzzleHttp\Promise\Promise putMultiRegionAccessPointPolicyAsync(array $args = [])
178 * @method \Aws\Result putPublicAccessBlock(array $args = [])
179 * @method \GuzzleHttp\Promise\Promise putPublicAccessBlockAsync(array $args = [])
180 * @method \Aws\Result putStorageLensConfiguration(array $args = [])
181 * @method \GuzzleHttp\Promise\Promise putStorageLensConfigurationAsync(array $args = [])
182 * @method \Aws\Result putStorageLensConfigurationTagging(array $args = [])
183 * @method \GuzzleHttp\Promise\Promise putStorageLensConfigurationTaggingAsync(array $args = [])
184 * @method \Aws\Result submitMultiRegionAccessPointRoutes(array $args = [])
185 * @method \GuzzleHttp\Promise\Promise submitMultiRegionAccessPointRoutesAsync(array $args = [])
186 * @method \Aws\Result tagResource(array $args = [])
187 * @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
188 * @method \Aws\Result untagResource(array $args = [])
189 * @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
190 * @method \Aws\Result updateAccessGrantsLocation(array $args = [])
191 * @method \GuzzleHttp\Promise\Promise updateAccessGrantsLocationAsync(array $args = [])
192 * @method \Aws\Result updateJobPriority(array $args = [])
193 * @method \GuzzleHttp\Promise\Promise updateJobPriorityAsync(array $args = [])
194 * @method \Aws\Result updateJobStatus(array $args = [])
195 * @method \GuzzleHttp\Promise\Promise updateJobStatusAsync(array $args = [])
196 * @method \Aws\Result updateStorageLensGroup(array $args = [])
197 * @method \GuzzleHttp\Promise\Promise updateStorageLensGroupAsync(array $args = [])
198 */
199 class S3ControlClient extends AwsClient
200 {
201 public static function getArguments()
202 {
203 $args = parent::getArguments();
204 return $args + [
205 'use_dual_stack_endpoint' => [
206 'type' => 'config',
207 'valid' => ['bool'],
208 'doc' => 'Set to true to send requests to an S3 Control Dual Stack'
209 . ' endpoint by default, which enables IPv6 Protocol.'
210 . ' Can be enabled or disabled on individual operations by setting'
211 . ' \'@use_dual_stack_endpoint\' to true or false.',
212 'default' => false,
213 ],
214 'use_arn_region' => [
215 'type' => 'config',
216 'valid' => [
217 'bool',
218 Configuration::class,
219 CacheInterface::class,
220 'callable'
221 ],
222 'doc' => 'Set to true to allow passed in ARNs to override'
223 . ' client region. Accepts...',
224 'fn' => [__CLASS__, '_apply_use_arn_region'],
225 'default' => [UseArnRegionConfigurationProvider::class, 'defaultProvider'],
226 ],
227 ];
228 }
229
230 public static function _apply_use_arn_region($value, array &$args, HandlerList $list)
231 {
232 if ($value instanceof CacheInterface) {
233 $value = UseArnRegionConfigurationProvider::defaultProvider($args);
234 }
235 if (is_callable($value)) {
236 $value = $value();
237 }
238 if ($value instanceof PromiseInterface) {
239 $value = $value->wait();
240 }
241 if ($value instanceof ConfigurationInterface) {
242 $args['use_arn_region'] = $value;
243 } else {
244 // The Configuration class itself will validate other inputs
245 $args['use_arn_region'] = new Configuration($value);
246 }
247 }
248
249 /**
250 * {@inheritdoc}
251 *
252 * In addition to the options available to
253 * {@see Aws\AwsClient::__construct}, S3ControlClient accepts the following
254 * option:
255 *
256 * - use_dual_stack_endpoint: (bool) Set to true to send requests to an S3
257 * Control Dual Stack endpoint by default, which enables IPv6 Protocol.
258 * Can be enabled or disabled on individual operations by setting
259 * '@use_dual_stack_endpoint\' to true or false. Note:
260 * you cannot use it together with an accelerate endpoint.
261 *
262 * @param array $args
263 */
264 public function __construct(array $args)
265 {
266 parent::__construct($args);
267
268 if ($this->isUseEndpointV2()) {
269 $this->processEndpointV2Model();
270 }
271 $stack = $this->getHandlerList();
272 $stack->appendBuild(
273 EndpointArnMiddleware::wrap(
274 $this->getApi(),
275 $this->getRegion(),
276 [
277 'use_arn_region' => $this->getConfig('use_arn_region'),
278 'dual_stack' =>
279 $this->getConfig('use_dual_stack_endpoint')->isUseDualStackEndpoint(),
280 'endpoint' => isset($args['endpoint'])
281 ? $args['endpoint']
282 : null,
283 'use_fips_endpoint' => $this->getConfig('use_fips_endpoint'),
284 ],
285 $this->isUseEndpointV2()
286 ),
287 's3control.endpoint_arn_middleware'
288 );
289 }
290
291 /**
292 * Modifies API definition to remove `AccountId`
293 * host prefix. This is now handled by the endpoint ruleset.
294 *
295 * @return void
296 *
297 * @internal
298 */
299 private function processEndpointV2Model()
300 {
301 $definition = $this->getApi()->getDefinition();
302 $this->removeHostPrefix($definition);
303 $this->removeRequiredMember($definition);
304 $this->getApi()->setDefinition($definition);
305 }
306
307 private function removeHostPrefix(&$definition)
308 {
309 foreach($definition['operations'] as &$operation) {
310 if (isset($operation['endpoint']['hostPrefix'])
311 && $operation['endpoint']['hostPrefix'] === '{AccountId}.'
312 ) {
313 $operation['endpoint']['hostPrefix'] = str_replace(
314 '{AccountId}.',
315 '',
316 $operation['endpoint']['hostPrefix']
317 );
318 }
319 }
320 }
321
322 private function removeRequiredMember(&$definition)
323 {
324 foreach($definition['shapes'] as &$shape) {
325 if (isset($shape['required'])
326 ) {
327 $found = array_search('AccountId', $shape['required']);
328
329 if ($found !== false) {
330 unset($shape['required'][$found]);
331 }
332 }
333 }
334 }
335 }
336