diff --git a/manifest.json b/manifest.json index 73a065247..916833df0 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "variables": { - "${LATEST}": "3.320.6" + "${LATEST}": "3.321.2" }, "endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json", "services": { diff --git a/src/Service/CloudWatchLogs/CHANGELOG.md b/src/Service/CloudWatchLogs/CHANGELOG.md index eca3fc518..0b6564970 100644 --- a/src/Service/CloudWatchLogs/CHANGELOG.md +++ b/src/Service/CloudWatchLogs/CHANGELOG.md @@ -5,6 +5,7 @@ ### Added - AWS api-change: Added `ap-southeast-5` region +- AWS api-change: This release introduces a new optional parameter: Entity, in PutLogEvents request ### Changed diff --git a/src/Service/CloudWatchLogs/src/CloudWatchLogsClient.php b/src/Service/CloudWatchLogs/src/CloudWatchLogsClient.php index 828763354..7c6ca57b0 100644 --- a/src/Service/CloudWatchLogs/src/CloudWatchLogsClient.php +++ b/src/Service/CloudWatchLogs/src/CloudWatchLogsClient.php @@ -21,6 +21,7 @@ use AsyncAws\CloudWatchLogs\Result\DescribeLogStreamsResponse; use AsyncAws\CloudWatchLogs\Result\FilterLogEventsResponse; use AsyncAws\CloudWatchLogs\Result\PutLogEventsResponse; +use AsyncAws\CloudWatchLogs\ValueObject\Entity; use AsyncAws\CloudWatchLogs\ValueObject\InputLogEvent; use AsyncAws\Core\AbstractApi; use AsyncAws\Core\AwsError\AwsErrorFactoryInterface; @@ -268,6 +269,7 @@ public function filterLogEvents($input = []): FilterLogEventsResponse * logStreamName: string, * logEvents: array, * sequenceToken?: null|string, + * entity?: null|Entity|array, * '@region'?: string|null, * }|PutLogEventsRequest $input * diff --git a/src/Service/CloudWatchLogs/src/Enum/EntityRejectionErrorType.php b/src/Service/CloudWatchLogs/src/Enum/EntityRejectionErrorType.php new file mode 100644 index 000000000..a60280d48 --- /dev/null +++ b/src/Service/CloudWatchLogs/src/Enum/EntityRejectionErrorType.php @@ -0,0 +1,27 @@ + true, + self::INVALID_ATTRIBUTES => true, + self::INVALID_ENTITY => true, + self::INVALID_KEY_ATTRIBUTES => true, + self::INVALID_TYPE_VALUE => true, + self::MISSING_REQUIRED_FIELDS => true, + self::UNSUPPORTED_LOG_GROUP_TYPE => true, + ][$value]); + } +} diff --git a/src/Service/CloudWatchLogs/src/Input/FilterLogEventsRequest.php b/src/Service/CloudWatchLogs/src/Input/FilterLogEventsRequest.php index 67f5fb12f..6723cf9e4 100644 --- a/src/Service/CloudWatchLogs/src/Input/FilterLogEventsRequest.php +++ b/src/Service/CloudWatchLogs/src/Input/FilterLogEventsRequest.php @@ -30,7 +30,7 @@ final class FilterLogEventsRequest extends Input /** * Filters the results to only logs from the log streams in this list. * - * If you specify a value for both `logStreamNamePrefix` and `logStreamNames`, the action returns an + * If you specify a value for both `logStreamNames` and `logStreamNamePrefix`, the action returns an * `InvalidParameterException` error. * * @var string[]|null @@ -40,9 +40,8 @@ final class FilterLogEventsRequest extends Input /** * Filters the results to include only events from log streams that have names starting with this prefix. * - * If you specify a value for both `logStreamNamePrefix` and `logStreamNames`, but the value for `logStreamNamePrefix` - * does not match any log stream names specified in `logStreamNames`, the action returns an `InvalidParameterException` - * error. + * If you specify a value for both `logStreamNamePrefix` and `logStreamNames`, the action returns an + * `InvalidParameterException` error. * * @var string|null */ diff --git a/src/Service/CloudWatchLogs/src/Input/PutLogEventsRequest.php b/src/Service/CloudWatchLogs/src/Input/PutLogEventsRequest.php index f6808e0c2..a8de54a4c 100644 --- a/src/Service/CloudWatchLogs/src/Input/PutLogEventsRequest.php +++ b/src/Service/CloudWatchLogs/src/Input/PutLogEventsRequest.php @@ -2,6 +2,7 @@ namespace AsyncAws\CloudWatchLogs\Input; +use AsyncAws\CloudWatchLogs\ValueObject\Entity; use AsyncAws\CloudWatchLogs\ValueObject\InputLogEvent; use AsyncAws\Core\Exception\InvalidArgument; use AsyncAws\Core\Input; @@ -48,12 +49,20 @@ final class PutLogEventsRequest extends Input */ private $sequenceToken; + /** + * Reserved for future use. + * + * @var Entity|null + */ + private $entity; + /** * @param array{ * logGroupName?: string, * logStreamName?: string, * logEvents?: array, * sequenceToken?: null|string, + * entity?: null|Entity|array, * '@region'?: string|null, * } $input */ @@ -63,6 +72,7 @@ public function __construct(array $input = []) $this->logStreamName = $input['logStreamName'] ?? null; $this->logEvents = isset($input['logEvents']) ? array_map([InputLogEvent::class, 'create'], $input['logEvents']) : null; $this->sequenceToken = $input['sequenceToken'] ?? null; + $this->entity = isset($input['entity']) ? Entity::create($input['entity']) : null; parent::__construct($input); } @@ -72,6 +82,7 @@ public function __construct(array $input = []) * logStreamName?: string, * logEvents?: array, * sequenceToken?: null|string, + * entity?: null|Entity|array, * '@region'?: string|null, * }|PutLogEventsRequest $input */ @@ -80,6 +91,11 @@ public static function create($input): self return $input instanceof self ? $input : new self($input); } + public function getEntity(): ?Entity + { + return $this->entity; + } + /** * @return InputLogEvent[] */ @@ -129,6 +145,13 @@ public function request(): Request return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body)); } + public function setEntity(?Entity $value): self + { + $this->entity = $value; + + return $this; + } + /** * @param InputLogEvent[] $value */ @@ -185,6 +208,9 @@ private function requestBody(): array if (null !== $v = $this->sequenceToken) { $payload['sequenceToken'] = $v; } + if (null !== $v = $this->entity) { + $payload['entity'] = $v->requestBody(); + } return $payload; } diff --git a/src/Service/CloudWatchLogs/src/Result/PutLogEventsResponse.php b/src/Service/CloudWatchLogs/src/Result/PutLogEventsResponse.php index 21ea95808..e807a255f 100644 --- a/src/Service/CloudWatchLogs/src/Result/PutLogEventsResponse.php +++ b/src/Service/CloudWatchLogs/src/Result/PutLogEventsResponse.php @@ -2,6 +2,7 @@ namespace AsyncAws\CloudWatchLogs\Result; +use AsyncAws\CloudWatchLogs\ValueObject\RejectedEntityInfo; use AsyncAws\CloudWatchLogs\ValueObject\RejectedLogEventsInfo; use AsyncAws\Core\Response; use AsyncAws\Core\Result; @@ -28,6 +29,13 @@ class PutLogEventsResponse extends Result */ private $rejectedLogEventsInfo; + /** + * Reserved for future use. + * + * @var RejectedEntityInfo|null + */ + private $rejectedEntityInfo; + public function getNextSequenceToken(): ?string { $this->initialize(); @@ -35,6 +43,13 @@ public function getNextSequenceToken(): ?string return $this->nextSequenceToken; } + public function getRejectedEntityInfo(): ?RejectedEntityInfo + { + $this->initialize(); + + return $this->rejectedEntityInfo; + } + public function getRejectedLogEventsInfo(): ?RejectedLogEventsInfo { $this->initialize(); @@ -48,6 +63,14 @@ protected function populateResult(Response $response): void $this->nextSequenceToken = isset($data['nextSequenceToken']) ? (string) $data['nextSequenceToken'] : null; $this->rejectedLogEventsInfo = empty($data['rejectedLogEventsInfo']) ? null : $this->populateResultRejectedLogEventsInfo($data['rejectedLogEventsInfo']); + $this->rejectedEntityInfo = empty($data['rejectedEntityInfo']) ? null : $this->populateResultRejectedEntityInfo($data['rejectedEntityInfo']); + } + + private function populateResultRejectedEntityInfo(array $json): RejectedEntityInfo + { + return new RejectedEntityInfo([ + 'errorType' => (string) $json['errorType'], + ]); } private function populateResultRejectedLogEventsInfo(array $json): RejectedLogEventsInfo diff --git a/src/Service/CloudWatchLogs/src/ValueObject/Entity.php b/src/Service/CloudWatchLogs/src/ValueObject/Entity.php new file mode 100644 index 000000000..2f5c33c20 --- /dev/null +++ b/src/Service/CloudWatchLogs/src/ValueObject/Entity.php @@ -0,0 +1,92 @@ +|null + */ + private $keyAttributes; + + /** + * Reserved for future use. + * + * @var array|null + */ + private $attributes; + + /** + * @param array{ + * keyAttributes?: null|array, + * attributes?: null|array, + * } $input + */ + public function __construct(array $input) + { + $this->keyAttributes = $input['keyAttributes'] ?? null; + $this->attributes = $input['attributes'] ?? null; + } + + /** + * @param array{ + * keyAttributes?: null|array, + * attributes?: null|array, + * }|Entity $input + */ + public static function create($input): self + { + return $input instanceof self ? $input : new self($input); + } + + /** + * @return array + */ + public function getAttributes(): array + { + return $this->attributes ?? []; + } + + /** + * @return array + */ + public function getKeyAttributes(): array + { + return $this->keyAttributes ?? []; + } + + /** + * @internal + */ + public function requestBody(): array + { + $payload = []; + if (null !== $v = $this->keyAttributes) { + if (empty($v)) { + $payload['keyAttributes'] = new \stdClass(); + } else { + $payload['keyAttributes'] = []; + foreach ($v as $name => $mv) { + $payload['keyAttributes'][$name] = $mv; + } + } + } + if (null !== $v = $this->attributes) { + if (empty($v)) { + $payload['attributes'] = new \stdClass(); + } else { + $payload['attributes'] = []; + foreach ($v as $name => $mv) { + $payload['attributes'][$name] = $mv; + } + } + } + + return $payload; + } +} diff --git a/src/Service/CloudWatchLogs/src/ValueObject/RejectedEntityInfo.php b/src/Service/CloudWatchLogs/src/ValueObject/RejectedEntityInfo.php new file mode 100644 index 000000000..b21795d75 --- /dev/null +++ b/src/Service/CloudWatchLogs/src/ValueObject/RejectedEntityInfo.php @@ -0,0 +1,55 @@ +errorType = $input['errorType'] ?? $this->throwException(new InvalidArgument('Missing required field "errorType".')); + } + + /** + * @param array{ + * errorType: EntityRejectionErrorType::*, + * }|RejectedEntityInfo $input + */ + public static function create($input): self + { + return $input instanceof self ? $input : new self($input); + } + + /** + * @return EntityRejectionErrorType::* + */ + public function getErrorType(): string + { + return $this->errorType; + } + + /** + * @return never + */ + private function throwException(\Throwable $exception) + { + throw $exception; + } +}