Skip to content

Commit

Permalink
Replace MinioCustomizer with properties
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Oct 14, 2020
1 parent cb8b1ab commit 45f2394
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 50 deletions.
17 changes: 7 additions & 10 deletions API.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public void configure() throws Exception {

// List the object names available in the S3 bucket
from("direct:list")
.to("aws-s3://{{api.bucket}}?operation=listObjects")
.transform().simple("${body.objectSummaries}")
.to("aws2-s3://{{api.bucket}}?operation=listObjects")
.split(simple("${body}"), AggregationStrategies.groupedBody())
.transform().simple("${body.key}")
.end()
Expand All @@ -23,22 +22,20 @@ public void configure() throws Exception {
// Get an object from the S3 bucket
from("direct:get")
.setHeader("CamelAwsS3Key", simple("${header.name}"))
.to("aws-s3://{{api.bucket}}?operation=getObject")
.setHeader("Content-Type", simple("${body.objectMetadata.contentType}"))
.transform().simple("${body.objectContent}");

.to("aws2-s3://{{api.bucket}}?operation=getObject")
.convertBodyTo(String.class);

// Upload a new object into the S3 bucket
from("direct:create")
.setHeader("CamelAwsS3Key", simple("${header.name}"))
.to("aws-s3://{{api.bucket}}");
.to("aws2-s3://{{api.bucket}}");


// Delete an object from the S3 bucket
from("direct:delete")
.setHeader("CamelAwsS3Key", simple("${header.name}"))
.to("aws-s3://{{api.bucket}}?operation=deleteObject")
.setBody().constant("");
.setHeader("CamelAwsS3Key", simple("${header.name}"))
.to("aws2-s3://{{api.bucket}}?operation=deleteObject")
.setBody().constant("");

}
}
4 changes: 2 additions & 2 deletions readme.didact.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ To run the integration, you need to link it to the proper configuration, that de

### 4.1 [Alternative 1] Using the test Minio server

As alternative, to connect the integration to the **test Minio server** deployed before using the [test/MinioCustomizer.java](didact://?commandId=vscode.open&projectFilePath=test/MinioCustomizer.java "Opens the customizer file"){.didact} class:
As alternative, to connect the integration to the **test Minio server** deployed before:

```
kamel run --name api test/MinioCustomizer.java API.java --property-file test/minio.properties --open-api openapi.yaml -d camel-openapi-java
kamel run --name api API.java --property-file test/minio.properties --open-api openapi.yaml -d camel-openapi-java
```
([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kamel%20run%20--name%20api%20test/MinioCustomizer.java%20API.java%20--property-file%20test/minio.properties%20--open-api%20openapi.yaml%20-d%20camel-openapi-java&completion=Integration%20run. "Opens a new terminal and sends the command above"){.didact})

Expand Down
36 changes: 0 additions & 36 deletions test/MinioCustomizer.java

This file was deleted.

8 changes: 7 additions & 1 deletion test/minio.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
# Bucket (referenced in the routes)
api.bucket=camel-k

# Minio information injected into the MinioCustomizer
# Minio information
minio.endpoint=http://minio:9000
minio.access-key=minio
minio.secret-key=minio123

# Camel AWS2 S3
camel.component.aws2-s3.region=EU_WEST_1
camel.component.aws2-s3.access-key={{minio.access-key}}
camel.component.aws2-s3.secret-key={{minio.secret-key}}
camel.component.aws2-s3.uri-endpoint-override = {{minio.endpoint}}
camel.component.aws2-s3.override-endpoint = true

# General configuration
camel.context.rest-configuration.api-context-path=/openapi.json
2 changes: 1 addition & 1 deletion test/yaks-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ pre:
run: |
kamel install -w -n ${YAKS_NAMESPACE}
kamel run --name api MinioCustomizer.java ../API.java --property-file minio.properties --open-api ../openapi.yaml -d camel-openapi-java -w -n ${YAKS_NAMESPACE}
kamel run --name api ../API.java --property-file minio.properties --open-api ../openapi.yaml -d camel-openapi-java -w -n ${YAKS_NAMESPACE}

0 comments on commit 45f2394

Please sign in to comment.