Skip to content

Commit 02083d6

Browse files
author
awstools
committed
feat(client-guardduty): Adds finding fields available from GuardDuty Console. Adds FreeTrial related operations. Deprecates the use of various APIs related to Master Accounts and Replace them with Administrator Accounts.
1 parent d29cb21 commit 02083d6

16 files changed

+1889
-53
lines changed

clients/client-guardduty/README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
AWS SDK for JavaScript GuardDuty Client for Node.js, Browser and React Native.
1111

1212
<p>Amazon GuardDuty is a continuous security monitoring service that analyzes and processes
13-
the following data sources: VPC Flow Logs, Amazon Web Services CloudTrail event logs, and DNS logs. It uses
14-
threat intelligence feeds (such as lists of malicious IPs and domains) and machine learning to
15-
identify unexpected, potentially unauthorized, and malicious activity within your Amazon Web Services
16-
environment. This can include issues like escalations of privileges, uses of exposed
17-
credentials, or communication with malicious IPs, URLs, or domains. For example, GuardDuty can
18-
detect compromised EC2 instances that serve malware or mine bitcoin. </p>
13+
the following data sources: VPC Flow Logs, AWS CloudTrail management event logs, CloudTrail S3 data event
14+
logs, EKS audit logs, and DNS logs.
15+
It uses threat intelligence
16+
feeds (such as lists of malicious IPs and domains) and machine learning to identify
17+
unexpected, potentially unauthorized, and malicious activity within your Amazon Web Services environment.
18+
This can include issues like escalations of privileges, uses of exposed credentials, or
19+
communication with malicious IPs, URLs, or domains. For example, GuardDuty can detect
20+
compromised EC2 instances that serve malware or mine bitcoin. </p>
1921
<p>GuardDuty also monitors Amazon Web Services account access behavior for signs of compromise. Some examples
2022
of this are unauthorized infrastructure deployments such as EC2 instances deployed in a Region
2123
that has never been used, or unusual API calls like a password policy change to reduce
@@ -42,16 +44,16 @@ using your favorite package manager:
4244

4345
The AWS SDK is modulized by clients and commands.
4446
To send a request, you only need to import the `GuardDutyClient` and
45-
the commands you need, for example `AcceptInvitationCommand`:
47+
the commands you need, for example `AcceptAdministratorInvitationCommand`:
4648

4749
```js
4850
// ES5 example
49-
const { GuardDutyClient, AcceptInvitationCommand } = require("@aws-sdk/client-guardduty");
51+
const { GuardDutyClient, AcceptAdministratorInvitationCommand } = require("@aws-sdk/client-guardduty");
5052
```
5153

5254
```ts
5355
// ES6+ example
54-
import { GuardDutyClient, AcceptInvitationCommand } from "@aws-sdk/client-guardduty";
56+
import { GuardDutyClient, AcceptAdministratorInvitationCommand } from "@aws-sdk/client-guardduty";
5557
```
5658

5759
### Usage
@@ -70,7 +72,7 @@ const client = new GuardDutyClient({ region: "REGION" });
7072
const params = {
7173
/** input parameters */
7274
};
73-
const command = new AcceptInvitationCommand(params);
75+
const command = new AcceptAdministratorInvitationCommand(params);
7476
```
7577

7678
#### Async/await
@@ -149,15 +151,15 @@ const client = new AWS.GuardDuty({ region: "REGION" });
149151

150152
// async/await.
151153
try {
152-
const data = await client.acceptInvitation(params);
154+
const data = await client.acceptAdministratorInvitation(params);
153155
// process data.
154156
} catch (error) {
155157
// error handling.
156158
}
157159

158160
// Promises.
159161
client
160-
.acceptInvitation(params)
162+
.acceptAdministratorInvitation(params)
161163
.then((data) => {
162164
// process data.
163165
})
@@ -166,7 +168,7 @@ client
166168
});
167169

168170
// callbacks.
169-
client.acceptInvitation(params, (err, data) => {
171+
client.acceptAdministratorInvitation(params, (err, data) => {
170172
// process err and data.
171173
});
172174
```

clients/client-guardduty/src/GuardDuty.ts

Lines changed: 167 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// smithy-typescript generated code
22
import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types";
33

4+
import {
5+
AcceptAdministratorInvitationCommand,
6+
AcceptAdministratorInvitationCommandInput,
7+
AcceptAdministratorInvitationCommandOutput,
8+
} from "./commands/AcceptAdministratorInvitationCommand";
49
import {
510
AcceptInvitationCommand,
611
AcceptInvitationCommandInput,
@@ -93,6 +98,11 @@ import {
9398
DisableOrganizationAdminAccountCommandInput,
9499
DisableOrganizationAdminAccountCommandOutput,
95100
} from "./commands/DisableOrganizationAdminAccountCommand";
101+
import {
102+
DisassociateFromAdministratorAccountCommand,
103+
DisassociateFromAdministratorAccountCommandInput,
104+
DisassociateFromAdministratorAccountCommandOutput,
105+
} from "./commands/DisassociateFromAdministratorAccountCommand";
96106
import {
97107
DisassociateFromMasterAccountCommand,
98108
DisassociateFromMasterAccountCommandInput,
@@ -108,6 +118,11 @@ import {
108118
EnableOrganizationAdminAccountCommandInput,
109119
EnableOrganizationAdminAccountCommandOutput,
110120
} from "./commands/EnableOrganizationAdminAccountCommand";
121+
import {
122+
GetAdministratorAccountCommand,
123+
GetAdministratorAccountCommandInput,
124+
GetAdministratorAccountCommandOutput,
125+
} from "./commands/GetAdministratorAccountCommand";
111126
import { GetDetectorCommand, GetDetectorCommandInput, GetDetectorCommandOutput } from "./commands/GetDetectorCommand";
112127
import { GetFilterCommand, GetFilterCommandInput, GetFilterCommandOutput } from "./commands/GetFilterCommand";
113128
import { GetFindingsCommand, GetFindingsCommandInput, GetFindingsCommandOutput } from "./commands/GetFindingsCommand";
@@ -133,6 +148,11 @@ import {
133148
GetMemberDetectorsCommandOutput,
134149
} from "./commands/GetMemberDetectorsCommand";
135150
import { GetMembersCommand, GetMembersCommandInput, GetMembersCommandOutput } from "./commands/GetMembersCommand";
151+
import {
152+
GetRemainingFreeTrialDaysCommand,
153+
GetRemainingFreeTrialDaysCommandInput,
154+
GetRemainingFreeTrialDaysCommandOutput,
155+
} from "./commands/GetRemainingFreeTrialDaysCommand";
136156
import {
137157
GetThreatIntelSetCommand,
138158
GetThreatIntelSetCommandInput,
@@ -247,12 +267,14 @@ import { GuardDutyClient } from "./GuardDutyClient";
247267

248268
/**
249269
* <p>Amazon GuardDuty is a continuous security monitoring service that analyzes and processes
250-
* the following data sources: VPC Flow Logs, Amazon Web Services CloudTrail event logs, and DNS logs. It uses
251-
* threat intelligence feeds (such as lists of malicious IPs and domains) and machine learning to
252-
* identify unexpected, potentially unauthorized, and malicious activity within your Amazon Web Services
253-
* environment. This can include issues like escalations of privileges, uses of exposed
254-
* credentials, or communication with malicious IPs, URLs, or domains. For example, GuardDuty can
255-
* detect compromised EC2 instances that serve malware or mine bitcoin. </p>
270+
* the following data sources: VPC Flow Logs, AWS CloudTrail management event logs, CloudTrail S3 data event
271+
* logs, EKS audit logs, and DNS logs.
272+
* It uses threat intelligence
273+
* feeds (such as lists of malicious IPs and domains) and machine learning to identify
274+
* unexpected, potentially unauthorized, and malicious activity within your Amazon Web Services environment.
275+
* This can include issues like escalations of privileges, uses of exposed credentials, or
276+
* communication with malicious IPs, URLs, or domains. For example, GuardDuty can detect
277+
* compromised EC2 instances that serve malware or mine bitcoin. </p>
256278
* <p>GuardDuty also monitors Amazon Web Services account access behavior for signs of compromise. Some examples
257279
* of this are unauthorized infrastructure deployments such as EC2 instances deployed in a Region
258280
* that has never been used, or unusual API calls like a password policy change to reduce
@@ -266,6 +288,40 @@ import { GuardDutyClient } from "./GuardDutyClient";
266288
*/
267289
export class GuardDuty extends GuardDutyClient {
268290
/**
291+
* <p>Accepts the invitation to be a member account and get monitored by a GuardDuty administrator account that sent the invitation.</p>
292+
*/
293+
public acceptAdministratorInvitation(
294+
args: AcceptAdministratorInvitationCommandInput,
295+
options?: __HttpHandlerOptions
296+
): Promise<AcceptAdministratorInvitationCommandOutput>;
297+
public acceptAdministratorInvitation(
298+
args: AcceptAdministratorInvitationCommandInput,
299+
cb: (err: any, data?: AcceptAdministratorInvitationCommandOutput) => void
300+
): void;
301+
public acceptAdministratorInvitation(
302+
args: AcceptAdministratorInvitationCommandInput,
303+
options: __HttpHandlerOptions,
304+
cb: (err: any, data?: AcceptAdministratorInvitationCommandOutput) => void
305+
): void;
306+
public acceptAdministratorInvitation(
307+
args: AcceptAdministratorInvitationCommandInput,
308+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: AcceptAdministratorInvitationCommandOutput) => void),
309+
cb?: (err: any, data?: AcceptAdministratorInvitationCommandOutput) => void
310+
): Promise<AcceptAdministratorInvitationCommandOutput> | void {
311+
const command = new AcceptAdministratorInvitationCommand(args);
312+
if (typeof optionsOrCb === "function") {
313+
this.send(command, optionsOrCb);
314+
} else if (typeof cb === "function") {
315+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
316+
this.send(command, optionsOrCb || {}, cb);
317+
} else {
318+
return this.send(command, optionsOrCb);
319+
}
320+
}
321+
322+
/**
323+
* @deprecated
324+
*
269325
* <p>Accepts the invitation to be monitored by a GuardDuty administrator account.</p>
270326
*/
271327
public acceptInvitation(
@@ -923,6 +979,40 @@ export class GuardDuty extends GuardDutyClient {
923979
/**
924980
* <p>Disassociates the current GuardDuty member account from its administrator account.</p>
925981
*/
982+
public disassociateFromAdministratorAccount(
983+
args: DisassociateFromAdministratorAccountCommandInput,
984+
options?: __HttpHandlerOptions
985+
): Promise<DisassociateFromAdministratorAccountCommandOutput>;
986+
public disassociateFromAdministratorAccount(
987+
args: DisassociateFromAdministratorAccountCommandInput,
988+
cb: (err: any, data?: DisassociateFromAdministratorAccountCommandOutput) => void
989+
): void;
990+
public disassociateFromAdministratorAccount(
991+
args: DisassociateFromAdministratorAccountCommandInput,
992+
options: __HttpHandlerOptions,
993+
cb: (err: any, data?: DisassociateFromAdministratorAccountCommandOutput) => void
994+
): void;
995+
public disassociateFromAdministratorAccount(
996+
args: DisassociateFromAdministratorAccountCommandInput,
997+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DisassociateFromAdministratorAccountCommandOutput) => void),
998+
cb?: (err: any, data?: DisassociateFromAdministratorAccountCommandOutput) => void
999+
): Promise<DisassociateFromAdministratorAccountCommandOutput> | void {
1000+
const command = new DisassociateFromAdministratorAccountCommand(args);
1001+
if (typeof optionsOrCb === "function") {
1002+
this.send(command, optionsOrCb);
1003+
} else if (typeof cb === "function") {
1004+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1005+
this.send(command, optionsOrCb || {}, cb);
1006+
} else {
1007+
return this.send(command, optionsOrCb);
1008+
}
1009+
}
1010+
1011+
/**
1012+
* @deprecated
1013+
*
1014+
* <p>Disassociates the current GuardDuty member account from its administrator account.</p>
1015+
*/
9261016
public disassociateFromMasterAccount(
9271017
args: DisassociateFromMasterAccountCommandInput,
9281018
options?: __HttpHandlerOptions
@@ -954,8 +1044,7 @@ export class GuardDuty extends GuardDutyClient {
9541044

9551045
/**
9561046
* <p>Disassociates GuardDuty member accounts (to the current GuardDuty administrator account)
957-
* specified by the account IDs. Member accounts added through <a href="https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_invitations.html">Invitation</a> get deleted from the
958-
* current GuardDuty administrator account after 30 days of disassociation.</p>
1047+
* specified by the account IDs.</p>
9591048
*/
9601049
public disassociateMembers(
9611050
args: DisassociateMembersCommandInput,
@@ -1019,6 +1108,39 @@ export class GuardDuty extends GuardDutyClient {
10191108
}
10201109
}
10211110

1111+
/**
1112+
* <p>Provides the details for the GuardDuty administrator account associated with the current
1113+
* GuardDuty member account.</p>
1114+
*/
1115+
public getAdministratorAccount(
1116+
args: GetAdministratorAccountCommandInput,
1117+
options?: __HttpHandlerOptions
1118+
): Promise<GetAdministratorAccountCommandOutput>;
1119+
public getAdministratorAccount(
1120+
args: GetAdministratorAccountCommandInput,
1121+
cb: (err: any, data?: GetAdministratorAccountCommandOutput) => void
1122+
): void;
1123+
public getAdministratorAccount(
1124+
args: GetAdministratorAccountCommandInput,
1125+
options: __HttpHandlerOptions,
1126+
cb: (err: any, data?: GetAdministratorAccountCommandOutput) => void
1127+
): void;
1128+
public getAdministratorAccount(
1129+
args: GetAdministratorAccountCommandInput,
1130+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetAdministratorAccountCommandOutput) => void),
1131+
cb?: (err: any, data?: GetAdministratorAccountCommandOutput) => void
1132+
): Promise<GetAdministratorAccountCommandOutput> | void {
1133+
const command = new GetAdministratorAccountCommand(args);
1134+
if (typeof optionsOrCb === "function") {
1135+
this.send(command, optionsOrCb);
1136+
} else if (typeof cb === "function") {
1137+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1138+
this.send(command, optionsOrCb || {}, cb);
1139+
} else {
1140+
return this.send(command, optionsOrCb);
1141+
}
1142+
}
1143+
10221144
/**
10231145
* <p>Retrieves an Amazon GuardDuty detector specified by the detectorId.</p>
10241146
*/
@@ -1189,6 +1311,8 @@ export class GuardDuty extends GuardDutyClient {
11891311
}
11901312

11911313
/**
1314+
* @deprecated
1315+
*
11921316
* <p>Provides the details for the GuardDuty administrator account associated with the current
11931317
* GuardDuty member account.</p>
11941318
*/
@@ -1280,6 +1404,38 @@ export class GuardDuty extends GuardDutyClient {
12801404
}
12811405
}
12821406

1407+
/**
1408+
* <p>Provides the number of days left for each data source used in the free trial period.</p>
1409+
*/
1410+
public getRemainingFreeTrialDays(
1411+
args: GetRemainingFreeTrialDaysCommandInput,
1412+
options?: __HttpHandlerOptions
1413+
): Promise<GetRemainingFreeTrialDaysCommandOutput>;
1414+
public getRemainingFreeTrialDays(
1415+
args: GetRemainingFreeTrialDaysCommandInput,
1416+
cb: (err: any, data?: GetRemainingFreeTrialDaysCommandOutput) => void
1417+
): void;
1418+
public getRemainingFreeTrialDays(
1419+
args: GetRemainingFreeTrialDaysCommandInput,
1420+
options: __HttpHandlerOptions,
1421+
cb: (err: any, data?: GetRemainingFreeTrialDaysCommandOutput) => void
1422+
): void;
1423+
public getRemainingFreeTrialDays(
1424+
args: GetRemainingFreeTrialDaysCommandInput,
1425+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetRemainingFreeTrialDaysCommandOutput) => void),
1426+
cb?: (err: any, data?: GetRemainingFreeTrialDaysCommandOutput) => void
1427+
): Promise<GetRemainingFreeTrialDaysCommandOutput> | void {
1428+
const command = new GetRemainingFreeTrialDaysCommand(args);
1429+
if (typeof optionsOrCb === "function") {
1430+
this.send(command, optionsOrCb);
1431+
} else if (typeof cb === "function") {
1432+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1433+
this.send(command, optionsOrCb || {}, cb);
1434+
} else {
1435+
return this.send(command, optionsOrCb);
1436+
}
1437+
}
1438+
12831439
/**
12841440
* <p>Retrieves the ThreatIntelSet that is specified by the ThreatIntelSet ID.</p>
12851441
*/
@@ -1314,9 +1470,9 @@ export class GuardDuty extends GuardDutyClient {
13141470

13151471
/**
13161472
* <p>Lists Amazon GuardDuty usage statistics over the last 30 days for the specified detector
1317-
* ID. For newly enabled detectors or data sources the cost returned will include only the usage
1318-
* so far under 30 days, this may differ from the cost metrics in the console, which projects
1319-
* usage over 30 days to provide a monthly cost estimate. For more information see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/monitoring_costs.html#usage-calculations">Understanding How Usage Costs are Calculated</a>.</p>
1473+
* ID. For newly enabled detectors or data sources, the cost returned will include only the usage
1474+
* so far under 30 days. This may differ from the cost metrics in the console, which project
1475+
* usage over 30 days to provide a monthly cost estimate. For more information, see <a href="https://docs.aws.amazon.com/guardduty/latest/ug/monitoring_costs.html#usage-calculations">Understanding How Usage Costs are Calculated</a>.</p>
13201476
*/
13211477
public getUsageStatistics(
13221478
args: GetUsageStatisticsCommandInput,

0 commit comments

Comments
 (0)