@@ -33,7 +33,7 @@ final class AssumeRoleRequest extends Input
3333 * The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as managed session policies. The
3434 * policies must exist in the same account as the role.
3535 *
36- * @var PolicyDescriptorType[]
36+ * @var PolicyDescriptorType[]|null
3737 */
3838 private $ PolicyArns ;
3939
@@ -63,7 +63,7 @@ final class AssumeRoleRequest extends Input
6363 *
6464 * @see https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html
6565 *
66- * @var Tag[]
66+ * @var Tag[]|null
6767 */
6868 private $ Tags ;
6969
@@ -74,7 +74,7 @@ final class AssumeRoleRequest extends Input
7474 *
7575 * @see https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining
7676 *
77- * @var string[]
77+ * @var string[]|null
7878 */
7979 private $ TransitiveTagKeys ;
8080
@@ -131,11 +131,11 @@ public function __construct(array $input = [])
131131 {
132132 $ this ->RoleArn = $ input ['RoleArn ' ] ?? null ;
133133 $ this ->RoleSessionName = $ input ['RoleSessionName ' ] ?? null ;
134- $ this ->PolicyArns = array_map ([PolicyDescriptorType::class, 'create ' ], $ input ['PolicyArns ' ] ?? []) ;
134+ $ this ->PolicyArns = isset ( $ input [ ' PolicyArns ' ]) ? array_map ([PolicyDescriptorType::class, 'create ' ], $ input ['PolicyArns ' ]) : null ;
135135 $ this ->Policy = $ input ['Policy ' ] ?? null ;
136136 $ this ->DurationSeconds = $ input ['DurationSeconds ' ] ?? null ;
137- $ this ->Tags = array_map ([Tag::class, 'create ' ], $ input ['Tags ' ] ?? []) ;
138- $ this ->TransitiveTagKeys = $ input ['TransitiveTagKeys ' ] ?? [] ;
137+ $ this ->Tags = isset ( $ input [ ' Tags ' ]) ? array_map ([Tag::class, 'create ' ], $ input ['Tags ' ]) : null ;
138+ $ this ->TransitiveTagKeys = $ input ['TransitiveTagKeys ' ] ?? null ;
139139 $ this ->ExternalId = $ input ['ExternalId ' ] ?? null ;
140140 $ this ->SerialNumber = $ input ['SerialNumber ' ] ?? null ;
141141 $ this ->TokenCode = $ input ['TokenCode ' ] ?? null ;
@@ -167,7 +167,7 @@ public function getPolicy(): ?string
167167 */
168168 public function getPolicyArns (): array
169169 {
170- return $ this ->PolicyArns ;
170+ return $ this ->PolicyArns ?? [] ;
171171 }
172172
173173 public function getRoleArn (): ?string
@@ -190,7 +190,7 @@ public function getSerialNumber(): ?string
190190 */
191191 public function getTags (): array
192192 {
193- return $ this ->Tags ;
193+ return $ this ->Tags ?? [] ;
194194 }
195195
196196 public function getTokenCode (): ?string
@@ -203,7 +203,7 @@ public function getTokenCode(): ?string
203203 */
204204 public function getTransitiveTagKeys (): array
205205 {
206- return $ this ->TransitiveTagKeys ;
206+ return $ this ->TransitiveTagKeys ?? [] ;
207207 }
208208
209209 /**
@@ -317,36 +317,37 @@ private function requestBody(): array
317317 throw new InvalidArgument (sprintf ('Missing parameter "RoleSessionName" for "%s". The value cannot be null. ' , __CLASS__ ));
318318 }
319319 $ payload ['RoleSessionName ' ] = $ v ;
320-
321- $ index = 0 ;
322- foreach ($ this ->PolicyArns as $ mapValue ) {
323- ++$ index ;
324- foreach ($ mapValue ->requestBody () as $ bodyKey => $ bodyValue ) {
325- $ payload ["PolicyArns.member. $ index. $ bodyKey " ] = $ bodyValue ;
320+ if (null !== $ v = $ this ->PolicyArns ) {
321+ $ index = 0 ;
322+ foreach ($ v as $ mapValue ) {
323+ ++$ index ;
324+ foreach ($ mapValue ->requestBody () as $ bodyKey => $ bodyValue ) {
325+ $ payload ["PolicyArns.member. $ index. $ bodyKey " ] = $ bodyValue ;
326+ }
326327 }
327328 }
328-
329329 if (null !== $ v = $ this ->Policy ) {
330330 $ payload ['Policy ' ] = $ v ;
331331 }
332332 if (null !== $ v = $ this ->DurationSeconds ) {
333333 $ payload ['DurationSeconds ' ] = $ v ;
334334 }
335-
336- $ index = 0 ;
337- foreach ($ this ->Tags as $ mapValue ) {
338- ++$ index ;
339- foreach ($ mapValue ->requestBody () as $ bodyKey => $ bodyValue ) {
340- $ payload ["Tags.member. $ index. $ bodyKey " ] = $ bodyValue ;
335+ if (null !== $ v = $ this ->Tags ) {
336+ $ index = 0 ;
337+ foreach ($ v as $ mapValue ) {
338+ ++$ index ;
339+ foreach ($ mapValue ->requestBody () as $ bodyKey => $ bodyValue ) {
340+ $ payload ["Tags.member. $ index. $ bodyKey " ] = $ bodyValue ;
341+ }
341342 }
342343 }
343-
344- $ index = 0 ;
345- foreach ($ this ->TransitiveTagKeys as $ mapValue ) {
346- ++$ index ;
347- $ payload ["TransitiveTagKeys.member. $ index " ] = $ mapValue ;
344+ if (null !== $ v = $ this ->TransitiveTagKeys ) {
345+ $ index = 0 ;
346+ foreach ($ v as $ mapValue ) {
347+ ++$ index ;
348+ $ payload ["TransitiveTagKeys.member. $ index " ] = $ mapValue ;
349+ }
348350 }
349-
350351 if (null !== $ v = $ this ->ExternalId ) {
351352 $ payload ['ExternalId ' ] = $ v ;
352353 }
0 commit comments