-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
230 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/Service/CloudWatchLogs/src/Enum/EntityRejectionErrorType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
55
src/Service/CloudWatchLogs/src/ValueObject/RejectedEntityInfo.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |