|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace AsyncAws\S3\Input; |
| 4 | + |
| 5 | +use AsyncAws\Core\Exception\InvalidArgument; |
| 6 | +use AsyncAws\Core\Input; |
| 7 | +use AsyncAws\Core\Request; |
| 8 | +use AsyncAws\Core\Stream\StreamFactory; |
| 9 | + |
| 10 | +final class DeleteObjectTaggingRequest extends Input |
| 11 | +{ |
| 12 | + /** |
| 13 | + * The bucket name containing the objects from which to remove the tags. |
| 14 | + * |
| 15 | + * When using this action with an access point, you must direct requests to the access point hostname. The access point |
| 16 | + * hostname takes the form *AccessPointName*-*AccountId*.s3-accesspoint.*Region*.amazonaws.com. When using this action |
| 17 | + * with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket |
| 18 | + * name. For more information about access point ARNs, see Using access points [^1] in the *Amazon S3 User Guide*. |
| 19 | + * |
| 20 | + * When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 |
| 21 | + * on Outposts hostname takes the form `*AccessPointName*-*AccountId*.*outpostID*.s3-outposts.*Region*.amazonaws.com`. |
| 22 | + * When you use this action with S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts access |
| 23 | + * point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts |
| 24 | + * [^2] in the *Amazon S3 User Guide*. |
| 25 | + * |
| 26 | + * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html |
| 27 | + * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html |
| 28 | + * |
| 29 | + * @required |
| 30 | + * |
| 31 | + * @var string|null |
| 32 | + */ |
| 33 | + private $bucket; |
| 34 | + |
| 35 | + /** |
| 36 | + * The key that identifies the object in the bucket from which to remove all tags. |
| 37 | + * |
| 38 | + * @required |
| 39 | + * |
| 40 | + * @var string|null |
| 41 | + */ |
| 42 | + private $key; |
| 43 | + |
| 44 | + /** |
| 45 | + * The versionId of the object that the tag-set will be removed from. |
| 46 | + * |
| 47 | + * @var string|null |
| 48 | + */ |
| 49 | + private $versionId; |
| 50 | + |
| 51 | + /** |
| 52 | + * The account ID of the expected bucket owner. If the bucket is owned by a different account, the request fails with |
| 53 | + * the HTTP status code `403 Forbidden` (access denied). |
| 54 | + * |
| 55 | + * @var string|null |
| 56 | + */ |
| 57 | + private $expectedBucketOwner; |
| 58 | + |
| 59 | + /** |
| 60 | + * @param array{ |
| 61 | + * Bucket?: string, |
| 62 | + * Key?: string, |
| 63 | + * VersionId?: string, |
| 64 | + * ExpectedBucketOwner?: string, |
| 65 | + * '@region'?: string|null, |
| 66 | + * } $input |
| 67 | + */ |
| 68 | + public function __construct(array $input = []) |
| 69 | + { |
| 70 | + $this->bucket = $input['Bucket'] ?? null; |
| 71 | + $this->key = $input['Key'] ?? null; |
| 72 | + $this->versionId = $input['VersionId'] ?? null; |
| 73 | + $this->expectedBucketOwner = $input['ExpectedBucketOwner'] ?? null; |
| 74 | + parent::__construct($input); |
| 75 | + } |
| 76 | + |
| 77 | + public static function create($input): self |
| 78 | + { |
| 79 | + return $input instanceof self ? $input : new self($input); |
| 80 | + } |
| 81 | + |
| 82 | + public function getBucket(): ?string |
| 83 | + { |
| 84 | + return $this->bucket; |
| 85 | + } |
| 86 | + |
| 87 | + public function getExpectedBucketOwner(): ?string |
| 88 | + { |
| 89 | + return $this->expectedBucketOwner; |
| 90 | + } |
| 91 | + |
| 92 | + public function getKey(): ?string |
| 93 | + { |
| 94 | + return $this->key; |
| 95 | + } |
| 96 | + |
| 97 | + public function getVersionId(): ?string |
| 98 | + { |
| 99 | + return $this->versionId; |
| 100 | + } |
| 101 | + |
| 102 | + /** |
| 103 | + * @internal |
| 104 | + */ |
| 105 | + public function request(): Request |
| 106 | + { |
| 107 | + // Prepare headers |
| 108 | + $headers = ['content-type' => 'application/xml']; |
| 109 | + if (null !== $this->expectedBucketOwner) { |
| 110 | + $headers['x-amz-expected-bucket-owner'] = $this->expectedBucketOwner; |
| 111 | + } |
| 112 | + |
| 113 | + // Prepare query |
| 114 | + $query = []; |
| 115 | + if (null !== $this->versionId) { |
| 116 | + $query['versionId'] = $this->versionId; |
| 117 | + } |
| 118 | + |
| 119 | + // Prepare URI |
| 120 | + $uri = []; |
| 121 | + if (null === $v = $this->bucket) { |
| 122 | + throw new InvalidArgument(sprintf('Missing parameter "Bucket" for "%s". The value cannot be null.', __CLASS__)); |
| 123 | + } |
| 124 | + $uri['Bucket'] = $v; |
| 125 | + if (null === $v = $this->key) { |
| 126 | + throw new InvalidArgument(sprintf('Missing parameter "Key" for "%s". The value cannot be null.', __CLASS__)); |
| 127 | + } |
| 128 | + $uri['Key'] = $v; |
| 129 | + $uriString = '/' . rawurlencode($uri['Bucket']) . '/' . str_replace('%2F', '/', rawurlencode($uri['Key'])) . '?tagging'; |
| 130 | + |
| 131 | + // Prepare Body |
| 132 | + $body = ''; |
| 133 | + |
| 134 | + // Return the Request |
| 135 | + return new Request('DELETE', $uriString, $query, $headers, StreamFactory::create($body)); |
| 136 | + } |
| 137 | + |
| 138 | + public function setBucket(?string $value): self |
| 139 | + { |
| 140 | + $this->bucket = $value; |
| 141 | + |
| 142 | + return $this; |
| 143 | + } |
| 144 | + |
| 145 | + public function setExpectedBucketOwner(?string $value): self |
| 146 | + { |
| 147 | + $this->expectedBucketOwner = $value; |
| 148 | + |
| 149 | + return $this; |
| 150 | + } |
| 151 | + |
| 152 | + public function setKey(?string $value): self |
| 153 | + { |
| 154 | + $this->key = $value; |
| 155 | + |
| 156 | + return $this; |
| 157 | + } |
| 158 | + |
| 159 | + public function setVersionId(?string $value): self |
| 160 | + { |
| 161 | + $this->versionId = $value; |
| 162 | + |
| 163 | + return $this; |
| 164 | + } |
| 165 | +} |
0 commit comments