Jump to Content

This API Documentation is now deprecated

We are excited to announce our new API Documentation.

Class AddLayerVersionPermissionCommandProtected

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.

Example

Use a bare-bones client and the command you need to make an API call.

import { LambdaClient, AddLayerVersionPermissionCommand } from "@aws-sdk/client-lambda"; // ES Modules import
// const { LambdaClient, AddLayerVersionPermissionCommand } = require("@aws-sdk/client-lambda"); // CommonJS import
const client = new LambdaClient(config);
const input = { // AddLayerVersionPermissionRequest
LayerName: "STRING_VALUE", // required
VersionNumber: Number("long"), // required
StatementId: "STRING_VALUE", // required
Action: "STRING_VALUE", // required
Principal: "STRING_VALUE", // required
OrganizationId: "STRING_VALUE",
RevisionId: "STRING_VALUE",
};
const command = new AddLayerVersionPermissionCommand(input);
const response = await client.send(command);
// { // AddLayerVersionPermissionResponse
// Statement: "STRING_VALUE",
// RevisionId: "STRING_VALUE",
// };

Param

AddLayerVersionPermissionCommandInput

Returns

AddLayerVersionPermissionCommandOutput

See

Throws

InvalidParameterValueException (client fault)

One of the parameters in the request is not valid.

Throws

PolicyLengthExceededException (client fault)

The permissions policy for the resource is too large. For more information, see Lambda quotas.

Throws

PreconditionFailedException (client fault)

The RevisionId provided does not match the latest RevisionId for the Lambda function or alias. Call the GetFunction or the GetAlias API operation to retrieve the latest RevisionId for your resource.

Throws

ResourceConflictException (client fault)

The resource already exists, or another operation is in progress.

Throws

ResourceNotFoundException (client fault)

The resource specified in the request does not exist.

Throws

ServiceException (server fault)

The Lambda service encountered an internal error.

Throws

TooManyRequestsException (client fault)

The request throughput limit was exceeded. For more information, see Lambda quotas.

Throws

LambdaServiceException

Base exception class for all service exceptions from Lambda service.

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

Methods