foobara-aws 0.2.0 → 0.3.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +16 -0
- data/lib/foobara/aws/plan.rb +51 -0
- data/lib/foobara/aws/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 16a858ce4e2944711259dacbf844fd258a1715018aaa7df98364e45739ec33de
|
|
4
|
+
data.tar.gz: 995b9e3af507e6cb53e3fd581945d27b9251f9559f0151c9151e5fa5bb277191
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a328cae1d9959faa1efc89dc399f007005673493704ae20dbe9e02904b85949f7eb76debefeff09830f2a367315efac9bde77981c660690299aced88f5871464
|
|
7
|
+
data.tar.gz: a0cb8f25daa37b5ea097d5bf13e145c0a7df3a27b2d6faa801e426dafb3f8f00def81a55093d7c95818cd2caf32b2d7bbe7c6f3864248993b099f749d1218d52
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.3.0] - 2026-08-04
|
|
4
|
+
|
|
5
|
+
- `Foobara::AWS.plan_from_connector(connector)` — build a plan by inspecting a live connector instead of a
|
|
6
|
+
manifest. No HTTP, no running server, and no snapshot on disk to go stale.
|
|
7
|
+
- It takes a CONNECTOR rather than a set of command classes, because `requires_authentication` is decided at
|
|
8
|
+
`connect` time and lives on the transformed command. The command classes alone cannot say which commands are
|
|
9
|
+
public, which is the one thing a deployment most needs to know.
|
|
10
|
+
- It adapts each command into the shape `plan` already reads, so there is a single derivation and the two routes
|
|
11
|
+
cannot drift — asserted by a spec comparing the plans they produce.
|
|
12
|
+
|
|
3
13
|
## [0.2.0] - 2026-08-04
|
|
4
14
|
|
|
5
15
|
- `Foobara::AWS::Check` — checks a DEPLOYED API against the plan it was deployed from. It asserts the few things
|
data/README.md
CHANGED
|
@@ -15,6 +15,22 @@ service = Foobara::AWS::CDK::Service.new(self, "Api", plan: plan, code_root: "bu
|
|
|
15
15
|
posts_table.grant_read_write_data(service.function("posts"))
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
## Where a plan comes from
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
Foobara::AWS.plan(manifest) # a manifest, however you obtained it
|
|
22
|
+
Foobara::AWS.plan_from_connector(connector) # a live connector, no server needed
|
|
23
|
+
Foobara::AWS::Plan.load(JSON.parse(json)) # one that has been through JSON
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`plan_from_connector` is usually what a build step wants: it reads the objects
|
|
27
|
+
directly, so there is no server to start and no snapshot to go stale. It takes a
|
|
28
|
+
**connector**, not a set of command classes — `requires_authentication` is
|
|
29
|
+
decided at `connect` time and lives on the transformed command, so the classes
|
|
30
|
+
alone cannot say which commands are public.
|
|
31
|
+
|
|
32
|
+
All three produce the same `Plan`, and a spec asserts the first two agree.
|
|
33
|
+
|
|
18
34
|
## Two halves, on purpose
|
|
19
35
|
|
|
20
36
|
```ruby
|
data/lib/foobara/aws/plan.rb
CHANGED
|
@@ -85,6 +85,28 @@ module Foobara
|
|
|
85
85
|
Plan.new(mount: mount, granularity: granularity, units: units.sort_by(&:name))
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
# Build a {Plan} by inspecting a live connector instead of a manifest.
|
|
89
|
+
#
|
|
90
|
+
# The same information by a shorter route: no HTTP, no running server, and
|
|
91
|
+
# no snapshot on disk to go stale. It needs the application loaded, so it
|
|
92
|
+
# belongs in a build step rather than in a CDK app — which is the whole
|
|
93
|
+
# reason a {Plan} can also travel as JSON.
|
|
94
|
+
#
|
|
95
|
+
# A CONNECTOR, not a set of command classes. `requires_authentication` is
|
|
96
|
+
# decided at `connect` time and lives on the transformed command, so the
|
|
97
|
+
# command classes alone cannot say which commands are public — which is the
|
|
98
|
+
# one thing a deployment most needs to know.
|
|
99
|
+
#
|
|
100
|
+
# It adapts each command into the shape {plan} already reads, so there is
|
|
101
|
+
# one implementation and the two routes cannot drift.
|
|
102
|
+
def plan_from_connector(connector, **)
|
|
103
|
+
commands = connector.command_registry.all_transformed_command_classes.to_h do |transformed|
|
|
104
|
+
[transformed.command_class.full_command_name, describe_command(transformed)]
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
plan({ "command" => commands }, **)
|
|
108
|
+
end
|
|
109
|
+
|
|
88
110
|
# Foobara's own commands — its auth domain and anything else it registers —
|
|
89
111
|
# are infrastructure, not the application, and deploying them is never what
|
|
90
112
|
# anyone means. Matched on the command's full name, which is where that
|
|
@@ -97,6 +119,35 @@ module Foobara
|
|
|
97
119
|
|
|
98
120
|
private
|
|
99
121
|
|
|
122
|
+
# Manifest-shaped, so {plan} cannot tell the difference. Only the fields
|
|
123
|
+
# planning reads — a manifest carries much more, and none of the rest
|
|
124
|
+
# matters here.
|
|
125
|
+
def describe_command(transformed)
|
|
126
|
+
command_class = transformed.command_class
|
|
127
|
+
|
|
128
|
+
{
|
|
129
|
+
"domain" => domain_name(command_class),
|
|
130
|
+
"organization" => organization_name(command_class),
|
|
131
|
+
"scoped_full_path" => Array(command_class.scoped_full_path),
|
|
132
|
+
"requires_authentication" => transformed.requires_authentication,
|
|
133
|
+
"depends_on" => Array(command_class.depends_on).map(&:to_s),
|
|
134
|
+
# The AWSLambda DSL, when the command extends it.
|
|
135
|
+
"aws_lambda" => (command_class.aws_lambda_manifest if command_class.respond_to?(:aws_lambda_manifest))
|
|
136
|
+
}.compact
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def domain_name(command_class)
|
|
140
|
+
command_class.domain.scoped_full_name
|
|
141
|
+
rescue StandardError
|
|
142
|
+
""
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def organization_name(command_class)
|
|
146
|
+
command_class.organization.scoped_full_name
|
|
147
|
+
rescue StandardError
|
|
148
|
+
""
|
|
149
|
+
end
|
|
150
|
+
|
|
100
151
|
def app_commands(manifest, exclude)
|
|
101
152
|
manifest.fetch("command").reject do |name, _command|
|
|
102
153
|
exclude.any? { |prefix| name.to_s.start_with?(prefix) }
|
data/lib/foobara/aws/version.rb
CHANGED