Skip to content

Commit bc8a22f

Browse files
author
awstools
committed
feat(client-guardduty): This release 1) introduces a new API: GetOrganizationStatistics , and 2) adds a new UsageStatisticType TOP_ACCOUNTS_BY_FEATURE for GetUsageStatistics API
1 parent 62b4da5 commit bc8a22f

16 files changed

+942
-340
lines changed

clients/client-guardduty/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,14 @@ GetMembers
525525

526526
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/guardduty/command/GetMembersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-guardduty/Interface/GetMembersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-guardduty/Interface/GetMembersCommandOutput/)
527527

528+
</details>
529+
<details>
530+
<summary>
531+
GetOrganizationStatistics
532+
</summary>
533+
534+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/guardduty/command/GetOrganizationStatisticsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-guardduty/Interface/GetOrganizationStatisticsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-guardduty/Interface/GetOrganizationStatisticsCommandOutput/)
535+
528536
</details>
529537
<details>
530538
<summary>

clients/client-guardduty/src/GuardDuty.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ import {
164164
GetMemberDetectorsCommandOutput,
165165
} from "./commands/GetMemberDetectorsCommand";
166166
import { GetMembersCommand, GetMembersCommandInput, GetMembersCommandOutput } from "./commands/GetMembersCommand";
167+
import {
168+
GetOrganizationStatisticsCommand,
169+
GetOrganizationStatisticsCommandInput,
170+
GetOrganizationStatisticsCommandOutput,
171+
} from "./commands/GetOrganizationStatisticsCommand";
167172
import {
168173
GetRemainingFreeTrialDaysCommand,
169174
GetRemainingFreeTrialDaysCommandInput,
@@ -335,6 +340,7 @@ const commands = {
335340
GetMasterAccountCommand,
336341
GetMemberDetectorsCommand,
337342
GetMembersCommand,
343+
GetOrganizationStatisticsCommand,
338344
GetRemainingFreeTrialDaysCommand,
339345
GetThreatIntelSetCommand,
340346
GetUsageStatisticsCommand,
@@ -939,6 +945,23 @@ export interface GuardDuty {
939945
cb: (err: any, data?: GetMembersCommandOutput) => void
940946
): void;
941947

948+
/**
949+
* @see {@link GetOrganizationStatisticsCommand}
950+
*/
951+
getOrganizationStatistics(
952+
args: GetOrganizationStatisticsCommandInput,
953+
options?: __HttpHandlerOptions
954+
): Promise<GetOrganizationStatisticsCommandOutput>;
955+
getOrganizationStatistics(
956+
args: GetOrganizationStatisticsCommandInput,
957+
cb: (err: any, data?: GetOrganizationStatisticsCommandOutput) => void
958+
): void;
959+
getOrganizationStatistics(
960+
args: GetOrganizationStatisticsCommandInput,
961+
options: __HttpHandlerOptions,
962+
cb: (err: any, data?: GetOrganizationStatisticsCommandOutput) => void
963+
): void;
964+
942965
/**
943966
* @see {@link GetRemainingFreeTrialDaysCommand}
944967
*/

clients/client-guardduty/src/GuardDutyClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ import {
143143
import { GetMasterAccountCommandInput, GetMasterAccountCommandOutput } from "./commands/GetMasterAccountCommand";
144144
import { GetMemberDetectorsCommandInput, GetMemberDetectorsCommandOutput } from "./commands/GetMemberDetectorsCommand";
145145
import { GetMembersCommandInput, GetMembersCommandOutput } from "./commands/GetMembersCommand";
146+
import {
147+
GetOrganizationStatisticsCommandInput,
148+
GetOrganizationStatisticsCommandOutput,
149+
} from "./commands/GetOrganizationStatisticsCommand";
146150
import {
147151
GetRemainingFreeTrialDaysCommandInput,
148152
GetRemainingFreeTrialDaysCommandOutput,
@@ -265,6 +269,7 @@ export type ServiceInputTypes =
265269
| GetMasterAccountCommandInput
266270
| GetMemberDetectorsCommandInput
267271
| GetMembersCommandInput
272+
| GetOrganizationStatisticsCommandInput
268273
| GetRemainingFreeTrialDaysCommandInput
269274
| GetThreatIntelSetCommandInput
270275
| GetUsageStatisticsCommandInput
@@ -338,6 +343,7 @@ export type ServiceOutputTypes =
338343
| GetMasterAccountCommandOutput
339344
| GetMemberDetectorsCommandOutput
340345
| GetMembersCommandOutput
346+
| GetOrganizationStatisticsCommandOutput
341347
| GetRemainingFreeTrialDaysCommandOutput
342348
| GetThreatIntelSetCommandOutput
343349
| GetUsageStatisticsCommandOutput

clients/client-guardduty/src/commands/CreateMembersCommand.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ export interface CreateMembersCommandOutput extends CreateMembersResponse, __Met
4444
* the added member accounts, with the exception of the
4545
* organization delegated administrator account. A delegated administrator must enable GuardDuty
4646
* prior to being added as a member.</p>
47+
* <p>When you use CreateMembers as an Organizations delegated
48+
* administrator, GuardDuty applies your organization's auto-enable settings to the member
49+
* accounts in this request, irrespective of the accounts being new or existing members. For
50+
* more information about the existing auto-enable settings for your organization, see
51+
* <a href="https://docs.aws.amazon.com/guardduty/latest/APIReference/API_DescribeOrganizationConfiguration.html">DescribeOrganizationConfiguration</a>.</p>
4752
* <p>If you are adding accounts by invitation, before using <a href="https://docs.aws.amazon.com/guardduty/latest/APIReference/API_InviteMembers.html">InviteMembers</a>, use
4853
* <code>CreateMembers</code> after GuardDuty has been enabled in potential member accounts.</p>
4954
* <p>If you disassociate a member from a GuardDuty

clients/client-guardduty/src/commands/GetCoverageStatisticsCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ export interface GetCoverageStatisticsCommandOutput extends GetCoverageStatistic
3939
* @public
4040
* <p>Retrieves aggregated statistics for your account. If you are a GuardDuty administrator, you
4141
* can retrieve the statistics for all the resources associated with the active member accounts
42-
* in your organization who have enabled EKS Runtime Monitoring and have the GuardDuty agent running
43-
* on their EKS nodes.</p>
42+
* in your organization who have enabled Runtime Monitoring and have the GuardDuty security agent running
43+
* on their resources.</p>
4444
* @example
4545
* Use a bare-bones client and the command you need to make an API call.
4646
* ```javascript
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
// smithy-typescript generated code
2+
import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
5+
import { Command as $Command } from "@smithy/smithy-client";
6+
import {
7+
FinalizeHandlerArguments,
8+
Handler,
9+
HandlerExecutionContext,
10+
HttpHandlerOptions as __HttpHandlerOptions,
11+
MetadataBearer as __MetadataBearer,
12+
MiddlewareStack,
13+
SerdeContext as __SerdeContext,
14+
SMITHY_CONTEXT_KEY,
15+
} from "@smithy/types";
16+
17+
import { GuardDutyClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GuardDutyClient";
18+
import { GetOrganizationStatisticsResponse } from "../models/models_0";
19+
import { de_GetOrganizationStatisticsCommand, se_GetOrganizationStatisticsCommand } from "../protocols/Aws_restJson1";
20+
21+
/**
22+
* @public
23+
*/
24+
export { __MetadataBearer, $Command };
25+
/**
26+
* @public
27+
*
28+
* The input for {@link GetOrganizationStatisticsCommand}.
29+
*/
30+
export interface GetOrganizationStatisticsCommandInput {}
31+
/**
32+
* @public
33+
*
34+
* The output of {@link GetOrganizationStatisticsCommand}.
35+
*/
36+
export interface GetOrganizationStatisticsCommandOutput extends GetOrganizationStatisticsResponse, __MetadataBearer {}
37+
38+
/**
39+
* @public
40+
* <p>Retrieves how many active member accounts
41+
* in your Amazon Web Services organization have
42+
* each feature enabled within GuardDuty. Only a delegated GuardDuty administrator of an organization can run this API.</p>
43+
* <p>When you create a new Amazon Web Services organization, it might take up to 24
44+
* hours to generate the statistics for the entire organization.</p>
45+
* @example
46+
* Use a bare-bones client and the command you need to make an API call.
47+
* ```javascript
48+
* import { GuardDutyClient, GetOrganizationStatisticsCommand } from "@aws-sdk/client-guardduty"; // ES Modules import
49+
* // const { GuardDutyClient, GetOrganizationStatisticsCommand } = require("@aws-sdk/client-guardduty"); // CommonJS import
50+
* const client = new GuardDutyClient(config);
51+
* const input = {};
52+
* const command = new GetOrganizationStatisticsCommand(input);
53+
* const response = await client.send(command);
54+
* // { // GetOrganizationStatisticsResponse
55+
* // OrganizationDetails: { // OrganizationDetails
56+
* // UpdatedAt: new Date("TIMESTAMP"),
57+
* // OrganizationStatistics: { // OrganizationStatistics
58+
* // TotalAccountsCount: Number("int"),
59+
* // MemberAccountsCount: Number("int"),
60+
* // ActiveAccountsCount: Number("int"),
61+
* // EnabledAccountsCount: Number("int"),
62+
* // CountByFeature: [ // OrganizationFeatureStatisticsResults
63+
* // { // OrganizationFeatureStatistics
64+
* // Name: "S3_DATA_EVENTS" || "EKS_AUDIT_LOGS" || "EBS_MALWARE_PROTECTION" || "RDS_LOGIN_EVENTS" || "EKS_RUNTIME_MONITORING" || "LAMBDA_NETWORK_LOGS" || "RUNTIME_MONITORING",
65+
* // EnabledAccountsCount: Number("int"),
66+
* // AdditionalConfiguration: [ // OrganizationFeatureStatisticsAdditionalConfigurations
67+
* // { // OrganizationFeatureStatisticsAdditionalConfiguration
68+
* // Name: "EKS_ADDON_MANAGEMENT" || "ECS_FARGATE_AGENT_MANAGEMENT",
69+
* // EnabledAccountsCount: Number("int"),
70+
* // },
71+
* // ],
72+
* // },
73+
* // ],
74+
* // },
75+
* // },
76+
* // };
77+
*
78+
* ```
79+
*
80+
* @param GetOrganizationStatisticsCommandInput - {@link GetOrganizationStatisticsCommandInput}
81+
* @returns {@link GetOrganizationStatisticsCommandOutput}
82+
* @see {@link GetOrganizationStatisticsCommandInput} for command's `input` shape.
83+
* @see {@link GetOrganizationStatisticsCommandOutput} for command's `response` shape.
84+
* @see {@link GuardDutyClientResolvedConfig | config} for GuardDutyClient's `config` shape.
85+
*
86+
* @throws {@link BadRequestException} (client fault)
87+
* <p>A bad request exception object.</p>
88+
*
89+
* @throws {@link InternalServerErrorException} (server fault)
90+
* <p>An internal server error exception object.</p>
91+
*
92+
* @throws {@link GuardDutyServiceException}
93+
* <p>Base exception class for all service exceptions from GuardDuty service.</p>
94+
*
95+
*/
96+
export class GetOrganizationStatisticsCommand extends $Command<
97+
GetOrganizationStatisticsCommandInput,
98+
GetOrganizationStatisticsCommandOutput,
99+
GuardDutyClientResolvedConfig
100+
> {
101+
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
102+
return {
103+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
104+
Endpoint: { type: "builtInParams", name: "endpoint" },
105+
Region: { type: "builtInParams", name: "region" },
106+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
107+
};
108+
}
109+
110+
/**
111+
* @public
112+
*/
113+
constructor(readonly input: GetOrganizationStatisticsCommandInput) {
114+
super();
115+
}
116+
117+
/**
118+
* @internal
119+
*/
120+
resolveMiddleware(
121+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
122+
configuration: GuardDutyClientResolvedConfig,
123+
options?: __HttpHandlerOptions
124+
): Handler<GetOrganizationStatisticsCommandInput, GetOrganizationStatisticsCommandOutput> {
125+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
126+
this.middlewareStack.use(
127+
getEndpointPlugin(configuration, GetOrganizationStatisticsCommand.getEndpointParameterInstructions())
128+
);
129+
130+
const stack = clientStack.concat(this.middlewareStack);
131+
132+
const { logger } = configuration;
133+
const clientName = "GuardDutyClient";
134+
const commandName = "GetOrganizationStatisticsCommand";
135+
const handlerExecutionContext: HandlerExecutionContext = {
136+
logger,
137+
clientName,
138+
commandName,
139+
inputFilterSensitiveLog: (_: any) => _,
140+
outputFilterSensitiveLog: (_: any) => _,
141+
[SMITHY_CONTEXT_KEY]: {
142+
service: "GuardDutyAPIService",
143+
operation: "GetOrganizationStatistics",
144+
},
145+
};
146+
const { requestHandler } = configuration;
147+
return stack.resolve(
148+
(request: FinalizeHandlerArguments<any>) =>
149+
requestHandler.handle(request.request as __HttpRequest, options || {}),
150+
handlerExecutionContext
151+
);
152+
}
153+
154+
/**
155+
* @internal
156+
*/
157+
private serialize(input: GetOrganizationStatisticsCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
158+
return se_GetOrganizationStatisticsCommand(input, context);
159+
}
160+
161+
/**
162+
* @internal
163+
*/
164+
private deserialize(
165+
output: __HttpResponse,
166+
context: __SerdeContext
167+
): Promise<GetOrganizationStatisticsCommandOutput> {
168+
return de_GetOrganizationStatisticsCommand(output, context);
169+
}
170+
}

clients/client-guardduty/src/commands/GetUsageStatisticsCommand.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export interface GetUsageStatisticsCommandOutput extends GetUsageStatisticsRespo
4949
* const client = new GuardDutyClient(config);
5050
* const input = { // GetUsageStatisticsRequest
5151
* DetectorId: "STRING_VALUE", // required
52-
* UsageStatisticType: "SUM_BY_ACCOUNT" || "SUM_BY_DATA_SOURCE" || "SUM_BY_RESOURCE" || "TOP_RESOURCES" || "SUM_BY_FEATURES", // required
52+
* UsageStatisticType: "SUM_BY_ACCOUNT" || "SUM_BY_DATA_SOURCE" || "SUM_BY_RESOURCE" || "TOP_RESOURCES" || "SUM_BY_FEATURES" || "TOP_ACCOUNTS_BY_FEATURE", // required
5353
* UsageCriteria: { // UsageCriteria
5454
* AccountIds: [ // AccountIds
5555
* "STRING_VALUE",
@@ -81,6 +81,20 @@ export interface GetUsageStatisticsCommandOutput extends GetUsageStatisticsRespo
8181
* // },
8282
* // },
8383
* // ],
84+
* // TopAccountsByFeature: [ // UsageTopAccountsResultList
85+
* // { // UsageTopAccountsResult
86+
* // Feature: "FLOW_LOGS" || "CLOUD_TRAIL" || "DNS_LOGS" || "S3_DATA_EVENTS" || "EKS_AUDIT_LOGS" || "EBS_MALWARE_PROTECTION" || "RDS_LOGIN_EVENTS" || "LAMBDA_NETWORK_LOGS" || "EKS_RUNTIME_MONITORING" || "FARGATE_RUNTIME_MONITORING" || "EC2_RUNTIME_MONITORING",
87+
* // Accounts: [ // UsageTopAccountsByFeatureList
88+
* // { // UsageTopAccountResult
89+
* // AccountId: "STRING_VALUE",
90+
* // Total: {
91+
* // Amount: "STRING_VALUE",
92+
* // Unit: "STRING_VALUE",
93+
* // },
94+
* // },
95+
* // ],
96+
* // },
97+
* // ],
8498
* // SumByDataSource: [ // UsageDataSourceResultList
8599
* // { // UsageDataSourceResult
86100
* // DataSource: "FLOW_LOGS" || "CLOUD_TRAIL" || "DNS_LOGS" || "S3_LOGS" || "KUBERNETES_AUDIT_LOGS" || "EC2_MALWARE_SCAN",
@@ -111,10 +125,7 @@ export interface GetUsageStatisticsCommandOutput extends GetUsageStatisticsRespo
111125
* // SumByFeature: [ // UsageFeatureResultList
112126
* // { // UsageFeatureResult
113127
* // Feature: "FLOW_LOGS" || "CLOUD_TRAIL" || "DNS_LOGS" || "S3_DATA_EVENTS" || "EKS_AUDIT_LOGS" || "EBS_MALWARE_PROTECTION" || "RDS_LOGIN_EVENTS" || "LAMBDA_NETWORK_LOGS" || "EKS_RUNTIME_MONITORING" || "FARGATE_RUNTIME_MONITORING" || "EC2_RUNTIME_MONITORING",
114-
* // Total: {
115-
* // Amount: "STRING_VALUE",
116-
* // Unit: "STRING_VALUE",
117-
* // },
128+
* // Total: "<Total>",
118129
* // },
119130
* // ],
120131
* // },

clients/client-guardduty/src/commands/ListCoverageCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ export interface ListCoverageCommandOutput extends ListCoverageResponse, __Metad
3939
* @public
4040
* <p>Lists coverage details for your GuardDuty account. If you're a GuardDuty administrator, you can
4141
* retrieve all resources associated with the active member accounts in your organization.</p>
42-
* <p>Make sure the accounts have EKS Runtime Monitoring enabled and GuardDuty agent running on
43-
* their EKS nodes.</p>
42+
* <p>Make sure the accounts have Runtime Monitoring enabled and GuardDuty agent running on
43+
* their resources.</p>
4444
* @example
4545
* Use a bare-bones client and the command you need to make an API call.
4646
* ```javascript

clients/client-guardduty/src/commands/ListDetectorsCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from "@smithy/types";
1616

1717
import { GuardDutyClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GuardDutyClient";
18-
import { ListDetectorsRequest, ListDetectorsResponse } from "../models/models_0";
18+
import { ListDetectorsRequest, ListDetectorsResponse } from "../models/models_1";
1919
import { de_ListDetectorsCommand, se_ListDetectorsCommand } from "../protocols/Aws_restJson1";
2020

2121
/**

clients/client-guardduty/src/commands/ListFiltersCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from "@smithy/types";
1616

1717
import { GuardDutyClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GuardDutyClient";
18-
import { ListFiltersRequest, ListFiltersResponse } from "../models/models_0";
18+
import { ListFiltersRequest, ListFiltersResponse } from "../models/models_1";
1919
import { de_ListFiltersCommand, se_ListFiltersCommand } from "../protocols/Aws_restJson1";
2020

2121
/**

clients/client-guardduty/src/commands/ListFindingsCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from "@smithy/types";
1616

1717
import { GuardDutyClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GuardDutyClient";
18-
import { ListFindingsRequest, ListFindingsResponse } from "../models/models_0";
18+
import { ListFindingsRequest, ListFindingsResponse } from "../models/models_1";
1919
import { de_ListFindingsCommand, se_ListFindingsCommand } from "../protocols/Aws_restJson1";
2020

2121
/**

clients/client-guardduty/src/commands/ListInvitationsCommand.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import {
1515
} from "@smithy/types";
1616

1717
import { GuardDutyClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GuardDutyClient";
18-
import { ListInvitationsRequest } from "../models/models_0";
19-
import { ListInvitationsResponse } from "../models/models_1";
18+
import { ListInvitationsRequest, ListInvitationsResponse } from "../models/models_1";
2019
import { de_ListInvitationsCommand, se_ListInvitationsCommand } from "../protocols/Aws_restJson1";
2120

2221
/**

clients/client-guardduty/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export * from "./GetMalwareScanSettingsCommand";
3737
export * from "./GetMasterAccountCommand";
3838
export * from "./GetMemberDetectorsCommand";
3939
export * from "./GetMembersCommand";
40+
export * from "./GetOrganizationStatisticsCommand";
4041
export * from "./GetRemainingFreeTrialDaysCommand";
4142
export * from "./GetThreatIntelSetCommand";
4243
export * from "./GetUsageStatisticsCommand";

0 commit comments

Comments
 (0)