Skip to content

Commit

Permalink
feat(client-health): Adds new API DescribeEntityAggregatesForOrganiza…
Browse files Browse the repository at this point in the history
…tion that retrieves entity aggregates across your organization. Also adds support for resource status filtering in DescribeAffectedEntitiesForOrganization, resource status aggregates in the DescribeEntityAggregates response, and new resource statuses.
  • Loading branch information
awstools committed Aug 31, 2023
1 parent 5152c34 commit 58d1b48
Show file tree
Hide file tree
Showing 12 changed files with 886 additions and 252 deletions.
8 changes: 8 additions & 0 deletions clients/client-health/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,14 @@ DescribeEntityAggregates

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-health/classes/describeentityaggregatescommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-health/interfaces/describeentityaggregatescommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-health/interfaces/describeentityaggregatescommandoutput.html)

</details>
<details>
<summary>
DescribeEntityAggregatesForOrganization
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-health/classes/describeentityaggregatesfororganizationcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-health/interfaces/describeentityaggregatesfororganizationcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-health/interfaces/describeentityaggregatesfororganizationcommandoutput.html)

</details>
<details>
<summary>
Expand Down
23 changes: 23 additions & 0 deletions clients/client-health/src/Health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ import {
DescribeEntityAggregatesCommandInput,
DescribeEntityAggregatesCommandOutput,
} from "./commands/DescribeEntityAggregatesCommand";
import {
DescribeEntityAggregatesForOrganizationCommand,
DescribeEntityAggregatesForOrganizationCommandInput,
DescribeEntityAggregatesForOrganizationCommandOutput,
} from "./commands/DescribeEntityAggregatesForOrganizationCommand";
import {
DescribeEventAggregatesCommand,
DescribeEventAggregatesCommandInput,
Expand Down Expand Up @@ -74,6 +79,7 @@ const commands = {
DescribeAffectedEntitiesCommand,
DescribeAffectedEntitiesForOrganizationCommand,
DescribeEntityAggregatesCommand,
DescribeEntityAggregatesForOrganizationCommand,
DescribeEventAggregatesCommand,
DescribeEventDetailsCommand,
DescribeEventDetailsForOrganizationCommand,
Expand Down Expand Up @@ -154,6 +160,23 @@ export interface Health {
cb: (err: any, data?: DescribeEntityAggregatesCommandOutput) => void
): void;

/**
* @see {@link DescribeEntityAggregatesForOrganizationCommand}
*/
describeEntityAggregatesForOrganization(
args: DescribeEntityAggregatesForOrganizationCommandInput,
options?: __HttpHandlerOptions
): Promise<DescribeEntityAggregatesForOrganizationCommandOutput>;
describeEntityAggregatesForOrganization(
args: DescribeEntityAggregatesForOrganizationCommandInput,
cb: (err: any, data?: DescribeEntityAggregatesForOrganizationCommandOutput) => void
): void;
describeEntityAggregatesForOrganization(
args: DescribeEntityAggregatesForOrganizationCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: DescribeEntityAggregatesForOrganizationCommandOutput) => void
): void;

/**
* @see {@link DescribeEventAggregatesCommand}
*/
Expand Down
6 changes: 6 additions & 0 deletions clients/client-health/src/HealthClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ import {
DescribeEntityAggregatesCommandInput,
DescribeEntityAggregatesCommandOutput,
} from "./commands/DescribeEntityAggregatesCommand";
import {
DescribeEntityAggregatesForOrganizationCommandInput,
DescribeEntityAggregatesForOrganizationCommandOutput,
} from "./commands/DescribeEntityAggregatesForOrganizationCommand";
import {
DescribeEventAggregatesCommandInput,
DescribeEventAggregatesCommandOutput,
Expand Down Expand Up @@ -115,6 +119,7 @@ export type ServiceInputTypes =
| DescribeAffectedEntitiesCommandInput
| DescribeAffectedEntitiesForOrganizationCommandInput
| DescribeEntityAggregatesCommandInput
| DescribeEntityAggregatesForOrganizationCommandInput
| DescribeEventAggregatesCommandInput
| DescribeEventDetailsCommandInput
| DescribeEventDetailsForOrganizationCommandInput
Expand All @@ -133,6 +138,7 @@ export type ServiceOutputTypes =
| DescribeAffectedEntitiesCommandOutput
| DescribeAffectedEntitiesForOrganizationCommandOutput
| DescribeEntityAggregatesCommandOutput
| DescribeEntityAggregatesForOrganizationCommandOutput
| DescribeEventAggregatesCommandOutput
| DescribeEventDetailsCommandOutput
| DescribeEventDetailsForOrganizationCommandOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export interface DescribeAffectedEntitiesCommandOutput extends DescribeAffectedE
* },
* ],
* statusCodes: [ // entityStatusCodeList
* "IMPAIRED" || "UNIMPAIRED" || "UNKNOWN",
* "IMPAIRED" || "UNIMPAIRED" || "UNKNOWN" || "PENDING" || "RESOLVED",
* ],
* },
* locale: "STRING_VALUE",
Expand All @@ -100,7 +100,7 @@ export interface DescribeAffectedEntitiesCommandOutput extends DescribeAffectedE
* // entityUrl: "STRING_VALUE",
* // awsAccountId: "STRING_VALUE",
* // lastUpdatedTime: new Date("TIMESTAMP"),
* // statusCode: "IMPAIRED" || "UNIMPAIRED" || "UNKNOWN",
* // statusCode: "IMPAIRED" || "UNIMPAIRED" || "UNKNOWN" || "PENDING" || "RESOLVED",
* // tags: { // tagSet
* // "<keys>": "STRING_VALUE",
* // },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export interface DescribeAffectedEntitiesForOrganizationCommandOutput
* // const { HealthClient, DescribeAffectedEntitiesForOrganizationCommand } = require("@aws-sdk/client-health"); // CommonJS import
* const client = new HealthClient(config);
* const input = { // DescribeAffectedEntitiesForOrganizationRequest
* organizationEntityFilters: [ // OrganizationEntityFiltersList // required
* organizationEntityFilters: [ // OrganizationEntityFiltersList
* { // EventAccountFilter
* eventArn: "STRING_VALUE", // required
* awsAccountId: "STRING_VALUE",
Expand All @@ -80,6 +80,15 @@ export interface DescribeAffectedEntitiesForOrganizationCommandOutput
* locale: "STRING_VALUE",
* nextToken: "STRING_VALUE",
* maxResults: Number("int"),
* organizationEntityAccountFilters: [ // OrganizationEntityAccountFiltersList
* { // EntityAccountFilter
* eventArn: "STRING_VALUE", // required
* awsAccountId: "STRING_VALUE",
* statusCodes: [ // entityStatusCodeList
* "IMPAIRED" || "UNIMPAIRED" || "UNKNOWN" || "PENDING" || "RESOLVED",
* ],
* },
* ],
* };
* const command = new DescribeAffectedEntitiesForOrganizationCommand(input);
* const response = await client.send(command);
Expand All @@ -92,7 +101,7 @@ export interface DescribeAffectedEntitiesForOrganizationCommandOutput
* // entityUrl: "STRING_VALUE",
* // awsAccountId: "STRING_VALUE",
* // lastUpdatedTime: new Date("TIMESTAMP"),
* // statusCode: "IMPAIRED" || "UNIMPAIRED" || "UNKNOWN",
* // statusCode: "IMPAIRED" || "UNIMPAIRED" || "UNKNOWN" || "PENDING" || "RESOLVED",
* // tags: { // tagSet
* // "<keys>": "STRING_VALUE",
* // },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export interface DescribeEntityAggregatesCommandOutput extends DescribeEntityAgg
* // { // EntityAggregate
* // eventArn: "STRING_VALUE",
* // count: Number("int"),
* // statuses: { // entityStatuses
* // "<keys>": Number("int"),
* // },
* // },
* // ],
* // };
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
import { Command as $Command } from "@smithy/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@smithy/types";

import { HealthClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../HealthClient";
import {
DescribeEntityAggregatesForOrganizationRequest,
DescribeEntityAggregatesForOrganizationResponse,
} from "../models/models_0";
import {
de_DescribeEntityAggregatesForOrganizationCommand,
se_DescribeEntityAggregatesForOrganizationCommand,
} from "../protocols/Aws_json1_1";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link DescribeEntityAggregatesForOrganizationCommand}.
*/
export interface DescribeEntityAggregatesForOrganizationCommandInput
extends DescribeEntityAggregatesForOrganizationRequest {}
/**
* @public
*
* The output of {@link DescribeEntityAggregatesForOrganizationCommand}.
*/
export interface DescribeEntityAggregatesForOrganizationCommandOutput
extends DescribeEntityAggregatesForOrganizationResponse,
__MetadataBearer {}

/**
* @public
* <p>Returns a list of entity aggregates for your Organizations that are affected by each of the specified events.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { HealthClient, DescribeEntityAggregatesForOrganizationCommand } from "@aws-sdk/client-health"; // ES Modules import
* // const { HealthClient, DescribeEntityAggregatesForOrganizationCommand } = require("@aws-sdk/client-health"); // CommonJS import
* const client = new HealthClient(config);
* const input = { // DescribeEntityAggregatesForOrganizationRequest
* eventArns: [ // OrganizationEventArnsList // required
* "STRING_VALUE",
* ],
* awsAccountIds: [ // OrganizationAccountIdsList
* "STRING_VALUE",
* ],
* };
* const command = new DescribeEntityAggregatesForOrganizationCommand(input);
* const response = await client.send(command);
* // { // DescribeEntityAggregatesForOrganizationResponse
* // organizationEntityAggregates: [ // OrganizationEntityAggregatesList
* // { // OrganizationEntityAggregate
* // eventArn: "STRING_VALUE",
* // count: Number("int"),
* // statuses: { // entityStatuses
* // "<keys>": Number("int"),
* // },
* // accounts: [ // AccountEntityAggregatesList
* // { // AccountEntityAggregate
* // accountId: "STRING_VALUE",
* // count: Number("int"),
* // statuses: {
* // "<keys>": Number("int"),
* // },
* // },
* // ],
* // },
* // ],
* // };
*
* ```
*
* @param DescribeEntityAggregatesForOrganizationCommandInput - {@link DescribeEntityAggregatesForOrganizationCommandInput}
* @returns {@link DescribeEntityAggregatesForOrganizationCommandOutput}
* @see {@link DescribeEntityAggregatesForOrganizationCommandInput} for command's `input` shape.
* @see {@link DescribeEntityAggregatesForOrganizationCommandOutput} for command's `response` shape.
* @see {@link HealthClientResolvedConfig | config} for HealthClient's `config` shape.
*
* @throws {@link HealthServiceException}
* <p>Base exception class for all service exceptions from Health service.</p>
*
*/
export class DescribeEntityAggregatesForOrganizationCommand extends $Command<
DescribeEntityAggregatesForOrganizationCommandInput,
DescribeEntityAggregatesForOrganizationCommandOutput,
HealthClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}

/**
* @public
*/
constructor(readonly input: DescribeEntityAggregatesForOrganizationCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: HealthClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<
DescribeEntityAggregatesForOrganizationCommandInput,
DescribeEntityAggregatesForOrganizationCommandOutput
> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(
configuration,
DescribeEntityAggregatesForOrganizationCommand.getEndpointParameterInstructions()
)
);

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "HealthClient";
const commandName = "DescribeEntityAggregatesForOrganizationCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

/**
* @internal
*/
private serialize(
input: DescribeEntityAggregatesForOrganizationCommandInput,
context: __SerdeContext
): Promise<__HttpRequest> {
return se_DescribeEntityAggregatesForOrganizationCommand(input, context);
}

/**
* @internal
*/
private deserialize(
output: __HttpResponse,
context: __SerdeContext
): Promise<DescribeEntityAggregatesForOrganizationCommandOutput> {
return de_DescribeEntityAggregatesForOrganizationCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
1 change: 1 addition & 0 deletions clients/client-health/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from "./DescribeAffectedAccountsForOrganizationCommand";
export * from "./DescribeAffectedEntitiesCommand";
export * from "./DescribeAffectedEntitiesForOrganizationCommand";
export * from "./DescribeEntityAggregatesCommand";
export * from "./DescribeEntityAggregatesForOrganizationCommand";
export * from "./DescribeEventAggregatesCommand";
export * from "./DescribeEventDetailsCommand";
export * from "./DescribeEventDetailsForOrganizationCommand";
Expand Down
2 changes: 1 addition & 1 deletion clients/client-health/src/endpoint/ruleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ q={[v]:"booleanEquals",[w]:[true,{[v]:"getAttr",[w]:[{[x]:e},"supportsDualStack"
r=[l],
s=[m],
t=[o];
const _data={version:"1.0",parameters:{Region:i,UseDualStack:j,UseFIPS:j,Endpoint:i},rules:[{conditions:[{[v]:a,[w]:[k]}],type:b,rules:[{conditions:r,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:c},{type:b,rules:[{conditions:s,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:c},{endpoint:{url:k,properties:n,headers:n},type:d}]}]},{type:b,rules:[{conditions:[{[v]:a,[w]:t}],type:b,rules:[{conditions:[{[v]:"aws.partition",[w]:t,assign:e}],type:b,rules:[{conditions:[l,m],type:b,rules:[{conditions:[p,q],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://health-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:d}]}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:c}]},{conditions:r,type:b,rules:[{conditions:[p],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://health-fips.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:d}]}]},{error:"FIPS is enabled but this partition does not support FIPS",type:c}]},{conditions:s,type:b,rules:[{conditions:[q],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://health.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:d}]}]},{error:"DualStack is enabled but this partition does not support DualStack",type:c}]},{type:b,rules:[{conditions:[{[v]:f,[w]:[o,"aws-global"]}],endpoint:{url:"https://global.health.amazonaws.com",properties:{authSchemes:[{name:g,signingName:h,signingRegion:"us-east-1"}]},headers:n},type:d},{conditions:[{[v]:f,[w]:[o,"aws-cn-global"]}],endpoint:{url:"https://global.health.amazonaws.com.cn",properties:{authSchemes:[{name:g,signingName:h,signingRegion:"cn-northwest-1"}]},headers:n},type:d},{endpoint:{url:"https://health.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:d}]}]}]},{error:"Invalid Configuration: Missing Region",type:c}]}]};
const _data={version:"1.0",parameters:{Region:i,UseDualStack:j,UseFIPS:j,Endpoint:i},rules:[{conditions:[{[v]:a,[w]:[k]}],type:b,rules:[{conditions:r,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:c},{conditions:s,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:c},{endpoint:{url:k,properties:n,headers:n},type:d}]},{conditions:[{[v]:a,[w]:t}],type:b,rules:[{conditions:[{[v]:"aws.partition",[w]:t,assign:e}],type:b,rules:[{conditions:[l,m],type:b,rules:[{conditions:[p,q],type:b,rules:[{endpoint:{url:"https://health-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:d}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:c}]},{conditions:r,type:b,rules:[{conditions:[p],type:b,rules:[{endpoint:{url:"https://health-fips.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:d}]},{error:"FIPS is enabled but this partition does not support FIPS",type:c}]},{conditions:s,type:b,rules:[{conditions:[q],type:b,rules:[{endpoint:{url:"https://health.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:d}]},{error:"DualStack is enabled but this partition does not support DualStack",type:c}]},{conditions:[{[v]:f,[w]:[o,"aws-global"]}],endpoint:{url:"https://global.health.amazonaws.com",properties:{authSchemes:[{name:g,signingName:h,signingRegion:"us-east-1"}]},headers:n},type:d},{conditions:[{[v]:f,[w]:[o,"aws-cn-global"]}],endpoint:{url:"https://global.health.amazonaws.com.cn",properties:{authSchemes:[{name:g,signingName:h,signingRegion:"cn-northwest-1"}]},headers:n},type:d},{endpoint:{url:"https://health.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:d}]}]},{error:"Invalid Configuration: Missing Region",type:c}]};
export const ruleSet: RuleSetObject = _data;
Loading

0 comments on commit 58d1b48

Please sign in to comment.