@@ -217,8 +217,11 @@ public function request(): Request
217217 // Prepare URI
218218 $ uriString = '/ ' ;
219219
220+ // Prepare Body
221+ $ body = http_build_query (['Action ' => 'AssumeRole ' , 'Version ' => '2011-06-15 ' ] + $ this ->requestBody (), '' , '& ' , \PHP_QUERY_RFC1738 );
222+
220223 // Return the Request
221- return new Request ('POST ' , $ uriString , $ query , $ headers , StreamFactory::create ($ this -> requestBody () ));
224+ return new Request ('POST ' , $ uriString , $ query , $ headers , StreamFactory::create ($ body ));
222225 }
223226
224227 public function setDurationSeconds (?int $ value ): self
@@ -319,55 +322,48 @@ public function validate(): void
319322 }
320323 }
321324
322- private function requestBody (): string
325+ /**
326+ * @internal
327+ */
328+ private function requestBody (): array
323329 {
324- $ payload = ['Action ' => 'AssumeRole ' , 'Version ' => '2011-06-15 ' ];
325- $ indices = new \stdClass ();
330+ $ payload = [];
326331 $ payload ['RoleArn ' ] = $ this ->RoleArn ;
327332 $ payload ['RoleSessionName ' ] = $ this ->RoleSessionName ;
328333
329- (static function (array $ input ) use (&$ payload , $ indices ) {
330- $ indices ->kfc822c1 = 0 ;
331- foreach ($ input as $ value ) {
332- ++$ indices ->kfc822c1 ;
333-
334- if (null !== $ value ) {
335- (static function (PolicyDescriptorType $ input ) use (&$ payload , $ indices ) {
336- if (null !== $ v = $ input ->getarn ()) {
337- $ payload ["PolicyArns.member. {$ indices ->kfc822c1 }.arn " ] = $ v ;
338- }
339- })($ value );
334+ $ index = 0 ;
335+ foreach ($ this ->PolicyArns as $ mapValue ) {
336+ ++$ index ;
337+ if (null !== $ v = $ mapValue ) {
338+ foreach ($ v ->requestBody () as $ bodyKey => $ bodyValue ) {
339+ $ payload ["PolicyArns.member. {$ index }. $ bodyKey " ] = $ bodyValue ;
340340 }
341341 }
342- })($ this ->PolicyArns );
342+ }
343+
343344 if (null !== $ v = $ this ->Policy ) {
344345 $ payload ['Policy ' ] = $ v ;
345346 }
346347 if (null !== $ v = $ this ->DurationSeconds ) {
347348 $ payload ['DurationSeconds ' ] = $ v ;
348349 }
349350
350- (static function (array $ input ) use (&$ payload , $ indices ) {
351- $ indices ->k26dfc14 = 0 ;
352- foreach ($ input as $ value ) {
353- ++$ indices ->k26dfc14 ;
354-
355- if (null !== $ value ) {
356- (static function (Tag $ input ) use (&$ payload , $ indices ) {
357- $ payload ["Tags.member. {$ indices ->k26dfc14 }.Key " ] = $ input ->getKey ();
358- $ payload ["Tags.member. {$ indices ->k26dfc14 }.Value " ] = $ input ->getValue ();
359- })($ value );
351+ $ index = 0 ;
352+ foreach ($ this ->Tags as $ mapValue ) {
353+ ++$ index ;
354+ if (null !== $ v = $ mapValue ) {
355+ foreach ($ v ->requestBody () as $ bodyKey => $ bodyValue ) {
356+ $ payload ["Tags.member. {$ index }. $ bodyKey " ] = $ bodyValue ;
360357 }
361358 }
362- })($ this ->Tags );
359+ }
360+
361+ $ index = 0 ;
362+ foreach ($ this ->TransitiveTagKeys as $ mapValue ) {
363+ ++$ index ;
364+ $ payload ["TransitiveTagKeys.member. {$ index }" ] = $ mapValue ;
365+ }
363366
364- (static function (array $ input ) use (&$ payload , $ indices ) {
365- $ indices ->k0ec5280 = 0 ;
366- foreach ($ input as $ value ) {
367- ++$ indices ->k0ec5280 ;
368- $ payload ["TransitiveTagKeys.member. {$ indices ->k0ec5280 }" ] = $ value ;
369- }
370- })($ this ->TransitiveTagKeys );
371367 if (null !== $ v = $ this ->ExternalId ) {
372368 $ payload ['ExternalId ' ] = $ v ;
373369 }
@@ -378,6 +374,6 @@ private function requestBody(): string
378374 $ payload ['TokenCode ' ] = $ v ;
379375 }
380376
381- return http_build_query ( $ payload, '' , ' & ' , \ PHP_QUERY_RFC1738 ) ;
377+ return $ payload ;
382378 }
383379}
0 commit comments