Update dependencies flagged by security advisories and require PHP 8.4

Bumps the packages reported by CVE/GHSA scans in #1564 to their patched
releases (with transitive dependencies):

- symfony/http-foundation 7.3.1 -> 7.4.14 (CVE-2025-64500 / GHSA-3rg7-wf37-54rm)
- phpunit/phpunit 10.5.47 -> 10.5.64 (CVE-2026-24765 / GHSA-vvj3-c3rp-c85p)
- aws/aws-sdk-php 3.349.3 -> 3.388.0 (GHSA-27qh-8cxx-2cr5)
- enshrined/svg-sanitize 0.21.0 -> 0.22.0 (GHSA-22wq-q86m-83fh)

Some transitive dependencies now require PHP 8.4, which matches the runtime
shipped in the official LinuxServer image, so the composer requirement is
raised to ^8.4, CI is pinned to PHP 8.4, and the readme is updated to match.

The remaining advisories in the report (php84, curl, libpq, git, sqlite,
busybox, coreutils) come from the LinuxServer base image, not this
repository, and are addressed by rebuilding the image on an updated base.

Refs #1564
This commit is contained in:
KodeStar
2026-07-08 16:30:22 +01:00
parent e2215fe42b
commit f69cbba6cd
1791 changed files with 48994 additions and 9191 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ jobs:
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: '8.3'
php-version: '8.4'
extensions: mbstring, dom, fileinfo, mysql, libxml, xml, xmlwriter, dom, tokenizer, filter, json, phar, pcre, openssl, pdo, intl, curl
- name: Cache composer dependencies
+5 -2
View File
@@ -8,10 +8,10 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^8.2",
"php": "^8.4",
"ext-intl": "*",
"ext-json": "*",
"enshrined/svg-sanitize": "^0.21.0",
"enshrined/svg-sanitize": "^0.22.0",
"graham-campbell/github": "^12.5",
"guzzlehttp/guzzle": "^7.8",
"laravel/framework": "^11.45",
@@ -84,6 +84,9 @@
"kylekatarnls/update-helper": true,
"symfony/thanks": true,
"php-http/discovery": true
},
"platform": {
}
},
"minimum-stability": "stable",
Generated
+343 -206
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -34,7 +34,7 @@ Supported applications are recognized by the title of the application as entered
[![foundationapps](https://img.shields.io/badge/dynamic/json.svg?label=Foundation%20Apps&url=https%3A%2F%2Fapps.heimdall.site%2Fstats&query=foundation_apps&colorB=3f8483&style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAjCAMAAACw/5reAAAAnFBMVEUAAADu7u7u7u7u7u7u7u7x8fHu7u7u7u7u7u7u7u7u7u7u7u7r6+vu7u7v7+/u7u7t7e3v7+/v7+/u7u7u7u7u7u7u7u7u7u7u7u7u7u7v7+/u7u7p6ent7e3v7+/v7+/v7+/u7u7u7u7u7u7u7u7t7e3////u7u7u7u7u7u7u7u7w8PDw8PDt7e3u7u7t7e3s7Ozu7u7t7e3u7u4TnCP6AAAAM3RSTlMA+9n3phHw3czC088M5Y5zG6mflWdJFumyfj4sB2NeTi7hiWlDOQPGt5lsMiG9hFQntpFqxQJtAAABnElEQVQoz2WRh3KrQAxFtYWO6ZhucItrynv6/3/LFnA24c6wurpnYBkJZvXduNix6+GXTo8qWnxUPU4m2w0O1ktTozPsftiZpejGlm7C2MWUnRcWOohIo36+PaKyDZdLUOgDXvqQfaT9kwkfvP3AN18E7Kl8hkJHMHSXSSadxaTtTNjJhMkfjFHKMqGlolg4T7mtCbcq8gBCotxkwklFLIQSlQoTHnVWQqzNxYQuzpfmqGVMc5ijHK5yAuIhxbZ5p/S92RZkjv5BKs6aosSIr0JrcXBo1FtICVINKRKK6u0GnraoN84O5KbhjRwYzxCJnQCMtotkdNxjq2F7dJ2RoGuXIBTvc3ROthdmat6hZ7cOyfcxKGV+wTxBkxQxTQTzWOFny/7qS2nzx37T7nbtZj9xu7zUr/323nVy0sQnhwMJktSZrl5v7CjgSQmWi+haUCY8sH4tyc/FGSKGouS+WqBJm8U2NIE/+nLu2tzpF/xVNGy02QzRClafC/ysVpDzQJuA8xXsKl8bv+pgpXz57H9Yy3J1lQNY62wUrW+mdzrylWS0QwAAAABJRU5ErkJggg==)](https://apps.heimdall.site/applications/foundation)
## Installing
Apart from the Laravel 10 dependencies, namely PHP >= 8.1, Ctype PHP Extension, cURL PHP Extension, DOM PHP Extension, Fileinfo PHP Extension, Filter PHP Extension, Hash PHP Extension, Mbstring PHP Extension, OpenSSL PHP Extension, PCRE PHP Extension, PDO PHP Extension, Session PHP Extension, Tokenizer PHP Extension, XML PHP Extension, the only other thing Heimdall needs is sqlite support and zip support (php-zip).
Apart from the Laravel 11 dependencies, namely PHP >= 8.4, Ctype PHP Extension, cURL PHP Extension, DOM PHP Extension, Fileinfo PHP Extension, Filter PHP Extension, Hash PHP Extension, Mbstring PHP Extension, OpenSSL PHP Extension, PCRE PHP Extension, PDO PHP Extension, Session PHP Extension, Tokenizer PHP Extension, XML PHP Extension, the only other thing Heimdall needs is sqlite support and zip support (php-zip).
If you find you can't change the background make sure `php_fileinfo` is enabled in your php.ini. I believe `php_fileinfo` should be enabled by default, but one user came across the issue on a windows system.
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "aws/aws-sdk-php",
"homepage": "http://aws.amazon.com/sdkforphp",
"homepage": "https://aws.amazon.com/sdk-for-php",
"description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project",
"keywords": ["aws","amazon","sdk","s3","ec2","dynamodb","cloud","glacier"],
"type": "library",
@@ -8,7 +8,7 @@
"authors": [
{
"name": "Amazon Web Services",
"homepage": "http://aws.amazon.com"
"homepage": "https://aws.amazon.com"
}
],
"support": {
@@ -20,20 +20,20 @@
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.4.5",
"guzzlehttp/promises": "^2.0",
"mtdowling/jmespath.php": "^2.8.0",
"mtdowling/jmespath.php": "^2.9.1",
"ext-pcre": "*",
"ext-json": "*",
"ext-simplexml": "*",
"aws/aws-crt-php": "^1.2.3",
"psr/http-message": "^2.0"
"psr/http-message": "^1.0 || ^2.0",
"symfony/filesystem": "^v5.4.45 || ^v6.4.3 || ^v7.1.0 || ^v8.0.0"
},
"require-dev": {
"composer/composer" : "^2.7.8",
"ext-openssl": "*",
"ext-dom": "*",
"ext-pcntl": "*",
"ext-sockets": "*",
"phpunit/phpunit": "^5.6.3 || ^8.5 || ^9.5",
"phpunit/phpunit": "^10.0",
"behat/behat": "~3.0",
"doctrine/cache": "~1.4",
"aws/aws-php-sns-message-validator": "~1.0",
@@ -41,14 +41,14 @@
"psr/cache": "^2.0 || ^3.0",
"psr/simple-cache": "^2.0 || ^3.0",
"sebastian/comparator": "^1.2.3 || ^4.0 || ^5.0",
"symfony/filesystem": "^v6.4.0 || ^v7.1.0",
"yoast/phpunit-polyfills": "^2.0",
"dms/phpunit-arraysubset-asserts": "^0.4.0"
"dms/phpunit-arraysubset-asserts": "^v0.5.0"
},
"suggest": {
"ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages",
"ext-curl": "To send requests using cURL",
"ext-sockets": "To use client-side monitoring",
"ext-pcntl": "To use client-side monitoring",
"doctrine/cache": "To use the DoctrineCacheAdapter",
"aws/aws-php-sns-message-validator": "To validate incoming SNS notifications"
},
@@ -0,0 +1,51 @@
<?php
namespace Aws\ARCRegionSwitch;
use Aws\AwsClient;
/**
* This client is used to interact with the **ARC - Region switch** service.
* @method \Aws\Result approvePlanExecutionStep(array $args = [])
* @method \GuzzleHttp\Promise\Promise approvePlanExecutionStepAsync(array $args = [])
* @method \Aws\Result cancelPlanExecution(array $args = [])
* @method \GuzzleHttp\Promise\Promise cancelPlanExecutionAsync(array $args = [])
* @method \Aws\Result createPlan(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPlanAsync(array $args = [])
* @method \Aws\Result deletePlan(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePlanAsync(array $args = [])
* @method \Aws\Result getPlan(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPlanAsync(array $args = [])
* @method \Aws\Result getPlanEvaluationStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPlanEvaluationStatusAsync(array $args = [])
* @method \Aws\Result getPlanExecution(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPlanExecutionAsync(array $args = [])
* @method \Aws\Result getPlanInRegion(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPlanInRegionAsync(array $args = [])
* @method \Aws\Result listPlanExecutionEvents(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPlanExecutionEventsAsync(array $args = [])
* @method \Aws\Result listPlanExecutions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPlanExecutionsAsync(array $args = [])
* @method \Aws\Result listPlans(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPlansAsync(array $args = [])
* @method \Aws\Result listPlansInRegion(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPlansInRegionAsync(array $args = [])
* @method \Aws\Result listRoute53HealthChecks(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRoute53HealthChecksAsync(array $args = [])
* @method \Aws\Result listRoute53HealthChecksInRegion(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRoute53HealthChecksInRegionAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result startPlanExecution(array $args = [])
* @method \GuzzleHttp\Promise\Promise startPlanExecutionAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updatePlan(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePlanAsync(array $args = [])
* @method \Aws\Result updatePlanExecution(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePlanExecutionAsync(array $args = [])
* @method \Aws\Result updatePlanExecutionStep(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePlanExecutionStepAsync(array $args = [])
*/
class ARCRegionSwitchClient extends AwsClient {}
@@ -0,0 +1,9 @@
<?php
namespace Aws\ARCRegionSwitch\Exception;
use Aws\Exception\AwsException;
/**
* Represents an error interacting with the **ARC - Region switch** service.
*/
class ARCRegionSwitchException extends AwsException {}
@@ -21,10 +21,14 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createAnalyzerAsync(array $args = [])
* @method \Aws\Result createArchiveRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise createArchiveRuleAsync(array $args = [])
* @method \Aws\Result createServiceLinkedAnalyzer(array $args = [])
* @method \GuzzleHttp\Promise\Promise createServiceLinkedAnalyzerAsync(array $args = [])
* @method \Aws\Result deleteAnalyzer(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAnalyzerAsync(array $args = [])
* @method \Aws\Result deleteArchiveRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteArchiveRuleAsync(array $args = [])
* @method \Aws\Result deleteServiceLinkedAnalyzer(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteServiceLinkedAnalyzerAsync(array $args = [])
* @method \Aws\Result generateFindingRecommendation(array $args = [])
* @method \GuzzleHttp\Promise\Promise generateFindingRecommendationAsync(array $args = [])
* @method \Aws\Result getAccessPreview(array $args = [])
+2
View File
@@ -19,6 +19,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getAlternateContactAsync(array $args = [])
* @method \Aws\Result getContactInformation(array $args = [])
* @method \GuzzleHttp\Promise\Promise getContactInformationAsync(array $args = [])
* @method \Aws\Result getGovCloudAccountInformation(array $args = [])
* @method \GuzzleHttp\Promise\Promise getGovCloudAccountInformationAsync(array $args = [])
* @method \Aws\Result getPrimaryEmail(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPrimaryEmailAsync(array $args = [])
* @method \Aws\Result getRegionOptStatus(array $args = [])
+46
View File
@@ -8,22 +8,54 @@ use Aws\AwsClient;
*
* @method \Aws\Result addTagsToCertificate(array $args = [])
* @method \GuzzleHttp\Promise\Promise addTagsToCertificateAsync(array $args = [])
* @method \Aws\Result createAcmeDomainValidation(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAcmeDomainValidationAsync(array $args = [])
* @method \Aws\Result createAcmeEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAcmeEndpointAsync(array $args = [])
* @method \Aws\Result createAcmeExternalAccountBinding(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAcmeExternalAccountBindingAsync(array $args = [])
* @method \Aws\Result deleteAcmeDomainValidation(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAcmeDomainValidationAsync(array $args = [])
* @method \Aws\Result deleteAcmeEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAcmeEndpointAsync(array $args = [])
* @method \Aws\Result deleteAcmeExternalAccountBinding(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAcmeExternalAccountBindingAsync(array $args = [])
* @method \Aws\Result deleteCertificate(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteCertificateAsync(array $args = [])
* @method \Aws\Result describeAcmeAccount(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAcmeAccountAsync(array $args = [])
* @method \Aws\Result describeAcmeDomainValidation(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAcmeDomainValidationAsync(array $args = [])
* @method \Aws\Result describeAcmeEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAcmeEndpointAsync(array $args = [])
* @method \Aws\Result describeAcmeExternalAccountBinding(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAcmeExternalAccountBindingAsync(array $args = [])
* @method \Aws\Result describeCertificate(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeCertificateAsync(array $args = [])
* @method \Aws\Result exportCertificate(array $args = [])
* @method \GuzzleHttp\Promise\Promise exportCertificateAsync(array $args = [])
* @method \Aws\Result getAccountConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAccountConfigurationAsync(array $args = [])
* @method \Aws\Result getAcmeExternalAccountBindingCredentials(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAcmeExternalAccountBindingCredentialsAsync(array $args = [])
* @method \Aws\Result getCertificate(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCertificateAsync(array $args = [])
* @method \Aws\Result importCertificate(array $args = [])
* @method \GuzzleHttp\Promise\Promise importCertificateAsync(array $args = [])
* @method \Aws\Result listAcmeAccounts(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAcmeAccountsAsync(array $args = [])
* @method \Aws\Result listAcmeDomainValidations(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAcmeDomainValidationsAsync(array $args = [])
* @method \Aws\Result listAcmeEndpoints(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAcmeEndpointsAsync(array $args = [])
* @method \Aws\Result listAcmeExternalAccountBindings(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAcmeExternalAccountBindingsAsync(array $args = [])
* @method \Aws\Result listCertificates(array $args = [])
* @method \GuzzleHttp\Promise\Promise listCertificatesAsync(array $args = [])
* @method \Aws\Result listTagsForCertificate(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForCertificateAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result putAccountConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise putAccountConfigurationAsync(array $args = [])
* @method \Aws\Result removeTagsFromCertificate(array $args = [])
@@ -34,8 +66,22 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise requestCertificateAsync(array $args = [])
* @method \Aws\Result resendValidationEmail(array $args = [])
* @method \GuzzleHttp\Promise\Promise resendValidationEmailAsync(array $args = [])
* @method \Aws\Result revokeAcmeAccount(array $args = [])
* @method \GuzzleHttp\Promise\Promise revokeAcmeAccountAsync(array $args = [])
* @method \Aws\Result revokeAcmeExternalAccountBinding(array $args = [])
* @method \GuzzleHttp\Promise\Promise revokeAcmeExternalAccountBindingAsync(array $args = [])
* @method \Aws\Result revokeCertificate(array $args = [])
* @method \GuzzleHttp\Promise\Promise revokeCertificateAsync(array $args = [])
* @method \Aws\Result searchCertificates(array $args = [])
* @method \GuzzleHttp\Promise\Promise searchCertificatesAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateAcmeDomainValidation(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAcmeDomainValidationAsync(array $args = [])
* @method \Aws\Result updateAcmeEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAcmeEndpointAsync(array $args = [])
* @method \Aws\Result updateCertificateOptions(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateCertificateOptionsAsync(array $args = [])
*/
@@ -43,8 +43,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getBackendJobAsync(array $args = [])
* @method \Aws\Result getBackendStorage(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBackendStorageAsync(array $args = [])
* @method \Aws\Result getToken(array $args = [])
* @method \GuzzleHttp\Promise\Promise getTokenAsync(array $args = [])
* @method \Aws\Result getChallengeToken(array $args = [])
* @method \GuzzleHttp\Promise\Promise getChallengeTokenAsync(array $args = [])
* @method \Aws\Result importBackendAuth(array $args = [])
* @method \GuzzleHttp\Promise\Promise importBackendAuthAsync(array $args = [])
* @method \Aws\Result importBackendStorage(array $args = [])
+664
View File
@@ -0,0 +1,664 @@
<?php
namespace Aws\Api\Cbor;
use Aws\Api\Cbor\Exception\CborException;
/**
* Decodes Concise Binary Object Representation encoded strings
* into PHP values according to RFC 8949
*
* https://www.rfc-editor.org/rfc/rfc8949.html
*
* Supports Major types 0-7 including:
* - Type 0: Unsigned integers
* - Type 1: Negative integers
* - Type 2: Byte strings
* - Type 3: Text strings (UTF-8)
* - Type 4: Arrays
* - Type 5: Maps
* - Type 6: Tagged values (timestamps)
* - Type 7: Simple values (null, bool, float)
*
* @internal
*/
final class CborDecoder
{
private int $offset;
private int $length;
/**
* Decode CBOR binary data to PHP value
*
* @param string $data The CBOR-encoded binary data to decode
*
* @return mixed The decoded PHP value (can be any type: int, string, array, bool, null, float)
* @throws CborException If data is empty or malformed CBOR
*/
public function decode(string $data): mixed
{
if ($data === '') {
throw new CborException("No data to decode");
}
$this->offset = 0;
$this->length = strlen($data);
return $this->decodeValue($data);
}
/**
* Decode multiple CBOR values from sequential binary data
*
* @param string $data The CBOR-encoded binary data containing multiple values
*
* @return array Array of decoded PHP values in the order they appear in the data
* @throws CborException If data is malformed CBOR
*/
public function decodeAll(string $data): array
{
$this->length = strlen($data);
$this->offset = 0;
$values = [];
while ($this->offset < $this->length) {
$values[] = $this->decodeValue($data);
}
return $values;
}
/**
* Decodes a single CBOR value at the current offset
*
* @param string $data Reference to the CBOR data being decoded
*
* @return mixed The decoded value
* @throws CborException If unexpected end of data or invalid CBOR format
*/
private function decodeValue(string &$data): mixed
{
$offset = $this->offset;
$length = $this->length;
if ($offset >= $length) {
throw new CborException("Unexpected end of data");
}
$byte = ord($data[$offset++]);
$majorType = $byte >> 5;
$info = $byte & 0x1F;
switch ($majorType) {
case 0: // Unsigned integer
if ($info < 24) {
$this->offset = $offset;
return $info;
}
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 1;
return ord($data[$offset]);
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 2;
return (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 4;
return unpack('N', $data, $offset)[1];
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 8;
return unpack('J', $data, $offset)[1];
default:
throw new CborException("Invalid additional info for integer: $info");
}
case 1: // Negative integer
if ($info < 24) {
$this->offset = $offset;
return -1 - $info;
}
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 1;
return -1 - ord($data[$offset]);
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 2;
return -1 - ((ord($data[$offset]) << 8) | ord($data[$offset + 1]));
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 4;
return -1 - unpack('N', $data, $offset)[1];
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 8;
$unsigned = unpack('J', $data, $offset)[1];
return ($unsigned === 9223372036854775807) ? PHP_INT_MIN : -1 - $unsigned;
default:
throw new CborException("Invalid additional info for integer: $info");
}
case 2: // Byte string
if ($info < 24) {
$len = $info;
} else {
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$len = ord($data[$offset++]);
break;
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$len = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$offset += 2;
break;
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('N', $data, $offset)[1];
$offset += 4;
break;
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('J', $data, $offset)[1];
$offset += 8;
break;
case 31:
$this->offset = $offset;
return $this->decodeIndefiniteString($data, 0x40);
default:
throw new CborException("Invalid additional info for byte string: $info");
}
}
if ($offset + $len > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + $len;
return substr($data, $offset, $len);
case 3: // Text string
if ($info < 24) {
$len = $info;
} else {
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$len = ord($data[$offset++]);
break;
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$len = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$offset += 2;
break;
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('N', $data, $offset)[1];
$offset += 4;
break;
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('J', $data, $offset)[1];
$offset += 8;
break;
case 31:
$this->offset = $offset;
return $this->decodeIndefiniteString($data, 0x60);
default:
throw new CborException("Invalid additional info for text string: $info");
}
}
if ($offset + $len > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + $len;
return substr($data, $offset, $len);
case 4: // Array
if ($info < 24) {
$count = $info;
} else {
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$count = ord($data[$offset++]);
break;
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$count = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$offset += 2;
break;
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$count = unpack('N', $data, $offset)[1];
$offset += 4;
break;
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$count = unpack('J', $data, $offset)[1];
$offset += 8;
break;
case 31:
$this->offset = $offset;
return $this->decodeIndefiniteArray($data);
default:
throw new CborException("Invalid additional info for array: $info");
}
}
$this->offset = $offset;
$arr = [];
for ($i = 0; $i < $count; $i++) {
$arr[] = $this->decodeValue($data);
}
return $arr;
case 5: // Map
if ($info < 24) {
$count = $info;
} else {
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$count = ord($data[$offset++]);
break;
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$count = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$offset += 2;
break;
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$count = unpack('N', $data, $offset)[1];
$offset += 4;
break;
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$count = unpack('J', $data, $offset)[1];
$offset += 8;
break;
case 31:
$this->offset = $offset;
return $this->decodeIndefiniteMap($data);
default:
throw new CborException("Invalid additional info for map: $info");
}
}
$this->offset = $offset;
$map = [];
for ($i = 0; $i < $count; $i++) {
$key = $this->decodeValue($data);
$map[$key] = $this->decodeValue($data);
}
return $map;
case 6: // Tag
switch ($info) {
case 24:
$offset++;
break;
case 25:
$offset += 2;
break;
case 26:
$offset += 4;
break;
case 27:
$offset += 8;
break;
}
$this->offset = $offset;
return $this->decodeValue($data);
case 7: // Simple/float
switch ($info) {
case 20:
$this->offset = $offset;
return false;
case 21:
$this->offset = $offset;
return true;
case 22:
case 23:
$this->offset = $offset;
return null;
case 25: // Half-precision float
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 2;
$half = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$sign = ($half >> 15) & 0x01;
$exp = ($half >> 10) & 0x1F;
$mant = $half & 0x3FF;
if ($exp === 0) {
return $mant === 0
? ($sign ? -0.0 : 0.0)
: ($sign ? -1 : 1) * pow(2, -14) * ($mant / 1024);
}
if ($exp === 31) {
return $mant === 0 ? ($sign ? -INF : INF) : NAN;
}
return (float) (($sign ? -1 : 1) * pow(2, $exp - 15) * (1 + $mant / 1024));
case 26: // Single-precision float
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 4;
return unpack('G', $data, $offset)[1];
case 27: // Double-precision float
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 8;
return unpack('E', $data, $offset)[1];
case 31:
throw new CborException("Unexpected break");
default:
throw new CborException("Unknown simple value: $info");
}
default:
throw new CborException("Unknown major type: $majorType");
}
}
/**
* Decode indefinite-length string (byte or text)
*
* @param string $data Reference to the CBOR data being decoded
* @param int $expectedMajor Expected major type (0x40 for byte string, 0x60 for text string)
*
* @return string The concatenated string from all chunks
* @throws CborException If invalid chunk format or unexpected end of data
*/
private function decodeIndefiniteString(string &$data, int $expectedMajor): string
{
$chunks = [];
while (true) {
$offset = $this->offset;
$length = $this->length;
if ($offset >= $length) {
throw new CborException("Unexpected end of data");
}
$byte = ord($data[$offset++]);
if ($byte === 0xFF) {
$this->offset = $offset;
return implode('', $chunks);
}
if (($byte & 0xE0) !== $expectedMajor) {
throw new CborException("Invalid chunk in indefinite string");
}
$info = $byte & 0x1F;
if ($info === 31) {
throw new CborException("Nested indefinite string");
}
if ($info < 24) {
$len = $info;
} else {
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$len = ord($data[$offset++]);
break;
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$len = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$offset += 2;
break;
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('N', $data, $offset)[1];
$offset += 4;
break;
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('J', $data, $offset)[1];
$offset += 8;
break;
default:
throw new CborException("Invalid chunk length info: $info");
}
}
if ($offset + $len > $length) {
throw new CborException("Not enough data for chunk");
}
$chunks[] = substr($data, $offset, $len);
$this->offset = $offset + $len;
}
}
/**
* Decode indefinite-length array
*
* @param string $data Reference to the CBOR data being decoded
*
* @return array The decoded array elements
* @throws CborException If unexpected end of data
*/
private function decodeIndefiniteArray(string &$data): array
{
$result = [];
while (true) {
if ($this->offset >= $this->length) {
throw new CborException("Unexpected end of data");
}
if (ord($data[$this->offset]) === 0xFF) {
$this->offset++;
return $result;
}
$result[] = $this->decodeValue($data);
}
}
/**
* Decode indefinite-length map
*
* @param string $data Reference to the CBOR data being decoded
*
* @return array The decoded map as associative array
* @throws CborException If unexpected end of data or odd number of items
*/
private function decodeIndefiniteMap(string &$data): array
{
$result = [];
while (true) {
if ($this->offset >= $this->length) {
throw new CborException("Unexpected end of data");
}
if (ord($data[$this->offset]) === 0xFF) {
$this->offset++;
return $result;
}
$key = $this->decodeValue($data);
$result[$key] = $this->decodeValue($data);
}
}
}
+345
View File
@@ -0,0 +1,345 @@
<?php
namespace Aws\Api\Cbor;
use Aws\Api\Cbor\Exception\CborException;
/**
* Encodes PHP values to Concise Binary Object Representation according to RFC 8949
* https://www.rfc-editor.org/rfc/rfc8949.html
*
* Supports Major types 0-7 including:
* - Type 0: Unsigned integers
* - Type 1: Negative integers
* - Type 2: Byte strings (via ['__cbor_bytes' => $data] wrappers)
* - Type 3: Text strings (UTF-8)
* - Type 4: Arrays
* - Type 5: Maps
* - Type 6: Tagged values (timestamps)
* - Type 7: Simple values (null, bool, float)
*
* @internal
*/
final class CborEncoder
{
/**
* Pre-encoded integers 0-23 (single byte) and common larger values
* CBOR major type 0 (unsigned integer)
*/
private const INT_CACHE = [
0 => "\x00", 1 => "\x01", 2 => "\x02", 3 => "\x03",
4 => "\x04", 5 => "\x05", 6 => "\x06", 7 => "\x07",
8 => "\x08", 9 => "\x09", 10 => "\x0A", 11 => "\x0B",
12 => "\x0C", 13 => "\x0D", 14 => "\x0E", 15 => "\x0F",
16 => "\x10", 17 => "\x11", 18 => "\x12", 19 => "\x13",
20 => "\x14", 21 => "\x15", 22 => "\x16", 23 => "\x17",
24 => "\x18\x18", 25 => "\x18\x19", 26 => "\x18\x1A",
32 => "\x18\x20", 50 => "\x18\x32", 64 => "\x18\x40",
100 => "\x18\x64", 128 => "\x18\x80", 200 => "\x18\xC8",
255 => "\x18\xFF", 256 => "\x19\x01\x00", 500 => "\x19\x01\xF4",
1000 => "\x19\x03\xE8", 1023 => "\x19\x03\xFF",
];
/**
* Pre-encoded negative integers -1 to -24 and common larger values
* CBOR major type 1 (negative integer)
*/
private const NEG_CACHE = [
-1 => "\x20", -2 => "\x21", -3 => "\x22", -4 => "\x23",
-5 => "\x24", -10 => "\x29", -20 => "\x33", -24 => "\x37",
-25 => "\x38\x18", -50 => "\x38\x31", -100 => "\x38\x63",
];
/**
* Encode a PHP value to CBOR binary string
*
* @param mixed $value The value to encode
*
* @return string
*/
public function encode(mixed $value): string
{
return $this->encodeValue($value);
}
/**
* Recursively encode a value to CBOR
*
* @param mixed $value Value to encode
* @return string Encoded CBOR bytes
*/
private function encodeValue(mixed $value): string
{
switch (gettype($value)) {
case 'string':
$len = strlen($value);
if ($len < 24) {
return chr(0x60 | $len) . $value;
}
if ($len < 0x100) {
return "\x78" . chr($len) . $value;
}
return $this->encodeTextString($value);
case 'array':
if (isset($value['__cbor_timestamp'])) {
return "\xC1\xFB" . pack('E', $value['__cbor_timestamp']);
}
// Encode a byte string (major type 2)
if (isset($value['__cbor_bytes'])) {
$bytes = $value['__cbor_bytes'];
$len = strlen($bytes);
if ($len < 24) {
return chr(0x40 | $len) . $bytes;
}
if ($len < 0x100) {
return "\x58" . chr($len) . $bytes;
}
if ($len < 0x10000) {
return "\x59" . pack('n', $len) . $bytes;
}
return "\x5A" . pack('N', $len) . $bytes;
}
if (array_is_list($value)) {
return $this->encodeArray($value);
}
return $this->encodeMap($value);
case 'integer':
if (isset(self::INT_CACHE[$value])) {
return self::INT_CACHE[$value];
}
if (isset(self::NEG_CACHE[$value])) {
return self::NEG_CACHE[$value];
}
// Fast path for positive integers
// Major type 0: unsigned integer
if ($value >= 0) {
if ($value < 24) {
return chr($value);
}
if ($value < 0x100) {
return "\x18" . chr($value);
}
if ($value < 0x10000) {
return "\x19" . pack('n', $value);
}
if ($value < 0x100000000) {
return "\x1A" . pack('N', $value);
}
return "\x1B" . pack('J', $value);
}
return $this->encodeInteger($value);
case 'double':
// Encode a float (major type 7, float 64)
return "\xFB" . pack('E', $value);
case 'boolean':
// Encode a boolean (major type 7, simple)
return $value ? "\xF5" : "\xF4";
case 'NULL':
// Encode null (major type 7, simple)
return "\xF6";
case 'object':
throw new CborException("Cannot encode object of type: " . get_class($value));
default:
throw new CborException("Cannot encode value of type: " . gettype($value));
}
}
/**
* Encode an integer (major type 0 or 1)
*
* @param int $value
* @return string
*/
private function encodeInteger(int $value): string
{
if (isset(self::INT_CACHE[$value])) {
return self::INT_CACHE[$value];
}
if (isset(self::NEG_CACHE[$value])) {
return self::NEG_CACHE[$value];
}
if ($value >= 0) {
// Major type 0: unsigned integer
if ($value < 24) {
return chr($value);
}
if ($value < 0x100) {
return "\x18" . chr($value);
}
if ($value < 0x10000) {
return "\x19" . pack('n', $value);
}
if ($value < 0x100000000) {
return "\x1A" . pack('N', $value);
}
return "\x1B" . pack('J', $value);
}
// Major type 1: negative integer (-1 - n)
$value = -1 - $value;
if ($value < 24) {
return chr(0x20 | $value);
}
if ($value < 0x100) {
return "\x38" . chr($value);
}
if ($value < 0x10000) {
return "\x39" . pack('n', $value);
}
if ($value < 0x100000000) {
return "\x3A" . pack('N', $value);
}
return "\x3B" . pack('J', $value);
}
/**
* Encode a text string (major type 3)
*
* @param string $value
* @return string
*/
private function encodeTextString(string $value): string
{
$len = strlen($value);
if ($len < 24) {
return chr(0x60 | $len) . $value;
}
if ($len < 0x100) {
return "\x78" . chr($len) . $value;
}
if ($len < 0x10000) {
return "\x79" . pack('n', $len) . $value;
}
if ($len < 0x100000000) {
return "\x7A" . pack('N', $len) . $value;
}
return "\x7B" . pack('J', $len) . $value;
}
/**
* Encode an array (major type 4)
*
* @param array $value
* @return string
*/
private function encodeArray(array $value): string
{
$count = count($value);
if ($count < 24) {
$result = chr(0x80 | $count);
} elseif ($count < 0x100) {
$result = "\x98" . chr($count);
} elseif ($count < 0x10000) {
$result = "\x99" . pack('n', $count);
} elseif ($count < 0x100000000) {
$result = "\x9A" . pack('N', $count);
} else {
$result = "\x9B" . pack('J', $count);
}
foreach ($value as $item) {
$result .= $this->encodeValue($item);
}
return $result;
}
/**
* Encode a map (major type 5)
*
* @param array $value
* @return string
*/
private function encodeMap(array $value): string
{
$count = count($value);
if ($count < 24) {
$result = chr(0xA0 | $count);
} elseif ($count < 0x100) {
$result = "\xB8" . chr($count);
} elseif ($count < 0x10000) {
$result = "\xB9" . pack('n', $count);
} elseif ($count < 0x100000000) {
$result = "\xBA" . pack('N', $count);
} else {
$result = "\xBB" . pack('J', $count);
}
foreach ($value as $k => $v) {
if (is_int($k)) {
$result .= $this->encodeInteger($k);
} else {
$len = strlen($k);
if ($len < 24) {
$result .= chr(0x60 | $len) . $k;
} elseif ($len < 0x100) {
$result .= "\x78" . chr($len) . $k;
} else {
$result .= "\x79" . pack('n', $len) . $k;
}
}
$result .= $this->encodeValue($v);
}
return $result;
}
/**
* Create an empty map (major type 5 with 0 elements)
*
* @return string
*/
public function encodeEmptyMap(): string
{
return "\xA0";
}
/**
* Create an empty indefinite map (major type 5 indefinite length)
*
* @return string
*/
public function encodeEmptyIndefiniteMap(): string
{
return "\xBF\xFF";
}
}
@@ -0,0 +1,6 @@
<?php
namespace Aws\Api\Cbor\Exception;
use RuntimeException;
class CborException extends RuntimeException {}
-5
View File
@@ -30,11 +30,6 @@ class DateTimeResult extends \DateTime implements \JsonSerializable
throw new ParserException('Invalid timestamp value passed to DateTimeResult::fromEpoch');
}
// PHP 5.5 does not support sub-second precision
if (\PHP_VERSION_ID < 56000) {
return new self(gmdate('c', $unixTimestamp));
}
$decimalSeparator = isset(localeconv()['decimal_point']) ? localeconv()['decimal_point'] : ".";
$formatString = "U" . $decimalSeparator . "u";
$dateTime = DateTime::createFromFormat(
@@ -31,19 +31,6 @@ abstract class AbstractErrorParser
StructureShape $member
);
protected function extractPayload(
StructureShape $member,
ResponseInterface $response
) {
if ($member instanceof StructureShape) {
// Structure members parse top-level data into a specific key.
return $this->payload($response, $member);
} else {
// Streaming data is just the stream from the response body.
return $response->getBody();
}
}
protected function populateShape(
array &$data,
ResponseInterface $response,
@@ -57,16 +44,15 @@ abstract class AbstractErrorParser
if (!empty($data['code'])) {
$errors = $this->api->getOperation($command->getName())->getErrors();
foreach ($errors as $key => $error) {
foreach ($errors as $error) {
// If error code matches a known error shape, populate the body
if ($this->errorCodeMatches($data, $error)) {
$modeledError = $error;
$data['body'] = $this->extractPayload(
$modeledError,
$response
$data['body'] = $this->payload(
$response,
$error
);
$data['error_shape'] = $modeledError;
$data['error_shape'] = $error;
foreach ($error->getMembers() as $name => $member) {
switch ($member['location']) {
@@ -0,0 +1,159 @@
<?php
namespace Aws\Api\ErrorParser;
use Aws\Api\Parser\AbstractParser;
use Aws\Api\StructureShape;
use Aws\CommandInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
/**
* Base implementation for Smithy RPC V2 protocol error parsers.
*
* @internal
*/
abstract class AbstractRpcV2ErrorParser extends AbstractErrorParser
{
private const HEADER_QUERY_ERROR = 'x-amzn-query-error';
private const HEADER_ERROR_TYPE = 'x-amzn-errortype';
private const HEADER_REQUEST_ID = 'x-amzn-requestid';
/**
* @param ResponseInterface $response
* @param CommandInterface|null $command
*
* @return array
*/
public function __invoke(
ResponseInterface $response,
?CommandInterface $command = null
) {
$response = AbstractParser::getResponseWithCachingStream($response);
$data = $this->parseError($response);
if (isset($data['parsed']['__type'])) {
$data['message'] = $data['parsed']['message'] ?? null;
}
$this->populateShape($data, $response, $command);
return $data;
}
/**
* @param ResponseInterface $response
* @param StructureShape $member
*
* @return array
*/
abstract protected function payload(
ResponseInterface $response,
StructureShape $member
): array;
/**
* @param StreamInterface $body
* @param ResponseInterface $response
*
* @return mixed
*/
abstract protected function parseBody(
StreamInterface $body,
ResponseInterface $response
): mixed;
/**
* @param ResponseInterface $response
*
* @return array
*/
private function parseError(ResponseInterface $response): array
{
$statusCode = (string) $response->getStatusCode();
$errorCode = null;
$errorType = null;
if ($this->api?->getMetadata('awsQueryCompatible') !== null
&& $response->hasHeader(self::HEADER_QUERY_ERROR)
&& $awsQueryError = $this->parseQueryCompatibleHeader($response)
) {
$errorCode = $awsQueryError['code'];
$errorType = $awsQueryError['type'];
}
if (!$errorCode && $response->hasHeader(self::HEADER_ERROR_TYPE)) {
$errorCode = $this->extractErrorCode(
$response->getHeaderLine(self::HEADER_ERROR_TYPE)
);
}
$parsedBody = null;
$body = $response->getBody();
if ($body->getSize()) {
//TODO handle unseekable streams with CachingStream
$parsedBody = array_change_key_case($this->parseBody($body, $response));
}
if (!$errorCode && $parsedBody) {
$errorCode = $this->extractErrorCode(
$parsedBody['code'] ?? $parsedBody['__type'] ?? ''
);
}
return [
'request_id' => $response->getHeaderLine(self::HEADER_REQUEST_ID),
'code' => $errorCode ?: null,
'message' => null,
'type' => $errorType ?? ($statusCode[0] === '4' ? 'client' : 'server'),
'parsed' => $parsedBody,
];
}
/**
* Parse AWS Query Compatible error from header
*
* @param ResponseInterface $response
*
* @return array|null Returns ['code' => string, 'type' => string] or null
*/
private function parseQueryCompatibleHeader(ResponseInterface $response): ?array
{
$parts = explode(';', $response->getHeaderLine(self::HEADER_QUERY_ERROR));
if (count($parts) === 2 && $parts[0] && $parts[1]) {
return [
'code' => $parts[0],
'type' => $parts[1],
];
}
return null;
}
/**
* Extract error code from raw error string containing # and/or : delimiters
*
* @param string $rawErrorCode
* @return string
*/
private function extractErrorCode(string $rawErrorCode): string
{
// Handle format with both # and uri (e.g., "namespace#ErrorCode:http://foo-bar")
if (str_contains($rawErrorCode, ':') && str_contains($rawErrorCode, '#')) {
$start = strpos($rawErrorCode, '#') + 1;
$end = strpos($rawErrorCode, ':', $start);
return substr($rawErrorCode, $start, $end - $start);
}
// Handle format with uri only : (e.g., "ErrorCode:http://foo-bar.com/baz")
if (str_contains($rawErrorCode, ':')) {
return substr($rawErrorCode, 0, strpos($rawErrorCode, ':'));
}
// Handle format with only # (e.g., "namespace#ErrorCode")
if (str_contains($rawErrorCode, '#')) {
return substr($rawErrorCode, strpos($rawErrorCode, '#') + 1);
}
return $rawErrorCode;
}
}
+108 -13
View File
@@ -1,6 +1,7 @@
<?php
namespace Aws\Api\ErrorParser;
use Aws\Api\Parser\AbstractParser;
use Aws\Api\Parser\PayloadParserTrait;
use Aws\Api\StructureShape;
use Psr\Http\Message\ResponseInterface;
@@ -12,41 +13,135 @@ trait JsonParserTrait
{
use PayloadParserTrait;
private function genericHandler(ResponseInterface $response)
private function genericHandler(ResponseInterface $response): array
{
$code = (string) $response->getStatusCode();
$error_code = null;
$error_type = null;
// Parse error code and type for query compatible services
if ($this->api
&& !is_null($this->api->getMetadata('awsQueryCompatible'))
&& $response->getHeaderLine('x-amzn-query-error')
&& $response->hasHeader('x-amzn-query-error')
) {
$queryError = $response->getHeaderLine('x-amzn-query-error');
$parts = explode(';', $queryError);
if (isset($parts) && count($parts) == 2 && $parts[0] && $parts[1]) {
$error_code = $parts[0];
$error_type = $parts[1];
$awsQueryError = $this->parseAwsQueryCompatibleHeader($response);
if ($awsQueryError) {
$error_code = $awsQueryError['code'];
$error_type = $awsQueryError['type'];
}
}
// Parse error code from X-Amzn-Errortype header
if (!$error_code && $response->hasHeader('X-Amzn-Errortype')) {
$error_code = $this->extractErrorCode(
$response->getHeaderLine('X-Amzn-Errortype')
);
}
$parsedBody = null;
$rawBody = AbstractParser::getBodyContents($response);
if (!empty($rawBody)) {
$parsedBody = $this->parseJson($rawBody, $response);
}
// Parse error code from response body
if (!$error_code && $parsedBody) {
$error_code = $this->parseErrorFromBody($parsedBody);
}
if (!isset($error_type)) {
$error_type = $code[0] == '4' ? 'client' : 'server';
}
return [
'request_id' => (string) $response->getHeaderLine('x-amzn-requestid'),
'code' => isset($error_code) ? $error_code : null,
'request_id' => $response->getHeaderLine('x-amzn-requestid'),
'code' => $error_code ?? null,
'message' => null,
'type' => $error_type,
'parsed' => $this->parseJson($response->getBody(), $response)
'parsed' => $parsedBody
];
}
/**
* Parse AWS Query Compatible error from header
*
* @param ResponseInterface $response
* @return array|null Returns ['code' => string, 'type' => string] or null
*/
private function parseAwsQueryCompatibleHeader(ResponseInterface $response): ?array
{
$queryError = $response->getHeaderLine('x-amzn-query-error');
$parts = explode(';', $queryError);
if (count($parts) === 2 && $parts[0] && $parts[1]) {
return [
'code' => $parts[0],
'type' => $parts[1]
];
}
return null;
}
/**
* Parse error code from response body
*
* @param array|null $parsedBody
* @return string|null
*/
private function parseErrorFromBody(?array $parsedBody): ?string
{
if (!$parsedBody
|| (!isset($parsedBody['code']) && !isset($parsedBody['__type']))
) {
return null;
}
$error_code = $parsedBody['code'] ?? $parsedBody['__type'];
return $this->extractErrorCode($error_code);
}
/**
* Extract error code from raw error string containing # and/or : delimiters
*
* @param string $rawErrorCode
* @return string
*/
private function extractErrorCode(string $rawErrorCode): string
{
// Handle format with both # and uri (e.g., "namespace#http://foo-bar")
if (str_contains($rawErrorCode, ':') && str_contains($rawErrorCode, '#')) {
$start = strpos($rawErrorCode, '#') + 1;
$end = strpos($rawErrorCode, ':', $start);
return substr($rawErrorCode, $start, $end - $start);
}
// Handle format with uri only : (e.g., "ErrorCode:http://foo-bar.com/baz")
if (str_contains($rawErrorCode, ':')) {
return substr($rawErrorCode, 0, strpos($rawErrorCode, ':'));
}
// Handle format with only # (e.g., "namespace#ErrorCode")
if (str_contains($rawErrorCode, '#')) {
return substr($rawErrorCode, strpos($rawErrorCode, '#') + 1);
}
return $rawErrorCode;
}
protected function payload(
ResponseInterface $response,
StructureShape $member
) {
$jsonBody = $this->parseJson($response->getBody(), $response);
$rawBody = AbstractParser::getBodyContents($response);
if (!empty($rawBody)) {
$jsonBody = $this->parseJson($rawBody, $response);
} else {
$jsonBody = $rawBody;
}
if ($jsonBody) {
return $this->parser->parse($member, $jsonBody);
}
}
}
@@ -1,6 +1,7 @@
<?php
namespace Aws\Api\ErrorParser;
use Aws\Api\Parser\AbstractParser;
use Aws\Api\Parser\JsonParser;
use Aws\Api\Service;
use Aws\CommandInterface;
@@ -25,6 +26,7 @@ class JsonRpcErrorParser extends AbstractErrorParser
ResponseInterface $response,
?CommandInterface $command = null
) {
$response = AbstractParser::getResponseWithCachingStream($response);
$data = $this->genericHandler($response);
// Make the casing consistent across services.
@@ -1,6 +1,7 @@
<?php
namespace Aws\Api\ErrorParser;
use Aws\Api\Parser\AbstractParser;
use Aws\Api\Parser\JsonParser;
use Aws\Api\Service;
use Aws\Api\StructureShape;
@@ -26,11 +27,12 @@ class RestJsonErrorParser extends AbstractErrorParser
ResponseInterface $response,
?CommandInterface $command = null
) {
$response = AbstractParser::getResponseWithCachingStream($response);
$data = $this->genericHandler($response);
// Merge in error data from the JSON body
if ($json = $data['parsed']) {
$data = array_replace($data, $json);
$data = array_replace($json, $data);
}
// Correct error type from services like Amazon Glacier
@@ -38,18 +40,11 @@ class RestJsonErrorParser extends AbstractErrorParser
$data['type'] = strtolower($data['type']);
}
// Retrieve the error code from services like Amazon Elastic Transcoder
if ($code = $response->getHeaderLine('x-amzn-errortype')) {
$colon = strpos($code, ':');
$data['code'] = $colon ? substr($code, 0, $colon) : $code;
}
// Retrieve error message directly
$data['message'] = isset($data['parsed']['message'])
? $data['parsed']['message']
: (isset($data['parsed']['Message'])
? $data['parsed']['Message']
: null);
$data['message'] = $data['parsed']['message']
?? $data['parsed']['Message']
?? $data['parsed']['error_description']
?? null;
$this->populateShape($data, $response, $command);
@@ -0,0 +1,65 @@
<?php
namespace Aws\Api\ErrorParser;
use Aws\Api\Cbor\CborDecoder;
use Aws\Api\Parser\RpcV2ParserTrait;
use Aws\Api\Service;
use Aws\Api\StructureShape;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
/**
* Parses errors according to Smithy RPC V2 CBOR protocol standards.
*
* https://smithy.io/2.0/additional-specs/protocols/smithy-rpc-v2.html
*
* @internal
*/
final class RpcV2CborErrorParser extends AbstractRpcV2ErrorParser
{
/** @var CborDecoder */
private CborDecoder $decoder;
use RpcV2ParserTrait;
/**
* @param Service|null $api
*/
public function __construct(?Service $api = null)
{
$this->decoder = new CborDecoder();
parent::__construct($api);
}
/**
* @param ResponseInterface $response
* @param StructureShape $member
*
* @return array
* @throws \Exception
*/
protected function payload(
ResponseInterface $response,
StructureShape $member
): array
{
$body = $response->getBody();
$cborBody = $this->parseCbor($body, $response);
return $this->resolveOutputShape($member, $cborBody);
}
/**
* @param StreamInterface $body
* @param ResponseInterface $response
*
* @return mixed
*/
protected function parseBody(
StreamInterface $body,
ResponseInterface $response
): mixed
{
return $this->parseCbor($body, $response);
}
}
@@ -1,6 +1,7 @@
<?php
namespace Aws\Api\ErrorParser;
use Aws\Api\Parser\AbstractParser;
use Aws\Api\Parser\PayloadParserTrait;
use Aws\Api\Parser\XmlParser;
use Aws\Api\Service;
@@ -27,6 +28,7 @@ class XmlErrorParser extends AbstractErrorParser
ResponseInterface $response,
?CommandInterface $command = null
) {
$response = AbstractParser::getResponseWithCachingStream($response);
$code = (string) $response->getStatusCode();
$data = [
@@ -37,9 +39,9 @@ class XmlErrorParser extends AbstractErrorParser
'parsed' => null
];
$body = $response->getBody();
if ($body->getSize() > 0) {
$this->parseBody($this->parseXml($body, $response), $data);
$rawBody = AbstractParser::getBodyContents($response);
if (!empty($rawBody)) {
$this->parseBody($this->parseXml($rawBody, $response), $data);
} else {
$this->parseHeaders($response, $data);
}
@@ -100,12 +102,20 @@ class XmlErrorParser extends AbstractErrorParser
ResponseInterface $response,
StructureShape $member
) {
$xmlBody = $this->parseXml($response->getBody(), $response);
$rawBody = AbstractParser::getBodyContents($response);
if (empty($rawBody)) {
return $rawBody;
}
$xmlBody = $this->parseXml($rawBody, $response);
$prefix = $this->registerNamespacePrefix($xmlBody);
$errorBody = $xmlBody->xpath("//{$prefix}Error");
if (is_array($errorBody) && !empty($errorBody[0])) {
return $this->parser->parse($member, $errorBody[0]);
}
return $rawBody;
}
}
@@ -0,0 +1,11 @@
<?php
namespace Aws\Api\Exception;
use Aws\HasMonitoringEventsTrait;
use Aws\MonitoringEventsInterface;
class RpcV2CborException extends \RuntimeException implements
MonitoringEventsInterface
{
use HasMonitoringEventsTrait;
}
+1 -1
View File
@@ -89,7 +89,7 @@ class Operation extends AbstractModel
/**
* Get an array of operation error shapes.
*
* @return Shape[]
* @return StructureShape[]
*/
public function getErrors()
{
@@ -5,6 +5,7 @@ use Aws\Api\Service;
use Aws\Api\StructureShape;
use Aws\CommandInterface;
use Aws\ResultInterface;
use GuzzleHttp\Psr7\CachingStream;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
@@ -43,4 +44,27 @@ abstract class AbstractParser
StructureShape $member,
$response
);
public static function getBodyContents(ResponseInterface $response): string
{
$body = $response->getBody();
if ($body->isSeekable()) {
$body->rewind();
}
return $body->getContents();
}
public static function getResponseWithCachingStream(
ResponseInterface $response
): ResponseInterface
{
if (!$response->getBody()->isSeekable()) {
return $response->withBody(
new CachingStream($response->getBody())
);
}
return $response;
}
}
+65 -15
View File
@@ -39,6 +39,21 @@ abstract class AbstractRestParser extends AbstractParser
if ($payload = $output['payload']) {
$this->extractPayload($payload, $output, $response, $result);
} else {
$response = AbstractParser::getResponseWithCachingStream($response);
if ($response->getBody()->getSize() === null) {
$rawBody = AbstractParser::getBodyContents($response);
$isEmpty = empty($rawBody);
} else {
$isEmpty = $response->getBody()->getSize() === 0;
}
if (!$isEmpty && count($output->getMembers()) > 0
) {
// if no payload was found, then parse the contents of the body
$this->payload($response, $output, $result);
}
}
foreach ($output->getMembers() as $name => $member) {
@@ -55,14 +70,6 @@ abstract class AbstractRestParser extends AbstractParser
}
}
if (!$payload
&& $response->getBody()->getSize() > 0
&& count($output->getMembers()) > 0
) {
// if no payload was found, then parse the contents of the body
$this->payload($response, $output, $result);
}
return new Result($result);
}
@@ -73,20 +80,38 @@ abstract class AbstractRestParser extends AbstractParser
array &$result
) {
$member = $output->getMember($payload);
$body = $response->getBody();
if (!empty($member['eventstream'])) {
$result[$payload] = new EventParsingIterator(
$response->getBody(),
$body,
$member,
$this
);
} else if ($member instanceof StructureShape) {
// Structure members parse top-level data into a specific key.
return;
}
$response = AbstractParser::getResponseWithCachingStream($response);
if ($member instanceof StructureShape) {
//Unions must have at least one member set to a non-null value
// If the body is empty, we can assume it is unset
if ($response->getBody()->getSize() === null) {
$rawBody = AbstractParser::getBodyContents($response);
$isEmpty = empty($rawBody);
} else {
$isEmpty = $response->getBody()->getSize() === 0;
}
if (!empty($member['union']) && $isEmpty) {
return;
}
$result[$payload] = [];
$this->payload($response, $member, $result[$payload]);
} else {
// Streaming data is just the stream from the response body.
$result[$payload] = $response->getBody();
// Always set the payload to the body stream, regardless of content
$result[$payload] = $body;
}
}
@@ -100,13 +125,21 @@ abstract class AbstractRestParser extends AbstractParser
&$result
) {
$value = $response->getHeaderLine($shape['locationName'] ?: $name);
// Empty headers should not be deserialized
if ($value === null || $value === '') {
return;
}
switch ($shape->getType()) {
case 'float':
case 'double':
$value = (float) $value;
$value = match ($value) {
'NaN', 'Infinity', '-Infinity' => $value,
default => (float) $value
};
break;
case 'long':
case 'integer':
$value = (int) $value;
break;
case 'boolean':
@@ -143,6 +176,23 @@ abstract class AbstractRestParser extends AbstractParser
//output structure.
return;
}
case 'list':
$listMember = $shape->getMember();
$type = $listMember->getType();
// Only boolean lists require special handling
// other types can be returned as-is
if ($type !== 'boolean') {
break;
}
$items = array_map('trim', explode(',', $value));
$value = array_map(
static fn($item) => filter_var($item, FILTER_VALIDATE_BOOLEAN),
$items
);
break;
}
$result[$name] = $value;
@@ -0,0 +1,83 @@
<?php
namespace Aws\Api\Parser;
use Aws\Api\Operation;
use Aws\Api\Parser\Exception\ParserException;
use Aws\Result;
use Aws\CommandInterface;
use Psr\Http\Message\ResponseInterface;
/**
* Base implementation for Smithy RPC V2 protocol parsers.
*
* Implementers MUST define the following static property representing
* the `Smithy-Protocol` header value:
* self::HEADER_SMITHY_PROTOCOL => static::$smithyProtocol
*
* @internal
*/
abstract class AbstractRpcV2Parser extends AbstractParser
{
private const HEADER_SMITHY_PROTOCOL = 'Smithy-Protocol';
/** @var string */
protected static string $smithyProtocol;
public function __invoke(
CommandInterface $command,
ResponseInterface $response
) {
$operation = $this->api->getOperation($command->getName());
return $this->parseResponse($response, $operation);
}
/**
* Parses a response according to Smithy RPC V2 protocol standards.
*
* @param ResponseInterface $response the response to parse.
* @param Operation $operation the operation which holds information for
* parsing the response.
*
* @return Result
*/
private function parseResponse(
ResponseInterface $response,
Operation $operation
): Result
{
$smithyProtocolHeader = $response->getHeaderLine(self::HEADER_SMITHY_PROTOCOL);
if ($smithyProtocolHeader !== static::$smithyProtocol) {
$statusCode = $response->getStatusCode();
throw new ParserException(
"Malformed response: Smithy-Protocol header mismatch (HTTP {$statusCode}). "
. 'Expected ' . static::$smithyProtocol
);
}
if ($operation['output'] === null) {
return new Result([]);
}
$outputShape = $operation->getOutput();
foreach ($outputShape->getMembers() as $memberName => $memberProps) {
if (!empty($memberProps['eventstream'])) {
return new Result([
$memberName => new EventParsingIterator(
$response->getBody(),
$outputShape->getMember($memberName),
$this
)
]);
}
}
$result = $this->parseMemberFromStream(
$response->getBody(),
$outputShape,
$response
);
return new Result(is_null($result) ? [] : $result);
}
}
+3
View File
@@ -50,8 +50,11 @@ class JsonParser
$values = $shape->getValue();
$target = [];
foreach ($value as $k => $v) {
// null map values should not be deserialized
if (!is_null($v)) {
$target[$k] = $this->parse($values, $v);
}
}
return $target;
case 'timestamp':
+6 -1
View File
@@ -63,8 +63,13 @@ class JsonRpcParser extends AbstractParser
}
}
$body = $response->getBody();
if ($body->isSeekable()) {
$body->rewind();
}
$result = $this->parseMemberFromStream(
$response->getBody(),
$body,
$operation->getOutput(),
$response
);
@@ -17,6 +17,10 @@ trait MetadataParserTrait
&$result
) {
$value = $response->getHeaderLine($shape['locationName'] ?: $name);
// Empty values should not be deserialized
if ($value === null || $value === '') {
return;
}
switch ($shape->getType()) {
case 'float':
@@ -24,6 +28,7 @@ trait MetadataParserTrait
$value = (float) $value;
break;
case 'long':
case 'integer':
$value = (int) $value;
break;
case 'boolean':
@@ -64,10 +64,21 @@ class NonSeekableStreamDecodingEventStreamIterator extends DecodingEventStreamIt
while (!empty($this->tempBuffer) && $num > 0) {
$byte = array_shift($this->tempBuffer);
$bytes .= $byte;
$num = $num - 1;
$num -= 1;
}
// Loop until we've read the expected number of bytes
while ($num > 0 && !$this->stream->eof()) {
$chunk = $this->stream->read($num);
$chunkLen = strlen($chunk);
$bytes .= $chunk;
$num -= $chunkLen;
if ($chunkLen === 0) {
break; // Prevent infinite loop on unexpected EOF
}
}
$bytes = $bytes . $this->stream->read($num);
hash_update($this->hashContext, $bytes);
return $bytes;
@@ -2,7 +2,6 @@
namespace Aws\Api\Parser;
use Aws\Api\Parser\Exception\ParserException;
use Psr\Http\Message\ResponseInterface;
trait PayloadParserTrait
{
+11 -1
View File
@@ -40,7 +40,17 @@ class QueryParser extends AbstractParser
ResponseInterface $response
) {
$output = $this->api->getOperation($command->getName())->getOutput();
$xml = $this->parseXml($response->getBody(), $response);
// Read the full payload, even in non-seekable streams
$rawBody = AbstractParser::getBodyContents($response);
// Just parse when the body is not empty
$xml = !empty($rawBody)
? $this->parseXml($rawBody, $response)
: null;
// Empty request bodies should not be deserialized.
if (is_null($xml)) {
return new Result();
}
if ($this->honorResultWrapper && $output['resultWrapper']) {
$xml = $xml->{$output['resultWrapper']};
+17 -3
View File
@@ -28,10 +28,24 @@ class RestJsonParser extends AbstractRestParser
StructureShape $member,
array &$result
) {
$jsonBody = $this->parseJson($response->getBody(), $response);
$rawBody = AbstractParser::getBodyContents($response);
if ($jsonBody) {
$result += $this->parser->parse($member, $jsonBody);
// Parse JSON if we have content
if (!empty($rawBody)) {
$parsedJson = $this->parseJson($rawBody, $response);
} else {
// An empty response body should be deserialized as null
$result = null;
return;
}
$parsedBody = $this->parser->parse($member, $parsedJson);
if (is_string($parsedBody) && $member['document']) {
// Document types can be strings: replace entire result
$result = $parsedBody;
} else {
// Merge array/object results into existing result
$result = array_merge($result, (array) $parsedBody);
}
}
+6 -1
View File
@@ -28,7 +28,12 @@ class RestXmlParser extends AbstractRestParser
StructureShape $member,
array &$result
) {
$result += $this->parseMemberFromStream($response->getBody(), $member, $response);
$body = $response->getBody();
if ($body->isSeekable()) {
$body->rewind();
}
$result += $this->parseMemberFromStream($body, $member, $response);
}
public function parseMemberFromStream(
@@ -0,0 +1,50 @@
<?php
namespace Aws\Api\Parser;
use Aws\Api\Cbor\CborDecoder;
use Aws\Api\Service;
use Aws\Api\StructureShape;
use Psr\Http\Message\StreamInterface;
/**
* Parses responses according to Smithy RPC V2 CBOR protocol standards.
*
* https://smithy.io/2.0/additional-specs/protocols/smithy-rpc-v2.html
*
* @internal
*/
final class RpcV2CborParser extends AbstractRpcV2Parser
{
/** @var string */
protected static string $smithyProtocol = 'rpc-v2-cbor';
/** @var CborDecoder */
private CborDecoder $decoder;
use RpcV2ParserTrait;
/**
* @param Service $api Service description
*/
public function __construct(Service $api)
{
$this->decoder = new CborDecoder();
parent::__construct($api);
}
/**
* @param StreamInterface $stream
* @param StructureShape $member
* @param $response
*
* @return mixed
*/
public function parseMemberFromStream(
StreamInterface $stream,
StructureShape $member,
$response
): mixed
{
return $this->resolveOutputShape($member, $this->parseCbor($stream, $response));
}
}
@@ -0,0 +1,105 @@
<?php
namespace Aws\Api\Parser;
use Aws\Api\Cbor\Exception\CborException;
use Aws\Api\DateTimeResult;
use Aws\Api\Parser\Exception\ParserException;
use Aws\Api\Shape;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
/**
* Shared parsing logic for RPC V2 Parsers.
*
* @internal
*/
trait RpcV2ParserTrait
{
/**
* Resolves output shape fields that are present in the response
*
* @param Shape $shape
* @param mixed $value
*
* @return mixed
*/
protected function resolveOutputShape(Shape $shape, mixed $value): mixed
{
if ($value === null) {
return $value;
}
switch ($shape['type']) {
case 'structure':
$target = [];
foreach ($shape->getMembers() as $name => $member) {
$locationName = $member['locationName'] ?: $name;
if (isset($value[$locationName])) {
$target[$name] = $this->resolveOutputShape($member, $value[$locationName]);
}
}
return $target;
case 'list':
$target = [];
foreach ($value as $v) {
$target[] = $this->resolveOutputShape($shape->getMember(), $v);
}
return $target;
case 'map':
$target = [];
foreach ($value as $k => $v) {
if ($v !== null) {
$target[$k] = $this->resolveOutputShape($shape->getValue(), $v);
}
}
return $target;
case 'timestamp':
try {
$value = DateTimeResult::fromEpoch($value);
} catch (\Exception $e) {
trigger_error(
'Unable to parse timestamp value for '
. $shape->getName()
. ': ' . $e->getMessage(),
E_USER_WARNING
);
}
return $value;
default:
return $value;
}
}
/**
* Parses CBOR-encoded response data from RPC V2 CBOR services.
*
* @param StreamInterface $stream
* @param ResponseInterface $response
*
* @return mixed
*/
protected function parseCbor(
StreamInterface $stream,
ResponseInterface $response
): mixed
{
try {
$cborString = (string) $stream;
return empty($cborString)
? null
: $this->decoder->decode($cborString);
} catch (CborException $e) {
throw new ParserException(
"Malformed Response: error parsing CBOR: {$e->getMessage()}",
0,
$e,
['response' => $response]
);
}
}
}
+18 -14
View File
@@ -76,16 +76,19 @@ class XmlParser
private function memberKey(Shape $shape, $name)
{
if (null !== $shape['locationName']) {
return $shape['locationName'];
}
if ($shape instanceof ListShape && $shape['flattened']) {
return $shape->getMember()['locationName'] ?: $name;
}
// Check if locationName came from shape definition
if ($shape instanceof StructureShape && isset($shape['locationName'])) {
$originalDef = $shape->getOriginalDefinition($shape->getName());
if ($originalDef && isset($originalDef['locationName'])
&& $originalDef['locationName'] === $shape['locationName']
) {
return $name;
}
}
return $shape['locationName'] ?? $name;
}
private function parse_list(ListShape $shape, \SimpleXMLElement $value)
{
@@ -132,7 +135,12 @@ class XmlParser
private function parse_float(Shape $shape, $value)
{
return (float) (string) $value;
$value = (string) $value;
return match ($value) {
'NaN', 'Infinity', '-Infinity' => $value,
default => (float) $value
};
}
private function parse_integer(Shape $shape, $value)
@@ -162,12 +170,8 @@ class XmlParser
private function parse_xml_attribute(Shape $shape, Shape $memberShape, $value)
{
$namespace = $shape['xmlNamespace']['uri']
? $shape['xmlNamespace']['uri']
: '';
$prefix = $shape['xmlNamespace']['prefix']
? $shape['xmlNamespace']['prefix']
: '';
$namespace = $shape['xmlNamespace']['uri'] ?? '';
$prefix = $shape['xmlNamespace']['prefix'] ?? '';
if (!empty($prefix)) {
$prefix .= ':';
}
@@ -0,0 +1,220 @@
<?php
namespace Aws\Api\Serializer;
use Aws\Api\Service;
use Aws\Api\Shape;
use Aws\Api\StructureShape;
use Aws\CommandInterface;
use Aws\EndpointV2\EndpointV2SerializerTrait;
use Aws\EndpointV2\Ruleset\RulesetEndpoint;
use DateTimeInterface;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Uri;
use Psr\Http\Message\RequestInterface;
/**
* Base implementation for Smithy RPC V2 protocol serializers.
*
* Implementers MUST override the defaultHeader property to represent
* protocol-specific default header values:
* self::HEADER_SMITHY_PROTOCOL => static::SMITHY_PROTOCOL,
* self::HEADER_CONTENT_TYPE => static::DEFAULT_CONTENT_TYPE,
* self::HEADER_ACCEPT => static::DEFAULT_ACCEPT
*
* Implementers must also implement `serialize()`, `resolveBlob()`, and `resolveTimestamp()
* according to their respective protocol specifications.
*
* @internal
*/
abstract class AbstractRpcV2Serializer
{
protected const HEADER_SMITHY_PROTOCOL = 'Smithy-Protocol';
protected const HEADER_CONTENT_TYPE = 'Content-Type';
protected const HEADER_ACCEPT = 'Accept';
/** @var array */
protected static array $defaultHeaders;
/** @var Service */
private Service $api;
/** @var string|Uri */
private string|Uri $endpoint;
/** @var bool */
private bool $isUseEndpointV2;
use EndpointV2SerializerTrait;
/**
* @param Service $api Service API description
* @param string $endpoint Endpoint to connect to
*/
public function __construct(Service $api, string|Uri $endpoint)
{
$this->api = $api;
$this->endpoint = Psr7\Utils::uriFor($endpoint);
}
/**
* @param CommandInterface $command Command to serialize into a request.
* @param mixed|null $endpoint
*
* @return RequestInterface
*/
public function __invoke(
CommandInterface $command,
mixed $endpoint = null
)
{
$commandArgs = $command->toArray();
$commandName = $command->getName();
$operation = $this->api->getOperation($commandName);
$headers = static::$defaultHeaders;
// Operations with no defined input type must not contain bodies
// Content-Type must not be set
if ($operation['input'] !== null) {
$body = $this->serialize($operation->getInput(), $commandArgs);
$headers['Content-Length'] = (string) strlen($body);
} else {
unset($headers['Content-Type']);
}
if ($endpoint instanceof RulesetEndpoint) {
$this->isUseEndpointV2 = true;
$this->setEndpointV2RequestOptions($endpoint, $headers);
$this->endpoint = $endpoint->getUrl();
}
$requestTarget = $this->buildRequestTarget(
$commandName,
$operation['http']['requestUri'] ?? ''
);
$uri = new Uri($this->endpoint . $requestTarget);
return new Request(
$operation['http']['method'],
$uri,
$headers,
$body ?? null
);
}
/**
* @param StructureShape $inputShape
* @param array $commandArgs
*
* @return string
*/
abstract public function serialize(
StructureShape $inputShape,
array $commandArgs
): string;
/**
* Resolves arguments for blob shapes present in the request arguments
* into a protocol-specific format.
*
* @param mixed $value
*
* @return array
*/
abstract protected function resolveBlob(mixed $value): array;
/**
* Resolves arguments for timestamp shapes present in the request arguments
* into a protocol-specific format.
*
* @param mixed $value
*
* @return array
*/
abstract protected function resolveTimestamp(
int|float|string|DateTimeInterface $value
): array;
/**
* Resolves input shape fields that are present in the request arguments
*
* @param Shape $shape
* @param mixed $value
*
* @return mixed
*/
protected function resolveInputShape(Shape $shape, mixed $value): mixed
{
switch ($shape->getType()) {
case 'structure':
$data = [];
foreach ($value as $k => $v) {
if ($v !== null && $shape->hasMember($k)) {
$valueShape = $shape->getMember($k);
$data[$valueShape['locationName'] ?: $k]
= $this->resolveInputShape($valueShape, $v);
}
}
return $data;
case 'list':
$items = $shape->getMember();
foreach ($value as $k => $v) {
$value[$k] = $this->resolveInputShape($items, $v);
}
return $value;
case 'map':
$values = $shape->getValue();
foreach ($value as $k => $v) {
$value[$k] = $this->resolveInputShape($values, $v);
}
return $value;
case 'timestamp':
return $this->resolveTimestamp($value);
case 'string':
return (string) $value;
case 'integer':
case 'long':
return (int) $value;
case 'double':
case 'float':
return (float) $value;
case 'blob':
return $this->resolveBlob($value);
default:
return $value;
}
}
/**
* Builds request URI absolute path
*
* @param string $commandName
* @param string $requestUri
*
* @return string
*/
private function buildRequestTarget(
string $commandName,
string $requestUri
): string
{
$requestUri = str_ends_with($requestUri, '/')
? $requestUri
: $requestUri . '/';
$targetPrefix = $this->api->getMetadata('targetPrefix');
return "{$requestUri}service/{$targetPrefix}/operation/{$commandName}";
}
}
+13 -5
View File
@@ -45,14 +45,22 @@ class JsonBody
* Builds the JSON body based on an array of arguments.
*
* @param Shape $shape Operation being constructed
* @param array $args Associative array of arguments
* @param array|string $args Associative array of arguments, or a string.
*
* @return string
*/
public function build(Shape $shape, array $args)
public function build(Shape $shape, array|string $args)
{
$result = json_encode($this->format($shape, $args));
return $result == '[]' ? '{}' : $result;
try {
$result = json_encode($this->format($shape, $args), JSON_THROW_ON_ERROR);
} catch (\JsonException $e) {
throw new InvalidJsonException(
'Unable to encode JSON document ' . $shape->getName() . ': ' .
$e->getMessage() . PHP_EOL
);
}
return $result === '[]' ? '{}' : $result;
}
private function format(Shape $shape, $value)
@@ -60,7 +68,7 @@ class JsonBody
switch ($shape['type']) {
case 'structure':
$data = [];
if (isset($shape['document']) && $shape['document']) {
if ($shape['document'] ?? false) {
return $value;
}
foreach ($value as $k => $v) {
@@ -62,23 +62,26 @@ class JsonRpcSerializer
$operationName = $command->getName();
$operation = $this->api->getOperation($operationName);
$commandArgs = $command->toArray();
$body = $this->jsonFormatter->build($operation->getInput(), $commandArgs);
$headers = [
'X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $operationName,
'Content-Type' => $this->contentType
'Content-Type' => $this->contentType,
'Content-Length' => (string) strlen($body)
];
if ($endpoint instanceof RulesetEndpoint) {
$this->setEndpointV2RequestOptions($endpoint, $headers);
}
$requestUri = $operation['http']['requestUri'] ?? null;
$absoluteUri = str_ends_with($this->endpoint, '/')
? $this->endpoint : $this->endpoint . $requestUri;
return new Request(
$operation['http']['method'],
$this->endpoint,
$absoluteUri,
$headers,
$this->jsonFormatter->build(
$operation->getInput(),
$commandArgs
)
$body
);
}
}
@@ -98,7 +98,8 @@ class QueryParamBuilder
if (!$this->isFlat($shape)) {
$locationName = $shape->getMember()['locationName'] ?: 'member';
$prefix .= ".$locationName";
} elseif ($name = $this->queryName($items)) {
// flattened lists can also model a `locationName`
} elseif ($name = $shape['locationName'] ?? $this->queryName($items)) {
$parts = explode('.', $prefix);
$parts[count($parts) - 1] = $name;
$prefix = implode('.', $parts);
@@ -36,9 +36,7 @@ class QuerySerializer
* containing "method", "uri", "headers", and "body" key value pairs.
*
* @param CommandInterface $command Command to serialize into a request.
* @param $endpointProvider Provider used for dynamic endpoint resolution.
* @param $clientArgs Client arguments used for dynamic endpoint resolution.
*
* @param null $endpoint Endpoint resolved using EndpointProviderV2
* @return RequestInterface
*/
public function __invoke(
@@ -63,17 +61,20 @@ class QuerySerializer
}
$body = http_build_query($body, '', '&', PHP_QUERY_RFC3986);
$headers = [
'Content-Length' => strlen($body),
'Content-Length' => (string) strlen($body),
'Content-Type' => 'application/x-www-form-urlencoded'
];
$requestUri = $operation['http']['requestUri'] ?? null;
if ($endpoint instanceof RulesetEndpoint) {
$this->setEndpointV2RequestOptions($endpoint, $headers);
}
$absoluteUri = str_ends_with($this->endpoint, '/')
? $this->endpoint : $this->endpoint . $requestUri;
return new Request(
'POST',
$this->endpoint,
$absoluteUri,
$headers,
$body
);
@@ -31,12 +31,11 @@ class RestJsonSerializer extends RestSerializer
$this->jsonFormatter = $jsonFormatter ?: new JsonBody($api);
}
protected function payload(StructureShape $member, array $value, array &$opts)
protected function payload(StructureShape $member, array|string $value, array &$opts)
{
$body = isset($value) ?
((string) $this->jsonFormatter->build($member, $value))
: "{}";
$opts['headers']['Content-Type'] = $this->contentType;
$body = $this->jsonFormatter->build($member, $value);
$opts['headers']['Content-Length'] = (string) strlen($body);
$opts['body'] = $body;
}
}
+308 -98
View File
@@ -1,6 +1,7 @@
<?php
namespace Aws\Api\Serializer;
use Aws\Api\ListShape;
use Aws\Api\MapShape;
use Aws\Api\Service;
use Aws\Api\Operation;
@@ -10,11 +11,13 @@ use Aws\Api\TimestampShape;
use Aws\CommandInterface;
use Aws\EndpointV2\EndpointV2SerializerTrait;
use Aws\EndpointV2\Ruleset\RulesetEndpoint;
use DateTimeInterface;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Uri;
use GuzzleHttp\Psr7\UriResolver;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\UriInterface;
/**
* Serializes HTTP locations like header, uri, payload, etc...
@@ -22,10 +25,15 @@ use Psr\Http\Message\RequestInterface;
*/
abstract class RestSerializer
{
use EndpointV2SerializerTrait;
private const TEMPLATE_STRING_REGEX = '/\{([^\}]+)\}/';
private static array $excludeContentType = [
's3' => true,
'glacier' => true
];
/** @var Service */
private $api;
private Service $api;
/** @var Uri */
private $endpoint;
@@ -33,6 +41,8 @@ abstract class RestSerializer
/** @var bool */
private $isUseEndpointV2;
use EndpointV2SerializerTrait;
/**
* @param Service $api Service API description
* @param string $endpoint Endpoint to connect to
@@ -45,19 +55,18 @@ abstract class RestSerializer
/**
* @param CommandInterface $command Command to serialize into a request.
* @param $clientArgs Client arguments used for dynamic endpoint resolution.
*
* @param mixed|null $endpoint
* @return RequestInterface
*/
public function __invoke(
CommandInterface $command,
$endpoint = null
mixed $endpoint = null
)
{
$operation = $this->api->getOperation($command->getName());
$commandArgs = $command->toArray();
$opts = $this->serialize($operation, $commandArgs);
$headers = isset($opts['headers']) ? $opts['headers'] : [];
$headers = $opts['headers'] ?? [];
if ($endpoint instanceof RulesetEndpoint) {
$this->isUseEndpointV2 = true;
@@ -70,7 +79,7 @@ abstract class RestSerializer
$operation['http']['method'],
$uri,
$headers,
isset($opts['body']) ? $opts['body'] : null
$opts['body'] ?? null
);
}
@@ -103,20 +112,20 @@ abstract class RestSerializer
$location = $member['location'];
if (!$payload && !$location) {
$bodyMembers[$name] = $value;
} elseif ($location == 'header') {
} elseif ($location === 'header') {
$this->applyHeader($name, $member, $value, $opts);
} elseif ($location == 'querystring') {
} elseif ($location === 'querystring') {
$this->applyQuery($name, $member, $value, $opts);
} elseif ($location == 'headers') {
} elseif ($location === 'headers') {
$this->applyHeaderMap($name, $member, $value, $opts);
}
}
}
if (isset($bodyMembers)) {
$this->payload($operation->getInput(), $bodyMembers, $opts);
$this->payload($input, $bodyMembers, $opts);
} else if (!isset($opts['body']) && $this->hasPayloadParam($input, $payload)) {
$this->payload($operation->getInput(), [], $opts);
$this->payload($input, [], $opts);
}
return $opts;
@@ -130,12 +139,38 @@ abstract class RestSerializer
$m = $input->getMember($name);
$type = $m->getType();
if ($m['streaming'] ||
($m['type'] == 'string' || $m['type'] == 'blob')
($type === 'string' || $type === 'blob')
) {
// This path skips setting the content-type header usually done in
// RestJsonSerializer and RestXmlSerializer.certain S3 and glacier
// operations determine content type in Middleware::ContentType()
if (!isset(self::$excludeContentType[$this->api->getServiceName() ?? ''])) {
switch ($type) {
case 'string':
$opts['headers']['Content-Type'] = 'text/plain';
break;
case 'blob':
$opts['headers']['Content-Type'] = 'application/octet-stream';
break;
}
}
$body = $args[$name];
if (!$m['streaming'] && is_string($body)) {
$opts['headers']['Content-Length'] = (string) strlen($body);
}
// Streaming bodies or payloads that are strings are
// always just a stream of data.
$opts['body'] = Psr7\Utils::streamFor($args[$name]);
$stream = Psr7\Utils::streamFor($body);
// User-owned resource which should be detached instead of closed
// during garbage-collection
if (is_resource($body)) {
$stream = \Aws\detach_on_close_stream($stream);
}
$opts['body'] = $stream;
return;
}
@@ -144,13 +179,45 @@ abstract class RestSerializer
private function applyHeader($name, Shape $member, $value, array &$opts)
{
if ($member->getType() === 'timestamp') {
$timestampFormat = !empty($member['timestampFormat'])
? $member['timestampFormat']
: 'rfc822';
$value = TimestampShape::format($value, $timestampFormat);
} elseif ($member->getType() === 'boolean') {
$value = $value ? 'true' : 'false';
if ($value === null) {
return;
}
// Handle lists by applying header logic to each element
if ($member instanceof ListShape) {
if (!is_array($value)) {
throw new \InvalidArgumentException('Header values must be scalar or an array of scalars.');
}
$listMember = $member->getMember();
$headerValues = [];
foreach ($value as $listValue) {
if ($listValue === null) {
throw new \InvalidArgumentException('Header values must be scalar or an array of scalars.');
}
$tempOpts = ['headers' => []];
$this->applyHeader('temp', $listMember, $listValue, $tempOpts);
if (!array_key_exists('temp', $tempOpts['headers'])) {
throw new \InvalidArgumentException('Header values must be scalar or an array of scalars.');
}
$convertedValue = $tempOpts['headers']['temp'];
$headerValues[] = $convertedValue;
}
$value = $headerValues;
} else {
switch ($member->getType()) {
case 'timestamp':
$timestampFormat = $member['timestampFormat'] ?? 'rfc822';
$value = $this->formatTimestamp($value, $timestampFormat);
break;
case 'boolean':
$value = $this->formatBoolean($value);
break;
}
}
if ($member['jsonvalue']) {
@@ -163,7 +230,7 @@ abstract class RestSerializer
$value = base64_encode($value);
}
$opts['headers'][$member['locationName'] ?: $name] = $value;
$opts['headers'][$member['locationName'] ?: $name] = self::prepareHeaderValue($value);
}
/**
@@ -173,8 +240,40 @@ abstract class RestSerializer
{
$prefix = $member['locationName'];
foreach ($value as $k => $v) {
$opts['headers'][$prefix . $k] = $v;
if ($v === null) {
continue;
}
$opts['headers'][$prefix . $k] = self::prepareHeaderValue($v);
}
}
/**
* @return string|string[]
*/
private static function prepareHeaderValue($value)
{
if (is_scalar($value)) {
return (string) $value;
}
if (is_array($value)) {
if ($value === []) {
return '';
}
foreach ($value as $key => $item) {
if (!is_scalar($item)) {
throw new \InvalidArgumentException('Header values must be scalar or an array of scalars.');
}
$value[$key] = (string) $item;
}
return $value;
}
throw new \InvalidArgumentException('Header values must be scalar or an array of scalars.');
}
private function applyQuery($name, Shape $member, $value, array &$opts)
@@ -183,148 +282,259 @@ abstract class RestSerializer
$opts['query'] = isset($opts['query']) && is_array($opts['query'])
? $opts['query'] + $value
: $value;
} elseif ($value !== null) {
$type = $member->getType();
if ($type === 'boolean') {
$value = $value ? 'true' : 'false';
} elseif ($type === 'timestamp') {
$timestampFormat = !empty($member['timestampFormat'])
? $member['timestampFormat']
: 'iso8601';
$value = TimestampShape::format($value, $timestampFormat);
} elseif ($member instanceof ListShape) {
$listMember = $member->getMember();
$paramName = $member['locationName'] ?: $name;
foreach ($value as $listValue) {
// Recursively call applyQuery for each list element
$tempOpts = ['query' => []];
$this->applyQuery('temp', $listMember, $listValue, $tempOpts);
$opts['query'][$paramName][] = $tempOpts['query']['temp'];
}
} elseif (!is_null($value)) {
switch ($member->getType()) {
case 'timestamp':
$timestampFormat = $member['timestampFormat'] ?? 'iso8601';
$value = $this->formatTimestamp($value, $timestampFormat);
break;
case 'boolean':
$value = $this->formatBoolean($value);
break;
}
$opts['query'][$member['locationName'] ?: $name] = $value;
}
}
private function buildEndpoint(Operation $operation, array $args, array $opts)
private function buildEndpoint(
Operation $operation,
array $args,
array $opts
): UriInterface
{
// Expand `requestUri` field members
$relativeUri = $this->expandUriTemplate($operation, $args);
// Add query members to relativeUri
if (!empty($opts['query'])) {
$relativeUri = $this->appendQuery($opts['query'], $relativeUri);
}
// Special case - S3 keys that need path preservation
if ($this->api->getServiceName() === 's3'
&& isset($args['Key'])
&& $this->shouldPreservePath($args['Key'])
) {
return new Uri($this->endpoint . $relativeUri);
}
return $this->resolveUri($relativeUri, $opts);
}
/**
* Expands `requestUri` members
*
* @param Operation $operation
* @param array $args
*
* @return string
*/
private function expandUriTemplate(Operation $operation, array $args): string
{
$serviceName = $this->api->getServiceName();
// Create an associative array of variable definitions used in expansions
$varDefinitions = $this->getVarDefinitions($operation, $args);
$relative = preg_replace_callback(
'/\{([^\}]+)\}/',
function (array $matches) use ($varDefinitions) {
$isGreedy = substr($matches[1], -1, 1) == '+';
$k = $isGreedy ? substr($matches[1], 0, -1) : $matches[1];
if (!isset($varDefinitions[$k])) {
return preg_replace_callback(
self::TEMPLATE_STRING_REGEX,
static function (array $matches) use ($varDefinitions) {
$isGreedy = str_ends_with($matches[1], '+');
$varName = $isGreedy ? substr($matches[1], 0, -1) : $matches[1];
if (!isset($varDefinitions[$varName])) {
return '';
}
$value = $varDefinitions[$varName];
if ($isGreedy) {
return str_replace('%2F', '/', rawurlencode($varDefinitions[$k]));
return str_replace('%2F', '/', rawurlencode($value));
}
return rawurlencode($varDefinitions[$k]);
return rawurlencode($value);
},
$operation['http']['requestUri']
);
// Add the query string variables or appending to one if needed.
if (!empty($opts['query'])) {
$relative = $this->appendQuery($opts['query'], $relative);
}
$path = $this->endpoint->getPath();
if ($this->isUseEndpointV2 && $serviceName === 's3') {
if (substr($path, -1) === '/' && $relative[0] === '/') {
$path = rtrim($path, '/');
/**
* Checks for path-like key names. If detected, traditional
* URI resolution is bypassed.
*
* @param string $key
* @return bool
*/
private function shouldPreservePath(string $key): bool
{
// Keys with dot segments
if (str_contains($key, '.')) {
$segments = explode('/', $key);
foreach ($segments as $segment) {
if ($segment === '.' || $segment === '..') {
return true;
}
}
}
$relative = $path . $relative;
if (strpos($relative, '../') !== false
|| substr($relative, -2) === '..'
// Keys starting with slash
if (str_starts_with($key, '/')) {
return true;
}
return false;
}
/**
* @param string $relativeUri
* @param array $opts
*
* @return UriInterface
*/
private function resolveUri(string $relativeUri, array $opts): UriInterface
{
$basePath = $this->endpoint->getPath();
// Only process if we have a non-empty base path
if (!empty($basePath) && $basePath !== '/') {
// if relative is just '/', we want just the base path without trailing slash
if ($relativeUri === '/' || empty($relativeUri)) {
// Remove trailing slash if present
return $this->endpoint->withPath(rtrim($basePath, '/'));
}
// if relative is '/?query', we want base path without trailing slash + query
// for now, this is only seen with S3 GetBucketLocation after processing the model
if (empty($opts['query'])
&& str_starts_with($relativeUri, '/?')
) {
if ($relative[0] !== '/') {
$relative = '/' . $relative;
$query = substr($relativeUri, 2); // Remove '/?'
return $this->endpoint->withQuery($query);
}
return new Uri($this->endpoint->withPath('') . $relative);
// Ensure base path has trailing slash
if (!str_ends_with($basePath, '/')) {
$this->endpoint = $this->endpoint->withPath($basePath . '/');
}
// Remove leading slash from relative path to make it relative
if (str_starts_with($relativeUri, '/')) {
$relativeUri = substr($relativeUri, 1);
}
}
if (((!empty($relative) && $relative !== '/')
&& !$this->isUseEndpointV2)
|| (isset($serviceName) && str_starts_with($serviceName, 'geo-'))
) {
$this->normalizePath($path);
}
// If endpoint has path, remove leading '/' to preserve URI resolution.
if ($path && $relative[0] === '/') {
$relative = substr($relative, 1);
}
//Append path to endpoint when leading '//...'
// present as uri cannot be properly resolved
if ($this->isUseEndpointV2 && strpos($relative, '//') === 0) {
return new Uri($this->endpoint . $relative);
}
// Expand path place holders using Amazon's slightly different URI
// template syntax.
return UriResolver::resolve($this->endpoint, new Uri($relative));
return UriResolver::resolve($this->endpoint, new Uri($relativeUri));
}
/**
* @param StructureShape $input
* @param $payload
*
* @return bool
*/
private function hasPayloadParam(StructureShape $input, $payload)
{
if ($payload) {
$potentiallyEmptyTypes = ['blob','string'];
if ($this->api->getMetadata('protocol') == 'rest-xml') {
if ($this->api->getProtocol() === 'rest-xml') {
$potentiallyEmptyTypes[] = 'structure';
}
$payloadMember = $input->getMember($payload);
if (in_array($payloadMember['type'], $potentiallyEmptyTypes)) {
//unions may also be empty/unset
if (!empty($payloadMember['union'])
|| in_array($payloadMember['type'], $potentiallyEmptyTypes)
) {
return false;
}
}
foreach ($input->getMembers() as $member) {
if (!isset($member['location'])) {
return true;
}
}
return false;
}
private function appendQuery($query, $endpoint)
/**
* @param $query
* @param $relativeUri
*
* @return string
*/
private function appendQuery($query, $relativeUri): string
{
$append = Psr7\Query::build($query);
return $endpoint .= strpos($endpoint, '?') !== false ? "&{$append}" : "?{$append}";
return $relativeUri
. (str_contains($relativeUri, '?') ? "&{$append}" : "?{$append}");
}
private function getVarDefinitions($command, $args)
/**
* @param CommandInterface $command
* @param array $args
*
* @return array
*/
private function getVarDefinitions(
Operation $operation,
array $args
): array
{
$varDefinitions = [];
foreach ($command->getInput()->getMembers() as $name => $member) {
if ($member['location'] == 'uri') {
$varDefinitions[$member['locationName'] ?: $name] =
isset($args[$name])
? $args[$name]
: null;
foreach ($operation->getInput()->getMembers() as $name => $member) {
if ($member['location'] === 'uri') {
$value = $args[$name] ?? null;
if (!is_null($value)) {
switch ($member->getType()) {
case 'timestamp':
$timestampFormat = $member['timestampFormat'] ?? 'iso8601';
$value = $this->formatTimestamp($value, $timestampFormat);
break;
case 'boolean':
$value = $this->formatBoolean($value);
break;
}
}
$varDefinitions[$member['locationName'] ?: $name] = $value;
}
}
return $varDefinitions;
}
/**
* Appends trailing slash to non-empty paths with at least one segment
* to ensure proper URI resolution
* @param DateTimeInterface|string|int $value
* @param string $timestampFormat
*
* @param string $path
*
* @return void
* @return string
*/
private function normalizePath(string $path): void
private function formatTimestamp(
DateTimeInterface|string|int $value,
string $timestampFormat
): string
{
if (!empty($path) && $path !== '/' && substr($path, -1) !== '/') {
$this->endpoint = $this->endpoint->withPath($path . '/');
return TimestampShape::format($value, $timestampFormat);
}
/**
* @param $value
*
* @return string
*/
private function formatBoolean($value): string
{
return $value ? 'true' : 'false';
}
}
@@ -29,7 +29,9 @@ class RestXmlSerializer extends RestSerializer
protected function payload(StructureShape $member, array $value, array &$opts)
{
$opts['headers']['Content-Type'] = 'application/xml';
$opts['body'] = $this->getXmlBody($member, $value);
$body = $this->getXmlBody($member, $value);
$opts['headers']['Content-Length'] = (string) strlen($body);
$opts['body'] = $body;
}
/**
@@ -39,7 +41,7 @@ class RestXmlSerializer extends RestSerializer
*/
private function getXmlBody(StructureShape $member, array $value)
{
$xmlBody = (string)$this->xmlBody->build($member, $value);
$xmlBody = $this->xmlBody->build($member, $value);
$xmlBody = str_replace("'", "&apos;", $xmlBody);
$xmlBody = str_replace('\r', "&#13;", $xmlBody);
$xmlBody = str_replace('\n', "&#10;", $xmlBody);
@@ -0,0 +1,124 @@
<?php
namespace Aws\Api\Serializer;
use Aws\Api\Cbor\CborEncoder;
use Aws\Api\Cbor\Exception\CborException;
use Aws\Api\Exception\RpcV2CborException;
use Aws\Api\Service;
use Aws\Api\StructureShape;
use DateTimeInterface;
/**
* Serializes requests according to Smithy RPC-V2 CBOR protocol standards.
*
* https://smithy.io/2.0/additional-specs/protocols/smithy-rpc-v2.html
*
* @internal
*/
final class RpcV2CborSerializer extends AbstractRpcV2Serializer
{
/** @var array|string[] */
protected static array $defaultHeaders = [
self::HEADER_SMITHY_PROTOCOL => 'rpc-v2-cbor',
self::HEADER_CONTENT_TYPE => 'application/cbor',
self::HEADER_ACCEPT => 'application/cbor',
];
/** @var CborEncoder */
private CborEncoder $encoder;
/**
* @param Service $api Service API description
* @param string $endpoint Endpoint to connect to
*/
public function __construct(Service $api, string $endpoint)
{
$this->encoder = new CborEncoder();
parent::__construct($api, $endpoint);
}
/**
* @param StructureShape $inputShape
* @param array $commandArgs
*
* @return string
* @throws RpcV2CborException
*/
public function serialize(
StructureShape $inputShape,
array $commandArgs
): string
{
try {
$resolvedInput = $this->resolveInputShape($inputShape, $commandArgs);
return !empty($resolvedInput)
? $this->encoder->encode($resolvedInput)
: $this->encoder->encodeEmptyIndefiniteMap();
} catch (CborException $e) {
throw new RpcV2CborException(
'Unable to encode CBOR document ' . $inputShape->getName() . ': ' .
$e->getMessage() . PHP_EOL
);
}
}
/**
* Wraps blob values in order to be encoded properly into
* byte strings.
*
* @param mixed $value
*
* @return string[]
* @throws RpcV2CborException
*/
protected function resolveBlob(mixed $value): array
{
if (is_resource($value)) {
$value = stream_get_contents($value);
if ($value === false) {
throw new RpcV2CborException(
'Failed to read resource stream value during serialization',
);
}
}
// Wrapper to differentiate byte string values during encoding
return ['__cbor_bytes' => (string) $value];
}
/**
* Wraps timestamp values in order to be encoded properly into
* value tag 1.
*
* @param mixed $value
*
* @return string[]
* @throws RpcV2CborException
*/
protected function resolveTimestamp(
int|float|string|DateTimeInterface $value
): array
{
if (is_numeric($value)) {
return ['__cbor_timestamp' => $value];
}
if ($value instanceof DateTimeInterface) {
// Preserve milliseconds
$micro = (int) $value->format('u');
$value = $value->getTimestamp() + $micro / 1e6;
} else {
$timestamp = strtotime($value);
if ($timestamp === false) {
throw new RpcV2CborException(
'Request serialization failed: Invalid date/time: ' . $value,
);
}
$value = $timestamp;
}
// Wrapper to differentiate timestamp values during encoding
return ['__cbor_timestamp' => $value];
}
}
+40 -6
View File
@@ -14,8 +14,8 @@ use XMLWriter;
*/
class XmlBody
{
/** @var \Aws\Api\Service */
private $api;
/** @var Service */
private Service $api;
/**
* @param Service $api API being used to create the XML body.
@@ -38,7 +38,10 @@ class XmlBody
$xml = new XMLWriter();
$xml->openMemory();
$xml->startDocument('1.0', 'UTF-8');
$this->format($shape, $shape['locationName'] ?: $shape['name'], $args, $xml);
$rootElementName = $this->determineRootElementName($shape);
$this->format($shape, $rootElementName, $args, $xml);
$xml->endDocument();
return $xml->outputMemory();
@@ -51,7 +54,7 @@ class XmlBody
if ($ns = $shape['xmlNamespace']) {
$xml->writeAttribute(
isset($ns['prefix']) ? "xmlns:{$ns['prefix']}" : 'xmlns',
$shape['xmlNamespace']['uri']
$ns['uri']
);
}
}
@@ -93,9 +96,17 @@ class XmlBody
$this->startElement($shape, $name, $xml);
foreach ($this->getStructureMembers($shape, $value) as $k => $definition) {
// Default to member name
$elementName = $k;
if ($definition['member']['locationName']
&& !isset($definition['member']['locationNameAtStructureLevel'])) {
$elementName = $definition['member']['locationName'];
}
$this->format(
$definition['member'],
$definition['member']['locationName'] ?: $k,
$elementName,
$definition['value'],
$xml
);
@@ -157,11 +168,13 @@ class XmlBody
array $value,
XMLWriter $xml
) {
$xmlEntry = $shape['flattened'] ? $shape['locationName'] : 'entry';
$xmlEntry = $shape['flattened'] ? $name : 'entry';
$xmlKey = $shape->getKey()['locationName'] ?: 'key';
$xmlValue = $shape->getValue()['locationName'] ?: 'value';
if (!$shape['flattened']) {
$this->startElement($shape, $name, $xml);
}
foreach ($value as $key => $v) {
$this->startElement($shape, $xmlEntry, $xml);
@@ -170,8 +183,10 @@ class XmlBody
$xml->endElement();
}
if (!$shape['flattened']) {
$xml->endElement();
}
}
private function add_blob(Shape $shape, $name, $value, XMLWriter $xml)
{
@@ -217,4 +232,23 @@ class XmlBody
$this->defaultShape($shape, $name, $value, $xml);
}
}
private function determineRootElementName(Shape $shape): string
{
$shapeName = $shape->getName();
// Look up the shape definition first
if ($shapeName && $shapeMap = $shape->getShapeMap()) {
if (isset($shapeMap[$shapeName]['locationName'])) {
return $shapeMap[$shapeName]['locationName'];
}
}
// Fall back to shape's current locationName
if ($shape['locationName']) {
return $shape['locationName'];
}
return $shapeName;
}
}
+6 -3
View File
@@ -91,7 +91,8 @@ class Service extends AbstractModel
'json' => Serializer\JsonRpcSerializer::class,
'query' => Serializer\QuerySerializer::class,
'rest-json' => Serializer\RestJsonSerializer::class,
'rest-xml' => Serializer\RestXmlSerializer::class
'rest-xml' => Serializer\RestXmlSerializer::class,
'smithy-rpc-v2-cbor' => Serializer\RpcV2CborSerializer::class
];
$proto = $api->getProtocol();
@@ -126,7 +127,8 @@ class Service extends AbstractModel
'query' => ErrorParser\XmlErrorParser::class,
'rest-json' => ErrorParser\RestJsonErrorParser::class,
'rest-xml' => ErrorParser\XmlErrorParser::class,
'ec2' => ErrorParser\XmlErrorParser::class
'ec2' => ErrorParser\XmlErrorParser::class,
'smithy-rpc-v2-cbor' => ErrorParser\RpcV2CborErrorParser::class
];
if (isset($mapping[$protocol])) {
@@ -149,7 +151,8 @@ class Service extends AbstractModel
'json' => Parser\JsonRpcParser::class,
'query' => Parser\QueryParser::class,
'rest-json' => Parser\RestJsonParser::class,
'rest-xml' => Parser\RestXmlParser::class
'rest-xml' => Parser\RestXmlParser::class,
'smithy-rpc-v2-cbor' => Parser\RpcV2CborParser::class
];
$proto = $api->getProtocol();
+50 -2
View File
@@ -4,7 +4,7 @@ namespace Aws\Api;
/**
* Builds shape based on shape references.
*/
class ShapeMap
class ShapeMap implements \ArrayAccess
{
/** @var array */
private $definitions;
@@ -51,7 +51,14 @@ class ShapeMap
return $this->simple[$shape];
}
$definition = $shapeRef + $this->definitions[$shape];
$shapeDefinition = $this->definitions[$shape];
$definition = $shapeRef + $shapeDefinition;
// Property to know whether the locationName was set at member level
// or the structure level.
if (isset($shapeDefinition['locationName'])) {
$definition['locationNameAtStructureLevel'] = true;
}
$definition['name'] = $definition['shape'];
if (isset($definition['shape'])) {
unset($definition['shape']);
@@ -65,4 +72,45 @@ class ShapeMap
return $result;
}
/**
* @param mixed $offset
* @return bool
*/
public function offsetExists(mixed $offset): bool
{
return isset($this->definitions[$offset]);
}
/**
* @param mixed $offset
* @return mixed
*/
public function offsetGet(mixed $offset): mixed
{
return $this->definitions[$offset] ?? null;
}
/**
* @param mixed $offset
* @param mixed $value
* @throws \BadMethodCallException
*/
public function offsetSet(mixed $offset, mixed $value): void
{
throw new \BadMethodCallException(
'ShapeMap is read-only and cannot be modified.'
);
}
/**
* @param mixed $offset
* @throws \BadMethodCallException
*/
public function offsetUnset(mixed $offset): void
{
throw new \BadMethodCallException(
'ShapeMap is read-only and cannot be modified.'
);
}
}
+26
View File
@@ -67,6 +67,32 @@ class StructureShape extends Shape
return $members[$name];
}
/**
* Used to look up the shape's original definition.
* ShapeMap::resolve() merges properties from both
* member and target shape definitions, causing certain
* properties like `locationName` to be overwritten.
*
* @return ShapeMap
* @internal This method is for internal use only and should not be used
* by external code. It may be changed or removed without notice.
*/
public function getShapeMap(): ShapeMap
{
return $this->shapeMap;
}
/**
* Used to look up a shape's original definition.
*
* @param string $name
*
* @return array|null
*/
public function getOriginalDefinition(string $name): ?array
{
return $this->shapeMap[$name] ?? null;
}
private function generateMembersHash()
{
+1
View File
@@ -8,6 +8,7 @@ namespace Aws\Api;
enum SupportedProtocols: string
{
case JSON = 'json';
case CBOR = 'smithy-rpc-v2-cbor';
case REST_JSON = 'rest-json';
case REST_XML = 'rest-xml';
case QUERY = 'query';
+3 -3
View File
@@ -28,16 +28,16 @@ class TimestampShape extends Shape
$value = $value->getTimestamp();
} elseif (is_string($value)) {
$value = strtotime($value);
} elseif (!is_int($value)) {
} elseif (!is_int($value) && !is_float($value)) {
throw new \InvalidArgumentException('Unable to handle the provided'
. ' timestamp type: ' . gettype($value));
}
switch ($format) {
case 'iso8601':
return gmdate('Y-m-d\TH:i:s\Z', $value);
return gmdate('Y-m-d\TH:i:s\Z', (int) $value);
case 'rfc822':
return gmdate('D, d M Y H:i:s \G\M\T', $value);
return gmdate('D, d M Y H:i:s \G\M\T', (int) $value);
case 'unixTimestamp':
return $value;
default:
+8 -11
View File
@@ -2,6 +2,7 @@
namespace Aws\Api;
use Aws;
use stdClass;
/**
* Validates a schema against a hash of input.
@@ -248,17 +249,7 @@ class Validator
private function checkArray($arr)
{
return $this->isIndexed($arr) || $this->isAssociative($arr);
}
private function isAssociative($arr)
{
return count(array_filter(array_keys($arr), "is_string")) == count($arr);
}
private function isIndexed(array $arr)
{
return $arr == array_values($arr);
return array_is_list($arr) || Aws\is_associative($arr);
}
private function checkCanString($value)
@@ -302,6 +293,12 @@ class Validator
private function checkDocumentType($value)
{
// To allow objects like value, which
// can be used within a member which type is `Document`
if ($value instanceof stdClass) {
$value = (array) $value;
}
if (is_array($value)) {
$typeOfFirstKey = gettype(key($value));
foreach ($value as $key => $val) {
@@ -21,6 +21,14 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createIntegrationResponseAsync(array $args = [])
* @method \Aws\Result createModel(array $args = [])
* @method \GuzzleHttp\Promise\Promise createModelAsync(array $args = [])
* @method \Aws\Result createPortal(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPortalAsync(array $args = [])
* @method \Aws\Result createPortalProduct(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPortalProductAsync(array $args = [])
* @method \Aws\Result createProductPage(array $args = [])
* @method \GuzzleHttp\Promise\Promise createProductPageAsync(array $args = [])
* @method \Aws\Result createProductRestEndpointPage(array $args = [])
* @method \GuzzleHttp\Promise\Promise createProductRestEndpointPageAsync(array $args = [])
* @method \Aws\Result createRoute(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRouteAsync(array $args = [])
* @method \Aws\Result createRouteResponse(array $args = [])
@@ -51,6 +59,16 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise deleteIntegrationResponseAsync(array $args = [])
* @method \Aws\Result deleteModel(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteModelAsync(array $args = [])
* @method \Aws\Result deletePortal(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePortalAsync(array $args = [])
* @method \Aws\Result deletePortalProduct(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePortalProductAsync(array $args = [])
* @method \Aws\Result deletePortalProductSharingPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePortalProductSharingPolicyAsync(array $args = [])
* @method \Aws\Result deleteProductPage(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteProductPageAsync(array $args = [])
* @method \Aws\Result deleteProductRestEndpointPage(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteProductRestEndpointPageAsync(array $args = [])
* @method \Aws\Result deleteRoute(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteRouteAsync(array $args = [])
* @method \Aws\Result deleteRouteRequestParameter(array $args = [])
@@ -67,6 +85,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise deleteVpcLinkAsync(array $args = [])
* @method \Aws\Result exportApi(array $args = [])
* @method \GuzzleHttp\Promise\Promise exportApiAsync(array $args = [])
* @method \Aws\Result disablePortal(array $args = [])
* @method \GuzzleHttp\Promise\Promise disablePortalAsync(array $args = [])
* @method \Aws\Result resetAuthorizersCache(array $args = [])
* @method \GuzzleHttp\Promise\Promise resetAuthorizersCacheAsync(array $args = [])
* @method \Aws\Result getApiResource(array $args = [])
@@ -103,6 +123,16 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getModelTemplateAsync(array $args = [])
* @method \Aws\Result getModels(array $args = [])
* @method \GuzzleHttp\Promise\Promise getModelsAsync(array $args = [])
* @method \Aws\Result getPortal(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPortalAsync(array $args = [])
* @method \Aws\Result getPortalProduct(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPortalProductAsync(array $args = [])
* @method \Aws\Result getPortalProductSharingPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPortalProductSharingPolicyAsync(array $args = [])
* @method \Aws\Result getProductPage(array $args = [])
* @method \GuzzleHttp\Promise\Promise getProductPageAsync(array $args = [])
* @method \Aws\Result getProductRestEndpointPage(array $args = [])
* @method \GuzzleHttp\Promise\Promise getProductRestEndpointPageAsync(array $args = [])
* @method \Aws\Result getRoute(array $args = [])
* @method \GuzzleHttp\Promise\Promise getRouteAsync(array $args = [])
* @method \Aws\Result getRouteResponse(array $args = [])
@@ -113,8 +143,6 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getRoutesAsync(array $args = [])
* @method \Aws\Result getRoutingRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise getRoutingRuleAsync(array $args = [])
* @method \Aws\Result listRoutingRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRoutingRulesAsync(array $args = [])
* @method \Aws\Result getStage(array $args = [])
* @method \GuzzleHttp\Promise\Promise getStageAsync(array $args = [])
* @method \Aws\Result getStages(array $args = [])
@@ -127,6 +155,22 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getVpcLinksAsync(array $args = [])
* @method \Aws\Result importApi(array $args = [])
* @method \GuzzleHttp\Promise\Promise importApiAsync(array $args = [])
* @method \Aws\Result listPortalProducts(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPortalProductsAsync(array $args = [])
* @method \Aws\Result listPortals(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPortalsAsync(array $args = [])
* @method \Aws\Result listProductPages(array $args = [])
* @method \GuzzleHttp\Promise\Promise listProductPagesAsync(array $args = [])
* @method \Aws\Result listProductRestEndpointPages(array $args = [])
* @method \GuzzleHttp\Promise\Promise listProductRestEndpointPagesAsync(array $args = [])
* @method \Aws\Result listRoutingRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRoutingRulesAsync(array $args = [])
* @method \Aws\Result previewPortal(array $args = [])
* @method \GuzzleHttp\Promise\Promise previewPortalAsync(array $args = [])
* @method \Aws\Result publishPortal(array $args = [])
* @method \GuzzleHttp\Promise\Promise publishPortalAsync(array $args = [])
* @method \Aws\Result putPortalProductSharingPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise putPortalProductSharingPolicyAsync(array $args = [])
* @method \Aws\Result putRoutingRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise putRoutingRuleAsync(array $args = [])
* @method \Aws\Result reimportApi(array $args = [])
@@ -151,6 +195,14 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise updateIntegrationResponseAsync(array $args = [])
* @method \Aws\Result updateModel(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateModelAsync(array $args = [])
* @method \Aws\Result updatePortal(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePortalAsync(array $args = [])
* @method \Aws\Result updatePortalProduct(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePortalProductAsync(array $args = [])
* @method \Aws\Result updateProductPage(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateProductPageAsync(array $args = [])
* @method \Aws\Result updateProductRestEndpointPage(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateProductRestEndpointPageAsync(array $args = [])
* @method \Aws\Result updateRoute(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateRouteAsync(array $args = [])
* @method \Aws\Result updateRouteResponse(array $args = [])
@@ -13,6 +13,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createDeploymentStrategyAsync(array $args = [])
* @method \Aws\Result createEnvironment(array $args = [])
* @method \GuzzleHttp\Promise\Promise createEnvironmentAsync(array $args = [])
* @method \Aws\Result createExperimentDefinition(array $args = [])
* @method \GuzzleHttp\Promise\Promise createExperimentDefinitionAsync(array $args = [])
* @method \Aws\Result createExtension(array $args = [])
* @method \GuzzleHttp\Promise\Promise createExtensionAsync(array $args = [])
* @method \Aws\Result createExtensionAssociation(array $args = [])
@@ -27,6 +29,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise deleteDeploymentStrategyAsync(array $args = [])
* @method \Aws\Result deleteEnvironment(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteEnvironmentAsync(array $args = [])
* @method \Aws\Result deleteExperimentDefinition(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteExperimentDefinitionAsync(array $args = [])
* @method \Aws\Result deleteExtension(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteExtensionAsync(array $args = [])
* @method \Aws\Result deleteExtensionAssociation(array $args = [])
@@ -47,6 +51,10 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getDeploymentStrategyAsync(array $args = [])
* @method \Aws\Result getEnvironment(array $args = [])
* @method \GuzzleHttp\Promise\Promise getEnvironmentAsync(array $args = [])
* @method \Aws\Result getExperimentDefinition(array $args = [])
* @method \GuzzleHttp\Promise\Promise getExperimentDefinitionAsync(array $args = [])
* @method \Aws\Result getExperimentRun(array $args = [])
* @method \GuzzleHttp\Promise\Promise getExperimentRunAsync(array $args = [])
* @method \Aws\Result getExtension(array $args = [])
* @method \GuzzleHttp\Promise\Promise getExtensionAsync(array $args = [])
* @method \Aws\Result getExtensionAssociation(array $args = [])
@@ -63,6 +71,12 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listDeploymentsAsync(array $args = [])
* @method \Aws\Result listEnvironments(array $args = [])
* @method \GuzzleHttp\Promise\Promise listEnvironmentsAsync(array $args = [])
* @method \Aws\Result listExperimentDefinitions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listExperimentDefinitionsAsync(array $args = [])
* @method \Aws\Result listExperimentRunEvents(array $args = [])
* @method \GuzzleHttp\Promise\Promise listExperimentRunEventsAsync(array $args = [])
* @method \Aws\Result listExperimentRuns(array $args = [])
* @method \GuzzleHttp\Promise\Promise listExperimentRunsAsync(array $args = [])
* @method \Aws\Result listExtensionAssociations(array $args = [])
* @method \GuzzleHttp\Promise\Promise listExtensionAssociationsAsync(array $args = [])
* @method \Aws\Result listExtensions(array $args = [])
@@ -73,8 +87,12 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result startDeployment(array $args = [])
* @method \GuzzleHttp\Promise\Promise startDeploymentAsync(array $args = [])
* @method \Aws\Result startExperimentRun(array $args = [])
* @method \GuzzleHttp\Promise\Promise startExperimentRunAsync(array $args = [])
* @method \Aws\Result stopDeployment(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopDeploymentAsync(array $args = [])
* @method \Aws\Result stopExperimentRun(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopExperimentRunAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
@@ -89,6 +107,10 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise updateDeploymentStrategyAsync(array $args = [])
* @method \Aws\Result updateEnvironment(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateEnvironmentAsync(array $args = [])
* @method \Aws\Result updateExperimentDefinition(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateExperimentDefinitionAsync(array $args = [])
* @method \Aws\Result updateExperimentRun(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateExperimentRunAsync(array $args = [])
* @method \Aws\Result updateExtension(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateExtensionAsync(array $args = [])
* @method \Aws\Result updateExtensionAssociation(array $args = [])
+2 -2
View File
@@ -63,8 +63,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise evaluateMappingTemplateAsync(array $args = [])
* @method \Aws\Result flushApiCache(array $args = [])
* @method \GuzzleHttp\Promise\Promise flushApiCacheAsync(array $args = [])
* @method \Aws\Result getApi(array $args = [])
* @method \GuzzleHttp\Promise\Promise getApiAsync(array $args = [])
* @method \Aws\Result getApiResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise getApiResourceAsync(array $args = [])
* @method \Aws\Result getApiAssociation(array $args = [])
* @method \GuzzleHttp\Promise\Promise getApiAssociationAsync(array $args = [])
* @method \Aws\Result getApiCache(array $args = [])
-57
View File
@@ -1,57 +0,0 @@
<?php
namespace Aws\AppTest;
use Aws\AwsClient;
/**
* This client is used to interact with the **AWS Mainframe Modernization Application Testing** service.
* @method \Aws\Result createTestCase(array $args = [])
* @method \GuzzleHttp\Promise\Promise createTestCaseAsync(array $args = [])
* @method \Aws\Result createTestConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise createTestConfigurationAsync(array $args = [])
* @method \Aws\Result createTestSuite(array $args = [])
* @method \GuzzleHttp\Promise\Promise createTestSuiteAsync(array $args = [])
* @method \Aws\Result deleteTestCase(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteTestCaseAsync(array $args = [])
* @method \Aws\Result deleteTestConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteTestConfigurationAsync(array $args = [])
* @method \Aws\Result deleteTestRun(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteTestRunAsync(array $args = [])
* @method \Aws\Result deleteTestSuite(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteTestSuiteAsync(array $args = [])
* @method \Aws\Result getTestCase(array $args = [])
* @method \GuzzleHttp\Promise\Promise getTestCaseAsync(array $args = [])
* @method \Aws\Result getTestConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise getTestConfigurationAsync(array $args = [])
* @method \Aws\Result getTestRunStep(array $args = [])
* @method \GuzzleHttp\Promise\Promise getTestRunStepAsync(array $args = [])
* @method \Aws\Result getTestSuite(array $args = [])
* @method \GuzzleHttp\Promise\Promise getTestSuiteAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result listTestCases(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTestCasesAsync(array $args = [])
* @method \Aws\Result listTestConfigurations(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTestConfigurationsAsync(array $args = [])
* @method \Aws\Result listTestRunSteps(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTestRunStepsAsync(array $args = [])
* @method \Aws\Result listTestRunTestCases(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTestRunTestCasesAsync(array $args = [])
* @method \Aws\Result listTestRuns(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTestRunsAsync(array $args = [])
* @method \Aws\Result listTestSuites(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTestSuitesAsync(array $args = [])
* @method \Aws\Result startTestRun(array $args = [])
* @method \GuzzleHttp\Promise\Promise startTestRunAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateTestCase(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateTestCaseAsync(array $args = [])
* @method \Aws\Result updateTestConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateTestConfigurationAsync(array $args = [])
* @method \Aws\Result updateTestSuite(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateTestSuiteAsync(array $args = [])
*/
class AppTestClient extends AwsClient {}
@@ -1,9 +0,0 @@
<?php
namespace Aws\AppTest\Exception;
use Aws\Exception\AwsException;
/**
* Represents an error interacting with the **AWS Mainframe Modernization Application Testing** service.
*/
class AppTestException extends AwsException {}
@@ -5,18 +5,38 @@ use Aws\AwsClient;
/**
* This client is used to interact with the **Amazon CloudWatch Application Signals** service.
* @method \Aws\Result batchDeleteInstrumentationConfigurations(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchDeleteInstrumentationConfigurationsAsync(array $args = [])
* @method \Aws\Result batchGetServiceLevelObjectiveBudgetReport(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchGetServiceLevelObjectiveBudgetReportAsync(array $args = [])
* @method \Aws\Result batchUpdateExclusionWindows(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchUpdateExclusionWindowsAsync(array $args = [])
* @method \Aws\Result createInstrumentationConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise createInstrumentationConfigurationAsync(array $args = [])
* @method \Aws\Result createServiceLevelObjective(array $args = [])
* @method \GuzzleHttp\Promise\Promise createServiceLevelObjectiveAsync(array $args = [])
* @method \Aws\Result deleteGroupingConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteGroupingConfigurationAsync(array $args = [])
* @method \Aws\Result deleteInstrumentationConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteInstrumentationConfigurationAsync(array $args = [])
* @method \Aws\Result deleteServiceLevelObjective(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteServiceLevelObjectiveAsync(array $args = [])
* @method \Aws\Result getInstrumentationConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise getInstrumentationConfigurationAsync(array $args = [])
* @method \Aws\Result getInstrumentationConfigurationStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise getInstrumentationConfigurationStatusAsync(array $args = [])
* @method \Aws\Result getService(array $args = [])
* @method \GuzzleHttp\Promise\Promise getServiceAsync(array $args = [])
* @method \Aws\Result getServiceLevelObjective(array $args = [])
* @method \GuzzleHttp\Promise\Promise getServiceLevelObjectiveAsync(array $args = [])
* @method \Aws\Result listAuditFindings(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAuditFindingsAsync(array $args = [])
* @method \Aws\Result listEntityEvents(array $args = [])
* @method \GuzzleHttp\Promise\Promise listEntityEventsAsync(array $args = [])
* @method \Aws\Result listGroupingAttributeDefinitions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listGroupingAttributeDefinitionsAsync(array $args = [])
* @method \Aws\Result listInstrumentationConfigurations(array $args = [])
* @method \GuzzleHttp\Promise\Promise listInstrumentationConfigurationsAsync(array $args = [])
* @method \Aws\Result listServiceDependencies(array $args = [])
* @method \GuzzleHttp\Promise\Promise listServiceDependenciesAsync(array $args = [])
* @method \Aws\Result listServiceDependents(array $args = [])
@@ -27,10 +47,16 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listServiceLevelObjectivesAsync(array $args = [])
* @method \Aws\Result listServiceOperations(array $args = [])
* @method \GuzzleHttp\Promise\Promise listServiceOperationsAsync(array $args = [])
* @method \Aws\Result listServiceStates(array $args = [])
* @method \GuzzleHttp\Promise\Promise listServiceStatesAsync(array $args = [])
* @method \Aws\Result listServices(array $args = [])
* @method \GuzzleHttp\Promise\Promise listServicesAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result putGroupingConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise putGroupingConfigurationAsync(array $args = [])
* @method \Aws\Result reportInstrumentationConfigurationStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise reportInstrumentationConfigurationStatusAsync(array $args = [])
* @method \Aws\Result startDiscovery(array $args = [])
* @method \GuzzleHttp\Promise\Promise startDiscoveryAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
@@ -13,6 +13,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise associateApplicationToEntitlementAsync(array $args = [])
* @method \Aws\Result associateFleet(array $args = [])
* @method \GuzzleHttp\Promise\Promise associateFleetAsync(array $args = [])
* @method \Aws\Result associateSoftwareToImageBuilder(array $args = [])
* @method \GuzzleHttp\Promise\Promise associateSoftwareToImageBuilderAsync(array $args = [])
* @method \Aws\Result batchAssociateUserStack(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchAssociateUserStackAsync(array $args = [])
* @method \Aws\Result batchDisassociateUserStack(array $args = [])
@@ -31,12 +33,16 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createDirectoryConfigAsync(array $args = [])
* @method \Aws\Result createEntitlement(array $args = [])
* @method \GuzzleHttp\Promise\Promise createEntitlementAsync(array $args = [])
* @method \Aws\Result createExportImageTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise createExportImageTaskAsync(array $args = [])
* @method \Aws\Result createFleet(array $args = [])
* @method \GuzzleHttp\Promise\Promise createFleetAsync(array $args = [])
* @method \Aws\Result createImageBuilder(array $args = [])
* @method \GuzzleHttp\Promise\Promise createImageBuilderAsync(array $args = [])
* @method \Aws\Result createImageBuilderStreamingURL(array $args = [])
* @method \GuzzleHttp\Promise\Promise createImageBuilderStreamingURLAsync(array $args = [])
* @method \Aws\Result createImportedImage(array $args = [])
* @method \GuzzleHttp\Promise\Promise createImportedImageAsync(array $args = [])
* @method \Aws\Result createStack(array $args = [])
* @method \GuzzleHttp\Promise\Promise createStackAsync(array $args = [])
* @method \Aws\Result createStreamingURL(array $args = [])
@@ -81,6 +87,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise describeAppBlockBuildersAsync(array $args = [])
* @method \Aws\Result describeAppBlocks(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAppBlocksAsync(array $args = [])
* @method \Aws\Result describeAppLicenseUsage(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAppLicenseUsageAsync(array $args = [])
* @method \Aws\Result describeApplicationFleetAssociations(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeApplicationFleetAssociationsAsync(array $args = [])
* @method \Aws\Result describeApplications(array $args = [])
@@ -99,6 +107,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise describeImagesAsync(array $args = [])
* @method \Aws\Result describeSessions(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeSessionsAsync(array $args = [])
* @method \Aws\Result describeSoftwareAssociations(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeSoftwareAssociationsAsync(array $args = [])
* @method \Aws\Result describeStacks(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeStacksAsync(array $args = [])
* @method \Aws\Result describeThemeForStack(array $args = [])
@@ -119,16 +129,24 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise disassociateApplicationFromEntitlementAsync(array $args = [])
* @method \Aws\Result disassociateFleet(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateFleetAsync(array $args = [])
* @method \Aws\Result disassociateSoftwareFromImageBuilder(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateSoftwareFromImageBuilderAsync(array $args = [])
* @method \Aws\Result drainSessionInstance(array $args = [])
* @method \GuzzleHttp\Promise\Promise drainSessionInstanceAsync(array $args = [])
* @method \Aws\Result enableUser(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableUserAsync(array $args = [])
* @method \Aws\Result expireSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise expireSessionAsync(array $args = [])
* @method \Aws\Result getExportImageTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise getExportImageTaskAsync(array $args = [])
* @method \Aws\Result listAssociatedFleets(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAssociatedFleetsAsync(array $args = [])
* @method \Aws\Result listAssociatedStacks(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAssociatedStacksAsync(array $args = [])
* @method \Aws\Result listEntitledApplications(array $args = [])
* @method \GuzzleHttp\Promise\Promise listEntitledApplicationsAsync(array $args = [])
* @method \Aws\Result listExportImageTasks(array $args = [])
* @method \GuzzleHttp\Promise\Promise listExportImageTasksAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result startAppBlockBuilder(array $args = [])
@@ -137,6 +155,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise startFleetAsync(array $args = [])
* @method \Aws\Result startImageBuilder(array $args = [])
* @method \GuzzleHttp\Promise\Promise startImageBuilderAsync(array $args = [])
* @method \Aws\Result startSoftwareDeploymentToImageBuilder(array $args = [])
* @method \GuzzleHttp\Promise\Promise startSoftwareDeploymentToImageBuilderAsync(array $args = [])
* @method \Aws\Result stopAppBlockBuilder(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopAppBlockBuilderAsync(array $args = [])
* @method \Aws\Result stopFleet(array $args = [])
+18
View File
@@ -5,19 +5,37 @@ use Aws\AwsClient;
/**
* This client is used to interact with the **AWS Artifact** service.
* @method \Aws\Result createComplianceInquiry(array $args = [])
* @method \GuzzleHttp\Promise\Promise createComplianceInquiryAsync(array $args = [])
* @method \Aws\Result exportComplianceInquiry(array $args = [])
* @method \GuzzleHttp\Promise\Promise exportComplianceInquiryAsync(array $args = [])
* @method \Aws\Result getAccountSettings(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAccountSettingsAsync(array $args = [])
* @method \Aws\Result getComplianceInquiryMetadata(array $args = [])
* @method \GuzzleHttp\Promise\Promise getComplianceInquiryMetadataAsync(array $args = [])
* @method \Aws\Result getReport(array $args = [])
* @method \GuzzleHttp\Promise\Promise getReportAsync(array $args = [])
* @method \Aws\Result getReportMetadata(array $args = [])
* @method \GuzzleHttp\Promise\Promise getReportMetadataAsync(array $args = [])
* @method \Aws\Result getTermForReport(array $args = [])
* @method \GuzzleHttp\Promise\Promise getTermForReportAsync(array $args = [])
* @method \Aws\Result listComplianceInquiries(array $args = [])
* @method \GuzzleHttp\Promise\Promise listComplianceInquiriesAsync(array $args = [])
* @method \Aws\Result listComplianceInquiryQueries(array $args = [])
* @method \GuzzleHttp\Promise\Promise listComplianceInquiryQueriesAsync(array $args = [])
* @method \Aws\Result listCustomerAgreements(array $args = [])
* @method \GuzzleHttp\Promise\Promise listCustomerAgreementsAsync(array $args = [])
* @method \Aws\Result listReportVersions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listReportVersionsAsync(array $args = [])
* @method \Aws\Result listReports(array $args = [])
* @method \GuzzleHttp\Promise\Promise listReportsAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result putAccountSettings(array $args = [])
* @method \GuzzleHttp\Promise\Promise putAccountSettingsAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
*/
class ArtifactClient extends AwsClient {}
+4
View File
@@ -67,8 +67,12 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getQueryResultsAsync(array $args = [])
* @method \Aws\Result getQueryRuntimeStatistics(array $args = [])
* @method \GuzzleHttp\Promise\Promise getQueryRuntimeStatisticsAsync(array $args = [])
* @method \Aws\Result getResourceDashboard(array $args = [])
* @method \GuzzleHttp\Promise\Promise getResourceDashboardAsync(array $args = [])
* @method \Aws\Result getSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise getSessionAsync(array $args = [])
* @method \Aws\Result getSessionEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise getSessionEndpointAsync(array $args = [])
* @method \Aws\Result getSessionStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise getSessionStatusAsync(array $args = [])
* @method \Aws\Result getTableMetadata(array $args = [])
@@ -13,9 +13,9 @@ interface AuthSchemeResolverInterface
* Selects an auth scheme for request signing.
*
* @param array $authSchemes a priority-ordered list of authentication schemes.
* @param IdentityInterface $identity Credentials to be used in request signing.
* @param array $args
*
* @return string
* @return string|null
*/
public function selectAuthScheme(
array $authSchemes,
+65 -12
View File
@@ -28,38 +28,50 @@ class AuthSelectionMiddleware
/** @var Service */
private $api;
/** @var array|null */
private ?array $configuredAuthSchemes;
/**
* Create a middleware wrapper function
*
* @param AuthSchemeResolverInterface $authResolver
* @param Service $api
* @param array|null $configuredAuthSchemes
*
* @return Closure
*/
public static function wrap(
AuthSchemeResolverInterface $authResolver,
Service $api
Service $api,
?array $configuredAuthSchemes
): Closure
{
return function (callable $handler) use ($authResolver, $api) {
return new self($handler, $authResolver, $api);
return function (callable $handler) use (
$authResolver,
$api,
$configuredAuthSchemes
) {
return new self($handler, $authResolver, $api, $configuredAuthSchemes);
};
}
/**
* @param callable $nextHandler
* @param $authResolver
* @param callable $identityProvider
* @param AuthSchemeResolverInterface $authResolver
* @param Service $api
* @param array|null $configuredAuthSchemes
*/
public function __construct(
callable $nextHandler,
AuthSchemeResolverInterface $authResolver,
Service $api
Service $api,
?array $configuredAuthSchemes = null
)
{
$this->nextHandler = $nextHandler;
$this->authResolver = $authResolver;
$this->api = $api;
$this->configuredAuthSchemes = $configuredAuthSchemes;
}
/**
@@ -86,21 +98,62 @@ class AuthSelectionMiddleware
}
try {
$selectedAuthScheme = $resolver->selectAuthScheme(
$authSchemeList = $this->buildAuthSchemeList(
$resolvableAuth,
$command['@context']['auth_scheme_preference']
?? null,
);
$selectedAuthScheme = $resolver->selectAuthScheme(
$authSchemeList,
['unsigned_payload' => $unsignedPayload]
);
} catch (UnresolvedAuthSchemeException $e) {
// There was an error resolving auth
// The signature version will fall back to the modeled `signatureVersion`
// or auth schemes resolved during endpoint resolution
}
if (!empty($selectedAuthScheme)) {
$command['@context']['signature_version'] = $selectedAuthScheme;
}
} catch (UnresolvedAuthSchemeException $ignored) {
// There was an error resolving auth
// The signature version will fall back to the modeled `signatureVersion`
// or auth schemes resolved during endpoint resolution
}
}
return $nextHandler($command);
}
/**
* Prioritizes auth schemes according to user preference order.
* User-preferred schemes that are available will be placed first,
* followed by remaining available schemes.
*
* @param array $resolvableAuthSchemeList Available auth schemes
* @param array|null $commandConfiguredAuthSchemes Command-level preferences (overrides config)
*
* @return array Reordered auth schemes with user preferences first
*/
private function buildAuthSchemeList(
array $resolvableAuthSchemeList,
?array $commandConfiguredAuthSchemes,
): array
{
$userConfiguredAuthSchemes = $commandConfiguredAuthSchemes
?? $this->configuredAuthSchemes;
if (empty($userConfiguredAuthSchemes)) {
return $resolvableAuthSchemeList;
}
$prioritizedAuthSchemes = array_intersect(
$userConfiguredAuthSchemes,
$resolvableAuthSchemeList
);
// Get remaining schemes not in user preferences
$remainingAuthSchemes = array_diff(
$resolvableAuthSchemeList,
$prioritizedAuthSchemes
);
return array_merge($prioritizedAuthSchemes, $remainingAuthSchemes);
}
}
@@ -4,7 +4,7 @@ namespace Aws\AutoScaling;
use Aws\AwsClient;
/**
* Auto Scaling client.
* This client is used to interact with the **AWS Auto Scaling** service.
*
* @method \Aws\Result attachInstances(array $args = [])
* @method \GuzzleHttp\Promise\Promise attachInstancesAsync(array $args = [])
@@ -106,6 +106,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise exitStandbyAsync(array $args = [])
* @method \Aws\Result getPredictiveScalingForecast(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPredictiveScalingForecastAsync(array $args = [])
* @method \Aws\Result launchInstances(array $args = [])
* @method \GuzzleHttp\Promise\Promise launchInstancesAsync(array $args = [])
* @method \Aws\Result putLifecycleHook(array $args = [])
* @method \GuzzleHttp\Promise\Promise putLifecycleHookAsync(array $args = [])
* @method \Aws\Result putNotificationConfiguration(array $args = [])
+48 -29
View File
@@ -272,7 +272,7 @@ class AwsClient implements AwsClientInterface
if ($this->isUseEndpointV2()) {
$this->addEndpointV2Middleware();
}
$this->addAuthSelectionMiddleware();
$this->addAuthSelectionMiddleware($config['config']);
if (!is_null($this->api->getMetadata('awsQueryCompatible'))) {
$this->addQueryCompatibleInputMiddleware($this->api);
@@ -283,6 +283,7 @@ class AwsClient implements AwsClientInterface
$args['with_resolved']($config);
}
$this->addUserAgentMiddleware($config);
$this->addEventStreamHttpFlagMiddleware();
}
public function getHandlerList()
@@ -303,6 +304,12 @@ class AwsClient implements AwsClientInterface
return $fn();
}
public function getToken()
{
$fn = $this->tokenProvider;
return $fn();
}
public function getEndpoint()
{
@@ -537,7 +544,7 @@ class AwsClient implements AwsClientInterface
{
$list = $this->getHandlerList();
$list->appendBuild(
Middleware::mapRequest(function (RequestInterface $r) {
Middleware::mapRequest(static function (RequestInterface $r) {
return $r->withHeader(
'x-amzn-query-mode',
"true"
@@ -562,8 +569,14 @@ class AwsClient implements AwsClientInterface
$aliases = \Aws\load_compiled_json($file);
$serviceId = $this->api->getServiceId();
$version = $this->getApi()->getApiVersion();
if (!empty($aliases['operations'][$serviceId][$version])) {
$this->aliases = array_flip($aliases['operations'][$serviceId][$version]);
$serviceAliases = null;
if (!is_null($serviceId) && isset($aliases['operations'][$serviceId])) {
$serviceAliases = $aliases['operations'][$serviceId];
}
if ($serviceAliases && isset($serviceAliases[$version])) {
$this->aliases = array_flip($serviceAliases[$version]);
}
}
}
@@ -589,14 +602,15 @@ class AwsClient implements AwsClientInterface
);
}
private function addAuthSelectionMiddleware()
private function addAuthSelectionMiddleware(array $args)
{
$list = $this->getHandlerList();
$list->prependBuild(
AuthSelectionMiddleware::wrap(
$this->authSchemeResolver,
$this->getApi()
$this->getApi(),
$args['auth_scheme_preference'] ?? null
),
'auth-selection'
);
@@ -636,6 +650,34 @@ class AwsClient implements AwsClientInterface
);
}
/**
* Enables streaming the response by using the stream flag.
*
* @return void
*/
private function addEventStreamHttpFlagMiddleware(): void
{
$api = $this->getApi();
$this->getHandlerList()
-> appendInit(
static function (callable $handler) use ($api) {
return static function (CommandInterface $command, $request = null) use ($handler, $api) {
$operation = $api->getOperation($command->getName());
$output = $operation->getOutput();
foreach ($output->getMembers() as $memberProps) {
if (!empty($memberProps['eventstream'])) {
$command['@http']['stream'] = true;
break;
}
}
return $handler($command, $request);
};
},
'event-streaming-flag-middleware'
);
}
/**
* Retrieves client context param definition from service model,
* creates mapping of client context param names with client-provided
@@ -724,29 +766,6 @@ class AwsClient implements AwsClientInterface
return $this->endpointProvider instanceof EndpointProviderV2;
}
public static function emitDeprecationWarning() {
trigger_error(
"This method is deprecated. It will be removed in an upcoming release."
, E_USER_DEPRECATED
);
$phpVersion = PHP_VERSION_ID;
if ($phpVersion < 70205) {
$phpVersionString = phpversion();
@trigger_error(
"This installation of the SDK is using PHP version"
. " {$phpVersionString}, which will be deprecated on August"
. " 15th, 2023. Please upgrade your PHP version to a minimum of"
. " 7.2.5 before then to continue receiving updates to the AWS"
. " SDK for PHP. To disable this warning, set"
. " suppress_php_deprecation_warning to true on the client constructor"
. " or set the environment variable AWS_SUPPRESS_PHP_DEPRECATION_WARNING"
. " to true.",
E_USER_DEPRECATED
);
}
}
/**
* Returns a service model and doc model with any necessary changes
+1 -1
View File
@@ -75,7 +75,7 @@ trait AwsClientTrait
$name = $this->aliases[ucfirst($name)];
}
$params = isset($args[0]) ? $args[0] : [];
$params = $args['args'] ?? $args[0] ?? [];
if (!empty($isAsync)) {
return $this->executeAsync(
@@ -0,0 +1,39 @@
<?php
namespace Aws\BCMDashboards;
use Aws\AwsClient;
/**
* This client is used to interact with the **AWS Billing and Cost Management Dashboards** service.
* @method \Aws\Result createDashboard(array $args = [])
* @method \GuzzleHttp\Promise\Promise createDashboardAsync(array $args = [])
* @method \Aws\Result createScheduledReport(array $args = [])
* @method \GuzzleHttp\Promise\Promise createScheduledReportAsync(array $args = [])
* @method \Aws\Result deleteDashboard(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteDashboardAsync(array $args = [])
* @method \Aws\Result deleteScheduledReport(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteScheduledReportAsync(array $args = [])
* @method \Aws\Result executeScheduledReport(array $args = [])
* @method \GuzzleHttp\Promise\Promise executeScheduledReportAsync(array $args = [])
* @method \Aws\Result getDashboard(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDashboardAsync(array $args = [])
* @method \Aws\Result getResourcePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise getResourcePolicyAsync(array $args = [])
* @method \Aws\Result getScheduledReport(array $args = [])
* @method \GuzzleHttp\Promise\Promise getScheduledReportAsync(array $args = [])
* @method \Aws\Result listDashboards(array $args = [])
* @method \GuzzleHttp\Promise\Promise listDashboardsAsync(array $args = [])
* @method \Aws\Result listScheduledReports(array $args = [])
* @method \GuzzleHttp\Promise\Promise listScheduledReportsAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateDashboard(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateDashboardAsync(array $args = [])
* @method \Aws\Result updateScheduledReport(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateScheduledReportAsync(array $args = [])
*/
class BCMDashboardsClient extends AwsClient {}
@@ -0,0 +1,9 @@
<?php
namespace Aws\BCMDashboards\Exception;
use Aws\Exception\AwsException;
/**
* Represents an error interacting with the **AWS Billing and Cost Management Dashboards** service.
*/
class BCMDashboardsException extends AwsException {}
@@ -0,0 +1,11 @@
<?php
namespace Aws\BCMRecommendedActions;
use Aws\AwsClient;
/**
* This client is used to interact with the **AWS Billing and Cost Management Recommended Actions** service.
* @method \Aws\Result listRecommendedActions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRecommendedActionsAsync(array $args = [])
*/
class BCMRecommendedActionsClient extends AwsClient {}
@@ -0,0 +1,9 @@
<?php
namespace Aws\BCMRecommendedActions\Exception;
use Aws\Exception\AwsException;
/**
* Represents an error interacting with the **AWS Billing and Cost Management Recommended Actions** service.
*/
class BCMRecommendedActionsException extends AwsException {}
+20
View File
@@ -29,6 +29,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createRestoreTestingPlanAsync(array $args = [])
* @method \Aws\Result createRestoreTestingSelection(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRestoreTestingSelectionAsync(array $args = [])
* @method \Aws\Result createTieringConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise createTieringConfigurationAsync(array $args = [])
* @method \Aws\Result deleteBackupPlan(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteBackupPlanAsync(array $args = [])
* @method \Aws\Result deleteBackupSelection(array $args = [])
@@ -51,6 +53,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise deleteRestoreTestingPlanAsync(array $args = [])
* @method \Aws\Result deleteRestoreTestingSelection(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteRestoreTestingSelectionAsync(array $args = [])
* @method \Aws\Result deleteTieringConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteTieringConfigurationAsync(array $args = [])
* @method \Aws\Result describeBackupJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeBackupJobAsync(array $args = [])
* @method \Aws\Result describeBackupVault(array $args = [])
@@ -73,6 +77,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise describeReportPlanAsync(array $args = [])
* @method \Aws\Result describeRestoreJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeRestoreJobAsync(array $args = [])
* @method \Aws\Result describeScanJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeScanJobAsync(array $args = [])
* @method \Aws\Result disassociateBackupVaultMpaApprovalTeam(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateBackupVaultMpaApprovalTeamAsync(array $args = [])
* @method \Aws\Result disassociateRecoveryPoint(array $args = [])
@@ -95,6 +101,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getBackupVaultNotificationsAsync(array $args = [])
* @method \Aws\Result getLegalHold(array $args = [])
* @method \GuzzleHttp\Promise\Promise getLegalHoldAsync(array $args = [])
* @method \Aws\Result getPITRMalwareScanResults(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPITRMalwareScanResultsAsync(array $args = [])
* @method \Aws\Result getRecoveryPointIndexDetails(array $args = [])
* @method \GuzzleHttp\Promise\Promise getRecoveryPointIndexDetailsAsync(array $args = [])
* @method \Aws\Result getRecoveryPointRestoreMetadata(array $args = [])
@@ -109,6 +117,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getRestoreTestingSelectionAsync(array $args = [])
* @method \Aws\Result getSupportedResourceTypes(array $args = [])
* @method \GuzzleHttp\Promise\Promise getSupportedResourceTypesAsync(array $args = [])
* @method \Aws\Result getTieringConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise getTieringConfigurationAsync(array $args = [])
* @method \Aws\Result listBackupJobSummaries(array $args = [])
* @method \GuzzleHttp\Promise\Promise listBackupJobSummariesAsync(array $args = [])
* @method \Aws\Result listBackupJobs(array $args = [])
@@ -159,8 +169,14 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listRestoreTestingPlansAsync(array $args = [])
* @method \Aws\Result listRestoreTestingSelections(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRestoreTestingSelectionsAsync(array $args = [])
* @method \Aws\Result listScanJobSummaries(array $args = [])
* @method \GuzzleHttp\Promise\Promise listScanJobSummariesAsync(array $args = [])
* @method \Aws\Result listScanJobs(array $args = [])
* @method \GuzzleHttp\Promise\Promise listScanJobsAsync(array $args = [])
* @method \Aws\Result listTags(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsAsync(array $args = [])
* @method \Aws\Result listTieringConfigurations(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTieringConfigurationsAsync(array $args = [])
* @method \Aws\Result putBackupVaultAccessPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise putBackupVaultAccessPolicyAsync(array $args = [])
* @method \Aws\Result putBackupVaultLockConfiguration(array $args = [])
@@ -179,6 +195,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise startReportJobAsync(array $args = [])
* @method \Aws\Result startRestoreJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise startRestoreJobAsync(array $args = [])
* @method \Aws\Result startScanJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise startScanJobAsync(array $args = [])
* @method \Aws\Result stopBackupJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopBackupJobAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
@@ -203,5 +221,7 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise updateRestoreTestingPlanAsync(array $args = [])
* @method \Aws\Result updateRestoreTestingSelection(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateRestoreTestingSelectionAsync(array $args = [])
* @method \Aws\Result updateTieringConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateTieringConfigurationAsync(array $args = [])
*/
class BackupClient extends AwsClient {}
+28
View File
@@ -13,16 +13,24 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createConsumableResourceAsync(array $args = [])
* @method \Aws\Result createJobQueue(array $args = [])
* @method \GuzzleHttp\Promise\Promise createJobQueueAsync(array $args = [])
* @method \Aws\Result createQuotaShare(array $args = [])
* @method \GuzzleHttp\Promise\Promise createQuotaShareAsync(array $args = [])
* @method \Aws\Result createSchedulingPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise createSchedulingPolicyAsync(array $args = [])
* @method \Aws\Result createServiceEnvironment(array $args = [])
* @method \GuzzleHttp\Promise\Promise createServiceEnvironmentAsync(array $args = [])
* @method \Aws\Result deleteComputeEnvironment(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteComputeEnvironmentAsync(array $args = [])
* @method \Aws\Result deleteConsumableResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteConsumableResourceAsync(array $args = [])
* @method \Aws\Result deleteJobQueue(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteJobQueueAsync(array $args = [])
* @method \Aws\Result deleteQuotaShare(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteQuotaShareAsync(array $args = [])
* @method \Aws\Result deleteSchedulingPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteSchedulingPolicyAsync(array $args = [])
* @method \Aws\Result deleteServiceEnvironment(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteServiceEnvironmentAsync(array $args = [])
* @method \Aws\Result deregisterJobDefinition(array $args = [])
* @method \GuzzleHttp\Promise\Promise deregisterJobDefinitionAsync(array $args = [])
* @method \Aws\Result describeComputeEnvironments(array $args = [])
@@ -35,8 +43,14 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise describeJobQueuesAsync(array $args = [])
* @method \Aws\Result describeJobs(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeJobsAsync(array $args = [])
* @method \Aws\Result describeQuotaShare(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeQuotaShareAsync(array $args = [])
* @method \Aws\Result describeSchedulingPolicies(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeSchedulingPoliciesAsync(array $args = [])
* @method \Aws\Result describeServiceEnvironments(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeServiceEnvironmentsAsync(array $args = [])
* @method \Aws\Result describeServiceJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeServiceJobAsync(array $args = [])
* @method \Aws\Result getJobQueueSnapshot(array $args = [])
* @method \GuzzleHttp\Promise\Promise getJobQueueSnapshotAsync(array $args = [])
* @method \Aws\Result listConsumableResources(array $args = [])
@@ -45,18 +59,26 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listJobsAsync(array $args = [])
* @method \Aws\Result listJobsByConsumableResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listJobsByConsumableResourceAsync(array $args = [])
* @method \Aws\Result listQuotaShares(array $args = [])
* @method \GuzzleHttp\Promise\Promise listQuotaSharesAsync(array $args = [])
* @method \Aws\Result listSchedulingPolicies(array $args = [])
* @method \GuzzleHttp\Promise\Promise listSchedulingPoliciesAsync(array $args = [])
* @method \Aws\Result listServiceJobs(array $args = [])
* @method \GuzzleHttp\Promise\Promise listServiceJobsAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result registerJobDefinition(array $args = [])
* @method \GuzzleHttp\Promise\Promise registerJobDefinitionAsync(array $args = [])
* @method \Aws\Result submitJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise submitJobAsync(array $args = [])
* @method \Aws\Result submitServiceJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise submitServiceJobAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result terminateJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise terminateJobAsync(array $args = [])
* @method \Aws\Result terminateServiceJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise terminateServiceJobAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateComputeEnvironment(array $args = [])
@@ -65,7 +87,13 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise updateConsumableResourceAsync(array $args = [])
* @method \Aws\Result updateJobQueue(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateJobQueueAsync(array $args = [])
* @method \Aws\Result updateQuotaShare(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateQuotaShareAsync(array $args = [])
* @method \Aws\Result updateSchedulingPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateSchedulingPolicyAsync(array $args = [])
* @method \Aws\Result updateServiceEnvironment(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateServiceEnvironmentAsync(array $args = [])
* @method \Aws\Result updateServiceJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateServiceJobAsync(array $args = [])
*/
class BatchClient extends AwsClient {}
+84
View File
@@ -5,10 +5,24 @@ use Aws\AwsClient;
/**
* This client is used to interact with the **Amazon Bedrock** service.
* @method \Aws\Result batchDeleteAdvancedPromptOptimizationJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchDeleteAdvancedPromptOptimizationJobAsync(array $args = [])
* @method \Aws\Result batchDeleteEvaluationJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchDeleteEvaluationJobAsync(array $args = [])
* @method \Aws\Result cancelAutomatedReasoningPolicyBuildWorkflow(array $args = [])
* @method \GuzzleHttp\Promise\Promise cancelAutomatedReasoningPolicyBuildWorkflowAsync(array $args = [])
* @method \Aws\Result createAdvancedPromptOptimizationJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAdvancedPromptOptimizationJobAsync(array $args = [])
* @method \Aws\Result createAutomatedReasoningPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAutomatedReasoningPolicyAsync(array $args = [])
* @method \Aws\Result createAutomatedReasoningPolicyTestCase(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAutomatedReasoningPolicyTestCaseAsync(array $args = [])
* @method \Aws\Result createAutomatedReasoningPolicyVersion(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAutomatedReasoningPolicyVersionAsync(array $args = [])
* @method \Aws\Result createCustomModel(array $args = [])
* @method \GuzzleHttp\Promise\Promise createCustomModelAsync(array $args = [])
* @method \Aws\Result createCustomModelDeployment(array $args = [])
* @method \GuzzleHttp\Promise\Promise createCustomModelDeploymentAsync(array $args = [])
* @method \Aws\Result createEvaluationJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise createEvaluationJobAsync(array $args = [])
* @method \Aws\Result createFoundationModelAgreement(array $args = [])
@@ -33,8 +47,18 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createPromptRouterAsync(array $args = [])
* @method \Aws\Result createProvisionedModelThroughput(array $args = [])
* @method \GuzzleHttp\Promise\Promise createProvisionedModelThroughputAsync(array $args = [])
* @method \Aws\Result deleteAutomatedReasoningPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAutomatedReasoningPolicyAsync(array $args = [])
* @method \Aws\Result deleteAutomatedReasoningPolicyBuildWorkflow(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAutomatedReasoningPolicyBuildWorkflowAsync(array $args = [])
* @method \Aws\Result deleteAutomatedReasoningPolicyTestCase(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAutomatedReasoningPolicyTestCaseAsync(array $args = [])
* @method \Aws\Result deleteCustomModel(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteCustomModelAsync(array $args = [])
* @method \Aws\Result deleteCustomModelDeployment(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteCustomModelDeploymentAsync(array $args = [])
* @method \Aws\Result deleteEnforcedGuardrailConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteEnforcedGuardrailConfigurationAsync(array $args = [])
* @method \Aws\Result deleteFoundationModelAgreement(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteFoundationModelAgreementAsync(array $args = [])
* @method \Aws\Result deleteGuardrail(array $args = [])
@@ -51,10 +75,34 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise deletePromptRouterAsync(array $args = [])
* @method \Aws\Result deleteProvisionedModelThroughput(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteProvisionedModelThroughputAsync(array $args = [])
* @method \Aws\Result deleteResourcePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteResourcePolicyAsync(array $args = [])
* @method \Aws\Result deregisterMarketplaceModelEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise deregisterMarketplaceModelEndpointAsync(array $args = [])
* @method \Aws\Result exportAutomatedReasoningPolicyVersion(array $args = [])
* @method \GuzzleHttp\Promise\Promise exportAutomatedReasoningPolicyVersionAsync(array $args = [])
* @method \Aws\Result getAccountDataRetention(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAccountDataRetentionAsync(array $args = [])
* @method \Aws\Result getAdvancedPromptOptimizationJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAdvancedPromptOptimizationJobAsync(array $args = [])
* @method \Aws\Result getAutomatedReasoningPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAutomatedReasoningPolicyAsync(array $args = [])
* @method \Aws\Result getAutomatedReasoningPolicyAnnotations(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAutomatedReasoningPolicyAnnotationsAsync(array $args = [])
* @method \Aws\Result getAutomatedReasoningPolicyBuildWorkflow(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAutomatedReasoningPolicyBuildWorkflowAsync(array $args = [])
* @method \Aws\Result getAutomatedReasoningPolicyBuildWorkflowResultAssets(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAutomatedReasoningPolicyBuildWorkflowResultAssetsAsync(array $args = [])
* @method \Aws\Result getAutomatedReasoningPolicyNextScenario(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAutomatedReasoningPolicyNextScenarioAsync(array $args = [])
* @method \Aws\Result getAutomatedReasoningPolicyTestCase(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAutomatedReasoningPolicyTestCaseAsync(array $args = [])
* @method \Aws\Result getAutomatedReasoningPolicyTestResult(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAutomatedReasoningPolicyTestResultAsync(array $args = [])
* @method \Aws\Result getCustomModel(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCustomModelAsync(array $args = [])
* @method \Aws\Result getCustomModelDeployment(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCustomModelDeploymentAsync(array $args = [])
* @method \Aws\Result getEvaluationJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise getEvaluationJobAsync(array $args = [])
* @method \Aws\Result getFoundationModel(array $args = [])
@@ -83,10 +131,26 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getPromptRouterAsync(array $args = [])
* @method \Aws\Result getProvisionedModelThroughput(array $args = [])
* @method \GuzzleHttp\Promise\Promise getProvisionedModelThroughputAsync(array $args = [])
* @method \Aws\Result getResourcePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise getResourcePolicyAsync(array $args = [])
* @method \Aws\Result getUseCaseForModelAccess(array $args = [])
* @method \GuzzleHttp\Promise\Promise getUseCaseForModelAccessAsync(array $args = [])
* @method \Aws\Result listAdvancedPromptOptimizationJobs(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAdvancedPromptOptimizationJobsAsync(array $args = [])
* @method \Aws\Result listAutomatedReasoningPolicies(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAutomatedReasoningPoliciesAsync(array $args = [])
* @method \Aws\Result listAutomatedReasoningPolicyBuildWorkflows(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAutomatedReasoningPolicyBuildWorkflowsAsync(array $args = [])
* @method \Aws\Result listAutomatedReasoningPolicyTestCases(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAutomatedReasoningPolicyTestCasesAsync(array $args = [])
* @method \Aws\Result listAutomatedReasoningPolicyTestResults(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAutomatedReasoningPolicyTestResultsAsync(array $args = [])
* @method \Aws\Result listCustomModelDeployments(array $args = [])
* @method \GuzzleHttp\Promise\Promise listCustomModelDeploymentsAsync(array $args = [])
* @method \Aws\Result listCustomModels(array $args = [])
* @method \GuzzleHttp\Promise\Promise listCustomModelsAsync(array $args = [])
* @method \Aws\Result listEnforcedGuardrailsConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise listEnforcedGuardrailsConfigurationAsync(array $args = [])
* @method \Aws\Result listEvaluationJobs(array $args = [])
* @method \GuzzleHttp\Promise\Promise listEvaluationJobsAsync(array $args = [])
* @method \Aws\Result listFoundationModelAgreementOffers(array $args = [])
@@ -115,12 +179,24 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listProvisionedModelThroughputsAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result putAccountDataRetention(array $args = [])
* @method \GuzzleHttp\Promise\Promise putAccountDataRetentionAsync(array $args = [])
* @method \Aws\Result putEnforcedGuardrailConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise putEnforcedGuardrailConfigurationAsync(array $args = [])
* @method \Aws\Result putModelInvocationLoggingConfiguration(array $args = [])
* @method \GuzzleHttp\Promise\Promise putModelInvocationLoggingConfigurationAsync(array $args = [])
* @method \Aws\Result putResourcePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise putResourcePolicyAsync(array $args = [])
* @method \Aws\Result putUseCaseForModelAccess(array $args = [])
* @method \GuzzleHttp\Promise\Promise putUseCaseForModelAccessAsync(array $args = [])
* @method \Aws\Result registerMarketplaceModelEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise registerMarketplaceModelEndpointAsync(array $args = [])
* @method \Aws\Result startAutomatedReasoningPolicyBuildWorkflow(array $args = [])
* @method \GuzzleHttp\Promise\Promise startAutomatedReasoningPolicyBuildWorkflowAsync(array $args = [])
* @method \Aws\Result startAutomatedReasoningPolicyTestWorkflow(array $args = [])
* @method \GuzzleHttp\Promise\Promise startAutomatedReasoningPolicyTestWorkflowAsync(array $args = [])
* @method \Aws\Result stopAdvancedPromptOptimizationJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopAdvancedPromptOptimizationJobAsync(array $args = [])
* @method \Aws\Result stopEvaluationJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopEvaluationJobAsync(array $args = [])
* @method \Aws\Result stopModelCustomizationJob(array $args = [])
@@ -131,6 +207,14 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateAutomatedReasoningPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAutomatedReasoningPolicyAsync(array $args = [])
* @method \Aws\Result updateAutomatedReasoningPolicyAnnotations(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAutomatedReasoningPolicyAnnotationsAsync(array $args = [])
* @method \Aws\Result updateAutomatedReasoningPolicyTestCase(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAutomatedReasoningPolicyTestCaseAsync(array $args = [])
* @method \Aws\Result updateCustomModelDeployment(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateCustomModelDeploymentAsync(array $args = [])
* @method \Aws\Result updateGuardrail(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateGuardrailAsync(array $args = [])
* @method \Aws\Result updateMarketplaceModelEndpoint(array $args = [])
@@ -51,6 +51,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise deleteKnowledgeBaseDocumentsAsync(array $args = [])
* @method \Aws\Result deletePrompt(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePromptAsync(array $args = [])
* @method \Aws\Result deleteResourcePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteResourcePolicyAsync(array $args = [])
* @method \Aws\Result disassociateAgentCollaborator(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateAgentCollaboratorAsync(array $args = [])
* @method \Aws\Result disassociateAgentKnowledgeBase(array $args = [])
@@ -83,6 +85,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getKnowledgeBaseDocumentsAsync(array $args = [])
* @method \Aws\Result getPrompt(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPromptAsync(array $args = [])
* @method \Aws\Result getResourcePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise getResourcePolicyAsync(array $args = [])
* @method \Aws\Result ingestKnowledgeBaseDocuments(array $args = [])
* @method \GuzzleHttp\Promise\Promise ingestKnowledgeBaseDocumentsAsync(array $args = [])
* @method \Aws\Result listAgentActionGroups(array $args = [])
@@ -119,6 +123,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise prepareAgentAsync(array $args = [])
* @method \Aws\Result prepareFlow(array $args = [])
* @method \GuzzleHttp\Promise\Promise prepareFlowAsync(array $args = [])
* @method \Aws\Result putResourcePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise putResourcePolicyAsync(array $args = [])
* @method \Aws\Result startIngestionJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise startIngestionJobAsync(array $args = [])
* @method \Aws\Result stopIngestionJob(array $args = [])
@@ -0,0 +1,139 @@
<?php
namespace Aws\BedrockAgentCore;
use Aws\AwsClient;
/**
* This client is used to interact with the **Amazon Bedrock AgentCore Data Plane Fronting Layer** service.
* @method \Aws\Result batchCreateMemoryRecords(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchCreateMemoryRecordsAsync(array $args = [])
* @method \Aws\Result batchDeleteMemoryRecords(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchDeleteMemoryRecordsAsync(array $args = [])
* @method \Aws\Result batchUpdateMemoryRecords(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchUpdateMemoryRecordsAsync(array $args = [])
* @method \Aws\Result completeResourceTokenAuth(array $args = [])
* @method \GuzzleHttp\Promise\Promise completeResourceTokenAuthAsync(array $args = [])
* @method \Aws\Result createABTest(array $args = [])
* @method \GuzzleHttp\Promise\Promise createABTestAsync(array $args = [])
* @method \Aws\Result createEvent(array $args = [])
* @method \GuzzleHttp\Promise\Promise createEventAsync(array $args = [])
* @method \Aws\Result createPaymentInstrument(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPaymentInstrumentAsync(array $args = [])
* @method \Aws\Result createPaymentSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPaymentSessionAsync(array $args = [])
* @method \Aws\Result deleteABTest(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteABTestAsync(array $args = [])
* @method \Aws\Result deleteBatchEvaluation(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteBatchEvaluationAsync(array $args = [])
* @method \Aws\Result deleteEvent(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteEventAsync(array $args = [])
* @method \Aws\Result deleteMemoryRecord(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteMemoryRecordAsync(array $args = [])
* @method \Aws\Result deletePaymentInstrument(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePaymentInstrumentAsync(array $args = [])
* @method \Aws\Result deletePaymentSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePaymentSessionAsync(array $args = [])
* @method \Aws\Result deleteRecommendation(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteRecommendationAsync(array $args = [])
* @method \Aws\Result evaluate(array $args = [])
* @method \GuzzleHttp\Promise\Promise evaluateAsync(array $args = [])
* @method \Aws\Result getABTest(array $args = [])
* @method \GuzzleHttp\Promise\Promise getABTestAsync(array $args = [])
* @method \Aws\Result getAgentCard(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAgentCardAsync(array $args = [])
* @method \Aws\Result getBatchEvaluation(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBatchEvaluationAsync(array $args = [])
* @method \Aws\Result getBrowserSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBrowserSessionAsync(array $args = [])
* @method \Aws\Result getCodeInterpreterSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCodeInterpreterSessionAsync(array $args = [])
* @method \Aws\Result getEvent(array $args = [])
* @method \GuzzleHttp\Promise\Promise getEventAsync(array $args = [])
* @method \Aws\Result getMemoryRecord(array $args = [])
* @method \GuzzleHttp\Promise\Promise getMemoryRecordAsync(array $args = [])
* @method \Aws\Result getPaymentInstrument(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPaymentInstrumentAsync(array $args = [])
* @method \Aws\Result getPaymentInstrumentBalance(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPaymentInstrumentBalanceAsync(array $args = [])
* @method \Aws\Result getPaymentSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPaymentSessionAsync(array $args = [])
* @method \Aws\Result getRecommendation(array $args = [])
* @method \GuzzleHttp\Promise\Promise getRecommendationAsync(array $args = [])
* @method \Aws\Result getResourceApiKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise getResourceApiKeyAsync(array $args = [])
* @method \Aws\Result getResourceOauth2Token(array $args = [])
* @method \GuzzleHttp\Promise\Promise getResourceOauth2TokenAsync(array $args = [])
* @method \Aws\Result getResourcePaymentToken(array $args = [])
* @method \GuzzleHttp\Promise\Promise getResourcePaymentTokenAsync(array $args = [])
* @method \Aws\Result getWorkloadAccessToken(array $args = [])
* @method \GuzzleHttp\Promise\Promise getWorkloadAccessTokenAsync(array $args = [])
* @method \Aws\Result getWorkloadAccessTokenForJWT(array $args = [])
* @method \GuzzleHttp\Promise\Promise getWorkloadAccessTokenForJWTAsync(array $args = [])
* @method \Aws\Result getWorkloadAccessTokenForUserId(array $args = [])
* @method \GuzzleHttp\Promise\Promise getWorkloadAccessTokenForUserIdAsync(array $args = [])
* @method \Aws\Result invokeAgentRuntime(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeAgentRuntimeAsync(array $args = [])
* @method \Aws\Result invokeAgentRuntimeCommand(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeAgentRuntimeCommandAsync(array $args = [])
* @method \Aws\Result invokeBrowser(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeBrowserAsync(array $args = [])
* @method \Aws\Result invokeCodeInterpreter(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeCodeInterpreterAsync(array $args = [])
* @method \Aws\Result invokeHarness(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeHarnessAsync(array $args = [])
* @method \Aws\Result listABTests(array $args = [])
* @method \GuzzleHttp\Promise\Promise listABTestsAsync(array $args = [])
* @method \Aws\Result listActors(array $args = [])
* @method \GuzzleHttp\Promise\Promise listActorsAsync(array $args = [])
* @method \Aws\Result listBatchEvaluations(array $args = [])
* @method \GuzzleHttp\Promise\Promise listBatchEvaluationsAsync(array $args = [])
* @method \Aws\Result listBrowserSessions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listBrowserSessionsAsync(array $args = [])
* @method \Aws\Result listCodeInterpreterSessions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listCodeInterpreterSessionsAsync(array $args = [])
* @method \Aws\Result listEvents(array $args = [])
* @method \GuzzleHttp\Promise\Promise listEventsAsync(array $args = [])
* @method \Aws\Result listMemoryExtractionJobs(array $args = [])
* @method \GuzzleHttp\Promise\Promise listMemoryExtractionJobsAsync(array $args = [])
* @method \Aws\Result listMemoryRecords(array $args = [])
* @method \GuzzleHttp\Promise\Promise listMemoryRecordsAsync(array $args = [])
* @method \Aws\Result listPaymentInstruments(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPaymentInstrumentsAsync(array $args = [])
* @method \Aws\Result listPaymentSessions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPaymentSessionsAsync(array $args = [])
* @method \Aws\Result listRecommendations(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRecommendationsAsync(array $args = [])
* @method \Aws\Result listSessions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listSessionsAsync(array $args = [])
* @method \Aws\Result processPayment(array $args = [])
* @method \GuzzleHttp\Promise\Promise processPaymentAsync(array $args = [])
* @method \Aws\Result retrieveMemoryRecords(array $args = [])
* @method \GuzzleHttp\Promise\Promise retrieveMemoryRecordsAsync(array $args = [])
* @method \Aws\Result saveBrowserSessionProfile(array $args = [])
* @method \GuzzleHttp\Promise\Promise saveBrowserSessionProfileAsync(array $args = [])
* @method \Aws\Result searchRegistryRecords(array $args = [])
* @method \GuzzleHttp\Promise\Promise searchRegistryRecordsAsync(array $args = [])
* @method \Aws\Result startBatchEvaluation(array $args = [])
* @method \GuzzleHttp\Promise\Promise startBatchEvaluationAsync(array $args = [])
* @method \Aws\Result startBrowserSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise startBrowserSessionAsync(array $args = [])
* @method \Aws\Result startCodeInterpreterSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise startCodeInterpreterSessionAsync(array $args = [])
* @method \Aws\Result startMemoryExtractionJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise startMemoryExtractionJobAsync(array $args = [])
* @method \Aws\Result startRecommendation(array $args = [])
* @method \GuzzleHttp\Promise\Promise startRecommendationAsync(array $args = [])
* @method \Aws\Result stopBatchEvaluation(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopBatchEvaluationAsync(array $args = [])
* @method \Aws\Result stopBrowserSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopBrowserSessionAsync(array $args = [])
* @method \Aws\Result stopCodeInterpreterSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopCodeInterpreterSessionAsync(array $args = [])
* @method \Aws\Result stopRuntimeSession(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopRuntimeSessionAsync(array $args = [])
* @method \Aws\Result updateABTest(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateABTestAsync(array $args = [])
* @method \Aws\Result updateBrowserStream(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateBrowserStreamAsync(array $args = [])
*/
class BedrockAgentCoreClient extends AwsClient {}
@@ -0,0 +1,9 @@
<?php
namespace Aws\BedrockAgentCore\Exception;
use Aws\Exception\AwsException;
/**
* Represents an error interacting with the **Amazon Bedrock AgentCore Data Plane Fronting Layer** service.
*/
class BedrockAgentCoreException extends AwsException {}
@@ -0,0 +1,315 @@
<?php
namespace Aws\BedrockAgentCoreControl;
use Aws\AwsClient;
/**
* This client is used to interact with the **Amazon Bedrock Agent Core Control Plane Fronting Layer** service.
* @method \Aws\Result addDatasetExamples(array $args = [])
* @method \GuzzleHttp\Promise\Promise addDatasetExamplesAsync(array $args = [])
* @method \Aws\Result createAgentRuntime(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAgentRuntimeAsync(array $args = [])
* @method \Aws\Result createAgentRuntimeEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise createAgentRuntimeEndpointAsync(array $args = [])
* @method \Aws\Result createApiKeyCredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise createApiKeyCredentialProviderAsync(array $args = [])
* @method \Aws\Result createBrowser(array $args = [])
* @method \GuzzleHttp\Promise\Promise createBrowserAsync(array $args = [])
* @method \Aws\Result createBrowserProfile(array $args = [])
* @method \GuzzleHttp\Promise\Promise createBrowserProfileAsync(array $args = [])
* @method \Aws\Result createCodeInterpreter(array $args = [])
* @method \GuzzleHttp\Promise\Promise createCodeInterpreterAsync(array $args = [])
* @method \Aws\Result createConfigurationBundle(array $args = [])
* @method \GuzzleHttp\Promise\Promise createConfigurationBundleAsync(array $args = [])
* @method \Aws\Result createDataset(array $args = [])
* @method \GuzzleHttp\Promise\Promise createDatasetAsync(array $args = [])
* @method \Aws\Result createDatasetVersion(array $args = [])
* @method \GuzzleHttp\Promise\Promise createDatasetVersionAsync(array $args = [])
* @method \Aws\Result createEvaluator(array $args = [])
* @method \GuzzleHttp\Promise\Promise createEvaluatorAsync(array $args = [])
* @method \Aws\Result createGateway(array $args = [])
* @method \GuzzleHttp\Promise\Promise createGatewayAsync(array $args = [])
* @method \Aws\Result createGatewayRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise createGatewayRuleAsync(array $args = [])
* @method \Aws\Result createGatewayTarget(array $args = [])
* @method \GuzzleHttp\Promise\Promise createGatewayTargetAsync(array $args = [])
* @method \Aws\Result createHarness(array $args = [])
* @method \GuzzleHttp\Promise\Promise createHarnessAsync(array $args = [])
* @method \Aws\Result createHarnessEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise createHarnessEndpointAsync(array $args = [])
* @method \Aws\Result createMemory(array $args = [])
* @method \GuzzleHttp\Promise\Promise createMemoryAsync(array $args = [])
* @method \Aws\Result createOauth2CredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise createOauth2CredentialProviderAsync(array $args = [])
* @method \Aws\Result createOnlineEvaluationConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise createOnlineEvaluationConfigAsync(array $args = [])
* @method \Aws\Result createPaymentConnector(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPaymentConnectorAsync(array $args = [])
* @method \Aws\Result createPaymentCredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPaymentCredentialProviderAsync(array $args = [])
* @method \Aws\Result createPaymentManager(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPaymentManagerAsync(array $args = [])
* @method \Aws\Result createPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPolicyAsync(array $args = [])
* @method \Aws\Result createPolicyEngine(array $args = [])
* @method \GuzzleHttp\Promise\Promise createPolicyEngineAsync(array $args = [])
* @method \Aws\Result createRegistry(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRegistryAsync(array $args = [])
* @method \Aws\Result createRegistryRecord(array $args = [])
* @method \GuzzleHttp\Promise\Promise createRegistryRecordAsync(array $args = [])
* @method \Aws\Result createWorkloadIdentity(array $args = [])
* @method \GuzzleHttp\Promise\Promise createWorkloadIdentityAsync(array $args = [])
* @method \Aws\Result deleteAgentRuntime(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAgentRuntimeAsync(array $args = [])
* @method \Aws\Result deleteAgentRuntimeEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAgentRuntimeEndpointAsync(array $args = [])
* @method \Aws\Result deleteApiKeyCredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteApiKeyCredentialProviderAsync(array $args = [])
* @method \Aws\Result deleteBrowser(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteBrowserAsync(array $args = [])
* @method \Aws\Result deleteBrowserProfile(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteBrowserProfileAsync(array $args = [])
* @method \Aws\Result deleteCodeInterpreter(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteCodeInterpreterAsync(array $args = [])
* @method \Aws\Result deleteConfigurationBundle(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteConfigurationBundleAsync(array $args = [])
* @method \Aws\Result deleteDataset(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteDatasetAsync(array $args = [])
* @method \Aws\Result deleteDatasetExamples(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteDatasetExamplesAsync(array $args = [])
* @method \Aws\Result deleteEvaluator(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteEvaluatorAsync(array $args = [])
* @method \Aws\Result deleteGateway(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteGatewayAsync(array $args = [])
* @method \Aws\Result deleteGatewayRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteGatewayRuleAsync(array $args = [])
* @method \Aws\Result deleteGatewayTarget(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteGatewayTargetAsync(array $args = [])
* @method \Aws\Result deleteHarness(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteHarnessAsync(array $args = [])
* @method \Aws\Result deleteHarnessEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteHarnessEndpointAsync(array $args = [])
* @method \Aws\Result deleteMemory(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteMemoryAsync(array $args = [])
* @method \Aws\Result deleteOauth2CredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteOauth2CredentialProviderAsync(array $args = [])
* @method \Aws\Result deleteOnlineEvaluationConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteOnlineEvaluationConfigAsync(array $args = [])
* @method \Aws\Result deletePaymentConnector(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePaymentConnectorAsync(array $args = [])
* @method \Aws\Result deletePaymentCredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePaymentCredentialProviderAsync(array $args = [])
* @method \Aws\Result deletePaymentManager(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePaymentManagerAsync(array $args = [])
* @method \Aws\Result deletePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePolicyAsync(array $args = [])
* @method \Aws\Result deletePolicyEngine(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePolicyEngineAsync(array $args = [])
* @method \Aws\Result deleteRegistry(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteRegistryAsync(array $args = [])
* @method \Aws\Result deleteRegistryRecord(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteRegistryRecordAsync(array $args = [])
* @method \Aws\Result deleteResourcePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteResourcePolicyAsync(array $args = [])
* @method \Aws\Result deleteWorkloadIdentity(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteWorkloadIdentityAsync(array $args = [])
* @method \Aws\Result getAgentRuntime(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAgentRuntimeAsync(array $args = [])
* @method \Aws\Result getAgentRuntimeEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAgentRuntimeEndpointAsync(array $args = [])
* @method \Aws\Result getApiKeyCredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise getApiKeyCredentialProviderAsync(array $args = [])
* @method \Aws\Result getBrowser(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBrowserAsync(array $args = [])
* @method \Aws\Result getBrowserProfile(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBrowserProfileAsync(array $args = [])
* @method \Aws\Result getCodeInterpreter(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCodeInterpreterAsync(array $args = [])
* @method \Aws\Result getConfigurationBundle(array $args = [])
* @method \GuzzleHttp\Promise\Promise getConfigurationBundleAsync(array $args = [])
* @method \Aws\Result getConfigurationBundleVersion(array $args = [])
* @method \GuzzleHttp\Promise\Promise getConfigurationBundleVersionAsync(array $args = [])
* @method \Aws\Result getDataset(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDatasetAsync(array $args = [])
* @method \Aws\Result getEvaluator(array $args = [])
* @method \GuzzleHttp\Promise\Promise getEvaluatorAsync(array $args = [])
* @method \Aws\Result getGateway(array $args = [])
* @method \GuzzleHttp\Promise\Promise getGatewayAsync(array $args = [])
* @method \Aws\Result getGatewayRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise getGatewayRuleAsync(array $args = [])
* @method \Aws\Result getGatewayTarget(array $args = [])
* @method \GuzzleHttp\Promise\Promise getGatewayTargetAsync(array $args = [])
* @method \Aws\Result getHarness(array $args = [])
* @method \GuzzleHttp\Promise\Promise getHarnessAsync(array $args = [])
* @method \Aws\Result getHarnessEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise getHarnessEndpointAsync(array $args = [])
* @method \Aws\Result getMemory(array $args = [])
* @method \GuzzleHttp\Promise\Promise getMemoryAsync(array $args = [])
* @method \Aws\Result getOauth2CredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise getOauth2CredentialProviderAsync(array $args = [])
* @method \Aws\Result getOnlineEvaluationConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise getOnlineEvaluationConfigAsync(array $args = [])
* @method \Aws\Result getPaymentConnector(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPaymentConnectorAsync(array $args = [])
* @method \Aws\Result getPaymentCredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPaymentCredentialProviderAsync(array $args = [])
* @method \Aws\Result getPaymentManager(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPaymentManagerAsync(array $args = [])
* @method \Aws\Result getPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPolicyAsync(array $args = [])
* @method \Aws\Result getPolicyEngine(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPolicyEngineAsync(array $args = [])
* @method \Aws\Result getPolicyEngineSummary(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPolicyEngineSummaryAsync(array $args = [])
* @method \Aws\Result getPolicyGeneration(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPolicyGenerationAsync(array $args = [])
* @method \Aws\Result getPolicyGenerationSummary(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPolicyGenerationSummaryAsync(array $args = [])
* @method \Aws\Result getPolicySummary(array $args = [])
* @method \GuzzleHttp\Promise\Promise getPolicySummaryAsync(array $args = [])
* @method \Aws\Result getRegistry(array $args = [])
* @method \GuzzleHttp\Promise\Promise getRegistryAsync(array $args = [])
* @method \Aws\Result getRegistryRecord(array $args = [])
* @method \GuzzleHttp\Promise\Promise getRegistryRecordAsync(array $args = [])
* @method \Aws\Result getResourcePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise getResourcePolicyAsync(array $args = [])
* @method \Aws\Result getTokenVault(array $args = [])
* @method \GuzzleHttp\Promise\Promise getTokenVaultAsync(array $args = [])
* @method \Aws\Result getWorkloadIdentity(array $args = [])
* @method \GuzzleHttp\Promise\Promise getWorkloadIdentityAsync(array $args = [])
* @method \Aws\Result listAgentRuntimeEndpoints(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAgentRuntimeEndpointsAsync(array $args = [])
* @method \Aws\Result listAgentRuntimeVersions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAgentRuntimeVersionsAsync(array $args = [])
* @method \Aws\Result listAgentRuntimes(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAgentRuntimesAsync(array $args = [])
* @method \Aws\Result listApiKeyCredentialProviders(array $args = [])
* @method \GuzzleHttp\Promise\Promise listApiKeyCredentialProvidersAsync(array $args = [])
* @method \Aws\Result listBrowserProfiles(array $args = [])
* @method \GuzzleHttp\Promise\Promise listBrowserProfilesAsync(array $args = [])
* @method \Aws\Result listBrowsers(array $args = [])
* @method \GuzzleHttp\Promise\Promise listBrowsersAsync(array $args = [])
* @method \Aws\Result listCodeInterpreters(array $args = [])
* @method \GuzzleHttp\Promise\Promise listCodeInterpretersAsync(array $args = [])
* @method \Aws\Result listConfigurationBundleVersions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listConfigurationBundleVersionsAsync(array $args = [])
* @method \Aws\Result listConfigurationBundles(array $args = [])
* @method \GuzzleHttp\Promise\Promise listConfigurationBundlesAsync(array $args = [])
* @method \Aws\Result listDatasetExamples(array $args = [])
* @method \GuzzleHttp\Promise\Promise listDatasetExamplesAsync(array $args = [])
* @method \Aws\Result listDatasetVersions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listDatasetVersionsAsync(array $args = [])
* @method \Aws\Result listDatasets(array $args = [])
* @method \GuzzleHttp\Promise\Promise listDatasetsAsync(array $args = [])
* @method \Aws\Result listEvaluators(array $args = [])
* @method \GuzzleHttp\Promise\Promise listEvaluatorsAsync(array $args = [])
* @method \Aws\Result listGatewayRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise listGatewayRulesAsync(array $args = [])
* @method \Aws\Result listGatewayTargets(array $args = [])
* @method \GuzzleHttp\Promise\Promise listGatewayTargetsAsync(array $args = [])
* @method \Aws\Result listGateways(array $args = [])
* @method \GuzzleHttp\Promise\Promise listGatewaysAsync(array $args = [])
* @method \Aws\Result listHarnessEndpoints(array $args = [])
* @method \GuzzleHttp\Promise\Promise listHarnessEndpointsAsync(array $args = [])
* @method \Aws\Result listHarnessVersions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listHarnessVersionsAsync(array $args = [])
* @method \Aws\Result listHarnesses(array $args = [])
* @method \GuzzleHttp\Promise\Promise listHarnessesAsync(array $args = [])
* @method \Aws\Result listMemories(array $args = [])
* @method \GuzzleHttp\Promise\Promise listMemoriesAsync(array $args = [])
* @method \Aws\Result listOauth2CredentialProviders(array $args = [])
* @method \GuzzleHttp\Promise\Promise listOauth2CredentialProvidersAsync(array $args = [])
* @method \Aws\Result listOnlineEvaluationConfigs(array $args = [])
* @method \GuzzleHttp\Promise\Promise listOnlineEvaluationConfigsAsync(array $args = [])
* @method \Aws\Result listPaymentConnectors(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPaymentConnectorsAsync(array $args = [])
* @method \Aws\Result listPaymentCredentialProviders(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPaymentCredentialProvidersAsync(array $args = [])
* @method \Aws\Result listPaymentManagers(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPaymentManagersAsync(array $args = [])
* @method \Aws\Result listPolicies(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPoliciesAsync(array $args = [])
* @method \Aws\Result listPolicyEngineSummaries(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPolicyEngineSummariesAsync(array $args = [])
* @method \Aws\Result listPolicyEngines(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPolicyEnginesAsync(array $args = [])
* @method \Aws\Result listPolicyGenerationAssets(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPolicyGenerationAssetsAsync(array $args = [])
* @method \Aws\Result listPolicyGenerationSummaries(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPolicyGenerationSummariesAsync(array $args = [])
* @method \Aws\Result listPolicyGenerations(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPolicyGenerationsAsync(array $args = [])
* @method \Aws\Result listPolicySummaries(array $args = [])
* @method \GuzzleHttp\Promise\Promise listPolicySummariesAsync(array $args = [])
* @method \Aws\Result listRegistries(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRegistriesAsync(array $args = [])
* @method \Aws\Result listRegistryRecords(array $args = [])
* @method \GuzzleHttp\Promise\Promise listRegistryRecordsAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result listWorkloadIdentities(array $args = [])
* @method \GuzzleHttp\Promise\Promise listWorkloadIdentitiesAsync(array $args = [])
* @method \Aws\Result putResourcePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise putResourcePolicyAsync(array $args = [])
* @method \Aws\Result setTokenVaultCMK(array $args = [])
* @method \GuzzleHttp\Promise\Promise setTokenVaultCMKAsync(array $args = [])
* @method \Aws\Result startPolicyGeneration(array $args = [])
* @method \GuzzleHttp\Promise\Promise startPolicyGenerationAsync(array $args = [])
* @method \Aws\Result submitRegistryRecordForApproval(array $args = [])
* @method \GuzzleHttp\Promise\Promise submitRegistryRecordForApprovalAsync(array $args = [])
* @method \Aws\Result synchronizeGatewayTargets(array $args = [])
* @method \GuzzleHttp\Promise\Promise synchronizeGatewayTargetsAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateAgentRuntime(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAgentRuntimeAsync(array $args = [])
* @method \Aws\Result updateAgentRuntimeEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateAgentRuntimeEndpointAsync(array $args = [])
* @method \Aws\Result updateApiKeyCredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateApiKeyCredentialProviderAsync(array $args = [])
* @method \Aws\Result updateConfigurationBundle(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateConfigurationBundleAsync(array $args = [])
* @method \Aws\Result updateDataset(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateDatasetAsync(array $args = [])
* @method \Aws\Result updateDatasetExamples(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateDatasetExamplesAsync(array $args = [])
* @method \Aws\Result updateEvaluator(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateEvaluatorAsync(array $args = [])
* @method \Aws\Result updateGateway(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateGatewayAsync(array $args = [])
* @method \Aws\Result updateGatewayRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateGatewayRuleAsync(array $args = [])
* @method \Aws\Result updateGatewayTarget(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateGatewayTargetAsync(array $args = [])
* @method \Aws\Result updateHarness(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateHarnessAsync(array $args = [])
* @method \Aws\Result updateHarnessEndpoint(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateHarnessEndpointAsync(array $args = [])
* @method \Aws\Result updateMemory(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateMemoryAsync(array $args = [])
* @method \Aws\Result updateOauth2CredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateOauth2CredentialProviderAsync(array $args = [])
* @method \Aws\Result updateOnlineEvaluationConfig(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateOnlineEvaluationConfigAsync(array $args = [])
* @method \Aws\Result updatePaymentConnector(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePaymentConnectorAsync(array $args = [])
* @method \Aws\Result updatePaymentCredentialProvider(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePaymentCredentialProviderAsync(array $args = [])
* @method \Aws\Result updatePaymentManager(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePaymentManagerAsync(array $args = [])
* @method \Aws\Result updatePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePolicyAsync(array $args = [])
* @method \Aws\Result updatePolicyEngine(array $args = [])
* @method \GuzzleHttp\Promise\Promise updatePolicyEngineAsync(array $args = [])
* @method \Aws\Result updateRegistry(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateRegistryAsync(array $args = [])
* @method \Aws\Result updateRegistryRecord(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateRegistryRecordAsync(array $args = [])
* @method \Aws\Result updateRegistryRecordStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateRegistryRecordStatusAsync(array $args = [])
* @method \Aws\Result updateWorkloadIdentity(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateWorkloadIdentityAsync(array $args = [])
*/
class BedrockAgentCoreControlClient extends AwsClient {}
@@ -0,0 +1,9 @@
<?php
namespace Aws\BedrockAgentCoreControl\Exception;
use Aws\Exception\AwsException;
/**
* Represents an error interacting with the **Amazon Bedrock Agent Core Control Plane Fronting Layer** service.
*/
class BedrockAgentCoreControlException extends AwsException {}
@@ -5,6 +5,8 @@ use Aws\AwsClient;
/**
* This client is used to interact with the **Agents for Amazon Bedrock Runtime** service.
* @method \Aws\Result agenticRetrieveStream(array $args = [])
* @method \GuzzleHttp\Promise\Promise agenticRetrieveStreamAsync(array $args = [])
* @method \Aws\Result createInvocation(array $args = [])
* @method \GuzzleHttp\Promise\Promise createInvocationAsync(array $args = [])
* @method \Aws\Result createSession(array $args = [])
@@ -19,6 +21,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise generateQueryAsync(array $args = [])
* @method \Aws\Result getAgentMemory(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAgentMemoryAsync(array $args = [])
* @method \Aws\Result getDocumentContent(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDocumentContentAsync(array $args = [])
* @method \Aws\Result getExecutionFlowSnapshot(array $args = [])
* @method \GuzzleHttp\Promise\Promise getExecutionFlowSnapshotAsync(array $args = [])
* @method \Aws\Result getFlowExecution(array $args = [])
@@ -5,22 +5,46 @@ use Aws\AwsClient;
/**
* This client is used to interact with the **Data Automation for Amazon Bedrock** service.
* @method \Aws\Result copyBlueprintStage(array $args = [])
* @method \GuzzleHttp\Promise\Promise copyBlueprintStageAsync(array $args = [])
* @method \Aws\Result createBlueprint(array $args = [])
* @method \GuzzleHttp\Promise\Promise createBlueprintAsync(array $args = [])
* @method \Aws\Result createBlueprintVersion(array $args = [])
* @method \GuzzleHttp\Promise\Promise createBlueprintVersionAsync(array $args = [])
* @method \Aws\Result createDataAutomationLibrary(array $args = [])
* @method \GuzzleHttp\Promise\Promise createDataAutomationLibraryAsync(array $args = [])
* @method \Aws\Result createDataAutomationProject(array $args = [])
* @method \GuzzleHttp\Promise\Promise createDataAutomationProjectAsync(array $args = [])
* @method \Aws\Result deleteBlueprint(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteBlueprintAsync(array $args = [])
* @method \Aws\Result deleteDataAutomationLibrary(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteDataAutomationLibraryAsync(array $args = [])
* @method \Aws\Result deleteDataAutomationProject(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteDataAutomationProjectAsync(array $args = [])
* @method \Aws\Result getBlueprint(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBlueprintAsync(array $args = [])
* @method \Aws\Result getBlueprintOptimizationStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBlueprintOptimizationStatusAsync(array $args = [])
* @method \Aws\Result getDataAutomationLibrary(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDataAutomationLibraryAsync(array $args = [])
* @method \Aws\Result getDataAutomationLibraryEntity(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDataAutomationLibraryEntityAsync(array $args = [])
* @method \Aws\Result getDataAutomationLibraryIngestionJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDataAutomationLibraryIngestionJobAsync(array $args = [])
* @method \Aws\Result getDataAutomationProject(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDataAutomationProjectAsync(array $args = [])
* @method \Aws\Result invokeBlueprintOptimizationAsync(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeBlueprintOptimizationAsyncAsync(array $args = [])
* @method \Aws\Result invokeDataAutomationLibraryIngestionJob(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeDataAutomationLibraryIngestionJobAsync(array $args = [])
* @method \Aws\Result listBlueprints(array $args = [])
* @method \GuzzleHttp\Promise\Promise listBlueprintsAsync(array $args = [])
* @method \Aws\Result listDataAutomationLibraries(array $args = [])
* @method \GuzzleHttp\Promise\Promise listDataAutomationLibrariesAsync(array $args = [])
* @method \Aws\Result listDataAutomationLibraryEntities(array $args = [])
* @method \GuzzleHttp\Promise\Promise listDataAutomationLibraryEntitiesAsync(array $args = [])
* @method \Aws\Result listDataAutomationLibraryIngestionJobs(array $args = [])
* @method \GuzzleHttp\Promise\Promise listDataAutomationLibraryIngestionJobsAsync(array $args = [])
* @method \Aws\Result listDataAutomationProjects(array $args = [])
* @method \GuzzleHttp\Promise\Promise listDataAutomationProjectsAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
@@ -31,6 +55,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateBlueprint(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateBlueprintAsync(array $args = [])
* @method \Aws\Result updateDataAutomationLibrary(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateDataAutomationLibraryAsync(array $args = [])
* @method \Aws\Result updateDataAutomationProject(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateDataAutomationProjectAsync(array $args = [])
*/
@@ -7,6 +7,8 @@ use Aws\AwsClient;
* This client is used to interact with the **Runtime for Amazon Bedrock Data Automation** service.
* @method \Aws\Result getDataAutomationStatus(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDataAutomationStatusAsync(array $args = [])
* @method \Aws\Result invokeDataAutomation(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeDataAutomationAsync(array $args = [])
* @method \Aws\Result invokeDataAutomationAsync(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeDataAutomationAsyncAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
@@ -11,8 +11,12 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise converseAsync(array $args = [])
* @method \Aws\Result converseStream(array $args = [])
* @method \GuzzleHttp\Promise\Promise converseStreamAsync(array $args = [])
* @method \Aws\Result countTokens(array $args = [])
* @method \GuzzleHttp\Promise\Promise countTokensAsync(array $args = [])
* @method \Aws\Result getAsyncInvoke(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAsyncInvokeAsync(array $args = [])
* @method \Aws\Result invokeGuardrailChecks(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeGuardrailChecksAsync(array $args = [])
* @method \Aws\Result invokeModel(array $args = [])
* @method \GuzzleHttp\Promise\Promise invokeModelAsync(array $args = [])
* @method \Aws\Result invokeModelWithResponseStream(array $args = [])
+14
View File
@@ -5,12 +5,22 @@ use Aws\AwsClient;
/**
* This client is used to interact with the **AWS Billing** service.
* @method \Aws\Result associateSourceViews(array $args = [])
* @method \GuzzleHttp\Promise\Promise associateSourceViewsAsync(array $args = [])
* @method \Aws\Result createBillingView(array $args = [])
* @method \GuzzleHttp\Promise\Promise createBillingViewAsync(array $args = [])
* @method \Aws\Result deleteBillingView(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteBillingViewAsync(array $args = [])
* @method \Aws\Result disassociateSourceViews(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateSourceViewsAsync(array $args = [])
* @method \Aws\Result getBillingPreferences(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBillingPreferencesAsync(array $args = [])
* @method \Aws\Result getBillingView(array $args = [])
* @method \GuzzleHttp\Promise\Promise getBillingViewAsync(array $args = [])
* @method \Aws\Result getCreditAllocationHistory(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCreditAllocationHistoryAsync(array $args = [])
* @method \Aws\Result getCredits(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCreditsAsync(array $args = [])
* @method \Aws\Result getResourcePolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise getResourcePolicyAsync(array $args = [])
* @method \Aws\Result listBillingViews(array $args = [])
@@ -19,10 +29,14 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listSourceViewsForBillingViewAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result redeemCredits(array $args = [])
* @method \GuzzleHttp\Promise\Promise redeemCreditsAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateBillingPreferences(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateBillingPreferencesAsync(array $args = [])
* @method \Aws\Result updateBillingView(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateBillingViewAsync(array $args = [])
*/
+8
View File
@@ -13,6 +13,10 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createJobAsync(array $args = [])
* @method \Aws\Result createQuantumTask(array $args = [])
* @method \GuzzleHttp\Promise\Promise createQuantumTaskAsync(array $args = [])
* @method \Aws\Result createSpendingLimit(array $args = [])
* @method \GuzzleHttp\Promise\Promise createSpendingLimitAsync(array $args = [])
* @method \Aws\Result deleteSpendingLimit(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteSpendingLimitAsync(array $args = [])
* @method \Aws\Result getDevice(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDeviceAsync(array $args = [])
* @method \Aws\Result getJob(array $args = [])
@@ -27,9 +31,13 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise searchJobsAsync(array $args = [])
* @method \Aws\Result searchQuantumTasks(array $args = [])
* @method \GuzzleHttp\Promise\Promise searchQuantumTasksAsync(array $args = [])
* @method \Aws\Result searchSpendingLimits(array $args = [])
* @method \GuzzleHttp\Promise\Promise searchSpendingLimitsAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateSpendingLimit(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateSpendingLimitAsync(array $args = [])
*/
class BraketClient extends AwsClient {}
+664
View File
@@ -0,0 +1,664 @@
<?php
namespace Aws\Cbor;
use Aws\Cbor\Exception\CborException;
/**
* Decodes Concise Binary Object Representation encoded strings
* into PHP values according to RFC 8949
*
* https://www.rfc-editor.org/rfc/rfc8949.html
*
* Supports Major types 0-7 including:
* - Type 0: Unsigned integers
* - Type 1: Negative integers
* - Type 2: Byte strings
* - Type 3: Text strings (UTF-8)
* - Type 4: Arrays
* - Type 5: Maps
* - Type 6: Tagged values (timestamps)
* - Type 7: Simple values (null, bool, float)
*
* @internal
*/
final class CborDecoder
{
private int $offset;
private int $length;
/**
* Decode CBOR binary data to PHP value
*
* @param string $data The CBOR-encoded binary data to decode
*
* @return mixed The decoded PHP value (can be any type: int, string, array, bool, null, float)
* @throws CborException If data is empty or malformed CBOR
*/
public function decode(string $data): mixed
{
if ($data === '') {
throw new CborException("No data to decode");
}
$this->offset = 0;
$this->length = strlen($data);
return $this->decodeValue($data);
}
/**
* Decode multiple CBOR values from sequential binary data
*
* @param string $data The CBOR-encoded binary data containing multiple values
*
* @return array Array of decoded PHP values in the order they appear in the data
* @throws CborException If data is malformed CBOR
*/
public function decodeAll(string $data): array
{
$this->length = strlen($data);
$this->offset = 0;
$values = [];
while ($this->offset < $this->length) {
$values[] = $this->decodeValue($data);
}
return $values;
}
/**
* Decodes a single CBOR value at the current offset
*
* @param string $data Reference to the CBOR data being decoded
*
* @return mixed The decoded value
* @throws CborException If unexpected end of data or invalid CBOR format
*/
private function decodeValue(string &$data): mixed
{
$offset = $this->offset;
$length = $this->length;
if ($offset >= $length) {
throw new CborException("Unexpected end of data");
}
$byte = ord($data[$offset++]);
$majorType = $byte >> 5;
$info = $byte & 0x1F;
switch ($majorType) {
case 0: // Unsigned integer
if ($info < 24) {
$this->offset = $offset;
return $info;
}
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 1;
return ord($data[$offset]);
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 2;
return (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 4;
return unpack('N', $data, $offset)[1];
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 8;
return unpack('J', $data, $offset)[1];
default:
throw new CborException("Invalid additional info for integer: $info");
}
case 1: // Negative integer
if ($info < 24) {
$this->offset = $offset;
return -1 - $info;
}
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 1;
return -1 - ord($data[$offset]);
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 2;
return -1 - ((ord($data[$offset]) << 8) | ord($data[$offset + 1]));
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 4;
return -1 - unpack('N', $data, $offset)[1];
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 8;
$unsigned = unpack('J', $data, $offset)[1];
return ($unsigned === 9223372036854775807) ? PHP_INT_MIN : -1 - $unsigned;
default:
throw new CborException("Invalid additional info for integer: $info");
}
case 2: // Byte string
if ($info < 24) {
$len = $info;
} else {
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$len = ord($data[$offset++]);
break;
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$len = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$offset += 2;
break;
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('N', $data, $offset)[1];
$offset += 4;
break;
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('J', $data, $offset)[1];
$offset += 8;
break;
case 31:
$this->offset = $offset;
return $this->decodeIndefiniteString($data, 0x40);
default:
throw new CborException("Invalid additional info for byte string: $info");
}
}
if ($offset + $len > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + $len;
return substr($data, $offset, $len);
case 3: // Text string
if ($info < 24) {
$len = $info;
} else {
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$len = ord($data[$offset++]);
break;
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$len = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$offset += 2;
break;
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('N', $data, $offset)[1];
$offset += 4;
break;
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('J', $data, $offset)[1];
$offset += 8;
break;
case 31:
$this->offset = $offset;
return $this->decodeIndefiniteString($data, 0x60);
default:
throw new CborException("Invalid additional info for text string: $info");
}
}
if ($offset + $len > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + $len;
return substr($data, $offset, $len);
case 4: // Array
if ($info < 24) {
$count = $info;
} else {
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$count = ord($data[$offset++]);
break;
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$count = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$offset += 2;
break;
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$count = unpack('N', $data, $offset)[1];
$offset += 4;
break;
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$count = unpack('J', $data, $offset)[1];
$offset += 8;
break;
case 31:
$this->offset = $offset;
return $this->decodeIndefiniteArray($data);
default:
throw new CborException("Invalid additional info for array: $info");
}
}
$this->offset = $offset;
$arr = [];
for ($i = 0; $i < $count; $i++) {
$arr[] = $this->decodeValue($data);
}
return $arr;
case 5: // Map
if ($info < 24) {
$count = $info;
} else {
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$count = ord($data[$offset++]);
break;
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$count = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$offset += 2;
break;
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$count = unpack('N', $data, $offset)[1];
$offset += 4;
break;
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$count = unpack('J', $data, $offset)[1];
$offset += 8;
break;
case 31:
$this->offset = $offset;
return $this->decodeIndefiniteMap($data);
default:
throw new CborException("Invalid additional info for map: $info");
}
}
$this->offset = $offset;
$map = [];
for ($i = 0; $i < $count; $i++) {
$key = $this->decodeValue($data);
$map[$key] = $this->decodeValue($data);
}
return $map;
case 6: // Tag
switch ($info) {
case 24:
$offset++;
break;
case 25:
$offset += 2;
break;
case 26:
$offset += 4;
break;
case 27:
$offset += 8;
break;
}
$this->offset = $offset;
return $this->decodeValue($data);
case 7: // Simple/float
switch ($info) {
case 20:
$this->offset = $offset;
return false;
case 21:
$this->offset = $offset;
return true;
case 22:
case 23:
$this->offset = $offset;
return null;
case 25: // Half-precision float
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 2;
$half = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$sign = ($half >> 15) & 0x01;
$exp = ($half >> 10) & 0x1F;
$mant = $half & 0x3FF;
if ($exp === 0) {
return $mant === 0
? ($sign ? -0.0 : 0.0)
: ($sign ? -1 : 1) * pow(2, -14) * ($mant / 1024);
}
if ($exp === 31) {
return $mant === 0 ? ($sign ? -INF : INF) : NAN;
}
return (float) (($sign ? -1 : 1) * pow(2, $exp - 15) * (1 + $mant / 1024));
case 26: // Single-precision float
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 4;
return unpack('G', $data, $offset)[1];
case 27: // Double-precision float
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$this->offset = $offset + 8;
return unpack('E', $data, $offset)[1];
case 31:
throw new CborException("Unexpected break");
default:
throw new CborException("Unknown simple value: $info");
}
default:
throw new CborException("Unknown major type: $majorType");
}
}
/**
* Decode indefinite-length string (byte or text)
*
* @param string $data Reference to the CBOR data being decoded
* @param int $expectedMajor Expected major type (0x40 for byte string, 0x60 for text string)
*
* @return string The concatenated string from all chunks
* @throws CborException If invalid chunk format or unexpected end of data
*/
private function decodeIndefiniteString(string &$data, int $expectedMajor): string
{
$chunks = [];
while (true) {
$offset = $this->offset;
$length = $this->length;
if ($offset >= $length) {
throw new CborException("Unexpected end of data");
}
$byte = ord($data[$offset++]);
if ($byte === 0xFF) {
$this->offset = $offset;
return implode('', $chunks);
}
if (($byte & 0xE0) !== $expectedMajor) {
throw new CborException("Invalid chunk in indefinite string");
}
$info = $byte & 0x1F;
if ($info === 31) {
throw new CborException("Nested indefinite string");
}
if ($info < 24) {
$len = $info;
} else {
switch ($info) {
case 24:
if ($offset >= $length) {
throw new CborException("Not enough data");
}
$len = ord($data[$offset++]);
break;
case 25:
if ($offset + 2 > $length) {
throw new CborException("Not enough data");
}
$len = (ord($data[$offset]) << 8) | ord($data[$offset + 1]);
$offset += 2;
break;
case 26:
if ($offset + 4 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('N', $data, $offset)[1];
$offset += 4;
break;
case 27:
if ($offset + 8 > $length) {
throw new CborException("Not enough data");
}
$len = unpack('J', $data, $offset)[1];
$offset += 8;
break;
default:
throw new CborException("Invalid chunk length info: $info");
}
}
if ($offset + $len > $length) {
throw new CborException("Not enough data for chunk");
}
$chunks[] = substr($data, $offset, $len);
$this->offset = $offset + $len;
}
}
/**
* Decode indefinite-length array
*
* @param string $data Reference to the CBOR data being decoded
*
* @return array The decoded array elements
* @throws CborException If unexpected end of data
*/
private function decodeIndefiniteArray(string &$data): array
{
$result = [];
while (true) {
if ($this->offset >= $this->length) {
throw new CborException("Unexpected end of data");
}
if (ord($data[$this->offset]) === 0xFF) {
$this->offset++;
return $result;
}
$result[] = $this->decodeValue($data);
}
}
/**
* Decode indefinite-length map
*
* @param string $data Reference to the CBOR data being decoded
*
* @return array The decoded map as associative array
* @throws CborException If unexpected end of data or odd number of items
*/
private function decodeIndefiniteMap(string &$data): array
{
$result = [];
while (true) {
if ($this->offset >= $this->length) {
throw new CborException("Unexpected end of data");
}
if (ord($data[$this->offset]) === 0xFF) {
$this->offset++;
return $result;
}
$key = $this->decodeValue($data);
$result[$key] = $this->decodeValue($data);
}
}
}
+357
View File
@@ -0,0 +1,357 @@
<?php
namespace Aws\Cbor;
use Aws\Cbor\Exception\CborException;
use DateTimeInterface;
/**
* Encodes PHP values to Concise Binary Object Representation according to RFC 8949
* https://www.rfc-editor.org/rfc/rfc8949.html
*
* Supports Major types 0-7 including:
* - Type 0: Unsigned integers
* - Type 1: Negative integers
* - Type 2: Byte strings (via ['__cbor_bytes' => $data] wrappers)
* - Type 3: Text strings (UTF-8)
* - Type 4: Arrays
* - Type 5: Maps
* - Type 6: Tagged values (timestamps)
* - Type 7: Simple values (null, bool, float)
*
* @internal
*/
final class CborEncoder
{
/**
* Pre-encoded integers 0-23 (single byte) and common larger values
* CBOR major type 0 (unsigned integer)
*/
private const INT_CACHE = [
0 => "\x00", 1 => "\x01", 2 => "\x02", 3 => "\x03",
4 => "\x04", 5 => "\x05", 6 => "\x06", 7 => "\x07",
8 => "\x08", 9 => "\x09", 10 => "\x0A", 11 => "\x0B",
12 => "\x0C", 13 => "\x0D", 14 => "\x0E", 15 => "\x0F",
16 => "\x10", 17 => "\x11", 18 => "\x12", 19 => "\x13",
20 => "\x14", 21 => "\x15", 22 => "\x16", 23 => "\x17",
24 => "\x18\x18", 25 => "\x18\x19", 26 => "\x18\x1A",
32 => "\x18\x20", 50 => "\x18\x32", 64 => "\x18\x40",
100 => "\x18\x64", 128 => "\x18\x80", 200 => "\x18\xC8",
255 => "\x18\xFF", 256 => "\x19\x01\x00", 500 => "\x19\x01\xF4",
1000 => "\x19\x03\xE8", 1023 => "\x19\x03\xFF",
];
/**
* Pre-encoded negative integers -1 to -24 and common larger values
* CBOR major type 1 (negative integer)
*/
private const NEG_CACHE = [
-1 => "\x20", -2 => "\x21", -3 => "\x22", -4 => "\x23",
-5 => "\x24", -10 => "\x29", -20 => "\x33", -24 => "\x37",
-25 => "\x38\x18", -50 => "\x38\x31", -100 => "\x38\x63",
];
/**
* Encode a PHP value to CBOR binary string
*
* @param mixed $value The value to encode
*
* @return string
*/
public function encode(mixed $value): string
{
return $this->encodeValue($value);
}
/**
* Recursively encode a value to CBOR
*
* @param mixed $value Value to encode
* @return string Encoded CBOR bytes
*/
private function encodeValue(mixed $value): string
{
switch (gettype($value)) {
case 'string':
$len = strlen($value);
if ($len < 24) {
return chr(0x60 | $len) . $value;
}
if ($len < 0x100) {
return "\x78" . chr($len) . $value;
}
return $this->encodeTextString($value);
case 'array':
// Encode a byte string (major type 2)
if (isset($value['__cbor_bytes'])) {
$bytes = $value['__cbor_bytes'];
$len = strlen($bytes);
if ($len < 24) {
return chr(0x40 | $len) . $bytes;
}
if ($len < 0x100) {
return "\x58" . chr($len) . $bytes;
}
if ($len < 0x10000) {
return "\x59" . pack('n', $len) . $bytes;
}
return "\x5A" . pack('N', $len) . $bytes;
}
if (array_is_list($value)) {
return $this->encodeArray($value);
}
return $this->encodeMap($value);
case 'integer':
if (isset(self::INT_CACHE[$value])) {
return self::INT_CACHE[$value];
}
if (isset(self::NEG_CACHE[$value])) {
return self::NEG_CACHE[$value];
}
// Fast path for positive integers
// Major type 0: unsigned integer
if ($value >= 0) {
if ($value < 24) {
return chr($value);
}
if ($value < 0x100) {
return "\x18" . chr($value);
}
if ($value < 0x10000) {
return "\x19" . pack('n', $value);
}
if ($value < 0x100000000) {
return "\x1A" . pack('N', $value);
}
return "\x1B" . pack('J', $value);
}
return $this->encodeInteger($value);
case 'double':
// Encode a float (major type 7, float 64)
return "\xFB" . pack('E', $value);
case 'boolean':
// Encode a boolean (major type 7, simple)
return $value ? "\xF5" : "\xF4";
case 'NULL':
// Encode null (major type 7, simple)
return "\xF6";
case 'object':
// Encode timestamp (major type 6, tag 1)
if ($value instanceof DateTimeInterface) {
$timestamp = $value->getTimestamp();
$micro = (int) $value->format('u');
if ($micro === 0) {
if ($timestamp >= 0 && $timestamp < 0x100000000) {
return "\xC1\x1A" . pack('N', $timestamp);
}
return "\xC1" . $this->encodeInteger($timestamp);
}
return "\xC1\xFB" . pack('E', $timestamp + $micro / 1e6);
}
throw new CborException("Cannot encode object of type: " . get_class($value));
default:
throw new CborException("Cannot encode value of type: " . gettype($value));
}
}
/**
* Encode an integer (major type 0 or 1)
*
* @param int $value
* @return string
*/
private function encodeInteger(int $value): string
{
if (isset(self::INT_CACHE[$value])) {
return self::INT_CACHE[$value];
}
if (isset(self::NEG_CACHE[$value])) {
return self::NEG_CACHE[$value];
}
if ($value >= 0) {
// Major type 0: unsigned integer
if ($value < 24) {
return chr($value);
}
if ($value < 0x100) {
return "\x18" . chr($value);
}
if ($value < 0x10000) {
return "\x19" . pack('n', $value);
}
if ($value < 0x100000000) {
return "\x1A" . pack('N', $value);
}
return "\x1B" . pack('J', $value);
}
// Major type 1: negative integer (-1 - n)
$value = -1 - $value;
if ($value < 24) {
return chr(0x20 | $value);
}
if ($value < 0x100) {
return "\x38" . chr($value);
}
if ($value < 0x10000) {
return "\x39" . pack('n', $value);
}
if ($value < 0x100000000) {
return "\x3A" . pack('N', $value);
}
return "\x3B" . pack('J', $value);
}
/**
* Encode a text string (major type 3)
*
* @param string $value
* @return string
*/
private function encodeTextString(string $value): string
{
$len = strlen($value);
if ($len < 24) {
return chr(0x60 | $len) . $value;
}
if ($len < 0x100) {
return "\x78" . chr($len) . $value;
}
if ($len < 0x10000) {
return "\x79" . pack('n', $len) . $value;
}
if ($len < 0x100000000) {
return "\x7A" . pack('N', $len) . $value;
}
return "\x7B" . pack('J', $len) . $value;
}
/**
* Encode an array (major type 4)
*
* @param array $value
* @return string
*/
private function encodeArray(array $value): string
{
$count = count($value);
if ($count < 24) {
$result = chr(0x80 | $count);
} elseif ($count < 0x100) {
$result = "\x98" . chr($count);
} elseif ($count < 0x10000) {
$result = "\x99" . pack('n', $count);
} elseif ($count < 0x100000000) {
$result = "\x9A" . pack('N', $count);
} else {
$result = "\x9B" . pack('J', $count);
}
foreach ($value as $item) {
$result .= $this->encodeValue($item);
}
return $result;
}
/**
* Encode a map (major type 5)
*
* @param array $value
* @return string
*/
private function encodeMap(array $value): string
{
$count = count($value);
if ($count < 24) {
$result = chr(0xA0 | $count);
} elseif ($count < 0x100) {
$result = "\xB8" . chr($count);
} elseif ($count < 0x10000) {
$result = "\xB9" . pack('n', $count);
} elseif ($count < 0x100000000) {
$result = "\xBA" . pack('N', $count);
} else {
$result = "\xBB" . pack('J', $count);
}
foreach ($value as $k => $v) {
if (is_int($k)) {
$result .= $this->encodeInteger($k);
} else {
$len = strlen($k);
if ($len < 24) {
$result .= chr(0x60 | $len) . $k;
} elseif ($len < 0x100) {
$result .= "\x78" . chr($len) . $k;
} else {
$result .= "\x79" . pack('n', $len) . $k;
}
}
$result .= $this->encodeValue($v);
}
return $result;
}
/**
* Create an empty map (major type 5 with 0 elements)
*
* @return string
*/
public function encodeEmptyMap(): string
{
return "\xA0";
}
/**
* Create an empty indefinite map (major type 5 indefinite length)
*
* @return string
*/
public function encodeEmptyIndefiniteMap(): string
{
return "\xBF\xFF";
}
}
@@ -0,0 +1,6 @@
<?php
namespace Aws\Cbor\Exception;
use RuntimeException;
class CborException extends RuntimeException {}
@@ -15,6 +15,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createAnalysisTemplateAsync(array $args = [])
* @method \Aws\Result createCollaboration(array $args = [])
* @method \GuzzleHttp\Promise\Promise createCollaborationAsync(array $args = [])
* @method \Aws\Result createCollaborationChangeRequest(array $args = [])
* @method \GuzzleHttp\Promise\Promise createCollaborationChangeRequestAsync(array $args = [])
* @method \Aws\Result createConfiguredAudienceModelAssociation(array $args = [])
* @method \GuzzleHttp\Promise\Promise createConfiguredAudienceModelAssociationAsync(array $args = [])
* @method \Aws\Result createConfiguredTable(array $args = [])
@@ -29,6 +31,10 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createIdMappingTableAsync(array $args = [])
* @method \Aws\Result createIdNamespaceAssociation(array $args = [])
* @method \GuzzleHttp\Promise\Promise createIdNamespaceAssociationAsync(array $args = [])
* @method \Aws\Result createIntermediateTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise createIntermediateTableAsync(array $args = [])
* @method \Aws\Result createIntermediateTableAnalysisRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise createIntermediateTableAnalysisRuleAsync(array $args = [])
* @method \Aws\Result createMembership(array $args = [])
* @method \GuzzleHttp\Promise\Promise createMembershipAsync(array $args = [])
* @method \Aws\Result createPrivacyBudgetTemplate(array $args = [])
@@ -51,18 +57,26 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise deleteIdMappingTableAsync(array $args = [])
* @method \Aws\Result deleteIdNamespaceAssociation(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteIdNamespaceAssociationAsync(array $args = [])
* @method \Aws\Result deleteIntermediateTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteIntermediateTableAsync(array $args = [])
* @method \Aws\Result deleteIntermediateTableAnalysisRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteIntermediateTableAnalysisRuleAsync(array $args = [])
* @method \Aws\Result deleteMember(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteMemberAsync(array $args = [])
* @method \Aws\Result deleteMembership(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteMembershipAsync(array $args = [])
* @method \Aws\Result deletePrivacyBudgetTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise deletePrivacyBudgetTemplateAsync(array $args = [])
* @method \Aws\Result disallowIntermediateTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise disallowIntermediateTableAsync(array $args = [])
* @method \Aws\Result getAnalysisTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAnalysisTemplateAsync(array $args = [])
* @method \Aws\Result getCollaboration(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCollaborationAsync(array $args = [])
* @method \Aws\Result getCollaborationAnalysisTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCollaborationAnalysisTemplateAsync(array $args = [])
* @method \Aws\Result getCollaborationChangeRequest(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCollaborationChangeRequestAsync(array $args = [])
* @method \Aws\Result getCollaborationConfiguredAudienceModelAssociation(array $args = [])
* @method \GuzzleHttp\Promise\Promise getCollaborationConfiguredAudienceModelAssociationAsync(array $args = [])
* @method \Aws\Result getCollaborationIdNamespaceAssociation(array $args = [])
@@ -83,6 +97,10 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getIdMappingTableAsync(array $args = [])
* @method \Aws\Result getIdNamespaceAssociation(array $args = [])
* @method \GuzzleHttp\Promise\Promise getIdNamespaceAssociationAsync(array $args = [])
* @method \Aws\Result getIntermediateTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise getIntermediateTableAsync(array $args = [])
* @method \Aws\Result getIntermediateTableAnalysisRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise getIntermediateTableAnalysisRuleAsync(array $args = [])
* @method \Aws\Result getMembership(array $args = [])
* @method \GuzzleHttp\Promise\Promise getMembershipAsync(array $args = [])
* @method \Aws\Result getPrivacyBudgetTemplate(array $args = [])
@@ -99,6 +117,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listAnalysisTemplatesAsync(array $args = [])
* @method \Aws\Result listCollaborationAnalysisTemplates(array $args = [])
* @method \GuzzleHttp\Promise\Promise listCollaborationAnalysisTemplatesAsync(array $args = [])
* @method \Aws\Result listCollaborationChangeRequests(array $args = [])
* @method \GuzzleHttp\Promise\Promise listCollaborationChangeRequestsAsync(array $args = [])
* @method \Aws\Result listCollaborationConfiguredAudienceModelAssociations(array $args = [])
* @method \GuzzleHttp\Promise\Promise listCollaborationConfiguredAudienceModelAssociationsAsync(array $args = [])
* @method \Aws\Result listCollaborationIdNamespaceAssociations(array $args = [])
@@ -119,6 +139,10 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listIdMappingTablesAsync(array $args = [])
* @method \Aws\Result listIdNamespaceAssociations(array $args = [])
* @method \GuzzleHttp\Promise\Promise listIdNamespaceAssociationsAsync(array $args = [])
* @method \Aws\Result listIntermediateTableVersions(array $args = [])
* @method \GuzzleHttp\Promise\Promise listIntermediateTableVersionsAsync(array $args = [])
* @method \Aws\Result listIntermediateTables(array $args = [])
* @method \GuzzleHttp\Promise\Promise listIntermediateTablesAsync(array $args = [])
* @method \Aws\Result listMembers(array $args = [])
* @method \GuzzleHttp\Promise\Promise listMembersAsync(array $args = [])
* @method \Aws\Result listMemberships(array $args = [])
@@ -137,6 +161,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result populateIdMappingTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise populateIdMappingTableAsync(array $args = [])
* @method \Aws\Result populateIntermediateTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise populateIntermediateTableAsync(array $args = [])
* @method \Aws\Result previewPrivacyImpact(array $args = [])
* @method \GuzzleHttp\Promise\Promise previewPrivacyImpactAsync(array $args = [])
* @method \Aws\Result startProtectedJob(array $args = [])
@@ -151,6 +177,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise updateAnalysisTemplateAsync(array $args = [])
* @method \Aws\Result updateCollaboration(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateCollaborationAsync(array $args = [])
* @method \Aws\Result updateCollaborationChangeRequest(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateCollaborationChangeRequestAsync(array $args = [])
* @method \Aws\Result updateConfiguredAudienceModelAssociation(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateConfiguredAudienceModelAssociationAsync(array $args = [])
* @method \Aws\Result updateConfiguredTable(array $args = [])
@@ -165,6 +193,10 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise updateIdMappingTableAsync(array $args = [])
* @method \Aws\Result updateIdNamespaceAssociation(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateIdNamespaceAssociationAsync(array $args = [])
* @method \Aws\Result updateIntermediateTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateIntermediateTableAsync(array $args = [])
* @method \Aws\Result updateIntermediateTableAnalysisRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateIntermediateTableAnalysisRuleAsync(array $args = [])
* @method \Aws\Result updateMembership(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateMembershipAsync(array $args = [])
* @method \Aws\Result updatePrivacyBudgetTemplate(array $args = [])
+77 -36
View File
@@ -27,13 +27,17 @@ use Aws\Endpoint\UseFipsEndpoint\ConfigurationProvider as UseFipsConfigProvider;
use Aws\EndpointDiscovery\ConfigurationInterface;
use Aws\EndpointDiscovery\ConfigurationProvider;
use Aws\EndpointV2\EndpointDefinitionProvider;
use Aws\EndpointV2\EndpointProviderV2;
use Aws\Exception\AwsException;
use Aws\Exception\InvalidRegionException;
use Aws\Retry\ConfigurationInterface as RetryConfigInterface;
use Aws\Retry\ConfigurationProvider as RetryConfigProvider;
use Aws\Retry\V3\OptIn as NewRetriesOptIn;
use Aws\Retry\V3\RetryMiddleware as RetryV3Middleware;
use Aws\Signature\SignatureProvider;
use Aws\Token\Token;
use Aws\Token\TokenInterface;
use Aws\Token\BedrockTokenProvider;
use Aws\Token\TokenProvider;
use GuzzleHttp\Promise\PromiseInterface;
use InvalidArgumentException as IAE;
@@ -60,6 +64,8 @@ class ClientResolver
__CLASS__,
'_resolve_from_env_ini'
];
private const ANONYMOUS_SIGNATURE = 'anonymous';
private const DPOP_SIGNATURE = 'dpop';
/** @var array Map of types to a corresponding function */
private static $typeMap = [
@@ -206,6 +212,13 @@ class ClientResolver
'fn' => [__CLASS__, '_apply_credentials'],
'default' => [__CLASS__, '_default_credential_provider'],
],
'auth_scheme_preference' => [
'type' => 'value',
'valid' => ['string', 'array'],
'doc' => 'Comma-separated list of authentication scheme preferences in priority order. Configure via environment variable `AWS_AUTH_SCHEME_PREFERENCE`, INI config file `auth_scheme_preference`, or client constructor parameter `auth_scheme_preference` (string or array).\nExample: `AWS_AUTH_SCHEME_PREFERENCE=aws.auth#sigv4a,aws.auth#sigv4,smithy.api#httpBearerAuth`',
'default' => self::DEFAULT_FROM_ENV_INI,
'fn' => [__CLASS__, '_apply_auth_scheme_preference'],
],
'token' => [
'type' => 'value',
'valid' => [TokenInterface::class, CacheInterface::class, 'array', 'bool', 'callable'],
@@ -537,7 +550,10 @@ class ClientResolver
public static function _apply_retries($value, array &$args, HandlerList $list)
{
// A value of 0 for the config option disables retries
if ($value) {
if (!$value) {
return;
}
$config = RetryConfigProvider::unwrap($value);
if ($config->getMode() === 'legacy') {
@@ -549,7 +565,20 @@ class ClientResolver
Middleware::retry($decider, null, $args['stats']['retries']),
'retry'
);
} else {
return;
}
if (NewRetriesOptIn::isEnabled()) {
$list->appendSign(
RetryV3Middleware::wrap($config, [
'collect_stats' => $args['stats']['retries'],
'service' => $args['service'],
]),
'retry'
);
return;
}
$list->appendSign(
RetryMiddlewareV2::wrap(
$config,
@@ -558,8 +587,6 @@ class ClientResolver
'retry'
);
}
}
}
public static function _apply_defaults($value, array &$args, HandlerList $list)
{
@@ -660,7 +687,10 @@ class ClientResolver
$args['credentials'] = CredentialProvider::fromCredentials(
new Credentials('', '')
);
$args['config']['signature_version'] = 'anonymous';
if ($args['config']['signature_version'] !== self::DPOP_SIGNATURE) {
$args['config']['signature_version'] = self::ANONYMOUS_SIGNATURE;
}
$args['config']['configured_signature_version'] = true;
} elseif ($value instanceof CacheInterface) {
$args['credentials'] = CredentialProvider::defaultProvider($args);
@@ -704,8 +734,17 @@ class ClientResolver
}
}
public static function _default_token_provider(array $args)
public static function _default_token_provider(array &$args)
{
if (($args['config']['signing_name'] ?? '') === 'bedrock') {
// Checks for env value, if present, sets auth_scheme_preference
// to bearer auth and returns a provider
$provider = BedrockTokenProvider::createIfAvailable($args);
if (!is_null($provider)) {
return $provider;
}
}
return TokenProvider::defaultProvider($args);
}
@@ -769,7 +808,7 @@ class ClientResolver
public static function _apply_endpoint_provider($value, array &$args)
{
if (!isset($args['endpoint'])) {
if ($value instanceof \Aws\EndpointV2\EndpointProviderV2) {
if ($value instanceof EndpointProviderV2) {
$options = self::getEndpointProviderOptions($args);
$value = PartitionEndpointProvider::defaultProvider($options)
->getPartition($args['region'], $args['service']);
@@ -1090,14 +1129,13 @@ class ClientResolver
if (self::isValidService($serviceName)
&& self::isValidApiVersion($serviceName, $apiVersion)
) {
$ruleset = EndpointDefinitionProvider::getEndpointRuleset(
$partitions = EndpointDefinitionProvider::getPartitions();
$parsed = EndpointDefinitionProvider::getParsedRuleset(
$service->getServiceName(),
$service->getApiVersion()
);
return new \Aws\EndpointV2\EndpointProviderV2(
$ruleset,
EndpointDefinitionProvider::getPartitions()
$service->getApiVersion(),
$partitions
);
return new EndpointProviderV2($parsed, $partitions);
}
$options = self::getEndpointProviderOptions($args);
return PartitionEndpointProvider::defaultProvider($options)
@@ -1122,6 +1160,32 @@ class ClientResolver
return new AuthSchemeResolver($args['credentials'], $args['token']);
}
public static function _apply_auth_scheme_preference(
string|array|null &$value,
array &$args
): void
{
// Not provided user's preference auth scheme list
if (empty($value)) {
$value = null;
$args['config']['auth_scheme_preference'] = $value;
return;
}
// Normalize it as an array
if (is_string($value)) {
$value = explode(',', $value);
}
// Let`s trim each value to remove break lines, spaces and/or tabs
foreach ($value as &$val) {
$val = trim($val);
}
// Assign user's preferred auth scheme list
$args['config']['auth_scheme_preference'] = $value;
}
public static function _default_signature_version(array &$args)
{
if (isset($args['config']['signature_version'])) {
@@ -1199,12 +1263,6 @@ class ClientResolver
$args['suppress_php_deprecation_warning'] =
\Aws\boolean_value($_ENV["AWS_SUPPRESS_PHP_DEPRECATION_WARNING"]);
}
if ($args['suppress_php_deprecation_warning'] === false
&& PHP_VERSION_ID < 80100
) {
self::emitDeprecationWarning();
}
}
public static function _default_endpoint(array &$args)
@@ -1392,21 +1450,4 @@ EOT;
__DIR__ . "/data/{$service}/$apiVersion"
);
}
private static function emitDeprecationWarning()
{
$phpVersionString = phpversion();
trigger_error(
"This installation of the SDK is using PHP version"
. " {$phpVersionString}, which will be deprecated on January"
. " 13th, 2025.\nPlease upgrade your PHP version to a minimum of"
. " 8.1.x to continue receiving updates for the AWS"
. " SDK for PHP.\nTo disable this warning, set"
. " suppress_php_deprecation_warning to true on the client constructor"
. " or set the environment variable AWS_SUPPRESS_PHP_DEPRECATION_WARNING"
. " to true.\nMore information can be found at: "
. "https://aws.amazon.com/blogs/developer/announcing-the-end-of-support-for-php-runtimes-8-0-x-and-below-in-the-aws-sdk-for-php/\n",
E_USER_DEPRECATED
);
}
}
@@ -50,6 +50,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise describeChangeSetAsync(array $args = [])
* @method \Aws\Result describeChangeSetHooks(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeChangeSetHooksAsync(array $args = [])
* @method \Aws\Result describeEvents(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeEventsAsync(array $args = [])
* @method \Aws\Result describeGeneratedTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeGeneratedTemplateAsync(array $args = [])
* @method \Aws\Result describeOrganizationsAccess(array $args = [])
@@ -96,6 +98,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise executeStackRefactorAsync(array $args = [])
* @method \Aws\Result getGeneratedTemplate(array $args = [])
* @method \GuzzleHttp\Promise\Promise getGeneratedTemplateAsync(array $args = [])
* @method \Aws\Result getHookResult(array $args = [])
* @method \GuzzleHttp\Promise\Promise getHookResultAsync(array $args = [])
* @method \Aws\Result getStackPolicy(array $args = [])
* @method \GuzzleHttp\Promise\Promise getStackPolicyAsync(array $args = [])
* @method \Aws\Result getTemplate(array $args = [])
@@ -110,6 +110,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createAnycastIpListAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result createCachePolicy(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise createCachePolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result createConnectionFunction(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise createConnectionFunctionAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result createConnectionGroup(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise createConnectionGroupAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result createContinuousDeploymentPolicy(array $args = []) (supported in versions 2020-05-31)
@@ -134,12 +136,16 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise createRealtimeLogConfigAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result createResponseHeadersPolicy(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise createResponseHeadersPolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result createTrustStore(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise createTrustStoreAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result createVpcOrigin(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise createVpcOriginAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result deleteAnycastIpList(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise deleteAnycastIpListAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result deleteCachePolicy(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise deleteCachePolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result deleteConnectionFunction(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise deleteConnectionFunctionAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result deleteConnectionGroup(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise deleteConnectionGroupAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result deleteContinuousDeploymentPolicy(array $args = []) (supported in versions 2020-05-31)
@@ -160,10 +166,16 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise deleteOriginRequestPolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result deleteRealtimeLogConfig(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise deleteRealtimeLogConfigAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result deleteResourcePolicy(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise deleteResourcePolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result deleteResponseHeadersPolicy(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise deleteResponseHeadersPolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result deleteTrustStore(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise deleteTrustStoreAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result deleteVpcOrigin(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise deleteVpcOriginAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result describeConnectionFunction(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise describeConnectionFunctionAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result describeFunction(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise describeFunctionAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result describeKeyValueStore(array $args = []) (supported in versions 2020-05-31)
@@ -178,6 +190,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getCachePolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result getCachePolicyConfig(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise getCachePolicyConfigAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result getConnectionFunction(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise getConnectionFunctionAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result getConnectionGroup(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise getConnectionGroupAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result getConnectionGroupByRoutingEndpoint(array $args = []) (supported in versions 2020-05-31)
@@ -212,10 +226,14 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getOriginRequestPolicyConfigAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result getRealtimeLogConfig(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise getRealtimeLogConfigAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result getResourcePolicy(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise getResourcePolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result getResponseHeadersPolicy(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise getResponseHeadersPolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result getResponseHeadersPolicyConfig(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise getResponseHeadersPolicyConfigAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result getTrustStore(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise getTrustStoreAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result getVpcOrigin(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise getVpcOriginAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listAnycastIpLists(array $args = []) (supported in versions 2020-05-31)
@@ -224,6 +242,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listCachePoliciesAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listConflictingAliases(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listConflictingAliasesAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listConnectionFunctions(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listConnectionFunctionsAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listConnectionGroups(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listConnectionGroupsAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listContinuousDeploymentPolicies(array $args = []) (supported in versions 2020-05-31)
@@ -236,16 +256,22 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listDistributionsByAnycastIpListIdAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listDistributionsByCachePolicyId(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listDistributionsByCachePolicyIdAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listDistributionsByConnectionFunction(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listDistributionsByConnectionFunctionAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listDistributionsByConnectionMode(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listDistributionsByConnectionModeAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listDistributionsByKeyGroup(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listDistributionsByKeyGroupAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listDistributionsByOriginRequestPolicyId(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listDistributionsByOriginRequestPolicyIdAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listDistributionsByOwnedResource(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listDistributionsByOwnedResourceAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listDistributionsByRealtimeLogConfig(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listDistributionsByRealtimeLogConfigAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listDistributionsByResponseHeadersPolicyId(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listDistributionsByResponseHeadersPolicyIdAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listDistributionsByTrustStore(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listDistributionsByTrustStoreAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listDistributionsByVpcOriginId(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listDistributionsByVpcOriginIdAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listDomainConflicts(array $args = []) (supported in versions 2020-05-31)
@@ -266,14 +292,26 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listRealtimeLogConfigsAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listResponseHeadersPolicies(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listResponseHeadersPoliciesAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listTrustStores(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listTrustStoresAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result listVpcOrigins(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise listVpcOriginsAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result publishConnectionFunction(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise publishConnectionFunctionAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result publishFunction(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise publishFunctionAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result putResourcePolicy(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise putResourcePolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result testConnectionFunction(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise testConnectionFunctionAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result testFunction(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise testFunctionAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result updateAnycastIpList(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise updateAnycastIpListAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result updateCachePolicy(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise updateCachePolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result updateConnectionFunction(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise updateConnectionFunctionAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result updateConnectionGroup(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise updateConnectionGroupAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result updateContinuousDeploymentPolicy(array $args = []) (supported in versions 2020-05-31)
@@ -298,6 +336,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise updateRealtimeLogConfigAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result updateResponseHeadersPolicy(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise updateResponseHeadersPolicyAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result updateTrustStore(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise updateTrustStoreAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result updateVpcOrigin(array $args = []) (supported in versions 2020-05-31)
* @method \GuzzleHttp\Promise\Promise updateVpcOriginAsync(array $args = []) (supported in versions 2020-05-31)
* @method \Aws\Result verifyDnsConfiguration(array $args = []) (supported in versions 2020-05-31)
+33
View File
@@ -81,8 +81,10 @@ class Signer
$signatureHash = [];
if ($policy) {
$policy = preg_replace('/\s/s', '', $policy);
self::validatePolicy($policy);
$signatureHash['Policy'] = $this->encode($policy);
} elseif ($resource && $expires) {
self::validateResourceUrl($resource);
$expires = (int) $expires; // Handle epoch passed as string
$policy = $this->createCannedPolicy($resource, $expires);
$signatureHash['Expires'] = $expires;
@@ -136,4 +138,35 @@ class Signer
{
return strtr(base64_encode($policy), '+=/', '-_~');
}
/**
* Validates a customer provided json document.
*
* @param string $jsonPolicy
*
* @return void
*/
private static function validatePolicy(string $jsonPolicy): void
{
$policy = json_decode($jsonPolicy, true);
foreach ($policy['Statement'] ?? [] as $statement) {
if (isset($statement['Resource'])) {
self::validateResourceUrl($statement['Resource']);
}
}
}
/**
* @param string $url
*
* @return void
*/
private static function validateResourceUrl(string $url): void
{
if (preg_match('/["\\\\\x00-\x1F]/', $url)) {
throw new \InvalidArgumentException(
'URL contains invalid characters: ", \\, or control characters'
);
}
}
}
+1 -1
View File
@@ -101,7 +101,7 @@ class UrlSigner
$parts = parse_url($url);
$pathParts = pathinfo($parts['path']);
$resource = ltrim(
$pathParts['dirname'] . '/' . $pathParts['basename'],
str_replace('\\', '/', $pathParts['dirname']) . '/' . $pathParts['basename'],
'/'
);
@@ -78,7 +78,7 @@ class CloudSearchDomainClient extends AwsClient
$query = $r->getUri()->getQuery();
$req = $r->withMethod('POST')
->withBody(Psr7\Utils::streamFor($query))
->withHeader('Content-Length', strlen($query))
->withHeader('Content-Length', (string) strlen($query))
->withHeader('Content-Type', 'application/x-www-form-urlencoded')
->withUri($r->getUri()->withQuery(''));
return $req;
@@ -72,6 +72,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listImportFailuresAsync(array $args = [])
* @method \Aws\Result listImports(array $args = [])
* @method \GuzzleHttp\Promise\Promise listImportsAsync(array $args = [])
* @method \Aws\Result listInsightsData(array $args = [])
* @method \GuzzleHttp\Promise\Promise listInsightsDataAsync(array $args = [])
* @method \Aws\Result listInsightsMetricData(array $args = [])
* @method \GuzzleHttp\Promise\Promise listInsightsMetricDataAsync(array $args = [])
* @method \Aws\Result listPublicKeys(array $args = [])
@@ -6,6 +6,10 @@ use Aws\AwsClient;
/**
* This client is used to interact with the **Amazon CloudWatch** service.
*
* @method \Aws\Result associateDatasetKmsKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise associateDatasetKmsKeyAsync(array $args = [])
* @method \Aws\Result deleteAlarmMuteRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAlarmMuteRuleAsync(array $args = [])
* @method \Aws\Result deleteAlarms(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteAlarmsAsync(array $args = [])
* @method \Aws\Result deleteAnomalyDetector(array $args = [])
@@ -16,6 +20,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise deleteInsightRulesAsync(array $args = [])
* @method \Aws\Result deleteMetricStream(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteMetricStreamAsync(array $args = [])
* @method \Aws\Result describeAlarmContributors(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAlarmContributorsAsync(array $args = [])
* @method \Aws\Result describeAlarmHistory(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeAlarmHistoryAsync(array $args = [])
* @method \Aws\Result describeAlarms(array $args = [])
@@ -30,12 +36,18 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise disableAlarmActionsAsync(array $args = [])
* @method \Aws\Result disableInsightRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise disableInsightRulesAsync(array $args = [])
* @method \Aws\Result disassociateDatasetKmsKey(array $args = [])
* @method \GuzzleHttp\Promise\Promise disassociateDatasetKmsKeyAsync(array $args = [])
* @method \Aws\Result enableAlarmActions(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableAlarmActionsAsync(array $args = [])
* @method \Aws\Result enableInsightRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise enableInsightRulesAsync(array $args = [])
* @method \Aws\Result getAlarmMuteRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise getAlarmMuteRuleAsync(array $args = [])
* @method \Aws\Result getDashboard(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDashboardAsync(array $args = [])
* @method \Aws\Result getDataset(array $args = [])
* @method \GuzzleHttp\Promise\Promise getDatasetAsync(array $args = [])
* @method \Aws\Result getInsightRuleReport(array $args = [])
* @method \GuzzleHttp\Promise\Promise getInsightRuleReportAsync(array $args = [])
* @method \Aws\Result getMetricData(array $args = [])
@@ -46,6 +58,10 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise getMetricStreamAsync(array $args = [])
* @method \Aws\Result getMetricWidgetImage(array $args = [])
* @method \GuzzleHttp\Promise\Promise getMetricWidgetImageAsync(array $args = [])
* @method \Aws\Result getOTelEnrichment(array $args = [])
* @method \GuzzleHttp\Promise\Promise getOTelEnrichmentAsync(array $args = [])
* @method \Aws\Result listAlarmMuteRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise listAlarmMuteRulesAsync(array $args = [])
* @method \Aws\Result listDashboards(array $args = [])
* @method \GuzzleHttp\Promise\Promise listDashboardsAsync(array $args = [])
* @method \Aws\Result listManagedInsightRules(array $args = [])
@@ -56,6 +72,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise listMetricsAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result putAlarmMuteRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise putAlarmMuteRuleAsync(array $args = [])
* @method \Aws\Result putAnomalyDetector(array $args = [])
* @method \GuzzleHttp\Promise\Promise putAnomalyDetectorAsync(array $args = [])
* @method \Aws\Result putCompositeAlarm(array $args = [])
@@ -64,6 +82,8 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise putDashboardAsync(array $args = [])
* @method \Aws\Result putInsightRule(array $args = [])
* @method \GuzzleHttp\Promise\Promise putInsightRuleAsync(array $args = [])
* @method \Aws\Result putLogAlarm(array $args = [])
* @method \GuzzleHttp\Promise\Promise putLogAlarmAsync(array $args = [])
* @method \Aws\Result putManagedInsightRules(array $args = [])
* @method \GuzzleHttp\Promise\Promise putManagedInsightRulesAsync(array $args = [])
* @method \Aws\Result putMetricAlarm(array $args = [])
@@ -76,8 +96,12 @@ use Aws\AwsClient;
* @method \GuzzleHttp\Promise\Promise setAlarmStateAsync(array $args = [])
* @method \Aws\Result startMetricStreams(array $args = [])
* @method \GuzzleHttp\Promise\Promise startMetricStreamsAsync(array $args = [])
* @method \Aws\Result startOTelEnrichment(array $args = [])
* @method \GuzzleHttp\Promise\Promise startOTelEnrichmentAsync(array $args = [])
* @method \Aws\Result stopMetricStreams(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopMetricStreamsAsync(array $args = [])
* @method \Aws\Result stopOTelEnrichment(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopOTelEnrichmentAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
@@ -1,85 +0,0 @@
<?php
namespace Aws\CloudWatchEvidently;
use Aws\AwsClient;
/**
* This client is used to interact with the **Amazon CloudWatch Evidently** service.
* @method \Aws\Result batchEvaluateFeature(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchEvaluateFeatureAsync(array $args = [])
* @method \Aws\Result createExperiment(array $args = [])
* @method \GuzzleHttp\Promise\Promise createExperimentAsync(array $args = [])
* @method \Aws\Result createFeature(array $args = [])
* @method \GuzzleHttp\Promise\Promise createFeatureAsync(array $args = [])
* @method \Aws\Result createLaunch(array $args = [])
* @method \GuzzleHttp\Promise\Promise createLaunchAsync(array $args = [])
* @method \Aws\Result createProject(array $args = [])
* @method \GuzzleHttp\Promise\Promise createProjectAsync(array $args = [])
* @method \Aws\Result createSegment(array $args = [])
* @method \GuzzleHttp\Promise\Promise createSegmentAsync(array $args = [])
* @method \Aws\Result deleteExperiment(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteExperimentAsync(array $args = [])
* @method \Aws\Result deleteFeature(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteFeatureAsync(array $args = [])
* @method \Aws\Result deleteLaunch(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteLaunchAsync(array $args = [])
* @method \Aws\Result deleteProject(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteProjectAsync(array $args = [])
* @method \Aws\Result deleteSegment(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteSegmentAsync(array $args = [])
* @method \Aws\Result evaluateFeature(array $args = [])
* @method \GuzzleHttp\Promise\Promise evaluateFeatureAsync(array $args = [])
* @method \Aws\Result getExperiment(array $args = [])
* @method \GuzzleHttp\Promise\Promise getExperimentAsync(array $args = [])
* @method \Aws\Result getExperimentResults(array $args = [])
* @method \GuzzleHttp\Promise\Promise getExperimentResultsAsync(array $args = [])
* @method \Aws\Result getFeature(array $args = [])
* @method \GuzzleHttp\Promise\Promise getFeatureAsync(array $args = [])
* @method \Aws\Result getLaunch(array $args = [])
* @method \GuzzleHttp\Promise\Promise getLaunchAsync(array $args = [])
* @method \Aws\Result getProject(array $args = [])
* @method \GuzzleHttp\Promise\Promise getProjectAsync(array $args = [])
* @method \Aws\Result getSegment(array $args = [])
* @method \GuzzleHttp\Promise\Promise getSegmentAsync(array $args = [])
* @method \Aws\Result listExperiments(array $args = [])
* @method \GuzzleHttp\Promise\Promise listExperimentsAsync(array $args = [])
* @method \Aws\Result listFeatures(array $args = [])
* @method \GuzzleHttp\Promise\Promise listFeaturesAsync(array $args = [])
* @method \Aws\Result listLaunches(array $args = [])
* @method \GuzzleHttp\Promise\Promise listLaunchesAsync(array $args = [])
* @method \Aws\Result listProjects(array $args = [])
* @method \GuzzleHttp\Promise\Promise listProjectsAsync(array $args = [])
* @method \Aws\Result listSegmentReferences(array $args = [])
* @method \GuzzleHttp\Promise\Promise listSegmentReferencesAsync(array $args = [])
* @method \Aws\Result listSegments(array $args = [])
* @method \GuzzleHttp\Promise\Promise listSegmentsAsync(array $args = [])
* @method \Aws\Result listTagsForResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
* @method \Aws\Result putProjectEvents(array $args = [])
* @method \GuzzleHttp\Promise\Promise putProjectEventsAsync(array $args = [])
* @method \Aws\Result startExperiment(array $args = [])
* @method \GuzzleHttp\Promise\Promise startExperimentAsync(array $args = [])
* @method \Aws\Result startLaunch(array $args = [])
* @method \GuzzleHttp\Promise\Promise startLaunchAsync(array $args = [])
* @method \Aws\Result stopExperiment(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopExperimentAsync(array $args = [])
* @method \Aws\Result stopLaunch(array $args = [])
* @method \GuzzleHttp\Promise\Promise stopLaunchAsync(array $args = [])
* @method \Aws\Result tagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
* @method \Aws\Result testSegmentPattern(array $args = [])
* @method \GuzzleHttp\Promise\Promise testSegmentPatternAsync(array $args = [])
* @method \Aws\Result untagResource(array $args = [])
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
* @method \Aws\Result updateExperiment(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateExperimentAsync(array $args = [])
* @method \Aws\Result updateFeature(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateFeatureAsync(array $args = [])
* @method \Aws\Result updateLaunch(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateLaunchAsync(array $args = [])
* @method \Aws\Result updateProject(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateProjectAsync(array $args = [])
* @method \Aws\Result updateProjectDataDelivery(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateProjectDataDeliveryAsync(array $args = [])
*/
class CloudWatchEvidentlyClient extends AwsClient {}
@@ -1,9 +0,0 @@
<?php
namespace Aws\CloudWatchEvidently\Exception;
use Aws\Exception\AwsException;
/**
* Represents an error interacting with the **Amazon CloudWatch Evidently** service.
*/
class CloudWatchEvidentlyException extends AwsException {}

Some files were not shown because too many files have changed in this diff Show More