FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
aws-lambda-builders/aws_lambda_builders/validator.py at develop · marekaiv/aws-lambda-builders · GitHub
marekaiv
/
aws-lambda-builders
Public
forked from
aws/aws-lambda-builders
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
aws-lambda-builders
/
aws_lambda_builders
/
validator.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
76 lines (63 loc) · 2.22 KB
Breadcrumbs
aws-lambda-builders
/
aws_lambda_builders
/
validator.py
Copy path
File metadata and controls
76 lines (63 loc) · 2.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"""
No-op validator that does not validate the runtime_path for a specified language.
"""
import
logging
from
aws_lambda_builders
.
architecture
import
ARM64
,
X86_64
from
aws_lambda_builders
.
exceptions
import
UnsupportedArchitectureError
,
UnsupportedRuntimeError
LOG
=
logging
.
getLogger
(
__name__
)
SUPPORTED_RUNTIMES
=
{
"nodejs12.x"
: [
ARM64
,
X86_64
],
"nodejs14.x"
: [
ARM64
,
X86_64
],
"nodejs16.x"
: [
ARM64
,
X86_64
],
"nodejs18.x"
: [
ARM64
,
X86_64
],
"python3.7"
: [
X86_64
],
"python3.8"
: [
ARM64
,
X86_64
],
"python3.9"
: [
ARM64
,
X86_64
],
"python3.10"
: [
ARM64
,
X86_64
],
"ruby2.7"
: [
ARM64
,
X86_64
],
"java8"
: [
ARM64
,
X86_64
],
"java11"
: [
ARM64
,
X86_64
],
"java17"
: [
ARM64
,
X86_64
],
"go1.x"
: [
ARM64
,
X86_64
],
"dotnetcore3.1"
: [
ARM64
,
X86_64
],
"dotnet6"
: [
ARM64
,
X86_64
],
"provided"
: [
ARM64
,
X86_64
],
}
class
RuntimeValidator
(
object
):
def
__init__
(
self
,
runtime
,
architecture
):
"""
Parameters
----------
runtime : str
name of the AWS Lambda runtime that you are building for. This is sent to the builder for
informational purposes.
architecture : str
Architecture for which the build will be based on in AWS lambda
"""
self
.
runtime
=
runtime
self
.
_runtime_path
=
None
self
.
architecture
=
architecture
def
validate
(
self
,
runtime_path
):
"""
Parameters
----------
runtime_path : str
runtime to check eg: /usr/bin/runtime
Returns
-------
str
runtime to check eg: /usr/bin/runtime
Raises
------
UnsupportedRuntimeError
Raised when runtime provided is not support.
UnsupportedArchitectureError
Raised when runtime is not compatible with architecture
"""
runtime_architectures
=
SUPPORTED_RUNTIMES
.
get
(
self
.
runtime
,
None
)
if
not
runtime_architectures
:
raise
UnsupportedRuntimeError
(
runtime
=
self
.
runtime
)
if
self
.
architecture
not
in
runtime_architectures
:
raise
UnsupportedArchitectureError
(
runtime
=
self
.
runtime
,
architecture
=
self
.
architecture
)
self
.
_runtime_path
=
runtime_path
return
runtime_path
Back
|
FazBrowse Home
|
New Git URL