Skip to content

Commit ed5e23a

Browse files
committed
Minor changes. Changelog.
1 parent 5f5ea11 commit ed5e23a

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22
## Unreleased
33

4+
## 0.3.2 - 2021-08-13
5+
6+
### Added
7+
8+
- Support for Container Images. [#29](https://github.com/hammerstonedev/sidecar/pull/29)
9+
410
## 0.3.1 - 2021-07-31
511

612
### Fixed

src/LambdaFunction.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,15 @@ public function runtime()
199199
}
200200

201201
/**
202-
* The type of deployment package. Set to Image for container image and set Zip for .zip file archive.
202+
* The type of deployment package. Set to Image for container
203+
* image and set Zip for .zip file archive.
203204
*
204205
* @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-lambda-2015-03-31.html#createfunction
205206
* @return string
206207
*/
207208
public function packageType()
208209
{
209-
if ($this->handler() === Package::CONTAINER_HANDLER) {
210-
return Package::CONTAINER_HANDLER;
211-
}
212-
213-
return 'Zip';
210+
return $this->handler() === Package::CONTAINER_HANDLER ? 'Image' : 'Zip';
214211
}
215212

216213
/**
@@ -249,6 +246,7 @@ public function variables()
249246
* If your file lived in a folder called "lambda", you can just prepend the
250247
* path to your handler, leaving you with e.g. "lambda/image.generate".
251248
*
249+
* @see https://hammerstone.dev/sidecar/docs/main/functions/handlers-and-packages
252250
* @see https://docs.aws.amazon.com/aws-sdk-php/v2/api/class-Aws.Lambda.LambdaClient.html#_createFunction
253251
* @return string
254252
*/
@@ -352,7 +350,10 @@ public function toDeploymentArray()
352350
'PackageType' => $this->packageType(),
353351
];
354352

355-
if ($this->packageType() !== 'Zip') {
353+
// For container image packages, we need to remove the Runtime
354+
// and Handler since the container handles both of those
355+
// things inherently.
356+
if ($this->packageType() === 'Image') {
356357
$config = Arr::except($config, ['Runtime', 'Handler']);
357358
}
358359

src/Package.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@
1818
class Package
1919
{
2020
/**
21+
* If your package is a container image, it does not require
22+
* a handler function. Use this constant instead.
23+
*
24+
* @see https://hammerstone.dev/sidecar/docs/main/functions/handlers-and-packages
2125
* @var string
2226
*/
23-
public const CONTAINER_HANDLER = 'Image';
27+
public const CONTAINER_HANDLER = 'container';
2428

2529
/**
2630
* @var array

0 commit comments

Comments
 (0)