AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the AddLayerVersionPermission operation. Adds permissions to the resource-based policy of a version of an Lambda layer. Use this action to grant layer usage permission to other accounts. You can grant permission to a single account, all accounts in an organization, or all Amazon Web Services accounts.

To revoke permission, call RemoveLayerVersionPermission with the statement ID that you specified when you added it.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.Lambda.AmazonLambdaRequest
      Amazon.Lambda.Model.AddLayerVersionPermissionRequest

Namespace: Amazon.Lambda.Model
Assembly: AWSSDK.Lambda.dll
Version: 3.x.y.z

Syntax

C#
public class AddLayerVersionPermissionRequest : AmazonLambdaRequest
         IAmazonWebServiceRequest

The AddLayerVersionPermissionRequest type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property Action System.String

Gets and sets the property Action.

The API action that grants access to the layer. For example, lambda:GetLayerVersion.

Public Property LayerName System.String

Gets and sets the property LayerName.

The name or Amazon Resource Name (ARN) of the layer.

Public Property OrganizationId System.String

Gets and sets the property OrganizationId.

With the principal set to *, grant permission to all accounts in the specified organization.

Public Property Principal System.String

Gets and sets the property Principal.

An account ID, or * to grant layer usage permission to all accounts in an organization, or all Amazon Web Services accounts (if organizationId is not specified). For the last case, make sure that you really do want all Amazon Web Services accounts to have usage permission to this layer.

Public Property RevisionId System.String

Gets and sets the property RevisionId.

Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.

Public Property StatementId System.String

Gets and sets the property StatementId.

An identifier that distinguishes the policy from others on the same layer version.

Public Property VersionNumber System.Int64

Gets and sets the property VersionNumber.

The version number.

Examples

The following example grants permission for the account 223456789012 to use version 1 of a layer named my-layer.

To add permissions to a layer version


var response = client.AddLayerVersionPermission(new AddLayerVersionPermissionRequest 
{
    Action = "lambda:GetLayerVersion",
    LayerName = "my-layer",
    Principal = "223456789012",
    StatementId = "xaccount",
    VersionNumber = 1
});

string revisionId = response.RevisionId;
string statement = response.Statement;

            

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5