|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace AsyncAws\Lambda\Input; |
| 4 | + |
| 5 | +use AsyncAws\Core\Exception\InvalidArgument; |
| 6 | + |
| 7 | +class AddLayerVersionPermissionRequest |
| 8 | +{ |
| 9 | + /** |
| 10 | + * The name or Amazon Resource Name (ARN) of the layer. |
| 11 | + * |
| 12 | + * @required |
| 13 | + * |
| 14 | + * @var string|null |
| 15 | + */ |
| 16 | + private $LayerName; |
| 17 | + |
| 18 | + /** |
| 19 | + * The version number. |
| 20 | + * |
| 21 | + * @required |
| 22 | + * |
| 23 | + * @var string|null |
| 24 | + */ |
| 25 | + private $VersionNumber; |
| 26 | + |
| 27 | + /** |
| 28 | + * An identifier that distinguishes the policy from others on the same layer version. |
| 29 | + * |
| 30 | + * @required |
| 31 | + * |
| 32 | + * @var string|null |
| 33 | + */ |
| 34 | + private $StatementId; |
| 35 | + |
| 36 | + /** |
| 37 | + * The API action that grants access to the layer. For example, `lambda:GetLayerVersion`. |
| 38 | + * |
| 39 | + * @required |
| 40 | + * |
| 41 | + * @var string|null |
| 42 | + */ |
| 43 | + private $Action; |
| 44 | + |
| 45 | + /** |
| 46 | + * An account ID, or `*` to grant permission to all AWS accounts. |
| 47 | + * |
| 48 | + * @required |
| 49 | + * |
| 50 | + * @var string|null |
| 51 | + */ |
| 52 | + private $Principal; |
| 53 | + |
| 54 | + /** |
| 55 | + * With the principal set to `*`, grant permission to all accounts in the specified organization. |
| 56 | + * |
| 57 | + * @var string|null |
| 58 | + */ |
| 59 | + private $OrganizationId; |
| 60 | + |
| 61 | + /** |
| 62 | + * Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that |
| 63 | + * has changed since you last read it. |
| 64 | + * |
| 65 | + * @var string|null |
| 66 | + */ |
| 67 | + private $RevisionId; |
| 68 | + |
| 69 | + /** |
| 70 | + * @param array{ |
| 71 | + * LayerName?: string, |
| 72 | + * VersionNumber?: string, |
| 73 | + * StatementId?: string, |
| 74 | + * Action?: string, |
| 75 | + * Principal?: string, |
| 76 | + * OrganizationId?: string, |
| 77 | + * RevisionId?: string, |
| 78 | + * } $input |
| 79 | + */ |
| 80 | + public function __construct(array $input = []) |
| 81 | + { |
| 82 | + $this->LayerName = $input['LayerName'] ?? null; |
| 83 | + $this->VersionNumber = $input['VersionNumber'] ?? null; |
| 84 | + $this->StatementId = $input['StatementId'] ?? null; |
| 85 | + $this->Action = $input['Action'] ?? null; |
| 86 | + $this->Principal = $input['Principal'] ?? null; |
| 87 | + $this->OrganizationId = $input['OrganizationId'] ?? null; |
| 88 | + $this->RevisionId = $input['RevisionId'] ?? null; |
| 89 | + } |
| 90 | + |
| 91 | + public static function create($input): self |
| 92 | + { |
| 93 | + return $input instanceof self ? $input : new self($input); |
| 94 | + } |
| 95 | + |
| 96 | + public function getAction(): ?string |
| 97 | + { |
| 98 | + return $this->Action; |
| 99 | + } |
| 100 | + |
| 101 | + public function getLayerName(): ?string |
| 102 | + { |
| 103 | + return $this->LayerName; |
| 104 | + } |
| 105 | + |
| 106 | + public function getOrganizationId(): ?string |
| 107 | + { |
| 108 | + return $this->OrganizationId; |
| 109 | + } |
| 110 | + |
| 111 | + public function getPrincipal(): ?string |
| 112 | + { |
| 113 | + return $this->Principal; |
| 114 | + } |
| 115 | + |
| 116 | + public function getRevisionId(): ?string |
| 117 | + { |
| 118 | + return $this->RevisionId; |
| 119 | + } |
| 120 | + |
| 121 | + public function getStatementId(): ?string |
| 122 | + { |
| 123 | + return $this->StatementId; |
| 124 | + } |
| 125 | + |
| 126 | + public function getVersionNumber(): ?string |
| 127 | + { |
| 128 | + return $this->VersionNumber; |
| 129 | + } |
| 130 | + |
| 131 | + public function requestBody(): array |
| 132 | + { |
| 133 | + $payload = ['Action' => 'AddLayerVersionPermission', 'Version' => '2015-03-31']; |
| 134 | + |
| 135 | + $payload['StatementId'] = $this->StatementId; |
| 136 | + $payload['Action'] = $this->Action; |
| 137 | + $payload['Principal'] = $this->Principal; |
| 138 | + |
| 139 | + if (null !== $v = $this->OrganizationId) { |
| 140 | + $payload['OrganizationId'] = $v; |
| 141 | + } |
| 142 | + |
| 143 | + return $payload; |
| 144 | + } |
| 145 | + |
| 146 | + public function requestHeaders(): array |
| 147 | + { |
| 148 | + $headers = []; |
| 149 | + |
| 150 | + return $headers; |
| 151 | + } |
| 152 | + |
| 153 | + public function requestQuery(): array |
| 154 | + { |
| 155 | + $query = []; |
| 156 | + if (null !== $this->RevisionId) { |
| 157 | + $query['RevisionId'] = $this->RevisionId; |
| 158 | + } |
| 159 | + |
| 160 | + return $query; |
| 161 | + } |
| 162 | + |
| 163 | + public function requestUri(): string |
| 164 | + { |
| 165 | + $uri = []; |
| 166 | + $uri['LayerName'] = $this->LayerName ?? ''; |
| 167 | + $uri['VersionNumber'] = $this->VersionNumber ?? ''; |
| 168 | + |
| 169 | + return "/2018-10-31/layers/{$uri['LayerName']}/versions/{$uri['VersionNumber']}/policy"; |
| 170 | + } |
| 171 | + |
| 172 | + public function setAction(?string $value): self |
| 173 | + { |
| 174 | + $this->Action = $value; |
| 175 | + |
| 176 | + return $this; |
| 177 | + } |
| 178 | + |
| 179 | + public function setLayerName(?string $value): self |
| 180 | + { |
| 181 | + $this->LayerName = $value; |
| 182 | + |
| 183 | + return $this; |
| 184 | + } |
| 185 | + |
| 186 | + public function setOrganizationId(?string $value): self |
| 187 | + { |
| 188 | + $this->OrganizationId = $value; |
| 189 | + |
| 190 | + return $this; |
| 191 | + } |
| 192 | + |
| 193 | + public function setPrincipal(?string $value): self |
| 194 | + { |
| 195 | + $this->Principal = $value; |
| 196 | + |
| 197 | + return $this; |
| 198 | + } |
| 199 | + |
| 200 | + public function setRevisionId(?string $value): self |
| 201 | + { |
| 202 | + $this->RevisionId = $value; |
| 203 | + |
| 204 | + return $this; |
| 205 | + } |
| 206 | + |
| 207 | + public function setStatementId(?string $value): self |
| 208 | + { |
| 209 | + $this->StatementId = $value; |
| 210 | + |
| 211 | + return $this; |
| 212 | + } |
| 213 | + |
| 214 | + public function setVersionNumber(?string $value): self |
| 215 | + { |
| 216 | + $this->VersionNumber = $value; |
| 217 | + |
| 218 | + return $this; |
| 219 | + } |
| 220 | + |
| 221 | + public function validate(): void |
| 222 | + { |
| 223 | + foreach (['LayerName', 'VersionNumber', 'StatementId', 'Action', 'Principal'] as $name) { |
| 224 | + if (null === $this->$name) { |
| 225 | + throw new InvalidArgument(sprintf('Missing parameter "%s" when validating the "%s". The value cannot be null.', $name, __CLASS__)); |
| 226 | + } |
| 227 | + } |
| 228 | + } |
| 229 | +} |
0 commit comments