-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into iot-actions-iotevents
- Loading branch information
Showing
467 changed files
with
32,653 additions
and
1,875 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/websocket/iam.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { | ||
WebSocketAuthorizerType, | ||
WebSocketRouteAuthorizerBindOptions, | ||
WebSocketRouteAuthorizerConfig, | ||
IWebSocketRouteAuthorizer, | ||
} from '@aws-cdk/aws-apigatewayv2'; | ||
|
||
/** | ||
* Authorize WebSocket API Routes with IAM | ||
*/ | ||
export class WebSocketIamAuthorizer implements IWebSocketRouteAuthorizer { | ||
public bind( | ||
_options: WebSocketRouteAuthorizerBindOptions, | ||
): WebSocketRouteAuthorizerConfig { | ||
return { | ||
authorizationType: WebSocketAuthorizerType.IAM, | ||
}; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/websocket/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './lambda'; | ||
export * from './iam'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
....integ.snapshot/ApiGatewayV2WebSocketIamTestDefaultTestDeployAssert2B412D7B.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
226 changes: 226 additions & 0 deletions
226
...atewayv2-authorizers/test/websocket/iam.integ.snapshot/IntegApiGatewayV2Iam.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
{ | ||
"Resources": { | ||
"User00B015A1": { | ||
"Type": "AWS::IAM::User" | ||
}, | ||
"UserAccessEC42ADF7": { | ||
"Type": "AWS::IAM::AccessKey", | ||
"Properties": { | ||
"UserName": { | ||
"Ref": "User00B015A1" | ||
} | ||
} | ||
}, | ||
"authfunctionServiceRoleFCB72198": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "lambda.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"ManagedPolicyArns": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" | ||
] | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"authfunction96361832": { | ||
"Type": "AWS::Lambda::Function", | ||
"Properties": { | ||
"Code": { | ||
"ZipFile": "exports.handler = () => {return true}" | ||
}, | ||
"Role": { | ||
"Fn::GetAtt": [ | ||
"authfunctionServiceRoleFCB72198", | ||
"Arn" | ||
] | ||
}, | ||
"Handler": "index.handler", | ||
"Runtime": "nodejs14.x" | ||
}, | ||
"DependsOn": [ | ||
"authfunctionServiceRoleFCB72198" | ||
] | ||
}, | ||
"WebSocketApi34BCF99B": { | ||
"Type": "AWS::ApiGatewayV2::Api", | ||
"Properties": { | ||
"Name": "WebSocketApi", | ||
"ProtocolType": "WEBSOCKET", | ||
"RouteSelectionExpression": "$request.body.action" | ||
} | ||
}, | ||
"WebSocketApiconnectRouteWebSocketLambdaIntegrationPermission76CD86C6": { | ||
"Type": "AWS::Lambda::Permission", | ||
"Properties": { | ||
"Action": "lambda:InvokeFunction", | ||
"FunctionName": { | ||
"Fn::GetAtt": [ | ||
"authfunction96361832", | ||
"Arn" | ||
] | ||
}, | ||
"Principal": "apigateway.amazonaws.com", | ||
"SourceArn": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":execute-api:", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
":", | ||
{ | ||
"Ref": "AWS::AccountId" | ||
}, | ||
":", | ||
{ | ||
"Ref": "WebSocketApi34BCF99B" | ||
}, | ||
"/*/*$connect" | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"WebSocketApiconnectRouteWebSocketLambdaIntegration3D2B13DD": { | ||
"Type": "AWS::ApiGatewayV2::Integration", | ||
"Properties": { | ||
"ApiId": { | ||
"Ref": "WebSocketApi34BCF99B" | ||
}, | ||
"IntegrationType": "AWS_PROXY", | ||
"IntegrationUri": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":apigateway:", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
":lambda:path/2015-03-31/functions/", | ||
{ | ||
"Fn::GetAtt": [ | ||
"authfunction96361832", | ||
"Arn" | ||
] | ||
}, | ||
"/invocations" | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"WebSocketApiconnectRoute846149DD": { | ||
"Type": "AWS::ApiGatewayV2::Route", | ||
"Properties": { | ||
"ApiId": { | ||
"Ref": "WebSocketApi34BCF99B" | ||
}, | ||
"RouteKey": "$connect", | ||
"AuthorizationType": "AWS_IAM", | ||
"Target": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"integrations/", | ||
{ | ||
"Ref": "WebSocketApiconnectRouteWebSocketLambdaIntegration3D2B13DD" | ||
} | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"AllowInvoke767865EA": { | ||
"Type": "AWS::IAM::Policy", | ||
"Properties": { | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "execute-api:Invoke", | ||
"Effect": "Allow", | ||
"Resource": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":execute-api:", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
":", | ||
{ | ||
"Ref": "AWS::AccountId" | ||
}, | ||
":", | ||
{ | ||
"Ref": "WebSocketApi34BCF99B" | ||
} | ||
] | ||
] | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"PolicyName": "AllowInvoke767865EA", | ||
"Users": [ | ||
{ | ||
"Ref": "User00B015A1" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"Outputs": { | ||
"TESTACCESSKEYID": { | ||
"Value": { | ||
"Ref": "UserAccessEC42ADF7" | ||
} | ||
}, | ||
"TESTSECRETACCESSKEY": { | ||
"Value": { | ||
"Fn::GetAtt": [ | ||
"UserAccessEC42ADF7", | ||
"SecretAccessKey" | ||
] | ||
} | ||
}, | ||
"TESTREGION": { | ||
"Value": { | ||
"Ref": "AWS::Region" | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/iam.integ.snapshot/integ.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "20.0.0", | ||
"testCases": { | ||
"ApiGatewayV2WebSocketIamTest/DefaultTest": { | ||
"stacks": [ | ||
"IntegApiGatewayV2Iam" | ||
], | ||
"assertionStack": "ApiGatewayV2WebSocketIamTestDefaultTestDeployAssert2B412D7B" | ||
} | ||
} | ||
} |
Oops, something went wrong.