Skip to content

Commit

Permalink
feat(client-internetmonitor): This release adds a new feature for Ama…
Browse files Browse the repository at this point in the history
…zon CloudWatch Internet Monitor that enables customers to set custom thresholds, for performance and availability drops, for triggering when to create a health event.
  • Loading branch information
awstools committed Jun 28, 2023
1 parent a3ee38f commit fb478aa
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export interface GetHealthEventCommandOutput extends GetHealthEventOutput, __Met
* // Status: "STRING_VALUE", // required
* // PercentOfTotalTrafficImpacted: Number("double"),
* // ImpactType: "STRING_VALUE", // required
* // HealthScoreThreshold: Number("double"),
* // };
*
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export interface GetMonitorCommandOutput extends GetMonitorOutput, __MetadataBea
* // },
* // },
* // TrafficPercentageToMonitor: Number("int"),
* // HealthEventsConfig: { // HealthEventsConfig
* // AvailabilityScoreThreshold: Number("double"),
* // PerformanceScoreThreshold: Number("double"),
* // },
* // };
*
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
47 changes: 47 additions & 0 deletions clients/client-internetmonitor/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@ export class ConflictException extends __BaseException {
}
}

/**
* @public
* <p>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%.</p>
*/
export interface HealthEventsConfig {
/**
* <p>The health event threshold percentage set for availability scores.</p>
*/
AvailabilityScoreThreshold?: number;

/**
* <p>The health event threshold percentage set for performance scores.</p>
*/
PerformanceScoreThreshold?: number;
}

/**
* @public
* @enum
Expand Down Expand Up @@ -197,6 +215,13 @@ export interface CreateMonitorInput {
* <p>The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.</p>
*/
TrafficPercentageToMonitor?: number;

/**
* <p>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%.</p>
*/
HealthEventsConfig?: HealthEventsConfig;
}

/**
Expand Down Expand Up @@ -658,6 +683,11 @@ export interface GetHealthEventOutput {
* <p>The type of impairment of a specific health event.</p>
*/
ImpactType: HealthEventImpactType | string | undefined;

/**
* <p>The threshold percentage for health events when Amazon CloudWatch Internet Monitor creates a health event.</p>
*/
HealthScoreThreshold?: number;
}

/**
Expand Down Expand Up @@ -755,6 +785,12 @@ export interface GetMonitorOutput {
* <p>The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.</p>
*/
TrafficPercentageToMonitor?: number;

/**
* <p>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.</p>
*/
HealthEventsConfig?: HealthEventsConfig;
}

/**
Expand Down Expand Up @@ -811,6 +847,11 @@ export interface HealthEvent {
* <p>The type of impairment for a health event.</p>
*/
ImpactType: HealthEventImpactType | string | undefined;

/**
* <p>The value of the threshold percentage for performance or availability that was configured when Amazon CloudWatch Internet Monitor created the health event.</p>
*/
HealthScoreThreshold?: number;
}

/**
Expand Down Expand Up @@ -1083,6 +1124,12 @@ export interface UpdateMonitorInput {
* <p>The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.</p>
*/
TrafficPercentageToMonitor?: number;

/**
* <p>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.</p>
*/
HealthEventsConfig?: HealthEventsConfig;
}

/**
Expand Down
27 changes: 27 additions & 0 deletions clients/client-internetmonitor/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
map,
parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset,
resolvedPath as __resolvedPath,
serializeFloat as __serializeFloat,
take,
withBaseException,
} from "@aws-sdk/smithy-client";
Expand Down Expand Up @@ -41,6 +42,7 @@ import {
BadRequestException,
ConflictException,
HealthEvent,
HealthEventsConfig,
ImpactedLocation,
InternalServerErrorException,
InternalServerException,
Expand Down Expand Up @@ -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: [],
Expand Down Expand Up @@ -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(_),
Expand Down Expand Up @@ -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(_)),
Expand Down Expand Up @@ -546,6 +551,7 @@ export const de_GetMonitorCommand = async (
const data: Record<string, any> = __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(_)),
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(_)),
Expand All @@ -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
*/
Expand Down
64 changes: 64 additions & 0 deletions codegen/sdk-codegen/aws-models/internetmonitor.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@
"smithy.api#default": 0,
"smithy.api#documentation": "<p>The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.</p>"
}
},
"HealthEventsConfig": {
"target": "com.amazonaws.internetmonitor#HealthEventsConfig",
"traits": {
"smithy.api#documentation": "<p>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%.</p>"
}
}
}
},
Expand Down Expand Up @@ -357,6 +363,13 @@
"smithy.api#documentation": "<p>The type of impairment of a specific health event.</p>",
"smithy.api#required": {}
}
},
"HealthScoreThreshold": {
"target": "com.amazonaws.internetmonitor#Percentage",
"traits": {
"smithy.api#default": 0,
"smithy.api#documentation": "<p>The threshold percentage for health events when Amazon CloudWatch Internet Monitor creates a health event.</p>"
}
}
}
},
Expand Down Expand Up @@ -488,6 +501,12 @@
"smithy.api#default": 0,
"smithy.api#documentation": "<p>The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.</p>"
}
},
"HealthEventsConfig": {
"target": "com.amazonaws.internetmonitor#HealthEventsConfig",
"traits": {
"smithy.api#documentation": "<p>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.</p>"
}
}
}
},
Expand Down Expand Up @@ -564,6 +583,13 @@
"smithy.api#documentation": "<p>The type of impairment for a health event.</p>",
"smithy.api#required": {}
}
},
"HealthScoreThreshold": {
"target": "com.amazonaws.internetmonitor#Percentage",
"traits": {
"smithy.api#default": 0,
"smithy.api#documentation": "<p>The value of the threshold percentage for performance or availability that was configured when Amazon CloudWatch Internet Monitor created the health event.</p>"
}
}
},
"traits": {
Expand Down Expand Up @@ -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": "<p>The health event threshold percentage set for availability scores.</p>"
}
},
"PerformanceScoreThreshold": {
"target": "com.amazonaws.internetmonitor#Percentage",
"traits": {
"smithy.api#default": 0,
"smithy.api#documentation": "<p>The health event threshold percentage set for performance scores.</p>"
}
}
},
"traits": {
"smithy.api#documentation": "<p>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%.</p>"
}
},
"com.amazonaws.internetmonitor#ImpactedLocation": {
"type": "structure",
"members": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -2224,6 +2282,12 @@
"smithy.api#default": 0,
"smithy.api#documentation": "<p>The percentage of the internet-facing traffic for your application that you want to monitor with this monitor.</p>"
}
},
"HealthEventsConfig": {
"target": "com.amazonaws.internetmonitor#HealthEventsConfig",
"traits": {
"smithy.api#documentation": "<p>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.</p>"
}
}
}
},
Expand Down

0 comments on commit fb478aa

Please sign in to comment.