-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsdks.html
More file actions
269 lines (248 loc) · 12.8 KB
/
sdks.html
File metadata and controls
269 lines (248 loc) · 12.8 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5C3LL34WWW"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-5C3LL34WWW');
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SDKs - Local Web Services</title>
<meta name="description" content="Test AWS applications with realistic in-process local services using native language SDKs. Python available now, with TypeScript, JavaScript, Java, and Go coming soon.">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css">
</head>
<body>
<nav class="nav">
<div class="container nav-inner">
<a href="index.html" class="nav-logo">Local Web Services</a>
<ul class="nav-links">
<li><a href="getting-started.html">Get Started</a></li>
<li><a href="sdks.html" class="nav-active">SDKs</a></li>
<li><a href="services.html">Cloud Emulation</a></li>
<li><a href="faking.html">Faking Services</a></li>
<li><a href="chaos.html">Chaos Engineering</a></li>
<li><a href="cli.html">CLI</a></li>
<li><a href="https://github.com/local-web-services/local-web-services" class="nav-github">GitHub</a></li>
</ul>
</div>
</nav>
<header class="page-header">
<div class="container">
<h1>SDKs</h1>
<p class="section-lead">Test your AWS applications with realistic in-process local services using a native language SDK. No external process, no ports, no Docker required — services run as threads inside your test suite.</p>
</div>
</header>
<section class="section">
<div class="container">
<div class="lang-grid">
<a href="sdk-python.html" class="lang-card lang-card--active">
<div class="lang-card-icon"><img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/python/python-original.svg" alt="Python" width="48" height="48"></div>
<div class="lang-badge lang-badge--available">Available</div>
<h3>Python</h3>
<p>pytest integration, DynamoDB / SQS / S3 helpers, fluent faking and chaos APIs</p>
</a>
<a href="sdk-typescript.html" class="lang-card lang-card--active">
<div class="lang-card-icon"><img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/typescript/typescript-original.svg" alt="TypeScript" width="48" height="48"></div>
<div class="lang-badge lang-badge--available">Available</div>
<h3>TypeScript</h3>
<p>Jest / Vitest integration, AWS SDK v3 clients, faking and chaos APIs</p>
</a>
<a href="sdk-javascript.html" class="lang-card lang-card--active">
<div class="lang-card-icon"><img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/javascript/javascript-original.svg" alt="JavaScript" width="48" height="48"></div>
<div class="lang-badge lang-badge--available">Available</div>
<h3>JavaScript</h3>
<p>Jest / Mocha integration, AWS SDK v3 clients, automatic endpoint redirection via env vars</p>
</a>
<a href="sdk-java.html" class="lang-card lang-card--active">
<div class="lang-card-icon"><img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/java/java-original.svg" alt="Java" width="48" height="48"></div>
<div class="lang-badge lang-badge--available">Available</div>
<h3>Java</h3>
<p>JUnit 5 integration for Java and Kotlin projects, AWS SDK v2 clients, try-with-resources lifecycle</p>
</a>
<a href="sdk-go.html" class="lang-card lang-card--active">
<div class="lang-card-icon"><img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/go/go-original-wordmark.svg" alt="Go" width="48" height="48"></div>
<div class="lang-badge lang-badge--available">Available</div>
<h3>Go</h3>
<p>Go testing package integration, AWS SDK v2 clients, auto-discovery from HCL</p>
</a>
</div>
<h3 class="section-subheading section-subheading--primary">Why use an SDK?</h3>
<div class="comparison">
<div class="comparison-col comparison-before">
<h3>ldk dev (local server)</h3>
<ul>
<li>Runs as an external process</li>
<li>Services start on network ports (3000–3030)</li>
<li>Works with any language or framework</li>
<li>Supports hot reloading for Lambda handlers</li>
<li>Web dashboard at <code>/_ldk/gui</code></li>
<li>Reads CDK or HCL projects</li>
</ul>
</div>
<div class="comparison-col comparison-after">
<h3>Language SDK (in-process)</h3>
<ul>
<li>Runs as threads in your test process</li>
<li>No ports, no networking overhead</li>
<li>Native test framework integration (pytest, Jest…)</li>
<li>Per-test state isolation with <code>session.reset()</code></li>
<li>Fluent APIs for faking and chaos injection</li>
<li>Auto-discovers resources from CDK or HCL</li>
</ul>
</div>
</div>
<h3 class="section-subheading">Python SDK Highlights</h3>
<p class="section-lead" style="margin-top: -32px;">The Python SDK (<code>local-web-services-python-sdk</code>) provides everything you need to test AWS-backed Python applications without leaving your pytest suite.</p>
<div class="feature-grid">
<div class="feature-card">
<div class="feature-icon">🔄</div>
<h3>LwsSession</h3>
<p>A single context manager that starts all your services. Declare tables, queues, buckets, topics, state machines, parameters, and secrets — or auto-discover them from a CDK or HCL project.</p>
</div>
<div class="feature-card">
<div class="feature-icon">👥</div>
<h3>pytest Fixtures</h3>
<p>Zero-boilerplate pytest integration. The <code>lws_session</code> fixture starts services once per session; <code>lws_reset</code> wipes state between tests automatically.</p>
</div>
<div class="feature-card">
<div class="feature-icon">📋</div>
<h3>Resource Helpers</h3>
<p>Simplified DynamoDB, SQS, and S3 helpers with built-in assertion methods: <code>table.assert_item_exists()</code>, <code>queue.assert_message_count()</code>, <code>bucket.assert_object_count()</code>.</p>
</div>
<div class="feature-card">
<div class="feature-icon">🎭</div>
<h3>Operation Faking</h3>
<p>Override any AWS operation response with a fluent builder. Inject throttling errors, custom status codes, or delayed responses at the operation level without changing application code.</p>
</div>
<div class="feature-card">
<div class="feature-icon">💥</div>
<h3>Chaos Engineering</h3>
<p>Inject error rates, latency ranges, connection resets, and timeouts into any service. Apply and clear chaos scenarios programmatically within individual test functions.</p>
</div>
<div class="feature-card">
<div class="feature-icon">🔒</div>
<h3>IAM Authorization</h3>
<p>Switch IAM modes to <code>disabled</code>, <code>audit</code>, or <code>enforce</code>. Define named identities with inline allow/deny policies and verify authorization behavior in tests.</p>
</div>
</div>
<div style="text-align: center; margin-top: 48px;">
<a href="sdk-python.html" class="btn btn-primary">Python SDK Docs</a>
<a href="https://github.com/local-web-services/local-web-services/tree/main/lang/python/sdk" class="btn btn-secondary">GitHub</a>
</div>
</div>
</section>
<section class="section section-alt">
<div class="container">
<h2>Quick Start: Python</h2>
<p class="section-lead">Install the SDK and write your first test in minutes.</p>
<div class="steps" style="max-width: 900px;">
<div class="step">
<div class="step-number">1</div>
<div class="step-content">
<h3>Install</h3>
<div class="code-block" style="margin-top: 8px;">
<code>pip install local-web-services-python-sdk
# or with uv
uv add local-web-services-python-sdk</code>
</div>
</div>
</div>
<div class="step">
<div class="step-number">2</div>
<div class="step-content">
<h3>Declare your resources</h3>
<div class="code-block" style="margin-top: 8px;">
<code>from lws_testing import LwsSession
with LwsSession(
tables=[{"name": "Orders", "partition_key": "id"}],
queues=["OrderQueue"],
buckets=["ReceiptsBucket"],
) as session:
# services are running
pass</code>
</div>
</div>
</div>
<div class="step">
<div class="step-number">3</div>
<div class="step-content">
<h3>Write a test</h3>
<div class="code-block" style="margin-top: 8px;">
<code>def test_create_order(lws_session):
# Use a boto3 client pointing to local services
client = lws_session.client("dynamodb")
client.put_item(
TableName="Orders",
Item={"id": {"S": "42"}, "status": {"S": "pending"}}
)
# Or use the DynamoDB helper with assertions
table = lws_session.dynamodb("Orders")
table.assert_item_exists({"id": {"S": "42"}})</code>
</div>
</div>
</div>
<div class="step">
<div class="step-number">4</div>
<div class="step-content">
<h3>Configure pytest fixtures</h3>
<div class="code-block" style="margin-top: 8px;">
<code># conftest.py
import pytest
from lws_testing import LwsSession
@pytest.fixture(scope="session")
def lws_session_spec():
return {
"tables": [{"name": "Orders", "partition_key": "id"}],
"queues": ["OrderQueue"],
"buckets": ["ReceiptsBucket"],
}
# lws_session and lws_reset fixtures are provided
# automatically by the lws_testing pytest plugin</code>
</div>
</div>
</div>
</div>
<div style="text-align: center; margin-top: 48px;">
<a href="sdk-python.html" class="btn btn-primary">Full Python SDK Reference</a>
</div>
</div>
</section>
<footer class="footer">
<div class="container">
<div class="footer-inner">
<div class="footer-brand">
<a href="index.html" class="nav-logo">Local Web Services</a>
<p>The fastest feedback loop for cloud-native development, for humans and AI alike</p>
</div>
<div class="footer-links">
<a href="https://github.com/local-web-services/local-web-services">GitHub</a>
<a href="https://github.com/local-web-services/local-web-services/tree/main/lang/python/sdk">Python SDK</a>
<a href="https://pypi.org/project/local-web-services-python-sdk/">PyPI</a>
<a href="https://www.npmjs.com/package/local-web-services-typescript-sdk">npm (TypeScript)</a>
<a href="https://www.npmjs.com/package/local-web-services-javascript-sdk">npm (JavaScript)</a>
<a href="https://github.com/local-web-services/local-web-services/tree/main/sample-project/cdk">CDK Sample</a>
<a href="https://github.com/local-web-services/local-web-services/tree/main/sample-project/hcl">Terraform Sample</a>
<a href="https://github.com/local-web-services/local-web-services/issues">Issues</a>
</div>
</div>
<p class="footer-copy">Open source under the MIT License.</p>
</div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-clike.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-javascript.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-typescript.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-go.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-java.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-yaml.min.js"></script>
<script src="lws.js"></script>
</body>
</html>