Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"variables": {
"${LATEST}": "3.402.1"
"${LATEST}": "3.402.2"
},
"endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json",
"services": {
Expand Down
4 changes: 4 additions & 0 deletions src/Service/Ec2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## NOT RELEASED

### Added

- AWS api-change: EC2 AMIs can now show vulnerability data and be targeted directly for scanning.

## 1.3.0

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/Service/Ec2/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
"dev-master": "1.4-dev"
}
}
}
27 changes: 27 additions & 0 deletions src/Service/Ec2/src/Enum/SeverityLabel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace AsyncAws\Ec2\Enum;

final class SeverityLabel
{
public const CRITICAL = 'critical';
public const HIGH = 'high';
public const INFORMATIONAL = 'informational';
public const LOW = 'low';
public const MEDIUM = 'medium';
public const UNKNOWN_TO_SDK = 'UNKNOWN_TO_SDK';

/**
* @psalm-assert-if-true self::* $value
*/
public static function exists(string $value): bool
{
return isset([
self::CRITICAL => true,
self::HIGH => true,
self::INFORMATIONAL => true,
self::LOW => true,
self::MEDIUM => true,
][$value]);
}
}
26 changes: 26 additions & 0 deletions src/Service/Ec2/src/Input/DescribeImagesRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,32 @@ final class DescribeImagesRequest extends Input
* - `ramdisk-id` - The RAM disk ID.
* - `root-device-name` - The device name of the root device volume (for example, `/dev/sda1`).
* - `root-device-type` - The type of the root device volume (`ebs` | `instance-store`).
* - `scan-result.critical-fix-available-since` - The earliest date and time, in the ISO 8601 format in the UTC time
* zone (YYYY-MM-DDThh:mm:ss.sssZ), at which Amazon Inspector reported a fix as available for a `critical` severity
* finding on the AMI.
* - `scan-result.finding-scan-date` - The date and time, in the ISO 8601 format in the UTC time zone
* (YYYY-MM-DDThh:mm:ss.sssZ), of the most recent Amazon Inspector scan of the AMI.
* - `scan-result.high-fix-available-since` - The earliest date and time, in the ISO 8601 format in the UTC time zone
* (YYYY-MM-DDThh:mm:ss.sssZ), at which Amazon Inspector reported a fix as available for a `high` severity finding on
* the AMI.
* - `scan-result.highest-finding-severity-label` - The highest severity among the AMI's Amazon Inspector findings,
* whether or not a fix is available. The valid values are the following Amazon Inspector severity levels:
*
* - `informational` - CVSS score of 0.
* - `low` - CVSS score of 0.1 to 3.9.
* - `medium` - CVSS score of 4.0 to 6.9.
* - `high` - CVSS score of 7.0 to 8.9.
* - `critical` - CVSS score of 9.0 to 10.0.
*
* - `scan-result.informational-fix-available-since` - The earliest date and time, in the ISO 8601 format in the UTC
* time zone (YYYY-MM-DDThh:mm:ss.sssZ), at which Amazon Inspector reported a fix as available for an `informational`
* severity finding on the AMI.
* - `scan-result.low-fix-available-since` - The earliest date and time, in the ISO 8601 format in the UTC time zone
* (YYYY-MM-DDThh:mm:ss.sssZ), at which Amazon Inspector reported a fix as available for a `low` severity finding on
* the AMI.
* - `scan-result.medium-fix-available-since` - The earliest date and time, in the ISO 8601 format in the UTC time zone
* (YYYY-MM-DDThh:mm:ss.sssZ), at which Amazon Inspector reported a fix as available for a `medium` severity finding
* on the AMI.
* - `source-image-id` - The ID of the source AMI from which the AMI was created.
* - `source-image-region` - The Region of the source AMI.
* - `source-instance-id` - The ID of the instance that the AMI was created from if the AMI was created using
Expand Down
16 changes: 16 additions & 0 deletions src/Service/Ec2/src/Result/DescribeImagesResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use AsyncAws\Ec2\Enum\ImdsSupportValues;
use AsyncAws\Ec2\Enum\PlatformValues;
use AsyncAws\Ec2\Enum\ProductCodeValues;
use AsyncAws\Ec2\Enum\SeverityLabel;
use AsyncAws\Ec2\Enum\TpmSupportValues;
use AsyncAws\Ec2\Enum\VirtualizationType;
use AsyncAws\Ec2\Enum\VolumeType;
Expand All @@ -26,6 +27,7 @@
use AsyncAws\Ec2\ValueObject\InstanceTypeItem;
use AsyncAws\Ec2\ValueObject\InstanceTypeSpecification;
use AsyncAws\Ec2\ValueObject\ProductCode;
use AsyncAws\Ec2\ValueObject\ScanResults;
use AsyncAws\Ec2\ValueObject\StateReason;
use AsyncAws\Ec2\ValueObject\Tag;

Expand Down Expand Up @@ -189,6 +191,7 @@ private function populateResultImage(\SimpleXMLElement $xml): Image
'FreeTierEligible' => (null !== $v = $xml->freeTierEligible[0]) ? filter_var((string) $v, \FILTER_VALIDATE_BOOLEAN) : null,
'PublicSsmParameterName' => (null !== $v = $xml->publicSsmParameterName[0]) ? (string) $v : null,
'ImageWatermarks' => (0 === ($v = $xml->imageWatermarkSet)->count()) ? null : $this->populateResultImageWatermarkList($v),
'ScanResults' => 0 === $xml->scanResults->count() ? null : $this->populateResultScanResults($xml->scanResults),
'InstanceTypeSpecification' => 0 === $xml->instanceTypeSpecification->count() ? null : $this->populateResultInstanceTypeSpecification($xml->instanceTypeSpecification),
'ImageId' => (null !== $v = $xml->imageId[0]) ? (string) $v : null,
'ImageLocation' => (null !== $v = $xml->imageLocation[0]) ? (string) $v : null,
Expand Down Expand Up @@ -278,6 +281,19 @@ private function populateResultProductCodeList(\SimpleXMLElement $xml): array
return $items;
}

private function populateResultScanResults(\SimpleXMLElement $xml): ScanResults
{
return new ScanResults([
'HighestFindingSeverityLabel' => (null !== $v = $xml->highestFindingSeverityLabel[0]) ? (!SeverityLabel::exists((string) $xml->highestFindingSeverityLabel) ? SeverityLabel::UNKNOWN_TO_SDK : (string) $xml->highestFindingSeverityLabel) : null,
'FindingScanDate' => (null !== $v = $xml->findingScanDate[0]) ? new \DateTimeImmutable((string) $v) : null,
'InformationalFixAvailableSince' => (null !== $v = $xml->informationalFixAvailableSince[0]) ? new \DateTimeImmutable((string) $v) : null,
'LowFixAvailableSince' => (null !== $v = $xml->lowFixAvailableSince[0]) ? new \DateTimeImmutable((string) $v) : null,
'MediumFixAvailableSince' => (null !== $v = $xml->mediumFixAvailableSince[0]) ? new \DateTimeImmutable((string) $v) : null,
'HighFixAvailableSince' => (null !== $v = $xml->highFixAvailableSince[0]) ? new \DateTimeImmutable((string) $v) : null,
'CriticalFixAvailableSince' => (null !== $v = $xml->criticalFixAvailableSince[0]) ? new \DateTimeImmutable((string) $v) : null,
]);
}

private function populateResultStateReason(\SimpleXMLElement $xml): StateReason
{
return new StateReason([
Expand Down
19 changes: 19 additions & 0 deletions src/Service/Ec2/src/ValueObject/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,17 @@ final class Image
*/
private $imageWatermarks;

/**
* The Amazon Inspector scan results for the AMI. This information is present only for AMIs that Amazon Inspector has
* scanned.
*
* When you share an AMI with other accounts, organizations, or organizational units (OUs), or make it public, its scan
* results are available to the accounts that can use the AMI.
*
* @var ScanResults|null
*/
private $scanResults;

/**
* The instance type specification for the AMI, which defines which instance types are compatible with this image.
*
Expand Down Expand Up @@ -371,6 +382,7 @@ final class Image
* FreeTierEligible?: bool|null,
* PublicSsmParameterName?: string|null,
* ImageWatermarks?: array<ImageWatermark|array>|null,
* ScanResults?: ScanResults|array|null,
* InstanceTypeSpecification?: InstanceTypeSpecification|array|null,
* ImageId?: string|null,
* ImageLocation?: string|null,
Expand Down Expand Up @@ -415,6 +427,7 @@ public function __construct(array $input)
$this->freeTierEligible = $input['FreeTierEligible'] ?? null;
$this->publicSsmParameterName = $input['PublicSsmParameterName'] ?? null;
$this->imageWatermarks = isset($input['ImageWatermarks']) ? array_map([ImageWatermark::class, 'create'], $input['ImageWatermarks']) : null;
$this->scanResults = isset($input['ScanResults']) ? ScanResults::create($input['ScanResults']) : null;
$this->instanceTypeSpecification = isset($input['InstanceTypeSpecification']) ? InstanceTypeSpecification::create($input['InstanceTypeSpecification']) : null;
$this->imageId = $input['ImageId'] ?? null;
$this->imageLocation = $input['ImageLocation'] ?? null;
Expand Down Expand Up @@ -459,6 +472,7 @@ public function __construct(array $input)
* FreeTierEligible?: bool|null,
* PublicSsmParameterName?: string|null,
* ImageWatermarks?: array<ImageWatermark|array>|null,
* ScanResults?: ScanResults|array|null,
* InstanceTypeSpecification?: InstanceTypeSpecification|array|null,
* ImageId?: string|null,
* ImageLocation?: string|null,
Expand Down Expand Up @@ -659,6 +673,11 @@ public function getRootDeviceType(): ?string
return $this->rootDeviceType;
}

public function getScanResults(): ?ScanResults
{
return $this->scanResults;
}

public function getSourceImageId(): ?string
{
return $this->sourceImageId;
Expand Down
172 changes: 172 additions & 0 deletions src/Service/Ec2/src/ValueObject/ScanResults.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
<?php

namespace AsyncAws\Ec2\ValueObject;

use AsyncAws\Ec2\Enum\SeverityLabel;

/**
* The Amazon Inspector scan results for an AMI. This information is present only for AMIs that Amazon Inspector has
* scanned.
*
* When you share an AMI with other accounts, organizations, or organizational units (OUs), or make it public, its scan
* results are available to the accounts that can use the AMI.
*
* The fix-available dates are specific to the AMI. Each date reflects when a fix became available for a finding on that
* AMI, not when the vendor released the fix. As a result, a date can be later than the vendor's release date, and AMIs
* with the same vulnerability can have different dates.
*/
final class ScanResults
{
/**
* The highest severity among the AMI's Amazon Inspector findings, whether or not a fix is available.
*
* The valid values are the following Amazon Inspector severity levels, which correspond to CVSS score ranges:
*
* - `informational` - CVSS score of 0.
* - `low` - CVSS score of 0.1 to 3.9.
* - `medium` - CVSS score of 4.0 to 6.9.
* - `high` - CVSS score of 7.0 to 8.9.
* - `critical` - CVSS score of 9.0 to 10.0.
*
* For more information, see Software package vulnerability severity [^1] in the *Amazon Inspector User Guide*.
*
* This value is present only if the AMI has at least one finding.
*
* [^1]: https://docs.aws.amazon.com/inspector/latest/user/findings-understanding-severity.html#findings-understanding-package-score
*
* @var SeverityLabel::*|null
*/
private $highestFindingSeverityLabel;

/**
* The date and time, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), of the most recent Amazon
* Inspector scan of the AMI.
*
* @var \DateTimeImmutable|null
*/
private $findingScanDate;

/**
* The earliest date and time, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), at which Amazon
* Inspector reported a fix as available for an `informational` severity finding on the AMI. This value is present only
* if the AMI has at least one `informational` severity finding with a fix available. Amazon Inspector recomputes this
* value on each scan.
*
* @var \DateTimeImmutable|null
*/
private $informationalFixAvailableSince;

/**
* The earliest date and time, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), at which Amazon
* Inspector reported a fix as available for a `low` severity finding on the AMI. This value is present only if the AMI
* has at least one `low` severity finding with a fix available. Amazon Inspector recomputes this value on each scan.
*
* @var \DateTimeImmutable|null
*/
private $lowFixAvailableSince;

/**
* The earliest date and time, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), at which Amazon
* Inspector reported a fix as available for a `medium` severity finding on the AMI. This value is present only if the
* AMI has at least one `medium` severity finding with a fix available. Amazon Inspector recomputes this value on each
* scan.
*
* @var \DateTimeImmutable|null
*/
private $mediumFixAvailableSince;

/**
* The earliest date and time, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), at which Amazon
* Inspector reported a fix as available for a `high` severity finding on the AMI. This value is present only if the AMI
* has at least one `high` severity finding with a fix available. Amazon Inspector recomputes this value on each scan.
*
* @var \DateTimeImmutable|null
*/
private $highFixAvailableSince;

/**
* The earliest date and time, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), at which Amazon
* Inspector reported a fix as available for a `critical` severity finding on the AMI. This value is present only if the
* AMI has at least one `critical` severity finding with a fix available. Amazon Inspector recomputes this value on each
* scan.
*
* @var \DateTimeImmutable|null
*/
private $criticalFixAvailableSince;

/**
* @param array{
* HighestFindingSeverityLabel?: SeverityLabel::*|null,
* FindingScanDate?: \DateTimeImmutable|null,
* InformationalFixAvailableSince?: \DateTimeImmutable|null,
* LowFixAvailableSince?: \DateTimeImmutable|null,
* MediumFixAvailableSince?: \DateTimeImmutable|null,
* HighFixAvailableSince?: \DateTimeImmutable|null,
* CriticalFixAvailableSince?: \DateTimeImmutable|null,
* } $input
*/
public function __construct(array $input)
{
$this->highestFindingSeverityLabel = $input['HighestFindingSeverityLabel'] ?? null;
$this->findingScanDate = $input['FindingScanDate'] ?? null;
$this->informationalFixAvailableSince = $input['InformationalFixAvailableSince'] ?? null;
$this->lowFixAvailableSince = $input['LowFixAvailableSince'] ?? null;
$this->mediumFixAvailableSince = $input['MediumFixAvailableSince'] ?? null;
$this->highFixAvailableSince = $input['HighFixAvailableSince'] ?? null;
$this->criticalFixAvailableSince = $input['CriticalFixAvailableSince'] ?? null;
}

/**
* @param array{
* HighestFindingSeverityLabel?: SeverityLabel::*|null,
* FindingScanDate?: \DateTimeImmutable|null,
* InformationalFixAvailableSince?: \DateTimeImmutable|null,
* LowFixAvailableSince?: \DateTimeImmutable|null,
* MediumFixAvailableSince?: \DateTimeImmutable|null,
* HighFixAvailableSince?: \DateTimeImmutable|null,
* CriticalFixAvailableSince?: \DateTimeImmutable|null,
* }|ScanResults $input
*/
public static function create($input): self
{
return $input instanceof self ? $input : new self($input);
}

public function getCriticalFixAvailableSince(): ?\DateTimeImmutable
{
return $this->criticalFixAvailableSince;
}

public function getFindingScanDate(): ?\DateTimeImmutable
{
return $this->findingScanDate;
}

public function getHighFixAvailableSince(): ?\DateTimeImmutable
{
return $this->highFixAvailableSince;
}

/**
* @return SeverityLabel::*|null
*/
public function getHighestFindingSeverityLabel(): ?string
{
return $this->highestFindingSeverityLabel;
}

public function getInformationalFixAvailableSince(): ?\DateTimeImmutable
{
return $this->informationalFixAvailableSince;
}

public function getLowFixAvailableSince(): ?\DateTimeImmutable
{
return $this->lowFixAvailableSince;
}

public function getMediumFixAvailableSince(): ?\DateTimeImmutable
{
return $this->mediumFixAvailableSince;
}
}
Loading