Skip to content

Commit 0bc9a39

Browse files
author
awstools
committed
feat(client-ec2): Launching GetSecurityGroupsForVpc API. This API gets security groups that can be associated by the AWS account making the request with network interfaces in the specified VPC.
1 parent 6bd6402 commit 0bc9a39

15 files changed

+886
-195
lines changed

clients/client-ec2/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3788,6 +3788,14 @@ GetReservedInstancesExchangeQuote
37883788

37893789
[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)
37903790

3791+
</details>
3792+
<details>
3793+
<summary>
3794+
GetSecurityGroupsForVpc
3795+
</summary>
3796+
3797+
[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)
3798+
37913799
</details>
37923800
<details>
37933801
<summary>

clients/client-ec2/src/EC2.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,6 +2175,11 @@ import {
21752175
GetReservedInstancesExchangeQuoteCommandInput,
21762176
GetReservedInstancesExchangeQuoteCommandOutput,
21772177
} from "./commands/GetReservedInstancesExchangeQuoteCommand";
2178+
import {
2179+
GetSecurityGroupsForVpcCommand,
2180+
GetSecurityGroupsForVpcCommandInput,
2181+
GetSecurityGroupsForVpcCommandOutput,
2182+
} from "./commands/GetSecurityGroupsForVpcCommand";
21782183
import {
21792184
GetSerialConsoleAccessStatusCommand,
21802185
GetSerialConsoleAccessStatusCommandInput,
@@ -3377,6 +3382,7 @@ const commands = {
33773382
GetNetworkInsightsAccessScopeContentCommand,
33783383
GetPasswordDataCommand,
33793384
GetReservedInstancesExchangeQuoteCommand,
3385+
GetSecurityGroupsForVpcCommand,
33803386
GetSerialConsoleAccessStatusCommand,
33813387
GetSpotPlacementScoresCommand,
33823388
GetSubnetCidrReservationsCommand,
@@ -10844,6 +10850,23 @@ export interface EC2 {
1084410850
cb: (err: any, data?: GetReservedInstancesExchangeQuoteCommandOutput) => void
1084510851
): void;
1084610852

10853+
/**
10854+
* @see {@link GetSecurityGroupsForVpcCommand}
10855+
*/
10856+
getSecurityGroupsForVpc(
10857+
args: GetSecurityGroupsForVpcCommandInput,
10858+
options?: __HttpHandlerOptions
10859+
): Promise<GetSecurityGroupsForVpcCommandOutput>;
10860+
getSecurityGroupsForVpc(
10861+
args: GetSecurityGroupsForVpcCommandInput,
10862+
cb: (err: any, data?: GetSecurityGroupsForVpcCommandOutput) => void
10863+
): void;
10864+
getSecurityGroupsForVpc(
10865+
args: GetSecurityGroupsForVpcCommandInput,
10866+
options: __HttpHandlerOptions,
10867+
cb: (err: any, data?: GetSecurityGroupsForVpcCommandOutput) => void
10868+
): void;
10869+
1084710870
/**
1084810871
* @see {@link GetSerialConsoleAccessStatusCommand}
1084910872
*/

clients/client-ec2/src/EC2Client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,10 @@ import {
15541554
GetReservedInstancesExchangeQuoteCommandInput,
15551555
GetReservedInstancesExchangeQuoteCommandOutput,
15561556
} from "./commands/GetReservedInstancesExchangeQuoteCommand";
1557+
import {
1558+
GetSecurityGroupsForVpcCommandInput,
1559+
GetSecurityGroupsForVpcCommandOutput,
1560+
} from "./commands/GetSecurityGroupsForVpcCommand";
15571561
import {
15581562
GetSerialConsoleAccessStatusCommandInput,
15591563
GetSerialConsoleAccessStatusCommandOutput,
@@ -2534,6 +2538,7 @@ export type ServiceInputTypes =
25342538
| GetNetworkInsightsAccessScopeContentCommandInput
25352539
| GetPasswordDataCommandInput
25362540
| GetReservedInstancesExchangeQuoteCommandInput
2541+
| GetSecurityGroupsForVpcCommandInput
25372542
| GetSerialConsoleAccessStatusCommandInput
25382543
| GetSpotPlacementScoresCommandInput
25392544
| GetSubnetCidrReservationsCommandInput
@@ -3138,6 +3143,7 @@ export type ServiceOutputTypes =
31383143
| GetNetworkInsightsAccessScopeContentCommandOutput
31393144
| GetPasswordDataCommandOutput
31403145
| GetReservedInstancesExchangeQuoteCommandOutput
3146+
| GetSecurityGroupsForVpcCommandOutput
31413147
| GetSerialConsoleAccessStatusCommandOutput
31423148
| GetSpotPlacementScoresCommandOutput
31433149
| GetSubnetCidrReservationsCommandOutput
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
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 { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
18+
import { GetSecurityGroupsForVpcRequest, GetSecurityGroupsForVpcResult } from "../models/models_5";
19+
import { de_GetSecurityGroupsForVpcCommand, se_GetSecurityGroupsForVpcCommand } from "../protocols/Aws_ec2";
20+
21+
/**
22+
* @public
23+
*/
24+
export { __MetadataBearer, $Command };
25+
/**
26+
* @public
27+
*
28+
* The input for {@link GetSecurityGroupsForVpcCommand}.
29+
*/
30+
export interface GetSecurityGroupsForVpcCommandInput extends GetSecurityGroupsForVpcRequest {}
31+
/**
32+
* @public
33+
*
34+
* The output of {@link GetSecurityGroupsForVpcCommand}.
35+
*/
36+
export interface GetSecurityGroupsForVpcCommandOutput extends GetSecurityGroupsForVpcResult, __MetadataBearer {}
37+
38+
/**
39+
* @public
40+
* <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>
41+
* @example
42+
* Use a bare-bones client and the command you need to make an API call.
43+
* ```javascript
44+
* import { EC2Client, GetSecurityGroupsForVpcCommand } from "@aws-sdk/client-ec2"; // ES Modules import
45+
* // const { EC2Client, GetSecurityGroupsForVpcCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
46+
* const client = new EC2Client(config);
47+
* const input = { // GetSecurityGroupsForVpcRequest
48+
* VpcId: "STRING_VALUE", // required
49+
* NextToken: "STRING_VALUE",
50+
* MaxResults: Number("int"),
51+
* Filters: [ // FilterList
52+
* { // Filter
53+
* Name: "STRING_VALUE",
54+
* Values: [ // ValueStringList
55+
* "STRING_VALUE",
56+
* ],
57+
* },
58+
* ],
59+
* DryRun: true || false,
60+
* };
61+
* const command = new GetSecurityGroupsForVpcCommand(input);
62+
* const response = await client.send(command);
63+
* // { // GetSecurityGroupsForVpcResult
64+
* // NextToken: "STRING_VALUE",
65+
* // SecurityGroupForVpcs: [ // SecurityGroupForVpcList
66+
* // { // SecurityGroupForVpc
67+
* // Description: "STRING_VALUE",
68+
* // GroupName: "STRING_VALUE",
69+
* // OwnerId: "STRING_VALUE",
70+
* // GroupId: "STRING_VALUE",
71+
* // Tags: [ // TagList
72+
* // { // Tag
73+
* // Key: "STRING_VALUE",
74+
* // Value: "STRING_VALUE",
75+
* // },
76+
* // ],
77+
* // PrimaryVpcId: "STRING_VALUE",
78+
* // },
79+
* // ],
80+
* // };
81+
*
82+
* ```
83+
*
84+
* @param GetSecurityGroupsForVpcCommandInput - {@link GetSecurityGroupsForVpcCommandInput}
85+
* @returns {@link GetSecurityGroupsForVpcCommandOutput}
86+
* @see {@link GetSecurityGroupsForVpcCommandInput} for command's `input` shape.
87+
* @see {@link GetSecurityGroupsForVpcCommandOutput} for command's `response` shape.
88+
* @see {@link EC2ClientResolvedConfig | config} for EC2Client's `config` shape.
89+
*
90+
* @throws {@link EC2ServiceException}
91+
* <p>Base exception class for all service exceptions from EC2 service.</p>
92+
*
93+
*/
94+
export class GetSecurityGroupsForVpcCommand extends $Command<
95+
GetSecurityGroupsForVpcCommandInput,
96+
GetSecurityGroupsForVpcCommandOutput,
97+
EC2ClientResolvedConfig
98+
> {
99+
// Start section: command_properties
100+
// End section: command_properties
101+
102+
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
103+
return {
104+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
105+
Endpoint: { type: "builtInParams", name: "endpoint" },
106+
Region: { type: "builtInParams", name: "region" },
107+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
108+
};
109+
}
110+
111+
/**
112+
* @public
113+
*/
114+
constructor(readonly input: GetSecurityGroupsForVpcCommandInput) {
115+
// Start section: command_constructor
116+
super();
117+
// End section: command_constructor
118+
}
119+
120+
/**
121+
* @internal
122+
*/
123+
resolveMiddleware(
124+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
125+
configuration: EC2ClientResolvedConfig,
126+
options?: __HttpHandlerOptions
127+
): Handler<GetSecurityGroupsForVpcCommandInput, GetSecurityGroupsForVpcCommandOutput> {
128+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
129+
this.middlewareStack.use(
130+
getEndpointPlugin(configuration, GetSecurityGroupsForVpcCommand.getEndpointParameterInstructions())
131+
);
132+
133+
const stack = clientStack.concat(this.middlewareStack);
134+
135+
const { logger } = configuration;
136+
const clientName = "EC2Client";
137+
const commandName = "GetSecurityGroupsForVpcCommand";
138+
const handlerExecutionContext: HandlerExecutionContext = {
139+
logger,
140+
clientName,
141+
commandName,
142+
inputFilterSensitiveLog: (_: any) => _,
143+
outputFilterSensitiveLog: (_: any) => _,
144+
[SMITHY_CONTEXT_KEY]: {
145+
service: "AmazonEC2",
146+
operation: "GetSecurityGroupsForVpc",
147+
},
148+
};
149+
const { requestHandler } = configuration;
150+
return stack.resolve(
151+
(request: FinalizeHandlerArguments<any>) =>
152+
requestHandler.handle(request.request as __HttpRequest, options || {}),
153+
handlerExecutionContext
154+
);
155+
}
156+
157+
/**
158+
* @internal
159+
*/
160+
private serialize(input: GetSecurityGroupsForVpcCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
161+
return se_GetSecurityGroupsForVpcCommand(input, context);
162+
}
163+
164+
/**
165+
* @internal
166+
*/
167+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetSecurityGroupsForVpcCommandOutput> {
168+
return de_GetSecurityGroupsForVpcCommand(output, context);
169+
}
170+
171+
// Start section: command_body_extra
172+
// End section: command_body_extra
173+
}

clients/client-ec2/src/commands/GetTransitGatewayRouteTableAssociationsCommand.ts

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

1717
import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
18-
import {
19-
GetTransitGatewayRouteTableAssociationsRequest,
20-
GetTransitGatewayRouteTableAssociationsResult,
21-
} from "../models/models_5";
18+
import { GetTransitGatewayRouteTableAssociationsRequest } from "../models/models_5";
19+
import { GetTransitGatewayRouteTableAssociationsResult } from "../models/models_6";
2220
import {
2321
de_GetTransitGatewayRouteTableAssociationsCommand,
2422
se_GetTransitGatewayRouteTableAssociationsCommand,

clients/client-ec2/src/commands/GetTransitGatewayRouteTablePropagationsCommand.ts

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

1717
import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
18-
import { GetTransitGatewayRouteTablePropagationsRequest } from "../models/models_5";
19-
import { GetTransitGatewayRouteTablePropagationsResult } from "../models/models_6";
18+
import {
19+
GetTransitGatewayRouteTablePropagationsRequest,
20+
GetTransitGatewayRouteTablePropagationsResult,
21+
} from "../models/models_6";
2022
import {
2123
de_GetTransitGatewayRouteTablePropagationsCommand,
2224
se_GetTransitGatewayRouteTablePropagationsCommand,

clients/client-ec2/src/commands/RevokeSecurityGroupIngressCommand.ts

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

1717
import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
18-
import { RevokeSecurityGroupIngressRequest, RevokeSecurityGroupIngressResult } from "../models/models_6";
18+
import { RevokeSecurityGroupIngressRequest } from "../models/models_6";
19+
import { RevokeSecurityGroupIngressResult } from "../models/models_7";
1920
import { de_RevokeSecurityGroupIngressCommand, se_RevokeSecurityGroupIngressCommand } from "../protocols/Aws_ec2";
2021

2122
/**

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ export * from "./GetNetworkInsightsAccessScopeAnalysisFindingsCommand";
444444
export * from "./GetNetworkInsightsAccessScopeContentCommand";
445445
export * from "./GetPasswordDataCommand";
446446
export * from "./GetReservedInstancesExchangeQuoteCommand";
447+
export * from "./GetSecurityGroupsForVpcCommand";
447448
export * from "./GetSerialConsoleAccessStatusCommand";
448449
export * from "./GetSpotPlacementScoresCommand";
449450
export * from "./GetSubnetCidrReservationsCommand";

0 commit comments

Comments
 (0)