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
76
77
78
79
80
81
82
83
84
85
use crate::;
/// [AWS::Lambda::LayerVersion]
///
/// The AWS::Lambda::LayerVersion resource creates a Lambda layer from a ZIP archive.
///
/// ```
/// use four::{
/// LogicalId,
/// lambda::{
/// resource::LayerVersion,
/// Architecture, Runtime, FunctionContent,
/// LayerVersionDescription, LayerName, LicenseInfo
/// },
/// };
///
/// let layer_id = LogicalId::try_from("MyLayer").unwrap();
/// let content = FunctionContent {
/// s3_bucket: "my-bucket-us-west-2-123456789012".to_string(),
/// s3_key: "layer.zip".to_string(),
/// s3_object_version: None,
/// };
/// let layer = LayerVersion::new(layer_id, content)
/// .compatible_architectures(vec![Architecture::X86_64].try_into().unwrap())
/// .compatible_runtimes(vec![Runtime::Python3_6, Runtime::Python3_7].try_into().unwrap())
/// .description("ThisIsMyLayer".try_into().unwrap())
/// .layer_name("my-layer".try_into().unwrap())
/// .license_info("MIT".try_into().unwrap());
///
/// let lhs = serde_json::to_string(&layer).unwrap();
/// let mut rhs = r#"
/// {
/// "Type": "AWS::Lambda::LayerVersion",
/// "Properties": {
/// "CompatibleArchitectures": ["x86_64"],
/// "CompatibleRuntimes": ["python3.6", "python3.7"],
/// "Content": {
/// "S3Bucket": "my-bucket-us-west-2-123456789012",
/// "S3Key": "layer.zip"
/// },
/// "Description": "ThisIsMyLayer",
/// "LayerName": "my-layer",
/// "LicenseInfo": "MIT"
/// }
/// }
/// "#.to_string();
/// rhs.retain(|c| c != '\n' && c != ' ');
///
/// assert_eq!(lhs, rhs);
/// ```
///
/// [AWS::Lambda::LayerVersion]: https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversion.html