cloud-foundry 0.0.2__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/PKG-INFO +1 -1
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/cloud_foundry/__init__.py +1 -0
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/cloud_foundry/pulumi/python_function.py +19 -19
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/pyproject.toml +1 -1
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/.gitignore +0 -0
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/LICENSE +0 -0
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/cloud_foundry/archive_builder.py +0 -0
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/cloud_foundry/cloud_foundry.py +0 -0
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/cloud_foundry/pulumi/log_group.pv +0 -0
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/cloud_foundry/pulumi/rest_api.py +0 -0
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/cloud_foundry/python_archive_builder.py +0 -0
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/cloud_foundry/utils/hash_comparator.py +0 -0
- {cloud_foundry-0.0.2 → cloud_foundry-0.0.4}/cloud_foundry/utils/logger.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: cloud-foundry
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: cloud-foundry is a curated set of cloud components that can be used to assemble cloud based applications.
|
|
5
5
|
Project-URL: Documentation, https://github.com/DanRepik/cloud-foundry
|
|
6
6
|
Project-URL: Source, https://github.com/DanRepik/cloud-foundry
|
|
@@ -18,16 +18,20 @@ class PythonFunction(pulumi.ComponentResource):
|
|
|
18
18
|
*,
|
|
19
19
|
hash: str,
|
|
20
20
|
archive_location: str,
|
|
21
|
-
handler: str,
|
|
21
|
+
handler: str = None,
|
|
22
|
+
timeout: int = None,
|
|
23
|
+
memory_size: int = None,
|
|
22
24
|
environment: dict[str, str]=None,
|
|
23
25
|
actions: list[str]=None,
|
|
24
26
|
opts=None
|
|
25
27
|
):
|
|
26
|
-
super().__init__("
|
|
28
|
+
super().__init__("cloud_forge:lambda:PythonFunction", name, {}, opts)
|
|
27
29
|
self.name = name
|
|
28
30
|
self.handler = handler
|
|
29
31
|
self.environment = environment or {}
|
|
30
|
-
self.
|
|
32
|
+
self.memory_size = memory_size
|
|
33
|
+
self.timeout = timeout
|
|
34
|
+
self.actions = actions
|
|
31
35
|
self.create_lambda_function(hash, archive_location)
|
|
32
36
|
self.register_outputs({})
|
|
33
37
|
|
|
@@ -51,6 +55,7 @@ class PythonFunction(pulumi.ComponentResource):
|
|
|
51
55
|
role = aws.iam.Role(
|
|
52
56
|
f"{self.name}-lambda-execution",
|
|
53
57
|
assume_role_policy=assume_role_policy.json,
|
|
58
|
+
name=f"{pulumi.get_project()}-{pulumi.get_stack()}-{self.name}-lambda-execution",
|
|
54
59
|
opts=pulumi.ResourceOptions(parent=self)
|
|
55
60
|
)
|
|
56
61
|
|
|
@@ -58,7 +63,7 @@ class PythonFunction(pulumi.ComponentResource):
|
|
|
58
63
|
statements=[
|
|
59
64
|
aws.iam.GetPolicyDocumentStatementArgs(
|
|
60
65
|
effect="Allow",
|
|
61
|
-
actions=(self.actions + [
|
|
66
|
+
actions=((self.actions or []) + [
|
|
62
67
|
"logs:CreateLogGroup",
|
|
63
68
|
"logs:CreateLogStream",
|
|
64
69
|
"logs:PutLogEvents",
|
|
@@ -70,40 +75,33 @@ class PythonFunction(pulumi.ComponentResource):
|
|
|
70
75
|
|
|
71
76
|
return role
|
|
72
77
|
|
|
73
|
-
def create_log_group(self) -> aws.cloudwatch.LogGroup:
|
|
74
|
-
log_group = aws.cloudwatch.LogGroup(
|
|
75
|
-
f"{self.name}-log-group",
|
|
76
|
-
name=f"/aws/lambda/{pulumi.get_project()}-{self.name}",
|
|
77
|
-
retention_in_days=3,
|
|
78
|
-
opts=pulumi.ResourceOptions(parent=self)
|
|
79
|
-
)
|
|
80
|
-
return log_group
|
|
81
|
-
|
|
82
78
|
def invoke_arn(self) -> pulumi.Output[str]:
|
|
83
79
|
return self.lambda_.invoke_arn
|
|
84
80
|
|
|
85
81
|
def create_lambda_function(self, hash: str, archive_location: str):
|
|
86
82
|
log.debug("creating lambda function")
|
|
87
83
|
|
|
88
|
-
log_group = self.create_log_group()
|
|
89
|
-
|
|
90
84
|
execution_role = self.create_execution_role()
|
|
91
85
|
|
|
92
86
|
self.lambda_ = aws.lambda_.Function(
|
|
93
87
|
f"{self.name}-lambda",
|
|
94
88
|
code=pulumi.FileArchive(archive_location),
|
|
95
|
-
name=f"{pulumi.get_project()}-{self.name}",
|
|
89
|
+
name=f"{pulumi.get_project()}-{pulumi.get_stack()}-{self.name}",
|
|
96
90
|
role=execution_role.arn,
|
|
97
|
-
|
|
91
|
+
memory_size=self.memory_size,
|
|
92
|
+
timeout=self.timeout,
|
|
93
|
+
handler=self.handler or "app.handler",
|
|
98
94
|
source_code_hash=hash,
|
|
99
95
|
runtime=aws.lambda_.Runtime.PYTHON3D9,
|
|
100
96
|
environment=aws.lambda_.FunctionEnvironmentArgs(variables=self.environment),
|
|
101
|
-
opts=pulumi.ResourceOptions(depends_on=[execution_role
|
|
97
|
+
opts=pulumi.ResourceOptions(depends_on=[execution_role], parent=self),
|
|
102
98
|
)
|
|
103
99
|
|
|
104
100
|
def python_function(
|
|
105
101
|
name: str, *,
|
|
106
|
-
handler: str,
|
|
102
|
+
handler: str = None,
|
|
103
|
+
memory_size: int = None,
|
|
104
|
+
timeout: int = None,
|
|
107
105
|
sources: dict[str, str] = None,
|
|
108
106
|
requirements: list[str] = None,
|
|
109
107
|
environment: dict[str, str] = None,
|
|
@@ -117,6 +115,8 @@ def python_function(
|
|
|
117
115
|
return PythonFunction(
|
|
118
116
|
name=name,
|
|
119
117
|
hash=archive_builder.hash(),
|
|
118
|
+
memory_size=memory_size,
|
|
119
|
+
timeout=timeout,
|
|
120
120
|
handler=handler,
|
|
121
121
|
archive_location=archive_builder.location(),
|
|
122
122
|
environment=environment,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|