addLayerVersionPermission

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.

Samples


fun main() { 
   //sampleStart 
   // The following example grants permission for the account 223456789012 to use version 1 of a layer
// named my layer.
val resp = lambdaClient.addLayerVersionPermission {
    layerName = "my-layer"
    versionNumber = 1
    statementId = "xaccount"
    action = "lambda:GetLayerVersion"
    principal = "223456789012"
} 
   //sampleEnd
}