Skip to content

Commit 88eb6bc

Browse files
committed
update generated code
1 parent 0f1c886 commit 88eb6bc

File tree

14 files changed

+522
-24
lines changed

14 files changed

+522
-24
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"variables": {
3-
"${LATEST}": "3.327.1"
3+
"${LATEST}": "3.328.0"
44
},
55
"endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json",
66
"services": {

src/Service/CloudWatch/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Added
6+
7+
- AWS api-change: Adds support for adding related Entity information to metrics ingested through PutMetricData.
8+
59
### Changed
610

711
- use strict comparison `null !==` instead of `!`

src/Service/CloudWatch/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"extra": {
2929
"branch-alias": {
30-
"dev-master": "1.0-dev"
30+
"dev-master": "1.1-dev"
3131
}
3232
}
3333
}

src/Service/CloudWatch/src/CloudWatchClient.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use AsyncAws\CloudWatch\Result\ListMetricsOutput;
2121
use AsyncAws\CloudWatch\ValueObject\Dimension;
2222
use AsyncAws\CloudWatch\ValueObject\DimensionFilter;
23+
use AsyncAws\CloudWatch\ValueObject\EntityMetricData;
2324
use AsyncAws\CloudWatch\ValueObject\LabelOptions;
2425
use AsyncAws\CloudWatch\ValueObject\MetricDataQuery;
2526
use AsyncAws\CloudWatch\ValueObject\MetricDatum;
@@ -235,17 +236,23 @@ public function listMetrics($input = []): ListMetricsOutput
235236
}
236237

237238
/**
238-
* Publishes metric data points to Amazon CloudWatch. CloudWatch associates the data points with the specified metric.
239-
* If the specified metric does not exist, CloudWatch creates the metric. When CloudWatch creates a metric, it can take
240-
* up to fifteen minutes for the metric to appear in calls to ListMetrics [^1].
239+
* Publishes metric data to Amazon CloudWatch. CloudWatch associates the data with the specified metric. If the
240+
* specified metric does not exist, CloudWatch creates the metric. When CloudWatch creates a metric, it can take up to
241+
* fifteen minutes for the metric to appear in calls to ListMetrics [^1].
241242
*
242-
* You can publish either individual data points in the `Value` field, or arrays of values and the number of times each
243-
* value occurred during the period by using the `Values` and `Counts` fields in the `MetricData` structure. Using the
243+
* You can publish metrics with associated entity data (so that related telemetry can be found and viewed together), or
244+
* publish metric data by itself. To send entity data with your metrics, use the `EntityMetricData` parameter. To send
245+
* metrics without entity data, use the `MetricData` parameter. The `EntityMetricData` structure includes `MetricData`
246+
* structures for the metric data.
247+
*
248+
* You can publish either individual values in the `Value` field, or arrays of values and the number of times each value
249+
* occurred during the period by using the `Values` and `Counts` fields in the `MetricData` structure. Using the
244250
* `Values` and `Counts` method enables you to publish up to 150 values per metric with one `PutMetricData` request, and
245251
* supports retrieving percentile statistics on this data.
246252
*
247253
* Each `PutMetricData` request is limited to 1 MB in size for HTTP POST requests. You can send a payload compressed by
248-
* gzip. Each request is also limited to no more than 1000 different metrics.
254+
* gzip. Each request is also limited to no more than 1000 different metrics (across both the `MetricData` and
255+
* `EntityMetricData` properties).
249256
*
250257
* Although the `Value` parameter accepts numbers of type `Double`, CloudWatch rejects values that are either too small
251258
* or too large. Values must be in the range of -2^360 to 2^360. In addition, special values (for example, NaN,
@@ -260,7 +267,7 @@ public function listMetrics($input = []): ListMetricsOutput
260267
*
261268
* Data points with time stamps from 24 hours ago or longer can take at least 48 hours to become available for
262269
* GetMetricData [^3] or GetMetricStatistics [^4] from the time they are submitted. Data points with time stamps between
263-
* 3 and 24 hours ago can take as much as 2 hours to become available for for GetMetricData [^5] or GetMetricStatistics
270+
* 3 and 24 hours ago can take as much as 2 hours to become available for GetMetricData [^5] or GetMetricStatistics
264271
* [^6].
265272
*
266273
* CloudWatch needs raw data points to calculate percentile statistics. If you publish data using a statistic set
@@ -281,7 +288,9 @@ public function listMetrics($input = []): ListMetricsOutput
281288
*
282289
* @param array{
283290
* Namespace: string,
284-
* MetricData: array<MetricDatum|array>,
291+
* MetricData?: null|array<MetricDatum|array>,
292+
* EntityMetricData?: null|array<EntityMetricData|array>,
293+
* StrictEntityValidation?: null|bool,
285294
* '@region'?: string|null,
286295
* }|PutMetricDataInput $input
287296
*

src/Service/CloudWatch/src/Input/ListMetricsInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ final class ListMetricsInput extends Input
4444
* parameter with a value of `PT3H`. This is the only valid value for this parameter.
4545
*
4646
* The results that are returned are an approximation of the value you specify. There is a low probability that the
47-
* returned results include metrics with last published data as much as 40 minutes more than the specified time
47+
* returned results include metrics with last published data as much as 50 minutes more than the specified time
4848
* interval.
4949
*
5050
* @var RecentlyActive::*|null

src/Service/CloudWatch/src/Input/PutMetricDataInput.php

Lines changed: 102 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace AsyncAws\CloudWatch\Input;
44

5+
use AsyncAws\CloudWatch\ValueObject\Entity;
6+
use AsyncAws\CloudWatch\ValueObject\EntityMetricData;
57
use AsyncAws\CloudWatch\ValueObject\MetricDatum;
68
use AsyncAws\Core\Exception\InvalidArgument;
79
use AsyncAws\Core\Input;
@@ -24,32 +26,80 @@ final class PutMetricDataInput extends Input
2426
private $namespace;
2527

2628
/**
27-
* The data for the metric. The array can include no more than 1000 metrics per call.
29+
* The data for the metrics. Use this parameter if your metrics do not contain associated entities. The array can
30+
* include no more than 1000 metrics per call.
2831
*
29-
* @required
32+
* The limit of metrics allowed, 1000, is the sum of both `EntityMetricData` and `MetricData` metrics.
3033
*
3134
* @var MetricDatum[]|null
3235
*/
3336
private $metricData;
3437

38+
/**
39+
* Data for metrics that contain associated entity information. You can include up to two `EntityMetricData` objects,
40+
* each of which can contain a single `Entity` and associated metrics.
41+
*
42+
* The limit of metrics allowed, 1000, is the sum of both `EntityMetricData` and `MetricData` metrics.
43+
*
44+
* @var EntityMetricData[]|null
45+
*/
46+
private $entityMetricData;
47+
48+
/**
49+
* Whether to accept valid metric data when an invalid entity is sent.
50+
*
51+
* - When set to `true`: Any validation error (for entity or metric data) will fail the entire request, and no data will
52+
* be ingested. The failed operation will return a 400 result with the error.
53+
* - When set to `false`: Validation errors in the entity will not associate the metric with the entity, but the metric
54+
* data will still be accepted and ingested. Validation errors in the metric data will fail the entire request, and no
55+
* data will be ingested.
56+
*
57+
* In the case of an invalid entity, the operation will return a `200` status, but an additional response header will
58+
* contain information about the validation errors. The new header, `X-Amzn-Failure-Message` is an enumeration of the
59+
* following values:
60+
*
61+
* - `InvalidEntity` - The provided entity is invalid.
62+
* - `InvalidKeyAttributes` - The provided `KeyAttributes` of an entity is invalid.
63+
* - `InvalidAttributes` - The provided `Attributes` of an entity is invalid.
64+
* - `InvalidTypeValue` - The provided `Type` in the `KeyAttributes` of an entity is invalid.
65+
* - `EntitySizeTooLarge` - The number of `EntityMetricData` objects allowed is 2.
66+
* - `MissingRequiredFields` - There are missing required fields in the `KeyAttributes` for the provided `Type`.
67+
*
68+
* For details of the requirements for specifying an entity, see How to add related information to telemetry [^1] in
69+
* the *CloudWatch User Guide*.
70+
*
71+
* This parameter is *required* when `EntityMetricData` is included.
72+
*
73+
* [^1]: https://docs.aws.amazon.com/adding-your-own-related-telemetry.html
74+
*
75+
* @var bool|null
76+
*/
77+
private $strictEntityValidation;
78+
3579
/**
3680
* @param array{
3781
* Namespace?: string,
38-
* MetricData?: array<MetricDatum|array>,
82+
* MetricData?: null|array<MetricDatum|array>,
83+
* EntityMetricData?: null|array<EntityMetricData|array>,
84+
* StrictEntityValidation?: null|bool,
3985
* '@region'?: string|null,
4086
* } $input
4187
*/
4288
public function __construct(array $input = [])
4389
{
4490
$this->namespace = $input['Namespace'] ?? null;
4591
$this->metricData = isset($input['MetricData']) ? array_map([MetricDatum::class, 'create'], $input['MetricData']) : null;
92+
$this->entityMetricData = isset($input['EntityMetricData']) ? array_map([EntityMetricData::class, 'create'], $input['EntityMetricData']) : null;
93+
$this->strictEntityValidation = $input['StrictEntityValidation'] ?? null;
4694
parent::__construct($input);
4795
}
4896

4997
/**
5098
* @param array{
5199
* Namespace?: string,
52-
* MetricData?: array<MetricDatum|array>,
100+
* MetricData?: null|array<MetricDatum|array>,
101+
* EntityMetricData?: null|array<EntityMetricData|array>,
102+
* StrictEntityValidation?: null|bool,
53103
* '@region'?: string|null,
54104
* }|PutMetricDataInput $input
55105
*/
@@ -58,6 +108,14 @@ public static function create($input): self
58108
return $input instanceof self ? $input : new self($input);
59109
}
60110

111+
/**
112+
* @return EntityMetricData[]
113+
*/
114+
public function getEntityMetricData(): array
115+
{
116+
return $this->entityMetricData ?? [];
117+
}
118+
61119
/**
62120
* @return MetricDatum[]
63121
*/
@@ -71,6 +129,11 @@ public function getNamespace(): ?string
71129
return $this->namespace;
72130
}
73131

132+
public function getStrictEntityValidation(): ?bool
133+
{
134+
return $this->strictEntityValidation;
135+
}
136+
74137
/**
75138
* @internal
76139
*/
@@ -92,6 +155,16 @@ public function request(): Request
92155
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));
93156
}
94157

158+
/**
159+
* @param EntityMetricData[] $value
160+
*/
161+
public function setEntityMetricData(array $value): self
162+
{
163+
$this->entityMetricData = $value;
164+
165+
return $this;
166+
}
167+
95168
/**
96169
* @param MetricDatum[] $value
97170
*/
@@ -109,24 +182,41 @@ public function setNamespace(?string $value): self
109182
return $this;
110183
}
111184

185+
public function setStrictEntityValidation(?bool $value): self
186+
{
187+
$this->strictEntityValidation = $value;
188+
189+
return $this;
190+
}
191+
112192
private function requestBody(): array
113193
{
114194
$payload = [];
115195
if (null === $v = $this->namespace) {
116196
throw new InvalidArgument(\sprintf('Missing parameter "Namespace" for "%s". The value cannot be null.', __CLASS__));
117197
}
118198
$payload['Namespace'] = $v;
119-
if (null === $v = $this->metricData) {
120-
throw new InvalidArgument(\sprintf('Missing parameter "MetricData" for "%s". The value cannot be null.', __CLASS__));
199+
if (null !== $v = $this->metricData) {
200+
$index = 0;
201+
foreach ($v as $mapValue) {
202+
++$index;
203+
foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) {
204+
$payload["MetricData.member.$index.$bodyKey"] = $bodyValue;
205+
}
206+
}
121207
}
122-
123-
$index = 0;
124-
foreach ($v as $mapValue) {
125-
++$index;
126-
foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) {
127-
$payload["MetricData.member.$index.$bodyKey"] = $bodyValue;
208+
if (null !== $v = $this->entityMetricData) {
209+
$index = 0;
210+
foreach ($v as $mapValue) {
211+
++$index;
212+
foreach ($mapValue->requestBody() as $bodyKey => $bodyValue) {
213+
$payload["EntityMetricData.member.$index.$bodyKey"] = $bodyValue;
214+
}
128215
}
129216
}
217+
if (null !== $v = $this->strictEntityValidation) {
218+
$payload['StrictEntityValidation'] = $v ? 'true' : 'false';
219+
}
130220

131221
return $payload;
132222
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?php
2+
3+
namespace AsyncAws\CloudWatch\ValueObject;
4+
5+
/**
6+
* An entity associated with metrics, to allow for finding related telemetry. An entity is typically a resource or
7+
* service within your system. For example, metrics from an Amazon EC2 instance could be associated with that instance
8+
* as the entity. Similarly, metrics from a service that you own could be associated with that service as the entity.
9+
*/
10+
final class Entity
11+
{
12+
/**
13+
* The attributes of the entity which identify the specific entity, as a list of key-value pairs. Entities with the same
14+
* `KeyAttributes` are considered to be the same entity. For an entity to be valid, the `KeyAttributes` must exist and
15+
* be formatted correctly.
16+
*
17+
* There are five allowed attributes (key names): `Type`, `ResourceType`, `Identifier`, `Name`, and `Environment`.
18+
*
19+
* For details about how to use the key attributes to specify an entity, see How to add related information to telemetry
20+
* [^1] in the *CloudWatch User Guide*.
21+
*
22+
* [^1]: https://docs.aws.amazon.com/adding-your-own-related-telemetry.html
23+
*
24+
* @var array<string, string>|null
25+
*/
26+
private $keyAttributes;
27+
28+
/**
29+
* Additional attributes of the entity that are not used to specify the identity of the entity. A list of key-value
30+
* pairs.
31+
*
32+
* For details about how to use the attributes, see How to add related information to telemetry [^1] in the *CloudWatch
33+
* User Guide*.
34+
*
35+
* [^1]: https://docs.aws.amazon.com/adding-your-own-related-telemetry.html
36+
*
37+
* @var array<string, string>|null
38+
*/
39+
private $attributes;
40+
41+
/**
42+
* @param array{
43+
* KeyAttributes?: null|array<string, string>,
44+
* Attributes?: null|array<string, string>,
45+
* } $input
46+
*/
47+
public function __construct(array $input)
48+
{
49+
$this->keyAttributes = $input['KeyAttributes'] ?? null;
50+
$this->attributes = $input['Attributes'] ?? null;
51+
}
52+
53+
/**
54+
* @param array{
55+
* KeyAttributes?: null|array<string, string>,
56+
* Attributes?: null|array<string, string>,
57+
* }|Entity $input
58+
*/
59+
public static function create($input): self
60+
{
61+
return $input instanceof self ? $input : new self($input);
62+
}
63+
64+
/**
65+
* @return array<string, string>
66+
*/
67+
public function getAttributes(): array
68+
{
69+
return $this->attributes ?? [];
70+
}
71+
72+
/**
73+
* @return array<string, string>
74+
*/
75+
public function getKeyAttributes(): array
76+
{
77+
return $this->keyAttributes ?? [];
78+
}
79+
80+
/**
81+
* @internal
82+
*/
83+
public function requestBody(): array
84+
{
85+
$payload = [];
86+
if (null !== $v = $this->keyAttributes) {
87+
$index = 0;
88+
foreach ($v as $mapKey => $mapValue) {
89+
++$index;
90+
$payload["KeyAttributes.entry.$index.key"] = $mapKey;
91+
$payload["KeyAttributes.entry.$index.value"] = $mapValue;
92+
}
93+
}
94+
if (null !== $v = $this->attributes) {
95+
$index = 0;
96+
foreach ($v as $mapKey => $mapValue) {
97+
++$index;
98+
$payload["Attributes.entry.$index.key"] = $mapKey;
99+
$payload["Attributes.entry.$index.value"] = $mapValue;
100+
}
101+
}
102+
103+
return $payload;
104+
}
105+
}

0 commit comments

Comments
 (0)