From fb478aaea8c100d368782847b047074471909aba Mon Sep 17 00:00:00 2001 From: awstools Date: Wed, 28 Jun 2023 18:15:56 +0000 Subject: [PATCH] feat(client-internetmonitor): This release adds a new feature for Amazon CloudWatch Internet Monitor that enables customers to set custom thresholds, for performance and availability drops, for triggering when to create a health event. --- .../src/commands/CreateMonitorCommand.ts | 4 ++ .../src/commands/GetHealthEventCommand.ts | 1 + .../src/commands/GetMonitorCommand.ts | 4 ++ .../src/commands/ListHealthEventsCommand.ts | 1 + .../src/commands/UpdateMonitorCommand.ts | 4 ++ .../src/models/models_0.ts | 47 ++++++++++++++ .../src/protocols/Aws_restJson1.ts | 27 ++++++++ .../aws-models/internetmonitor.json | 64 +++++++++++++++++++ 8 files changed, 152 insertions(+) diff --git a/clients/client-internetmonitor/src/commands/CreateMonitorCommand.ts b/clients/client-internetmonitor/src/commands/CreateMonitorCommand.ts index fd8bbc88281a..abb1c956845a 100644 --- a/clients/client-internetmonitor/src/commands/CreateMonitorCommand.ts +++ b/clients/client-internetmonitor/src/commands/CreateMonitorCommand.ts @@ -67,6 +67,10 @@ export interface CreateMonitorCommandOutput extends CreateMonitorOutput, __Metad * }, * }, * TrafficPercentageToMonitor: Number("int"), + * HealthEventsConfig: { // HealthEventsConfig + * AvailabilityScoreThreshold: Number("double"), + * PerformanceScoreThreshold: Number("double"), + * }, * }; * const command = new CreateMonitorCommand(input); * const response = await client.send(command); diff --git a/clients/client-internetmonitor/src/commands/GetHealthEventCommand.ts b/clients/client-internetmonitor/src/commands/GetHealthEventCommand.ts index 592e54134cf7..a69839c7155b 100644 --- a/clients/client-internetmonitor/src/commands/GetHealthEventCommand.ts +++ b/clients/client-internetmonitor/src/commands/GetHealthEventCommand.ts @@ -111,6 +111,7 @@ export interface GetHealthEventCommandOutput extends GetHealthEventOutput, __Met * // Status: "STRING_VALUE", // required * // PercentOfTotalTrafficImpacted: Number("double"), * // ImpactType: "STRING_VALUE", // required + * // HealthScoreThreshold: Number("double"), * // }; * * ``` diff --git a/clients/client-internetmonitor/src/commands/GetMonitorCommand.ts b/clients/client-internetmonitor/src/commands/GetMonitorCommand.ts index cd31b236c086..b08aff70a5ee 100644 --- a/clients/client-internetmonitor/src/commands/GetMonitorCommand.ts +++ b/clients/client-internetmonitor/src/commands/GetMonitorCommand.ts @@ -72,6 +72,10 @@ export interface GetMonitorCommandOutput extends GetMonitorOutput, __MetadataBea * // }, * // }, * // TrafficPercentageToMonitor: Number("int"), + * // HealthEventsConfig: { // HealthEventsConfig + * // AvailabilityScoreThreshold: Number("double"), + * // PerformanceScoreThreshold: Number("double"), + * // }, * // }; * * ``` diff --git a/clients/client-internetmonitor/src/commands/ListHealthEventsCommand.ts b/clients/client-internetmonitor/src/commands/ListHealthEventsCommand.ts index b0b2e36addf4..708e3159ffa4 100644 --- a/clients/client-internetmonitor/src/commands/ListHealthEventsCommand.ts +++ b/clients/client-internetmonitor/src/commands/ListHealthEventsCommand.ts @@ -117,6 +117,7 @@ export interface ListHealthEventsCommandOutput extends ListHealthEventsOutput, _ * // Status: "STRING_VALUE", // required * // PercentOfTotalTrafficImpacted: Number("double"), * // ImpactType: "STRING_VALUE", // required + * // HealthScoreThreshold: Number("double"), * // }, * // ], * // NextToken: "STRING_VALUE", diff --git a/clients/client-internetmonitor/src/commands/UpdateMonitorCommand.ts b/clients/client-internetmonitor/src/commands/UpdateMonitorCommand.ts index ca4d5b0afb92..fce885433b3c 100644 --- a/clients/client-internetmonitor/src/commands/UpdateMonitorCommand.ts +++ b/clients/client-internetmonitor/src/commands/UpdateMonitorCommand.ts @@ -66,6 +66,10 @@ export interface UpdateMonitorCommandOutput extends UpdateMonitorOutput, __Metad * }, * }, * TrafficPercentageToMonitor: Number("int"), + * HealthEventsConfig: { // HealthEventsConfig + * AvailabilityScoreThreshold: Number("double"), + * PerformanceScoreThreshold: Number("double"), + * }, * }; * const command = new UpdateMonitorCommand(input); * const response = await client.send(command); diff --git a/clients/client-internetmonitor/src/models/models_0.ts b/clients/client-internetmonitor/src/models/models_0.ts index 51a2b55c9a52..e17c9b513504 100644 --- a/clients/client-internetmonitor/src/models/models_0.ts +++ b/clients/client-internetmonitor/src/models/models_0.ts @@ -100,6 +100,24 @@ export class ConflictException extends __BaseException { } } +/** + * @public + *

A complex type for the configuration. Defines the health event threshold percentages, for performance score and availability score. Amazon CloudWatch Internet Monitor creates a health event when + * there's an internet issue that affects your application end users where a health score percentage is at or below a set threshold. If you + * don't set a health event threshold, the default value is 95%.

+ */ +export interface HealthEventsConfig { + /** + *

The health event threshold percentage set for availability scores.

+ */ + AvailabilityScoreThreshold?: number; + + /** + *

The health event threshold percentage set for performance scores.

+ */ + PerformanceScoreThreshold?: number; +} + /** * @public * @enum @@ -197,6 +215,13 @@ export interface CreateMonitorInput { *

The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.

*/ TrafficPercentageToMonitor?: number; + + /** + *

Defines the health event threshold percentages, for performance score and availability score. Internet Monitor creates a health event when + * there's an internet issue that affects your application end users where a health score percentage is at or below a set threshold. If you + * don't set a health event threshold, the default calue is 95%.

+ */ + HealthEventsConfig?: HealthEventsConfig; } /** @@ -658,6 +683,11 @@ export interface GetHealthEventOutput { *

The type of impairment of a specific health event.

*/ ImpactType: HealthEventImpactType | string | undefined; + + /** + *

The threshold percentage for health events when Amazon CloudWatch Internet Monitor creates a health event.

+ */ + HealthScoreThreshold?: number; } /** @@ -755,6 +785,12 @@ export interface GetMonitorOutput { *

The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.

*/ TrafficPercentageToMonitor?: number; + + /** + *

The list of health event thresholds. A health event threshold percentage, for performance and availability, determines the level + * of impact at which Amazon CloudWatch Internet Monitor creates a health event when there's an internet issue that affects your application end users.

+ */ + HealthEventsConfig?: HealthEventsConfig; } /** @@ -811,6 +847,11 @@ export interface HealthEvent { *

The type of impairment for a health event.

*/ ImpactType: HealthEventImpactType | string | undefined; + + /** + *

The value of the threshold percentage for performance or availability that was configured when Amazon CloudWatch Internet Monitor created the health event.

+ */ + HealthScoreThreshold?: number; } /** @@ -1083,6 +1124,12 @@ export interface UpdateMonitorInput { *

The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.

*/ TrafficPercentageToMonitor?: number; + + /** + *

The list of health event thresholds. A health event threshold percentage, for performance and availability, determines when Internet Monitor creates + * a health event when there's an internet issue that affects your application end users.

+ */ + HealthEventsConfig?: HealthEventsConfig; } /** diff --git a/clients/client-internetmonitor/src/protocols/Aws_restJson1.ts b/clients/client-internetmonitor/src/protocols/Aws_restJson1.ts index c6c72b31c7b8..1c39280249e0 100644 --- a/clients/client-internetmonitor/src/protocols/Aws_restJson1.ts +++ b/clients/client-internetmonitor/src/protocols/Aws_restJson1.ts @@ -13,6 +13,7 @@ import { map, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, resolvedPath as __resolvedPath, + serializeFloat as __serializeFloat, take, withBaseException, } from "@aws-sdk/smithy-client"; @@ -41,6 +42,7 @@ import { BadRequestException, ConflictException, HealthEvent, + HealthEventsConfig, ImpactedLocation, InternalServerErrorException, InternalServerException, @@ -73,6 +75,7 @@ export const se_CreateMonitorCommand = async ( body = JSON.stringify( take(input, { ClientToken: [true, (_) => _ ?? generateIdempotencyToken()], + HealthEventsConfig: (_) => se_HealthEventsConfig(_, context), InternetMeasurementsLogDelivery: (_) => _json(_), MaxCityNetworksToMonitor: [], MonitorName: [], @@ -331,6 +334,7 @@ export const se_UpdateMonitorCommand = async ( body = JSON.stringify( take(input, { ClientToken: [true, (_) => _ ?? generateIdempotencyToken()], + HealthEventsConfig: (_) => se_HealthEventsConfig(_, context), InternetMeasurementsLogDelivery: (_) => _json(_), MaxCityNetworksToMonitor: [], ResourcesToAdd: (_) => _json(_), @@ -484,6 +488,7 @@ export const de_GetHealthEventCommand = async ( EndedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), EventArn: __expectString, EventId: __expectString, + HealthScoreThreshold: __limitedParseDouble, ImpactType: __expectString, ImpactedLocations: (_) => de_ImpactedLocationsList(_, context), LastUpdatedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), @@ -546,6 +551,7 @@ export const de_GetMonitorCommand = async ( const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); const doc = take(data, { CreatedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + HealthEventsConfig: (_) => de_HealthEventsConfig(_, context), InternetMeasurementsLogDelivery: _json, MaxCityNetworksToMonitor: __expectInt32, ModifiedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), @@ -1149,6 +1155,16 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont return __decorateServiceException(exception, parsedOutput.body); }; +/** + * serializeAws_restJson1HealthEventsConfig + */ +const se_HealthEventsConfig = (input: HealthEventsConfig, context: __SerdeContext): any => { + return take(input, { + AvailabilityScoreThreshold: __serializeFloat, + PerformanceScoreThreshold: __serializeFloat, + }); +}; + // se_InternetMeasurementsLogDelivery omitted. // se_S3Config omitted. @@ -1177,6 +1193,7 @@ const de_HealthEvent = (output: any, context: __SerdeContext): HealthEvent => { EndedAt: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), EventArn: __expectString, EventId: __expectString, + HealthScoreThreshold: __limitedParseDouble, ImpactType: __expectString, ImpactedLocations: (_: any) => de_ImpactedLocationsList(_, context), LastUpdatedAt: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), @@ -1198,6 +1215,16 @@ const de_HealthEventList = (output: any, context: __SerdeContext): HealthEvent[] return retVal; }; +/** + * deserializeAws_restJson1HealthEventsConfig + */ +const de_HealthEventsConfig = (output: any, context: __SerdeContext): HealthEventsConfig => { + return take(output, { + AvailabilityScoreThreshold: __limitedParseDouble, + PerformanceScoreThreshold: __limitedParseDouble, + }) as any; +}; + /** * deserializeAws_restJson1ImpactedLocation */ diff --git a/codegen/sdk-codegen/aws-models/internetmonitor.json b/codegen/sdk-codegen/aws-models/internetmonitor.json index 0928ede027e7..bd09e55b36e1 100644 --- a/codegen/sdk-codegen/aws-models/internetmonitor.json +++ b/codegen/sdk-codegen/aws-models/internetmonitor.json @@ -162,6 +162,12 @@ "smithy.api#default": 0, "smithy.api#documentation": "

The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.

" } + }, + "HealthEventsConfig": { + "target": "com.amazonaws.internetmonitor#HealthEventsConfig", + "traits": { + "smithy.api#documentation": "

Defines the health event threshold percentages, for performance score and availability score. Internet Monitor creates a health event when \n\t\t\tthere's an internet issue that affects your application end users where a health score percentage is at or below a set threshold. If you \n\t\t\tdon't set a health event threshold, the default calue is 95%.

" + } } } }, @@ -357,6 +363,13 @@ "smithy.api#documentation": "

The type of impairment of a specific health event.

", "smithy.api#required": {} } + }, + "HealthScoreThreshold": { + "target": "com.amazonaws.internetmonitor#Percentage", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The threshold percentage for health events when Amazon CloudWatch Internet Monitor creates a health event.

" + } } } }, @@ -488,6 +501,12 @@ "smithy.api#default": 0, "smithy.api#documentation": "

The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.

" } + }, + "HealthEventsConfig": { + "target": "com.amazonaws.internetmonitor#HealthEventsConfig", + "traits": { + "smithy.api#documentation": "

The list of health event thresholds. A health event threshold percentage, for performance and availability, determines the level\n\t\t\tof impact at which Amazon CloudWatch Internet Monitor creates a health event when there's an internet issue that affects your application end users.

" + } } } }, @@ -564,6 +583,13 @@ "smithy.api#documentation": "

The type of impairment for a health event.

", "smithy.api#required": {} } + }, + "HealthScoreThreshold": { + "target": "com.amazonaws.internetmonitor#Percentage", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The value of the threshold percentage for performance or availability that was configured when Amazon CloudWatch Internet Monitor created the health event.

" + } } }, "traits": { @@ -639,6 +665,28 @@ ] } }, + "com.amazonaws.internetmonitor#HealthEventsConfig": { + "type": "structure", + "members": { + "AvailabilityScoreThreshold": { + "target": "com.amazonaws.internetmonitor#Percentage", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The health event threshold percentage set for availability scores.

" + } + }, + "PerformanceScoreThreshold": { + "target": "com.amazonaws.internetmonitor#Percentage", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The health event threshold percentage set for performance scores.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

A complex type for the configuration. Defines the health event threshold percentages, for performance score and availability score. Amazon CloudWatch Internet Monitor creates a health event when \n\t\t\tthere's an internet issue that affects your application end users where a health score percentage is at or below a set threshold. If you \n\t\t\tdon't set a health event threshold, the default value is 95%.

" + } + }, "com.amazonaws.internetmonitor#ImpactedLocation": { "type": "structure", "members": { @@ -1771,6 +1819,16 @@ "smithy.api#httpError": 404 } }, + "com.amazonaws.internetmonitor#Percentage": { + "type": "double", + "traits": { + "smithy.api#default": 0, + "smithy.api#range": { + "min": 0, + "max": 100 + } + } + }, "com.amazonaws.internetmonitor#PerformanceMeasurement": { "type": "structure", "members": { @@ -2224,6 +2282,12 @@ "smithy.api#default": 0, "smithy.api#documentation": "

The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.

" } + }, + "HealthEventsConfig": { + "target": "com.amazonaws.internetmonitor#HealthEventsConfig", + "traits": { + "smithy.api#documentation": "

The list of health event thresholds. A health event threshold percentage, for performance and availability, determines when Internet Monitor creates \n\t\t\ta health event when there's an internet issue that affects your application end users.

" + } } } },