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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"variables": {
"${LATEST}": "3.366.4"
"${LATEST}": "3.367.1"
},
"endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json",
"services": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ public function generate(StructureShape $shape, bool $throwOnError = true): Pars
}

$body = '$data = $response->toArray(' . ($throwOnError ? '' : 'false') . ');' . "\n";
if (null !== $wrapper = $shape->getResultWrapper()) {
$body .= strtr('$data = $data[WRAPPER];' . "\n", ['WRAPPER' => var_export($wrapper, true)]);
}
$body .= "\n" . implode("\n", $properties);

return new ParserResult($body, $this->imports, $this->functions);
Expand Down
1 change: 1 addition & 0 deletions src/Service/CloudWatch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- AWS api-change: Added `us-isob-west-1` region
- AWS api-change: Added `eusc-de-east-1` region
- AWS api-change: This release switch to the AWS JSON 1.1 Procol, replacing the currently utilized one, AWSQuery.

### Dependency bumped

Expand Down
2 changes: 1 addition & 1 deletion src/Service/CloudWatch/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"require": {
"php": "^8.2",
"ext-simplexml": "*",
"ext-json": "*",
"async-aws/core": "^1.9"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions src/Service/CloudWatch/src/CloudWatchClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
use AsyncAws\CloudWatch\ValueObject\MetricDatum;
use AsyncAws\Core\AbstractApi;
use AsyncAws\Core\AwsError\AwsErrorFactoryInterface;
use AsyncAws\Core\AwsError\XmlAwsErrorFactory;
use AsyncAws\Core\AwsError\JsonRpcAwsErrorFactory;
use AsyncAws\Core\Configuration;
use AsyncAws\Core\RequestContext;
use AsyncAws\Core\Result;
Expand Down Expand Up @@ -314,7 +314,7 @@ public function putMetricData($input): Result

protected function getAwsErrorFactory(): AwsErrorFactoryInterface
{
return new XmlAwsErrorFactory();
return new JsonRpcAwsErrorFactory();
}

protected function getEndpointMetadata(?string $region): array
Expand Down
26 changes: 14 additions & 12 deletions src/Service/CloudWatch/src/Input/GetMetricDataInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ public function getStartTime(): ?\DateTimeImmutable
public function request(): Request
{
// Prepare headers
$headers = ['content-type' => 'application/x-www-form-urlencoded'];
$headers = [
'Content-Type' => 'application/x-amz-json-1.0',
'X-Amz-Target' => 'GraniteServiceVersion20100801.GetMetricData',
'Accept' => 'application/json',
];

// Prepare query
$query = [];
Expand All @@ -201,7 +205,8 @@ public function request(): Request
$uriString = '/';

// Prepare Body
$body = http_build_query(['Action' => 'GetMetricData', 'Version' => '2010-08-01'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738);
$bodyPayload = $this->requestBody();
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304);

// Return the Request
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));
Expand Down Expand Up @@ -269,22 +274,21 @@ private function requestBody(): array
throw new InvalidArgument(\sprintf('Missing parameter "MetricDataQueries" for "%s". The value cannot be null.', __CLASS__));
}

$index = 0;
foreach ($v as $mapValue) {
$index = -1;
$payload['MetricDataQueries'] = [];
foreach ($v as $listValue) {
++$index;
foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) {
$payload["MetricDataQueries.member.$index.$bodyKey"] = $bodyValue;
}
$payload['MetricDataQueries'][$index] = $listValue->requestBody();
}

if (null === $v = $this->startTime) {
throw new InvalidArgument(\sprintf('Missing parameter "StartTime" for "%s". The value cannot be null.', __CLASS__));
}
$payload['StartTime'] = $v->format(\DateTimeInterface::ATOM);
$payload['StartTime'] = $v->getTimestamp();
if (null === $v = $this->endTime) {
throw new InvalidArgument(\sprintf('Missing parameter "EndTime" for "%s". The value cannot be null.', __CLASS__));
}
$payload['EndTime'] = $v->format(\DateTimeInterface::ATOM);
$payload['EndTime'] = $v->getTimestamp();
if (null !== $v = $this->nextToken) {
$payload['NextToken'] = $v;
}
Expand All @@ -298,9 +302,7 @@ private function requestBody(): array
$payload['MaxDatapoints'] = $v;
}
if (null !== $v = $this->labelOptions) {
foreach ($v->requestBody() as $bodyKey => $bodyValue) {
$payload["LabelOptions.$bodyKey"] = $bodyValue;
}
$payload['LabelOptions'] = $v->requestBody();
}

return $payload;
Expand Down
40 changes: 23 additions & 17 deletions src/Service/CloudWatch/src/Input/GetMetricStatisticsInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@ public function getUnit(): ?string
public function request(): Request
{
// Prepare headers
$headers = ['content-type' => 'application/x-www-form-urlencoded'];
$headers = [
'Content-Type' => 'application/x-amz-json-1.0',
'X-Amz-Target' => 'GraniteServiceVersion20100801.GetMetricStatistics',
'Accept' => 'application/json',
];

// Prepare query
$query = [];
Expand All @@ -249,7 +253,8 @@ public function request(): Request
$uriString = '/';

// Prepare Body
$body = http_build_query(['Action' => 'GetMetricStatistics', 'Version' => '2010-08-01'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738);
$bodyPayload = $this->requestBody();
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304);

// Return the Request
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));
Expand Down Expand Up @@ -342,41 +347,42 @@ private function requestBody(): array
}
$payload['MetricName'] = $v;
if (null !== $v = $this->dimensions) {
$index = 0;
foreach ($v as $mapValue) {
$index = -1;
$payload['Dimensions'] = [];
foreach ($v as $listValue) {
++$index;
foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) {
$payload["Dimensions.member.$index.$bodyKey"] = $bodyValue;
}
$payload['Dimensions'][$index] = $listValue->requestBody();
}
}
if (null === $v = $this->startTime) {
throw new InvalidArgument(\sprintf('Missing parameter "StartTime" for "%s". The value cannot be null.', __CLASS__));
}
$payload['StartTime'] = $v->format(\DateTimeInterface::ATOM);
$payload['StartTime'] = $v->getTimestamp();
if (null === $v = $this->endTime) {
throw new InvalidArgument(\sprintf('Missing parameter "EndTime" for "%s". The value cannot be null.', __CLASS__));
}
$payload['EndTime'] = $v->format(\DateTimeInterface::ATOM);
$payload['EndTime'] = $v->getTimestamp();
if (null === $v = $this->period) {
throw new InvalidArgument(\sprintf('Missing parameter "Period" for "%s". The value cannot be null.', __CLASS__));
}
$payload['Period'] = $v;
if (null !== $v = $this->statistics) {
$index = 0;
foreach ($v as $mapValue) {
$index = -1;
$payload['Statistics'] = [];
foreach ($v as $listValue) {
++$index;
if (!Statistic::exists($mapValue)) {
throw new InvalidArgument(\sprintf('Invalid parameter "Statistics.member" for "%s". The value "%s" is not a valid "Statistic".', __CLASS__, $mapValue));
if (!Statistic::exists($listValue)) {
throw new InvalidArgument(\sprintf('Invalid parameter "Statistics" for "%s". The value "%s" is not a valid "Statistic".', __CLASS__, $listValue));
}
$payload["Statistics.member.$index"] = $mapValue;
$payload['Statistics'][$index] = $listValue;
}
}
if (null !== $v = $this->extendedStatistics) {
$index = 0;
foreach ($v as $mapValue) {
$index = -1;
$payload['ExtendedStatistics'] = [];
foreach ($v as $listValue) {
++$index;
$payload["ExtendedStatistics.member.$index"] = $mapValue;
$payload['ExtendedStatistics'][$index] = $listValue;
}
}
if (null !== $v = $this->unit) {
Expand Down
20 changes: 12 additions & 8 deletions src/Service/CloudWatch/src/Input/ListMetricsInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ public function getRecentlyActive(): ?string
public function request(): Request
{
// Prepare headers
$headers = ['content-type' => 'application/x-www-form-urlencoded'];
$headers = [
'Content-Type' => 'application/x-amz-json-1.0',
'X-Amz-Target' => 'GraniteServiceVersion20100801.ListMetrics',
'Accept' => 'application/json',
];

// Prepare query
$query = [];
Expand All @@ -167,7 +171,8 @@ public function request(): Request
$uriString = '/';

// Prepare Body
$body = http_build_query(['Action' => 'ListMetrics', 'Version' => '2010-08-01'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738);
$bodyPayload = $this->requestBody();
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304);

// Return the Request
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));
Expand Down Expand Up @@ -238,12 +243,11 @@ private function requestBody(): array
$payload['MetricName'] = $v;
}
if (null !== $v = $this->dimensions) {
$index = 0;
foreach ($v as $mapValue) {
$index = -1;
$payload['Dimensions'] = [];
foreach ($v as $listValue) {
++$index;
foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) {
$payload["Dimensions.member.$index.$bodyKey"] = $bodyValue;
}
$payload['Dimensions'][$index] = $listValue->requestBody();
}
}
if (null !== $v = $this->nextToken) {
Expand All @@ -256,7 +260,7 @@ private function requestBody(): array
$payload['RecentlyActive'] = $v;
}
if (null !== $v = $this->includeLinkedAccounts) {
$payload['IncludeLinkedAccounts'] = $v ? 'true' : 'false';
$payload['IncludeLinkedAccounts'] = (bool) $v;
}
if (null !== $v = $this->owningAccount) {
$payload['OwningAccount'] = $v;
Expand Down
29 changes: 16 additions & 13 deletions src/Service/CloudWatch/src/Input/PutMetricDataInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ public function getStrictEntityValidation(): ?bool
public function request(): Request
{
// Prepare headers
$headers = ['content-type' => 'application/x-www-form-urlencoded'];
$headers = [
'Content-Type' => 'application/x-amz-json-1.0',
'X-Amz-Target' => 'GraniteServiceVersion20100801.PutMetricData',
'Accept' => 'application/json',
];

// Prepare query
$query = [];
Expand All @@ -149,7 +153,8 @@ public function request(): Request
$uriString = '/';

// Prepare Body
$body = http_build_query(['Action' => 'PutMetricData', 'Version' => '2010-08-01'] + $this->requestBody(), '', '&', \PHP_QUERY_RFC1738);
$bodyPayload = $this->requestBody();
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload, 4194304);

// Return the Request
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));
Expand Down Expand Up @@ -197,25 +202,23 @@ private function requestBody(): array
}
$payload['Namespace'] = $v;
if (null !== $v = $this->metricData) {
$index = 0;
foreach ($v as $mapValue) {
$index = -1;
$payload['MetricData'] = [];
foreach ($v as $listValue) {
++$index;
foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) {
$payload["MetricData.member.$index.$bodyKey"] = $bodyValue;
}
$payload['MetricData'][$index] = $listValue->requestBody();
}
}
if (null !== $v = $this->entityMetricData) {
$index = 0;
foreach ($v as $mapValue) {
$index = -1;
$payload['EntityMetricData'] = [];
foreach ($v as $listValue) {
++$index;
foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) {
$payload["EntityMetricData.member.$index.$bodyKey"] = $bodyValue;
}
$payload['EntityMetricData'][$index] = $listValue->requestBody();
}
}
if (null !== $v = $this->strictEntityValidation) {
$payload['StrictEntityValidation'] = $v ? 'true' : 'false';
$payload['StrictEntityValidation'] = (bool) $v;
}

return $payload;
Expand Down
Loading