1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
use crate::;
/// [AWS::Lambda::LayerVersionPermission]
///
/// The AWS::Lambda::LayerVersionPermission resource 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 AWS accounts, or all accounts in an organization.
///
/// ```
/// use four::{
/// LogicalId, arn_builder, Account, Region, RegionDetail, service, Partition,
/// lambda::{
/// resource::LayerVersionPermission,
/// GetLayerVersionAction, LayerName, OrganizationId, LayerVersionPrincipal,
/// },
/// };
///
/// let permission_id = LogicalId::try_from("permission").unwrap();
/// let action = GetLayerVersionAction;
/// let account = Account::try_from("123456789012").unwrap();
/// let layer_version_arn = arn_builder("layer:my-layer:1", account)
/// .region(Region::Detail(RegionDetail::UsEast1))
/// .partition(Partition::Aws)
/// .build(service::Lambda)
/// .into();
/// let principal = LayerVersionPrincipal::Any;
/// let permission = LayerVersionPermission::new(permission_id, action, layer_version_arn, principal)
/// .organization_id(OrganizationId::try_new("o-t194hfs8cz").unwrap());
///
/// let lhs = serde_json::to_string(&permission).unwrap();
/// let mut rhs = r#"
/// {
/// "Type": "AWS::Lambda::LayerVersionPermission",
/// "Properties": {
/// "Action": "lambda:GetLayerVersion",
/// "LayerVersionArn": "arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1",
/// "OrganizationId": "o-t194hfs8cz",
/// "Principal": "*"
/// }
/// }
/// "#.to_string();
/// rhs.retain(|c| c != '\n' && c != ' ');
///
/// assert_eq!(lhs, rhs);
/// ```
///
/// [AWS::Lambda::LayerVersionPermission]: https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversionpermission.html