@@ -95,47 +95,49 @@ public function getLicenseInfo(): ?string
9595 return $ this ->LicenseInfo ;
9696 }
9797
98- public function requestBody (): array
98+ public function requestBody (): string
9999 {
100100 $ payload = ['Action ' => 'PublishLayerVersion ' , 'Version ' => '2015-03-31 ' ];
101- $ indices = new \stdClass ();
102101
103102 if (null !== $ v = $ this ->Description ) {
104103 $ payload ['Description ' ] = $ v ;
105104 }
106105
107- (static function ($ input ) use (&$ payload ) {
108- if (null !== $ v = $ input ->getS3Bucket ()) {
109- $ payload ['Content.S3Bucket ' ] = $ v ;
110- }
111- if (null !== $ v = $ input ->getS3Key ()) {
112- $ payload ['Content.S3Key ' ] = $ v ;
113- }
114- if (null !== $ v = $ input ->getS3ObjectVersion ()) {
115- $ payload ['Content.S3ObjectVersion ' ] = $ v ;
116- }
117- if (null !== $ v = $ input ->getZipFile ()) {
118- $ payload ['Content.ZipFile ' ] = base64_encode ($ v );
119- }
120- })($ this ->Content );
121- (static function ($ input ) use (&$ payload , $ indices ) {
122- $ indices ->k45e4982 = 0 ;
106+ if (null !== $ this ->Content ) {
107+ (static function (LayerVersionContentInput $ input ) use (&$ payload ) {
108+ if (null !== $ v = $ input ->getS3Bucket ()) {
109+ $ payload ['Content ' ]['S3Bucket ' ] = $ v ;
110+ }
111+
112+ if (null !== $ v = $ input ->getS3Key ()) {
113+ $ payload ['Content ' ]['S3Key ' ] = $ v ;
114+ }
115+
116+ if (null !== $ v = $ input ->getS3ObjectVersion ()) {
117+ $ payload ['Content ' ]['S3ObjectVersion ' ] = $ v ;
118+ }
119+
120+ if (null !== $ v = $ input ->getZipFile ()) {
121+ $ payload ['Content ' ]['ZipFile ' ] = base64_encode ($ v );
122+ }
123+ })($ this ->Content );
124+ }
125+
126+ (static function (array $ input ) use (&$ payload ) {
123127 foreach ($ input as $ value ) {
124- ++$ indices ->k45e4982 ;
125- $ payload ["CompatibleRuntimes. {$ indices ->k45e4982 }" ] = $ value ;
128+ $ payload ['CompatibleRuntimes ' ][] = $ value ;
126129 }
127130 })($ this ->CompatibleRuntimes );
128-
129131 if (null !== $ v = $ this ->LicenseInfo ) {
130132 $ payload ['LicenseInfo ' ] = $ v ;
131133 }
132134
133- return $ payload ;
135+ return json_encode ( $ payload) ;
134136 }
135137
136138 public function requestHeaders (): array
137139 {
138- $ headers = [];
140+ $ headers = [' content-type ' => ' application/json ' ];
139141
140142 return $ headers ;
141143 }
0 commit comments