apx-aws-lambda 0.3.5__tar.gz → 0.3.6__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.
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/PKG-INFO +2 -2
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/README.md +1 -1
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/lambda_.py +9 -8
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda.egg-info/PKG-INFO +2 -2
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/pyproject.toml +1 -1
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/tests/test_proxy.py +14 -7
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/tests/test_targets.py +2 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/LICENSE +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/__init__.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/cli.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/cloud/aws/lambda/cookiecutter.json +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/cloud/aws/lambda/hooks/post_gen_project.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/.github/workflows/deploy.yml +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/DEPLOY.md +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/_lang/python/Makefile +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/_lang/python/lambda_handler.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/_lang/python/tools/lambda_requirements.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/policy.json +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/trust.json +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/samconfig.toml +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/template.yaml +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/overlays/index.json +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/plugin.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/proxy.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/shell.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda/tools.py +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda.egg-info/SOURCES.txt +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda.egg-info/dependency_links.txt +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda.egg-info/entry_points.txt +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda.egg-info/requires.txt +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/apx_aws_lambda.egg-info/top_level.txt +0 -0
- {apx_aws_lambda-0.3.5 → apx_aws_lambda-0.3.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apx-aws-lambda
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary: AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions.
|
|
5
5
|
Author-email: Action Platform <cloud@actionplatform.io>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -110,7 +110,7 @@ proxy_url = "https://xxxx.lambda-url.us-east-1.on.aws"
|
|
|
110
110
|
app = "acme/shop/orders"
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
Through the proxy the stack is named `ap-acme-shop-orders-dev` / `-prod` — the deploy role reaches that prefix only, so the target sets `--stack-name` itself and `stack_name` in `samconfig.toml` is ignored; the repository never has to know the organization.
|
|
114
114
|
|
|
115
115
|
**4.** `action-platform deploy`.
|
|
116
116
|
|
|
@@ -90,7 +90,7 @@ proxy_url = "https://xxxx.lambda-url.us-east-1.on.aws"
|
|
|
90
90
|
app = "acme/shop/orders"
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
Through the proxy the stack is named `ap-acme-shop-orders-dev` / `-prod` — the deploy role reaches that prefix only, so the target sets `--stack-name` itself and `stack_name` in `samconfig.toml` is ignored; the repository never has to know the organization.
|
|
94
94
|
|
|
95
95
|
**4.** `action-platform deploy`.
|
|
96
96
|
|
|
@@ -89,6 +89,12 @@ class LambdaTarget(DeployTarget):
|
|
|
89
89
|
return tomllib.loads(path.read_text())
|
|
90
90
|
|
|
91
91
|
def _stack(self, ctx: Context) -> str:
|
|
92
|
+
"""The stack: `<prefix>-<stage>` when the proxy granted a prefix — the repository's samconfig.toml never has to know the organization — else samconfig.toml's `stack_name`."""
|
|
93
|
+
prefix = (self.env(ctx) or {}).get("AP_STACK_PREFIX")
|
|
94
|
+
|
|
95
|
+
if prefix:
|
|
96
|
+
return f"{prefix}-{'prod' if ctx.stage == 'prod' else 'dev'}"
|
|
97
|
+
|
|
92
98
|
params = (
|
|
93
99
|
self._samconfig(ctx)
|
|
94
100
|
.get(self._stage(ctx), {})
|
|
@@ -138,15 +144,8 @@ class LambdaTarget(DeployTarget):
|
|
|
138
144
|
"template.yaml not found: apply the aws/lambda overlay first"
|
|
139
145
|
)
|
|
140
146
|
|
|
141
|
-
|
|
147
|
+
self._stack(ctx)
|
|
142
148
|
env = self.env(ctx)
|
|
143
|
-
prefix = (env or {}).get("AP_STACK_PREFIX")
|
|
144
|
-
|
|
145
|
-
if prefix and not stack.startswith(prefix):
|
|
146
|
-
raise DeployError(
|
|
147
|
-
f"stack_name {stack!r} must start with {prefix!r}: the proxy grants deploy on that prefix only"
|
|
148
|
-
)
|
|
149
|
-
|
|
150
149
|
shell.aws("sts", "get-caller-identity", region=self._region(ctx), env=env)
|
|
151
150
|
shell.run(
|
|
152
151
|
[*shell.require("sam", ""), "validate", "--lint"],
|
|
@@ -164,6 +163,8 @@ class LambdaTarget(DeployTarget):
|
|
|
164
163
|
"deploy",
|
|
165
164
|
"--no-confirm-changeset",
|
|
166
165
|
"--no-fail-on-empty-changeset",
|
|
166
|
+
"--stack-name",
|
|
167
|
+
self._stack(ctx),
|
|
167
168
|
]
|
|
168
169
|
|
|
169
170
|
if stage != "default":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apx-aws-lambda
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary: AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions.
|
|
5
5
|
Author-email: Action Platform <cloud@actionplatform.io>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -110,7 +110,7 @@ proxy_url = "https://xxxx.lambda-url.us-east-1.on.aws"
|
|
|
110
110
|
app = "acme/shop/orders"
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
Through the proxy the stack is named `ap-acme-shop-orders-dev` / `-prod` — the deploy role reaches that prefix only, so the target sets `--stack-name` itself and `stack_name` in `samconfig.toml` is ignored; the repository never has to know the organization.
|
|
114
114
|
|
|
115
115
|
**4.** `action-platform deploy`.
|
|
116
116
|
|
|
@@ -207,24 +207,31 @@ class ProxyClientTest(unittest.TestCase):
|
|
|
207
207
|
with self.assertRaises(DeployError):
|
|
208
208
|
ProxyClient("https://proxy.test", "orders")
|
|
209
209
|
|
|
210
|
-
def
|
|
210
|
+
def test_the_stack_follows_the_prefix_the_proxy_granted(self):
|
|
211
211
|
(self.root / "samconfig.toml").write_text(SAMCONFIG.format(stack="shop-dev"))
|
|
212
212
|
(self.root / "template.yaml").write_text("Resources: {}\n")
|
|
213
213
|
fake = FakeProxy({"POST /apps/acme/shop/orders/credentials": GRANTED})
|
|
214
214
|
target = LambdaTarget(proxy_url="https://proxy.test", app="acme/shop/orders")
|
|
215
|
+
calls: list[list[str]] = []
|
|
216
|
+
|
|
217
|
+
def run(args, cwd=None, env=None):
|
|
218
|
+
calls.append(args)
|
|
219
|
+
|
|
220
|
+
return "{}"
|
|
215
221
|
|
|
216
222
|
with (
|
|
217
223
|
mock.patch("urllib.request.urlopen", fake),
|
|
218
224
|
mock.patch.multiple(
|
|
219
|
-
shell,
|
|
220
|
-
run=lambda *a, **k: "{}",
|
|
221
|
-
require=lambda tool, hint: [f"/usr/bin/{tool}"],
|
|
225
|
+
shell, run=run, require=lambda tool, hint: [f"/usr/bin/{tool}"]
|
|
222
226
|
),
|
|
223
227
|
):
|
|
224
|
-
|
|
225
|
-
|
|
228
|
+
target.preflight(self.ctx())
|
|
229
|
+
target.deploy(self.ctx())
|
|
226
230
|
|
|
227
|
-
|
|
231
|
+
deploy = next(c for c in calls if c[1] == "deploy")
|
|
232
|
+
self.assertEqual(
|
|
233
|
+
deploy[deploy.index("--stack-name") + 1], "ap-acme-shop-orders-dev"
|
|
234
|
+
)
|
|
228
235
|
|
|
229
236
|
def test_the_target_deploys_with_the_granted_credentials(self):
|
|
230
237
|
(self.root / "samconfig.toml").write_text(
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|