{
  "typeName" : "AWS::Lambda::LayerVersionPermission",
  "description" : "Schema for Lambda LayerVersionPermission",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-lambda.git",
  "additionalProperties" : false,
  "properties" : {
    "Id" : {
      "description" : "ID generated by service",
      "type" : "string"
    },
    "Action" : {
      "description" : "The API action that grants access to the layer.",
      "type" : "string"
    },
    "LayerVersionArn" : {
      "description" : "The name or Amazon Resource Name (ARN) of the layer.",
      "type" : "string"
    },
    "OrganizationId" : {
      "description" : "With the principal set to *, grant permission to all accounts in the specified organization.",
      "type" : "string"
    },
    "Principal" : {
      "description" : "An account ID, or * to grant layer usage permission to all accounts in an organization, or all AWS accounts (if organizationId is not specified).",
      "type" : "string"
    }
  },
  "tagging" : {
    "taggable" : false,
    "tagOnCreate" : false,
    "tagUpdatable" : false,
    "cloudFormationSystemTags" : false
  },
  "required" : [ "LayerVersionArn", "Action", "Principal" ],
  "createOnlyProperties" : [ "/properties/OrganizationId", "/properties/Principal", "/properties/Action", "/properties/LayerVersionArn" ],
  "primaryIdentifier" : [ "/properties/Id" ],
  "readOnlyProperties" : [ "/properties/Id" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "lambda:AddLayerVersionPermission" ]
    },
    "read" : {
      "permissions" : [ "lambda:GetLayerVersionPolicy" ]
    },
    "delete" : {
      "permissions" : [ "lambda:GetLayerVersionPolicy", "lambda:RemoveLayerVersionPermission" ]
    },
    "list" : {
      "permissions" : [ "lambda:GetLayerVersionPolicy" ]
    }
  },
  "propertyTransform" : {
    "/properties/Principal" : "$join([\"^arn:aws[a-zA-Z-]*:iam::\",Principal,\":[a-zA-Z-]*\"]) $OR $join([\".*AWS.*[\", Principal, \"].*\"]) $OR $replace(Principal, /^arn:aws[a-zA-Z-]*:/, \"arn:aws[a-zA-Z-]*:\") $OR Principal"
  }
}