Skip to content

Commit

Permalink
feat(client-ec2): Launching GetSecurityGroupsForVpc API. This API get…
Browse files Browse the repository at this point in the history
…s security groups that can be associated by the AWS account making the request with network interfaces in the specified VPC.
  • Loading branch information
awstools committed Oct 26, 2023
1 parent 6bd6402 commit 0bc9a39
Show file tree
Hide file tree
Showing 15 changed files with 886 additions and 195 deletions.
8 changes: 8 additions & 0 deletions clients/client-ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3788,6 +3788,14 @@ GetReservedInstancesExchangeQuote

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ec2/classes/getreservedinstancesexchangequotecommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ec2/interfaces/getreservedinstancesexchangequotecommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ec2/interfaces/getreservedinstancesexchangequotecommandoutput.html)

</details>
<details>
<summary>
GetSecurityGroupsForVpc
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ec2/classes/getsecuritygroupsforvpccommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ec2/interfaces/getsecuritygroupsforvpccommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ec2/interfaces/getsecuritygroupsforvpccommandoutput.html)

</details>
<details>
<summary>
Expand Down
23 changes: 23 additions & 0 deletions clients/client-ec2/src/EC2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2175,6 +2175,11 @@ import {
GetReservedInstancesExchangeQuoteCommandInput,
GetReservedInstancesExchangeQuoteCommandOutput,
} from "./commands/GetReservedInstancesExchangeQuoteCommand";
import {
GetSecurityGroupsForVpcCommand,
GetSecurityGroupsForVpcCommandInput,
GetSecurityGroupsForVpcCommandOutput,
} from "./commands/GetSecurityGroupsForVpcCommand";
import {
GetSerialConsoleAccessStatusCommand,
GetSerialConsoleAccessStatusCommandInput,
Expand Down Expand Up @@ -3377,6 +3382,7 @@ const commands = {
GetNetworkInsightsAccessScopeContentCommand,
GetPasswordDataCommand,
GetReservedInstancesExchangeQuoteCommand,
GetSecurityGroupsForVpcCommand,
GetSerialConsoleAccessStatusCommand,
GetSpotPlacementScoresCommand,
GetSubnetCidrReservationsCommand,
Expand Down Expand Up @@ -10844,6 +10850,23 @@ export interface EC2 {
cb: (err: any, data?: GetReservedInstancesExchangeQuoteCommandOutput) => void
): void;

/**
* @see {@link GetSecurityGroupsForVpcCommand}
*/
getSecurityGroupsForVpc(
args: GetSecurityGroupsForVpcCommandInput,
options?: __HttpHandlerOptions
): Promise<GetSecurityGroupsForVpcCommandOutput>;
getSecurityGroupsForVpc(
args: GetSecurityGroupsForVpcCommandInput,
cb: (err: any, data?: GetSecurityGroupsForVpcCommandOutput) => void
): void;
getSecurityGroupsForVpc(
args: GetSecurityGroupsForVpcCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetSecurityGroupsForVpcCommandOutput) => void
): void;

/**
* @see {@link GetSerialConsoleAccessStatusCommand}
*/
Expand Down
6 changes: 6 additions & 0 deletions clients/client-ec2/src/EC2Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,10 @@ import {
GetReservedInstancesExchangeQuoteCommandInput,
GetReservedInstancesExchangeQuoteCommandOutput,
} from "./commands/GetReservedInstancesExchangeQuoteCommand";
import {
GetSecurityGroupsForVpcCommandInput,
GetSecurityGroupsForVpcCommandOutput,
} from "./commands/GetSecurityGroupsForVpcCommand";
import {
GetSerialConsoleAccessStatusCommandInput,
GetSerialConsoleAccessStatusCommandOutput,
Expand Down Expand Up @@ -2534,6 +2538,7 @@ export type ServiceInputTypes =
| GetNetworkInsightsAccessScopeContentCommandInput
| GetPasswordDataCommandInput
| GetReservedInstancesExchangeQuoteCommandInput
| GetSecurityGroupsForVpcCommandInput
| GetSerialConsoleAccessStatusCommandInput
| GetSpotPlacementScoresCommandInput
| GetSubnetCidrReservationsCommandInput
Expand Down Expand Up @@ -3138,6 +3143,7 @@ export type ServiceOutputTypes =
| GetNetworkInsightsAccessScopeContentCommandOutput
| GetPasswordDataCommandOutput
| GetReservedInstancesExchangeQuoteCommandOutput
| GetSecurityGroupsForVpcCommandOutput
| GetSerialConsoleAccessStatusCommandOutput
| GetSpotPlacementScoresCommandOutput
| GetSubnetCidrReservationsCommandOutput
Expand Down
173 changes: 173 additions & 0 deletions clients/client-ec2/src/commands/GetSecurityGroupsForVpcCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
// 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,
SMITHY_CONTEXT_KEY,
} from "@smithy/types";

import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
import { GetSecurityGroupsForVpcRequest, GetSecurityGroupsForVpcResult } from "../models/models_5";
import { de_GetSecurityGroupsForVpcCommand, se_GetSecurityGroupsForVpcCommand } from "../protocols/Aws_ec2";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link GetSecurityGroupsForVpcCommand}.
*/
export interface GetSecurityGroupsForVpcCommandInput extends GetSecurityGroupsForVpcRequest {}
/**
* @public
*
* The output of {@link GetSecurityGroupsForVpcCommand}.
*/
export interface GetSecurityGroupsForVpcCommandOutput extends GetSecurityGroupsForVpcResult, __MetadataBearer {}

/**
* @public
* <p>Gets security groups that can be associated by the Amazon Web Services account making the request with network interfaces in the specified VPC.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { EC2Client, GetSecurityGroupsForVpcCommand } from "@aws-sdk/client-ec2"; // ES Modules import
* // const { EC2Client, GetSecurityGroupsForVpcCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
* const client = new EC2Client(config);
* const input = { // GetSecurityGroupsForVpcRequest
* VpcId: "STRING_VALUE", // required
* NextToken: "STRING_VALUE",
* MaxResults: Number("int"),
* Filters: [ // FilterList
* { // Filter
* Name: "STRING_VALUE",
* Values: [ // ValueStringList
* "STRING_VALUE",
* ],
* },
* ],
* DryRun: true || false,
* };
* const command = new GetSecurityGroupsForVpcCommand(input);
* const response = await client.send(command);
* // { // GetSecurityGroupsForVpcResult
* // NextToken: "STRING_VALUE",
* // SecurityGroupForVpcs: [ // SecurityGroupForVpcList
* // { // SecurityGroupForVpc
* // Description: "STRING_VALUE",
* // GroupName: "STRING_VALUE",
* // OwnerId: "STRING_VALUE",
* // GroupId: "STRING_VALUE",
* // Tags: [ // TagList
* // { // Tag
* // Key: "STRING_VALUE",
* // Value: "STRING_VALUE",
* // },
* // ],
* // PrimaryVpcId: "STRING_VALUE",
* // },
* // ],
* // };
*
* ```
*
* @param GetSecurityGroupsForVpcCommandInput - {@link GetSecurityGroupsForVpcCommandInput}
* @returns {@link GetSecurityGroupsForVpcCommandOutput}
* @see {@link GetSecurityGroupsForVpcCommandInput} for command's `input` shape.
* @see {@link GetSecurityGroupsForVpcCommandOutput} for command's `response` shape.
* @see {@link EC2ClientResolvedConfig | config} for EC2Client's `config` shape.
*
* @throws {@link EC2ServiceException}
* <p>Base exception class for all service exceptions from EC2 service.</p>
*
*/
export class GetSecurityGroupsForVpcCommand extends $Command<
GetSecurityGroupsForVpcCommandInput,
GetSecurityGroupsForVpcCommandOutput,
EC2ClientResolvedConfig
> {
// 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: GetSecurityGroupsForVpcCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: EC2ClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<GetSecurityGroupsForVpcCommandInput, GetSecurityGroupsForVpcCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, GetSecurityGroupsForVpcCommand.getEndpointParameterInstructions())
);

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

const { logger } = configuration;
const clientName = "EC2Client";
const commandName = "GetSecurityGroupsForVpcCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
[SMITHY_CONTEXT_KEY]: {
service: "AmazonEC2",
operation: "GetSecurityGroupsForVpc",
},
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

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

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

// Start section: command_body_extra
// End section: command_body_extra
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ import {
} from "@smithy/types";

import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
import {
GetTransitGatewayRouteTableAssociationsRequest,
GetTransitGatewayRouteTableAssociationsResult,
} from "../models/models_5";
import { GetTransitGatewayRouteTableAssociationsRequest } from "../models/models_5";
import { GetTransitGatewayRouteTableAssociationsResult } from "../models/models_6";
import {
de_GetTransitGatewayRouteTableAssociationsCommand,
se_GetTransitGatewayRouteTableAssociationsCommand,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ import {
} from "@smithy/types";

import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
import { GetTransitGatewayRouteTablePropagationsRequest } from "../models/models_5";
import { GetTransitGatewayRouteTablePropagationsResult } from "../models/models_6";
import {
GetTransitGatewayRouteTablePropagationsRequest,
GetTransitGatewayRouteTablePropagationsResult,
} from "../models/models_6";
import {
de_GetTransitGatewayRouteTablePropagationsCommand,
se_GetTransitGatewayRouteTablePropagationsCommand,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
} from "@smithy/types";

import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
import { RevokeSecurityGroupIngressRequest, RevokeSecurityGroupIngressResult } from "../models/models_6";
import { RevokeSecurityGroupIngressRequest } from "../models/models_6";
import { RevokeSecurityGroupIngressResult } from "../models/models_7";
import { de_RevokeSecurityGroupIngressCommand, se_RevokeSecurityGroupIngressCommand } from "../protocols/Aws_ec2";

/**
Expand Down
1 change: 1 addition & 0 deletions clients/client-ec2/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ export * from "./GetNetworkInsightsAccessScopeAnalysisFindingsCommand";
export * from "./GetNetworkInsightsAccessScopeContentCommand";
export * from "./GetPasswordDataCommand";
export * from "./GetReservedInstancesExchangeQuoteCommand";
export * from "./GetSecurityGroupsForVpcCommand";
export * from "./GetSerialConsoleAccessStatusCommand";
export * from "./GetSpotPlacementScoresCommand";
export * from "./GetSubnetCidrReservationsCommand";
Expand Down
Loading

0 comments on commit 0bc9a39

Please sign in to comment.