Show / Hide Table of Contents

Enum Effect

The Effect element of an IAM policy.

Namespace: Amazon.CDK.AWS.IAM
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public enum Effect
Syntax (vb)
Public Enum Effect
Remarks

See: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_effect.html

ExampleMetadata: infused

Examples
using Amazon.CDK.AwsApigatewayv2Authorizers;
             using Amazon.CDK.AwsApigatewayv2Integrations;

             // This function handles your connect route
             Function connectHandler;


             var webSocketApi = new WebSocketApi(this, "WebSocketApi");

             webSocketApi.AddRoute("$connect", new WebSocketRouteOptions {
                 Integration = new WebSocketLambdaIntegration("Integration", connectHandler),
                 Authorizer = new WebSocketIamAuthorizer()
             });

             // Create an IAM user (identity)
             var user = new User(this, "User");

             var webSocketArn = Stack.Of(this).FormatArn(new ArnComponents {
                 Service = "execute-api",
                 Resource = webSocketApi.ApiId
             });

             // Grant access to the IAM user
             user.AttachInlinePolicy(new Policy(this, "AllowInvoke", new PolicyProps {
                 Statements = new [] {
                     new PolicyStatement(new PolicyStatementProps {
                         Actions = new [] { "execute-api:Invoke" },
                         Effect = Effect.ALLOW,
                         Resources = new [] { webSocketArn }
                     }) }
             }));

Synopsis

Fields

ALLOW

Allows access to a resource in an IAM policy statement.

DENY

Explicitly deny access to a resource.

Fields

Name Description
ALLOW

Allows access to a resource in an IAM policy statement.

DENY

Explicitly deny access to a resource.

Back to top Generated by DocFX