Skip to content

Commit

Permalink
feat(client-guardduty): Amazon GuardDuty introduces a new Malware Pro…
Browse files Browse the repository at this point in the history
…tection feature that triggers malware scan on selected EC2 instance resources, after the service detects a potentially malicious activity.
  • Loading branch information
awstools committed Jul 26, 2022
1 parent 65ad083 commit f85fa66
Show file tree
Hide file tree
Showing 11 changed files with 4,429 additions and 501 deletions.
111 changes: 111 additions & 0 deletions clients/client-guardduty/src/GuardDuty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ import {
DeleteThreatIntelSetCommandInput,
DeleteThreatIntelSetCommandOutput,
} from "./commands/DeleteThreatIntelSetCommand";
import {
DescribeMalwareScansCommand,
DescribeMalwareScansCommandInput,
DescribeMalwareScansCommandOutput,
} from "./commands/DescribeMalwareScansCommand";
import {
DescribeOrganizationConfigurationCommand,
DescribeOrganizationConfigurationCommandInput,
Expand Down Expand Up @@ -137,6 +142,11 @@ import {
GetInvitationsCountCommandOutput,
} from "./commands/GetInvitationsCountCommand";
import { GetIPSetCommand, GetIPSetCommandInput, GetIPSetCommandOutput } from "./commands/GetIPSetCommand";
import {
GetMalwareScanSettingsCommand,
GetMalwareScanSettingsCommandInput,
GetMalwareScanSettingsCommandOutput,
} from "./commands/GetMalwareScanSettingsCommand";
import {
GetMasterAccountCommand,
GetMasterAccountCommandInput,
Expand Down Expand Up @@ -243,6 +253,11 @@ import {
UpdateFindingsFeedbackCommandOutput,
} from "./commands/UpdateFindingsFeedbackCommand";
import { UpdateIPSetCommand, UpdateIPSetCommandInput, UpdateIPSetCommandOutput } from "./commands/UpdateIPSetCommand";
import {
UpdateMalwareScanSettingsCommand,
UpdateMalwareScanSettingsCommandInput,
UpdateMalwareScanSettingsCommandOutput,
} from "./commands/UpdateMalwareScanSettingsCommand";
import {
UpdateMemberDetectorsCommand,
UpdateMemberDetectorsCommandInput,
Expand Down Expand Up @@ -877,6 +892,38 @@ export class GuardDuty extends GuardDutyClient {
}
}

/**
* <p>Returns a list of malware scans.</p>
*/
public describeMalwareScans(
args: DescribeMalwareScansCommandInput,
options?: __HttpHandlerOptions
): Promise<DescribeMalwareScansCommandOutput>;
public describeMalwareScans(
args: DescribeMalwareScansCommandInput,
cb: (err: any, data?: DescribeMalwareScansCommandOutput) => void
): void;
public describeMalwareScans(
args: DescribeMalwareScansCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: DescribeMalwareScansCommandOutput) => void
): void;
public describeMalwareScans(
args: DescribeMalwareScansCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DescribeMalwareScansCommandOutput) => void),
cb?: (err: any, data?: DescribeMalwareScansCommandOutput) => void
): Promise<DescribeMalwareScansCommandOutput> | void {
const command = new DescribeMalwareScansCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Returns information about the account selected as the delegated administrator for
* GuardDuty.</p>
Expand Down Expand Up @@ -1310,6 +1357,38 @@ export class GuardDuty extends GuardDutyClient {
}
}

/**
* <p>Returns the details of the malware scan settings.</p>
*/
public getMalwareScanSettings(
args: GetMalwareScanSettingsCommandInput,
options?: __HttpHandlerOptions
): Promise<GetMalwareScanSettingsCommandOutput>;
public getMalwareScanSettings(
args: GetMalwareScanSettingsCommandInput,
cb: (err: any, data?: GetMalwareScanSettingsCommandOutput) => void
): void;
public getMalwareScanSettings(
args: GetMalwareScanSettingsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetMalwareScanSettingsCommandOutput) => void
): void;
public getMalwareScanSettings(
args: GetMalwareScanSettingsCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetMalwareScanSettingsCommandOutput) => void),
cb?: (err: any, data?: GetMalwareScanSettingsCommandOutput) => void
): Promise<GetMalwareScanSettingsCommandOutput> | void {
const command = new GetMalwareScanSettingsCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* @deprecated
*
Expand Down Expand Up @@ -2121,6 +2200,38 @@ export class GuardDuty extends GuardDutyClient {
}
}

/**
* <p>Updates the malware scan settings.</p>
*/
public updateMalwareScanSettings(
args: UpdateMalwareScanSettingsCommandInput,
options?: __HttpHandlerOptions
): Promise<UpdateMalwareScanSettingsCommandOutput>;
public updateMalwareScanSettings(
args: UpdateMalwareScanSettingsCommandInput,
cb: (err: any, data?: UpdateMalwareScanSettingsCommandOutput) => void
): void;
public updateMalwareScanSettings(
args: UpdateMalwareScanSettingsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: UpdateMalwareScanSettingsCommandOutput) => void
): void;
public updateMalwareScanSettings(
args: UpdateMalwareScanSettingsCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: UpdateMalwareScanSettingsCommandOutput) => void),
cb?: (err: any, data?: UpdateMalwareScanSettingsCommandOutput) => void
): Promise<UpdateMalwareScanSettingsCommandOutput> | void {
const command = new UpdateMalwareScanSettingsCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Contains information on member accounts to be updated.</p>
*/
Expand Down
18 changes: 18 additions & 0 deletions clients/client-guardduty/src/GuardDutyClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ import {
DeleteThreatIntelSetCommandInput,
DeleteThreatIntelSetCommandOutput,
} from "./commands/DeleteThreatIntelSetCommand";
import {
DescribeMalwareScansCommandInput,
DescribeMalwareScansCommandOutput,
} from "./commands/DescribeMalwareScansCommand";
import {
DescribeOrganizationConfigurationCommandInput,
DescribeOrganizationConfigurationCommandOutput,
Expand Down Expand Up @@ -133,6 +137,10 @@ import {
GetInvitationsCountCommandOutput,
} from "./commands/GetInvitationsCountCommand";
import { GetIPSetCommandInput, GetIPSetCommandOutput } from "./commands/GetIPSetCommand";
import {
GetMalwareScanSettingsCommandInput,
GetMalwareScanSettingsCommandOutput,
} from "./commands/GetMalwareScanSettingsCommand";
import { GetMasterAccountCommandInput, GetMasterAccountCommandOutput } from "./commands/GetMasterAccountCommand";
import { GetMemberDetectorsCommandInput, GetMemberDetectorsCommandOutput } from "./commands/GetMemberDetectorsCommand";
import { GetMembersCommandInput, GetMembersCommandOutput } from "./commands/GetMembersCommand";
Expand Down Expand Up @@ -183,6 +191,10 @@ import {
UpdateFindingsFeedbackCommandOutput,
} from "./commands/UpdateFindingsFeedbackCommand";
import { UpdateIPSetCommandInput, UpdateIPSetCommandOutput } from "./commands/UpdateIPSetCommand";
import {
UpdateMalwareScanSettingsCommandInput,
UpdateMalwareScanSettingsCommandOutput,
} from "./commands/UpdateMalwareScanSettingsCommand";
import {
UpdateMemberDetectorsCommandInput,
UpdateMemberDetectorsCommandOutput,
Expand Down Expand Up @@ -220,6 +232,7 @@ export type ServiceInputTypes =
| DeleteMembersCommandInput
| DeletePublishingDestinationCommandInput
| DeleteThreatIntelSetCommandInput
| DescribeMalwareScansCommandInput
| DescribeOrganizationConfigurationCommandInput
| DescribePublishingDestinationCommandInput
| DisableOrganizationAdminAccountCommandInput
Expand All @@ -234,6 +247,7 @@ export type ServiceInputTypes =
| GetFindingsStatisticsCommandInput
| GetIPSetCommandInput
| GetInvitationsCountCommandInput
| GetMalwareScanSettingsCommandInput
| GetMasterAccountCommandInput
| GetMemberDetectorsCommandInput
| GetMembersCommandInput
Expand All @@ -260,6 +274,7 @@ export type ServiceInputTypes =
| UpdateFilterCommandInput
| UpdateFindingsFeedbackCommandInput
| UpdateIPSetCommandInput
| UpdateMalwareScanSettingsCommandInput
| UpdateMemberDetectorsCommandInput
| UpdateOrganizationConfigurationCommandInput
| UpdatePublishingDestinationCommandInput
Expand All @@ -284,6 +299,7 @@ export type ServiceOutputTypes =
| DeleteMembersCommandOutput
| DeletePublishingDestinationCommandOutput
| DeleteThreatIntelSetCommandOutput
| DescribeMalwareScansCommandOutput
| DescribeOrganizationConfigurationCommandOutput
| DescribePublishingDestinationCommandOutput
| DisableOrganizationAdminAccountCommandOutput
Expand All @@ -298,6 +314,7 @@ export type ServiceOutputTypes =
| GetFindingsStatisticsCommandOutput
| GetIPSetCommandOutput
| GetInvitationsCountCommandOutput
| GetMalwareScanSettingsCommandOutput
| GetMasterAccountCommandOutput
| GetMemberDetectorsCommandOutput
| GetMembersCommandOutput
Expand All @@ -324,6 +341,7 @@ export type ServiceOutputTypes =
| UpdateFilterCommandOutput
| UpdateFindingsFeedbackCommandOutput
| UpdateIPSetCommandOutput
| UpdateMalwareScanSettingsCommandOutput
| UpdateMemberDetectorsCommandOutput
| UpdateOrganizationConfigurationCommandOutput
| UpdatePublishingDestinationCommandOutput
Expand Down
101 changes: 101 additions & 0 deletions clients/client-guardduty/src/commands/DescribeMalwareScansCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// smithy-typescript generated code
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import { GuardDutyClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GuardDutyClient";
import {
DescribeMalwareScansRequest,
DescribeMalwareScansRequestFilterSensitiveLog,
DescribeMalwareScansResponse,
DescribeMalwareScansResponseFilterSensitiveLog,
} from "../models/models_0";
import {
deserializeAws_restJson1DescribeMalwareScansCommand,
serializeAws_restJson1DescribeMalwareScansCommand,
} from "../protocols/Aws_restJson1";

export interface DescribeMalwareScansCommandInput extends DescribeMalwareScansRequest {}
export interface DescribeMalwareScansCommandOutput extends DescribeMalwareScansResponse, __MetadataBearer {}

/**
* <p>Returns a list of malware scans.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { GuardDutyClient, DescribeMalwareScansCommand } from "@aws-sdk/client-guardduty"; // ES Modules import
* // const { GuardDutyClient, DescribeMalwareScansCommand } = require("@aws-sdk/client-guardduty"); // CommonJS import
* const client = new GuardDutyClient(config);
* const command = new DescribeMalwareScansCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link DescribeMalwareScansCommandInput} for command's `input` shape.
* @see {@link DescribeMalwareScansCommandOutput} for command's `response` shape.
* @see {@link GuardDutyClientResolvedConfig | config} for GuardDutyClient's `config` shape.
*
*/
export class DescribeMalwareScansCommand extends $Command<
DescribeMalwareScansCommandInput,
DescribeMalwareScansCommandOutput,
GuardDutyClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

constructor(readonly input: DescribeMalwareScansCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: GuardDutyClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<DescribeMalwareScansCommandInput, DescribeMalwareScansCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

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

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

private serialize(input: DescribeMalwareScansCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_restJson1DescribeMalwareScansCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<DescribeMalwareScansCommandOutput> {
return deserializeAws_restJson1DescribeMalwareScansCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
Loading

0 comments on commit f85fa66

Please sign in to comment.