Skip to content

Commit

Permalink
Update generated code (#1756)
Browse files Browse the repository at this point in the history
update generated code
  • Loading branch information
async-aws-bot authored Aug 31, 2024
1 parent 3c0238e commit f0f9d4b
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 5 deletions.
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.320.6"
"${LATEST}": "3.321.2"
},
"endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json",
"services": {
Expand Down
1 change: 1 addition & 0 deletions src/Service/CloudWatchLogs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/Service/CloudWatchLogs/src/CloudWatchLogsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -268,6 +269,7 @@ public function filterLogEvents($input = []): FilterLogEventsResponse
* logStreamName: string,
* logEvents: array<InputLogEvent|array>,
* sequenceToken?: null|string,
* entity?: null|Entity|array,
* '@region'?: string|null,
* }|PutLogEventsRequest $input
*
Expand Down
27 changes: 27 additions & 0 deletions src/Service/CloudWatchLogs/src/Enum/EntityRejectionErrorType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace AsyncAws\CloudWatchLogs\Enum;

final class EntityRejectionErrorType
{
public const ENTITY_SIZE_TOO_LARGE = 'EntitySizeTooLarge';
public const INVALID_ATTRIBUTES = 'InvalidAttributes';
public const INVALID_ENTITY = 'InvalidEntity';
public const INVALID_KEY_ATTRIBUTES = 'InvalidKeyAttributes';
public const INVALID_TYPE_VALUE = 'InvalidTypeValue';
public const MISSING_REQUIRED_FIELDS = 'MissingRequiredFields';
public const UNSUPPORTED_LOG_GROUP_TYPE = 'UnsupportedLogGroupType';

public static function exists(string $value): bool
{
return isset([
self::ENTITY_SIZE_TOO_LARGE => 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]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
*/
Expand Down
26 changes: 26 additions & 0 deletions src/Service/CloudWatchLogs/src/Input/PutLogEventsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<InputLogEvent|array>,
* sequenceToken?: null|string,
* entity?: null|Entity|array,
* '@region'?: string|null,
* } $input
*/
Expand All @@ -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);
}

Expand All @@ -72,6 +82,7 @@ public function __construct(array $input = [])
* logStreamName?: string,
* logEvents?: array<InputLogEvent|array>,
* sequenceToken?: null|string,
* entity?: null|Entity|array,
* '@region'?: string|null,
* }|PutLogEventsRequest $input
*/
Expand All @@ -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[]
*/
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
}
Expand Down
23 changes: 23 additions & 0 deletions src/Service/CloudWatchLogs/src/Result/PutLogEventsResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,13 +29,27 @@ class PutLogEventsResponse extends Result
*/
private $rejectedLogEventsInfo;

/**
* Reserved for future use.
*
* @var RejectedEntityInfo|null
*/
private $rejectedEntityInfo;

public function getNextSequenceToken(): ?string
{
$this->initialize();

return $this->nextSequenceToken;
}

public function getRejectedEntityInfo(): ?RejectedEntityInfo
{
$this->initialize();

return $this->rejectedEntityInfo;
}

public function getRejectedLogEventsInfo(): ?RejectedLogEventsInfo
{
$this->initialize();
Expand All @@ -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
Expand Down
92 changes: 92 additions & 0 deletions src/Service/CloudWatchLogs/src/ValueObject/Entity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php

namespace AsyncAws\CloudWatchLogs\ValueObject;

/**
* Reserved for future use.
*/
final class Entity
{
/**
* Reserved for future use.
*
* @var array<string, string>|null
*/
private $keyAttributes;

/**
* Reserved for future use.
*
* @var array<string, string>|null
*/
private $attributes;

/**
* @param array{
* keyAttributes?: null|array<string, string>,
* attributes?: null|array<string, string>,
* } $input
*/
public function __construct(array $input)
{
$this->keyAttributes = $input['keyAttributes'] ?? null;
$this->attributes = $input['attributes'] ?? null;
}

/**
* @param array{
* keyAttributes?: null|array<string, string>,
* attributes?: null|array<string, string>,
* }|Entity $input
*/
public static function create($input): self
{
return $input instanceof self ? $input : new self($input);
}

/**
* @return array<string, string>
*/
public function getAttributes(): array
{
return $this->attributes ?? [];
}

/**
* @return array<string, string>
*/
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;
}
}
55 changes: 55 additions & 0 deletions src/Service/CloudWatchLogs/src/ValueObject/RejectedEntityInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace AsyncAws\CloudWatchLogs\ValueObject;

use AsyncAws\CloudWatchLogs\Enum\EntityRejectionErrorType;
use AsyncAws\Core\Exception\InvalidArgument;

/**
* Reserved for future use.
*/
final class RejectedEntityInfo
{
/**
* Reserved for future use.
*
* @var EntityRejectionErrorType::*
*/
private $errorType;

/**
* @param array{
* errorType: EntityRejectionErrorType::*,
* } $input
*/
public function __construct(array $input)
{
$this->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;
}
}

0 comments on commit f0f9d4b

Please sign in to comment.