apx-aws-lambda 1.0.0__tar.gz → 1.1.0__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-1.0.0 → apx_aws_lambda-1.1.0}/PKG-INFO +4 -4
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/README.md +2 -2
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/lambda_.py +5 -0
- apx_aws_lambda-1.1.0/apx_aws_lambda/plugin.py +69 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda.egg-info/PKG-INFO +4 -4
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda.egg-info/requires.txt +1 -1
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/pyproject.toml +2 -2
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/tests/test_targets.py +21 -1
- apx_aws_lambda-1.0.0/apx_aws_lambda/plugin.py +0 -47
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/LICENSE +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/__init__.py +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/cli.py +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/connect/template.yaml +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/overlays/cloud/aws/lambda/cookiecutter.json +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/overlays/cloud/aws/lambda/hooks/post_gen_project.py +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/.github/workflows/deploy.yml +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/DEPLOY.md +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/Makefile +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/policy.json +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/trust.json +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/samconfig.toml +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/template.yaml +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/overlays/index.json +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/shell.py +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda/tools.py +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda.egg-info/SOURCES.txt +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda.egg-info/dependency_links.txt +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda.egg-info/entry_points.txt +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/apx_aws_lambda.egg-info/top_level.txt +0 -0
- {apx_aws_lambda-1.0.0 → apx_aws_lambda-1.1.0}/setup.cfg +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apx-aws-lambda
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.0
|
|
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
|
|
7
7
|
Requires-Python: >=3.11
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
License-File: LICENSE
|
|
10
|
-
Requires-Dist: action-platform>=0.
|
|
10
|
+
Requires-Dist: action-platform>=0.32.0
|
|
11
11
|
Requires-Dist: awscli>=1.34
|
|
12
12
|
Requires-Dist: aws-sam-cli>=1.120
|
|
13
13
|
Provides-Extra: dev
|
|
@@ -77,13 +77,13 @@ The target looks for credentials in this order:
|
|
|
77
77
|
|
|
78
78
|
One CloudFormation stack, IAM only — no function, no table, nothing to upgrade. AWS itself trusts the platform's OIDC tokens; the token's session tag keeps each deploy inside its app.
|
|
79
79
|
|
|
80
|
-
**1. Create the stack** — once per AWS account, with your own AWS credentials (not the root account).
|
|
80
|
+
**1. Create the stack** — once per AWS account, with your own AWS credentials (not the root account). On the platform: Plugins → AWS Lambda → Configure → **Connect AWS** copies the command and opens AWS CloudShell (the AWS sign-in first); paste, press Enter, and paste the account ID it prints into the field. Or in the console: CloudFormation → Create stack → *Upload a template file* → [`apx_aws_lambda/connect/template.yaml`](apx_aws_lambda/connect/template.yaml), parameters `IssuerUrl` (the platform's public url) and `Organization` (its slug), acknowledge IAM; or from a machine:
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
83
|
action-platform aws-lambda connect https://platform.example.com acme # --region, --stack-name, --oidc-provider-arn
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
**2. Tell the platform** — Plugins → AWS Lambda → Configure → **
|
|
86
|
+
**2. Tell the platform** — Plugins → AWS Lambda → Configure → **AWS account ID** = the 12-digit account ID (or the stack's `DeployRoleArn` output). Every app of the organization whose `platform.toml` says `target = "aws/lambda"` deploys from then on; nothing to register per app.
|
|
87
87
|
|
|
88
88
|
What the stack creates:
|
|
89
89
|
|
|
@@ -59,13 +59,13 @@ The target looks for credentials in this order:
|
|
|
59
59
|
|
|
60
60
|
One CloudFormation stack, IAM only — no function, no table, nothing to upgrade. AWS itself trusts the platform's OIDC tokens; the token's session tag keeps each deploy inside its app.
|
|
61
61
|
|
|
62
|
-
**1. Create the stack** — once per AWS account, with your own AWS credentials (not the root account).
|
|
62
|
+
**1. Create the stack** — once per AWS account, with your own AWS credentials (not the root account). On the platform: Plugins → AWS Lambda → Configure → **Connect AWS** copies the command and opens AWS CloudShell (the AWS sign-in first); paste, press Enter, and paste the account ID it prints into the field. Or in the console: CloudFormation → Create stack → *Upload a template file* → [`apx_aws_lambda/connect/template.yaml`](apx_aws_lambda/connect/template.yaml), parameters `IssuerUrl` (the platform's public url) and `Organization` (its slug), acknowledge IAM; or from a machine:
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
65
|
action-platform aws-lambda connect https://platform.example.com acme # --region, --stack-name, --oidc-provider-arn
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
**2. Tell the platform** — Plugins → AWS Lambda → Configure → **
|
|
68
|
+
**2. Tell the platform** — Plugins → AWS Lambda → Configure → **AWS account ID** = the 12-digit account ID (or the stack's `DeployRoleArn` output). Every app of the organization whose `platform.toml` says `target = "aws/lambda"` deploys from then on; nothing to register per app.
|
|
69
69
|
|
|
70
70
|
What the stack creates:
|
|
71
71
|
|
|
@@ -55,6 +55,11 @@ class LambdaTarget(DeployTarget):
|
|
|
55
55
|
if not role:
|
|
56
56
|
return None
|
|
57
57
|
|
|
58
|
+
if re.fullmatch(r"\d{12}", role.strip()):
|
|
59
|
+
role = (
|
|
60
|
+
f"arn:aws:iam::{role.strip()}:role/action-platform/ActionPlatformDeploy"
|
|
61
|
+
)
|
|
62
|
+
|
|
58
63
|
app = self.app or ctx.env.get("AP_APP") or os.environ.get("AP_APP", "")
|
|
59
64
|
parts = app.strip("/").split("/")
|
|
60
65
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""The plugin: the aws/lambda overlay, `action-platform aws-lambda` commands, `aws_lambda_*` tools."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from action_platform.abc import Option, Plugin, Surface
|
|
9
|
+
|
|
10
|
+
from apx_aws_lambda import cli
|
|
11
|
+
from apx_aws_lambda.tools import register_tools
|
|
12
|
+
|
|
13
|
+
CLOUDSHELL = "https://console.aws.amazon.com/cloudshell/home?region=us-east-1"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def connect_command() -> str:
|
|
17
|
+
"""What the user pastes in CloudShell: the connect stack from this release's template on GitHub, then the account ID the platform asks for."""
|
|
18
|
+
try:
|
|
19
|
+
ref = f"v{version('apx-aws-lambda')}"
|
|
20
|
+
except PackageNotFoundError:
|
|
21
|
+
ref = "master"
|
|
22
|
+
|
|
23
|
+
template = f"https://raw.githubusercontent.com/actionplatform/apx-aws-lambda/{ref}/apx_aws_lambda/connect/template.yaml"
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
f"curl -fsSL {template} -o ap-connect.yaml"
|
|
27
|
+
" && aws cloudformation deploy --region us-east-1"
|
|
28
|
+
" --stack-name action-platform-connect --template-file ap-connect.yaml"
|
|
29
|
+
" --capabilities CAPABILITY_NAMED_IAM --no-fail-on-empty-changeset"
|
|
30
|
+
" --parameter-overrides IssuerUrl={issuer} Organization={organization}"
|
|
31
|
+
" && aws sts get-caller-identity --query Account --output text"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class AwsLambdaPlugin(Plugin):
|
|
36
|
+
slug = "aws-lambda"
|
|
37
|
+
name = "AWS Lambda"
|
|
38
|
+
description = (
|
|
39
|
+
"Deploy to AWS Lambda with SAM; read CloudFormation stacks and functions"
|
|
40
|
+
)
|
|
41
|
+
min_core = "0.32.0"
|
|
42
|
+
needs = [
|
|
43
|
+
"tool: aws, sam (bundled as Python packages when not on PATH)",
|
|
44
|
+
"env: AWS_REGION; credentials from role_arn (the connected account's deploy role, OIDC, no keys) or the AWS CLI chain (SSO, profile, instance role)",
|
|
45
|
+
"net: *.amazonaws.com",
|
|
46
|
+
]
|
|
47
|
+
options = [
|
|
48
|
+
Option(
|
|
49
|
+
"role_arn",
|
|
50
|
+
"AWS account ID",
|
|
51
|
+
"text",
|
|
52
|
+
help="Paste the account ID the command prints.",
|
|
53
|
+
required=True,
|
|
54
|
+
action_label="Connect AWS",
|
|
55
|
+
action_url=CLOUDSHELL,
|
|
56
|
+
action_copy=connect_command(),
|
|
57
|
+
),
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def overlays(self) -> Path:
|
|
62
|
+
return Path(__file__).parent / "overlays"
|
|
63
|
+
|
|
64
|
+
def register(self, surface: Surface) -> None:
|
|
65
|
+
if surface.mcp is not None:
|
|
66
|
+
register_tools(surface.mcp)
|
|
67
|
+
|
|
68
|
+
if surface.cli is not None:
|
|
69
|
+
surface.cli.add_typer(cli.app, name="aws-lambda")
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apx-aws-lambda
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.0
|
|
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
|
|
7
7
|
Requires-Python: >=3.11
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
License-File: LICENSE
|
|
10
|
-
Requires-Dist: action-platform>=0.
|
|
10
|
+
Requires-Dist: action-platform>=0.32.0
|
|
11
11
|
Requires-Dist: awscli>=1.34
|
|
12
12
|
Requires-Dist: aws-sam-cli>=1.120
|
|
13
13
|
Provides-Extra: dev
|
|
@@ -77,13 +77,13 @@ The target looks for credentials in this order:
|
|
|
77
77
|
|
|
78
78
|
One CloudFormation stack, IAM only — no function, no table, nothing to upgrade. AWS itself trusts the platform's OIDC tokens; the token's session tag keeps each deploy inside its app.
|
|
79
79
|
|
|
80
|
-
**1. Create the stack** — once per AWS account, with your own AWS credentials (not the root account).
|
|
80
|
+
**1. Create the stack** — once per AWS account, with your own AWS credentials (not the root account). On the platform: Plugins → AWS Lambda → Configure → **Connect AWS** copies the command and opens AWS CloudShell (the AWS sign-in first); paste, press Enter, and paste the account ID it prints into the field. Or in the console: CloudFormation → Create stack → *Upload a template file* → [`apx_aws_lambda/connect/template.yaml`](apx_aws_lambda/connect/template.yaml), parameters `IssuerUrl` (the platform's public url) and `Organization` (its slug), acknowledge IAM; or from a machine:
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
83
|
action-platform aws-lambda connect https://platform.example.com acme # --region, --stack-name, --oidc-provider-arn
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
**2. Tell the platform** — Plugins → AWS Lambda → Configure → **
|
|
86
|
+
**2. Tell the platform** — Plugins → AWS Lambda → Configure → **AWS account ID** = the 12-digit account ID (or the stack's `DeployRoleArn` output). Every app of the organization whose `platform.toml` says `target = "aws/lambda"` deploys from then on; nothing to register per app.
|
|
87
87
|
|
|
88
88
|
What the stack creates:
|
|
89
89
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "apx-aws-lambda"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.1.0"
|
|
4
4
|
description = "AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "Apache-2.0"
|
|
7
7
|
requires-python = ">=3.11"
|
|
8
8
|
authors = [{ name = "Action Platform", email = "cloud@actionplatform.io" }]
|
|
9
|
-
dependencies = ["action-platform>=0.
|
|
9
|
+
dependencies = ["action-platform>=0.32.0", "awscli>=1.34", "aws-sam-cli>=1.120"]
|
|
10
10
|
|
|
11
11
|
[project.optional-dependencies]
|
|
12
12
|
dev = ["pytest>=8", "ruff>=0.6", "action-platform[mcp]"]
|
|
@@ -9,7 +9,7 @@ from unittest import mock
|
|
|
9
9
|
|
|
10
10
|
from action_platform.core.context import Context
|
|
11
11
|
from action_platform.core.exception import DeployError
|
|
12
|
-
from action_platform.core.scaffold.
|
|
12
|
+
from action_platform.core.scaffold.catalog import Matrix, with_plugin_clouds
|
|
13
13
|
from action_platform.plugins import Loaded, Plugins, PluginState, registry
|
|
14
14
|
|
|
15
15
|
from apx_aws_lambda import AwsLambdaPlugin, shell
|
|
@@ -478,6 +478,26 @@ class ConnectedAccountTest(unittest.TestCase):
|
|
|
478
478
|
|
|
479
479
|
self.assertFalse(checks["template.boundary"].ok)
|
|
480
480
|
|
|
481
|
+
def test_an_account_id_names_the_connect_stacks_role(self):
|
|
482
|
+
ctx = self.ctx()
|
|
483
|
+
ctx.env["AP_AWS_LAMBDA_ROLE_ARN"] = "123456789012"
|
|
484
|
+
|
|
485
|
+
self.assertEqual(
|
|
486
|
+
LambdaTarget().connected(ctx), (self.ROLE, "ap-acme-shop-orders")
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
def test_the_connect_command_fills_in_the_platform_and_the_organization(self):
|
|
490
|
+
from apx_aws_lambda.plugin import AwsLambdaPlugin
|
|
491
|
+
|
|
492
|
+
option = AwsLambdaPlugin.options[0]
|
|
493
|
+
|
|
494
|
+
self.assertIn("cloudshell", option.action_url)
|
|
495
|
+
self.assertIn("aws cloudformation deploy", option.action_copy)
|
|
496
|
+
self.assertIn(
|
|
497
|
+
"IssuerUrl={issuer} Organization={organization}", option.action_copy
|
|
498
|
+
)
|
|
499
|
+
self.assertIn("connect/template.yaml", option.action_copy)
|
|
500
|
+
|
|
481
501
|
def test_a_role_of_the_repository_wins_over_the_connected_account(self):
|
|
482
502
|
target = LambdaTarget(role_arn="arn:aws:iam::1:role/own")
|
|
483
503
|
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"""The plugin: the aws/lambda overlay, `action-platform aws-lambda` commands, `aws_lambda_*` tools."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
|
|
7
|
-
from action_platform.abc import Option, Plugin, Surface
|
|
8
|
-
|
|
9
|
-
from apx_aws_lambda import cli
|
|
10
|
-
from apx_aws_lambda.tools import register_tools
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class AwsLambdaPlugin(Plugin):
|
|
14
|
-
slug = "aws-lambda"
|
|
15
|
-
name = "AWS Lambda"
|
|
16
|
-
description = (
|
|
17
|
-
"Deploy to AWS Lambda with SAM; read CloudFormation stacks and functions"
|
|
18
|
-
)
|
|
19
|
-
min_core = "0.17.9"
|
|
20
|
-
needs = [
|
|
21
|
-
"tool: aws, sam (bundled as Python packages when not on PATH)",
|
|
22
|
-
"env: AWS_REGION; credentials from role_arn (the connected account's deploy role, OIDC, no keys) or the AWS CLI chain (SSO, profile, instance role)",
|
|
23
|
-
"net: *.amazonaws.com",
|
|
24
|
-
]
|
|
25
|
-
options = [
|
|
26
|
-
Option(
|
|
27
|
-
"role_arn",
|
|
28
|
-
"Deploy role ARN",
|
|
29
|
-
"text",
|
|
30
|
-
help=(
|
|
31
|
-
"The deploy role of your connected AWS account: the platform's token assumes it, and the token's session tag keeps every deploy inside its app, so the platform never holds an access key and nothing runs in your account. "
|
|
32
|
-
"Create it once with the IAM-only stack apx_aws_lambda/connect/template.yaml (CloudFormation console, Upload a template file) or `action-platform aws-lambda connect <platform url> <organization>`; the DeployRoleArn output goes here."
|
|
33
|
-
),
|
|
34
|
-
required=True,
|
|
35
|
-
),
|
|
36
|
-
]
|
|
37
|
-
|
|
38
|
-
@property
|
|
39
|
-
def overlays(self) -> Path:
|
|
40
|
-
return Path(__file__).parent / "overlays"
|
|
41
|
-
|
|
42
|
-
def register(self, surface: Surface) -> None:
|
|
43
|
-
if surface.mcp is not None:
|
|
44
|
-
register_tools(surface.mcp)
|
|
45
|
-
|
|
46
|
-
if surface.cli is not None:
|
|
47
|
-
surface.cli.add_typer(cli.app, name="aws-lambda")
|
|
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
|