Skip to content

Commit 93f33f5

Browse files
committed
fix all modified files
1 parent c85e948 commit 93f33f5

File tree

13 files changed

+344
-226
lines changed

13 files changed

+344
-226
lines changed

src/content/docs/aws/integrations/app-frameworks/spring-cloud-function.mdx

Lines changed: 59 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ To that end, we use the "Shadow Jar" plugin.
118118

119119
Here's our final `build.gradle`:
120120

121-
{/* {{< highlight gradle "linenos=table" >}} */} {/* mdx-disabled */}
121+
{/* {{< highlight gradle "linenos=table" >}} */} {/* mdx-disabled */} {/* TODO: packing this into a bash block for now */}
122+
```gradle
122123
plugins {
123124
id "java"
124125
id "org.jetbrains.kotlin.jvm" version '1.5.31'
@@ -195,6 +196,7 @@ shadowJar {
195196
}
196197
197198
assemble.dependsOn shadowJar
199+
```
198200
{/* {/* {/* {/* {/* {/* {/* {/* {/* {/* {{< / highlight >}} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */}
199201

200202
Please note that we will be using `org.localstack.sampleproject` as a
@@ -211,18 +213,18 @@ In this project, we are following
211213
to setup up `src/main/resources/log4j2.xml` content.
212214

213215
```xml
214-
{/* <?xml version="1.0" encoding="UTF-8"?> */} {/* mdx-disabled */}
215-
{/* <Configuration packages="com.amazonaws.services.lambda.runtime.log4j2.LambdaAppender"> */} {/* mdx-disabled */}
216+
?xml version="1.0" encoding="UTF-8"?>
217+
<Configuration packages="com.amazonaws.services.lambda.runtime.log4j2.LambdaAppender">
216218
<Appenders>
217-
{/* <Lambda name="Lambda"> */} {/* mdx-disabled */}
219+
<Lambda name="Lambda">
218220
<PatternLayout>
219221
<pattern>%d{yyyy-MM-dd HH:mm:ss} %X{AWSRequestId} %-5p %c{1}:%L - %m%n</pattern>
220222
</PatternLayout>
221223
</Lambda>
222224
</Appenders>
223225
<Loggers>
224-
{/* <Root level="debug"> */} {/* mdx-disabled */}
225-
{/* <AppenderRef ref="Lambda" /> */} {/* mdx-disabled */}
226+
<Root level="debug">
227+
<AppenderRef ref="Lambda" />
226228
</Root>
227229
</Loggers>
228230
</Configuration>
@@ -256,6 +258,8 @@ Now our application needs an entry-class, the one we referenced earlier.
256258
Let's add it under `src/main/kotlin/org/localstack/sampleproject/Application.kt`.
257259

258260
{/* {/* {/* {/* {/* {/* {/* {/* {/* {{< highlight kotlin "linenos=table" >}} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */}
261+
{/* TODO: packing this into a java block for now */}
262+
```java
259263
package org.localstack.sampleproject
260264

261265
import org.springframework.boot.autoconfigure.SpringBootApplication
@@ -266,7 +270,8 @@ class Application
266270
fun main(args: Array<String>) {
267271
// Do nothing unless you use a custom runtime
268272
}
269-
{{< / highlight >}}
273+
```
274+
{/*{{< / highlight >}}*/}
270275

271276
### Configure Jackson
272277

@@ -275,7 +280,9 @@ The easiest way to get started with JSON is to use the Jackson library.
275280
Let's configure it by creating a new configuration class `JacksonConfiguration.kt` under
276281
`src/main/kotlin/org/localstack/sampleproject/config`:
277282

278-
{{< highlight kotlin "linenos=table" >}}
283+
{/*{{< highlight kotlin "linenos=table" >}}*/}
284+
285+
```java
279286
package org.localstack.sampleproject.config
280287

281288
import com.fasterxml.jackson.annotation.JsonInclude
@@ -306,8 +313,8 @@ class JacksonConfiguration {
306313
findAndRegisterModules()
307314
}
308315
}
309-
310-
{{< / highlight >}}
316+
```
317+
{/*{{< / highlight >}}*/}
311318

312319
In applications where you need support for multiple formats or a format
313320
different from JSON (for example, SOAP/XML applications) simply use multiple
@@ -319,7 +326,9 @@ implementations.
319326

320327
Let's create a small logging utility to simplify interactions with the logger
321328

322-
{{< highlight kotlin "linenos=table" >}}
329+
{/*{{< highlight kotlin "linenos=table" >}}*/}
330+
{/* TODO: packing this into a java block for now */}
331+
```java
323332
package org.localstack.sampleproject.util
324333

325334
import org.apache.logging.log4j.LogManager
@@ -328,7 +337,8 @@ import org.apache.logging.log4j.Logger
328337
open class Logger {
329338
val LOGGER: Logger = LogManager.getLogger(javaClass.enclosingClass)
330339
}
331-
{{< / highlight >}}
340+
```
341+
{/*{{< / highlight >}}*/}
332342

333343
### Add Request/Response utilities
334344

@@ -343,7 +353,9 @@ Your application may even support multiple protocols with different request/resp
343353

344354
Let's define utility functions to to build API gateway responses:
345355
346-
{{< highlight kotlin "linenos=table" >}}
356+
{/*{{< highlight kotlin "linenos=table" >}}*/}
357+
{/* TODO: packing this into a java block for now */}
358+
```java
347359
package org.localstack.sampleproject.util
348360
349361
import org.springframework.messaging.Message
@@ -365,11 +377,14 @@ fun <T>buildJsonResponse(data: T, code: Int = 200): Message<T> {
365377
366378
fun buildJsonErrorResponse(message: String, code: Int = 500) =
367379
buildJsonResponse(ResponseError(message), code)
368-
{{< / highlight >}}
380+
```
381+
{/*{{< / highlight >}}*/}
369382
370383
And now a utility function to process API Gateway requests:
371384
372-
{{< highlight kotlin "linenos=table" >}}
385+
{/*{{< highlight kotlin "linenos=table" >}}*/}
386+
{/* TODO: packing this into a java block for now */}
387+
```java
373388
package org.localstack.sampleproject.util
374389
375390
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent
@@ -393,15 +408,18 @@ fun <T>apiGatewayFunction(
393408
return@Function buildJsonErrorResponse(message ?: "", 500)
394409
}
395410
}
396-
{{< / highlight >}}
411+
```
412+
{/*{{< / highlight >}}*/}
397413
398414
### Creating a sample Model / DTO
399415
400416
To transfer data from requests into something more meaningful than JSON strings
401417
(and back) you will be using a lot of Models and Data Transfer Objects (DTOs).
402418
It's time to define our first one.
403419
404-
{{< highlight kotlin "linenos=table" >}}
420+
{/*{{< highlight kotlin "linenos=table" >}}*/}
421+
{/* TODO: packing this into a java block for now */}
422+
```java
405423
package org.localstack.sampleproject.model
406424
407425
import com.fasterxml.jackson.annotation.JsonIgnore
@@ -413,14 +431,17 @@ data class SampleModel(
413431
@JsonIgnore
414432
val jsonIgnoredProperty: String? = null,
415433
)
416-
{{< / highlight >}}
434+
```
435+
{/*{{< / highlight >}}*/}
417436
418437
### Creating Rest API endpoints
419438
420439
Let's add our first endpoints to simulate CRUD operations on previously
421440
defined `SampleModel`:
422441
423-
{{< highlight kotlin "linenos=table" >}}
442+
{/*{{< highlight kotlin "linenos=table" >}}*/}
443+
{/* TODO: packing this into a java block for now */}
444+
```java
424445
package org.localstack.sampleproject.api
425446
426447
import com.fasterxml.jackson.databind.ObjectMapper
@@ -461,7 +482,9 @@ class SampleApi(private val objectMapper: ObjectMapper) {
461482
buildJsonResponse(SAMPLE_RESPONSE.find { it.id == desiredId })
462483
}
463484
}
464-
{{< / highlight >}}
485+
486+
```
487+
{/*{{< / highlight >}}*/}
465488
466489
Note how we used Spring's dependency injection to inject `ObjectMapper` Bean we
467490
configured earlier.
@@ -472,7 +495,9 @@ We know Java's cold start is always a pain.
472495
To minimize this pain, we will try to define a pre-warming endpoint within the Rest API.
473496
By invoking this function every 5-10 mins we can make sure Rest API lambda is always kept in a pre-warmed state.
474497
475-
{{< highlight kotlin "linenos=table" >}}
498+
{/*{{< highlight kotlin "linenos=table" >}}*/}
499+
{/* TODO: packing this into a java block for now */}
500+
```java
476501
package org.localstack.sampleproject.api
477502
478503
import com.fasterxml.jackson.databind.ObjectMapper
@@ -490,7 +515,9 @@ class ScheduleApi(private val objectMapper: ObjectMapper) {
490515
buildJsonResponse("OK")
491516
}
492517
}
493-
{{< / highlight >}}
518+
519+
```
520+
{/*{{< / highlight >}}*/}
494521
495522
Now you can add a scheduled event to the Rest API lambda function with the following synthetic payload (to simulate API gateway request).
496523
This way, you can define any other scheduled events, but we recommend using pure lambda functions.
@@ -513,7 +540,9 @@ We can still define pure lambda functions, DynamoDB stream handlers, and so on.
513540
514541
Below you can find a little example of few lambda functions grouped in `LambdaApi` class.
515542
516-
{{< highlight kotlin "linenos=table" >}}
543+
{/*{{< highlight kotlin "linenos=table" >}}*/}
544+
{/* TODO: packing this into a java block for now */}
545+
```java
517546
package org.localstack.sampleproject.api
518547
519548
import com.amazonaws.services.lambda.runtime.events.DynamodbEvent
@@ -552,7 +581,9 @@ class LambdaApi : SpringBootStreamHandler() {
552581
}
553582
}
554583
}
555-
{{< / highlight >}}
584+
585+
```
586+
{/*{{< / highlight >}}*/}
556587
557588
As you can see from the example above, we are using `SpringBootStreamHandler`
558589
class as a base that takes care of the application bootstrapping process and
@@ -572,6 +603,7 @@ for usage examples.
572603
573604
{/* {{< tabpane >}} */} {/* mdx-disabled */}
574605
{/* {{< tab header="Serverless" lang="yaml" >}} */} {/* mdx-disabled */}
606+
```yaml
575607
service: localstack-sampleproject-serverless
576608
577609
provider:
@@ -621,8 +653,10 @@ functions:
621653
handler: org.localstack.sampleproject.api.LambdaApi
622654
environment:
623655
FUNCTION_NAME: functionTwo
656+
```yaml
624657
{/* {/* {/* {{< /tab >}} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */}
625658
{/* {{< tab header="AWS CDK" lang="kotlin" >}} */} {/* mdx-disabled */}
659+
```java
626660
package org.localstack.cdkstack
627661
628662
import java.util.UUID
@@ -845,7 +879,7 @@ resource "aws_lambda_function" "exampleFunctionTwo" {
845879
}
846880
{{< /tab >}}
847881
{/* {{< /tabpane >}} */} {/* mdx-disabled */}
848-
882+
```
849883
## Testing, Debugging and Hot Reloading
850884

851885
Please read our [Lambda Tools](/content/en/tools/lambda-tools/_index.md)

src/content/docs/aws/integrations/aws-native-tools/aws-copilot-cli.mdx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,34 @@ Using `copilotlocal` instead of `copilot` in your command line therefore ensures
2020

2121
{/* {{< tabpane lang="bash" >}} */} {/* mdx-disabled */}
2222
{/* {{< tab header="Linux AMD64" lang="bash">}} */} {/* mdx-disabled */}
23+
```bash
2324
curl -Lo copilotlocal https://github.com/localstack/copilot-cli/raw/localstack-builds/build/linux-amd64/copilotlocal && chmod +x copilotlocal
2425
# if you want to have copilotlocal in your $PATH, move the executable e.g. to /usr/local/bin/
2526

2627
sudo mv copilotlocal /usr/local/bin/
27-
{/* {/* {/* {/* {{< /tab >}} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */} */} {/* mdx-disabled */}
28+
```
29+
{/* {{< /tab >}} */} {/* mdx-disabled */}
2830
{/* {{< tab header="Linux ARM64" lang="bash">}} */} {/* mdx-disabled */}
31+
```bash
2932
curl -Lo copilotlocal https://github.com/localstack/copilot-cli/raw/localstack-builds/build/linux-arm64/copilotlocal && chmod +x copilotlocal
3033
# if you want to have copilotlocal in your $PATH, move the executable e.g. to /usr/local/bin/
3134

3235
sudo mv copilotlocal /usr/local/bin/
33-
{{< /tab >}}
36+
```
37+
{/*{{< /tab >}}*/}
3438
{/* {{< tab header="Mac OS" lang="bash">}} */} {/* mdx-disabled */}
39+
```bash
3540
curl -Lo copilotlocal https://github.com/localstack/copilot-cli/raw/localstack-builds/build/macos-darwin/copilotlocal && chmod +x copilotlocal
3641
# if you want to have copilotlocal in your $PATH, move the executable e.g. to /usr/local/bin/
3742

3843
sudo mv copilotlocal /usr/local/bin/
39-
{{< /tab >}}
44+
```
45+
{/*{{< /tab >}}*/}
4046
{/* {{< tab header="Windows Powershell" lang="powershell">}} */} {/* mdx-disabled */}
47+
```powershell
4148
Invoke-WebRequest -Uri https://github.com/localstack/copilot-cli/raw/localstack-builds/build/windows/copilotlocal.exe -OutFile copilotlocal.exe
42-
{{< /tab >}}
49+
```
50+
{/*{{< /tab >}}*/}
4351
{/* {{< /tabpane >}} */} {/* mdx-disabled */}
4452

4553
### Configuration

src/content/docs/aws/integrations/aws-sdks/go.mdx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ template: doc
55
sidebar:
66
order: 3
77
---
8+
import { Tabs, TabItem } from '@astrojs/starlight/components';
89

910
## Overview
1011

@@ -21,8 +22,9 @@ The Go SDK has two major versions, each with their own way of specifying the Loc
2122
Here is an example of how to create an S3 Client from a Session with the endpoint set to LocalStack.
2223
Full examples for both SDK versions can be found [in our samples repository](https://github.com/localstack/localstack-aws-sdk-examples/tree/main/go).
2324

24-
{/* {{< tabpane lang="golang" >}} */} {/* mdx-disabled */}
25-
{/* {{< tab header="aws-go-sdk" lang="golang" >}} */} {/* mdx-disabled */}
25+
<Tabs>
26+
<TabItem label="aws-go-sdk">
27+
```go
2628
package main
2729

2830
import (
@@ -45,9 +47,12 @@ func main() {
4547
client := s3.New(sess)
4648

4749
// ...
48-
{/* {/* }{{< /tab >}} */} {/* mdx-disabled */} */} {/* mdx-disabled */}
50+
}
51+
```
52+
</TabItem>
4953

50-
{/* {{< tab header="aws-go-sdk-v2" lang="golang" >}} */} {/* mdx-disabled */}
54+
<TabItem label="aws-go-sdk-v2">
55+
```go
5156
package main
5257

5358
import (
@@ -76,8 +81,10 @@ func main() {
7681
o.BaseEndpoint = aws.String(awsEndpoint)
7782
})
7883
// ...
79-
}{{< /tab >}}
80-
{/* {{< /tabpane >}} */} {/* mdx-disabled */}
84+
}
85+
```
86+
</TabItem>
87+
</Tabs>
8188

8289
## Resources
8390

0 commit comments

Comments
 (0)