You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by GitBox <gi...@apache.org> on 2019/02/11 17:49:35 UTC
[GitHub] kameshsampath commented on issue #419: Resolving Dependency
Automatically -- aws-s3
kameshsampath commented on issue #419: Resolving Dependency Automatically -- aws-s3
URL: https://github.com/apache/camel-k/issues/419#issuecomment-462425242
it.yaml
------
```yaml
apiVersion: camel.apache.org/v1alpha1
kind: Integration
metadata:
creationTimestamp: 2019-02-11T16:50:39Z
generation: 1
name: file-organizer
namespace: cookbook
resourceVersion: "40155"
selfLink: /apis/camel.apache.org/v1alpha1/namespaces/cookbook/integrations/file-organizer
uid: 29658d87-2e1d-11e9-97f5-42010aa00009
spec:
configuration:
- type: secret
value: s3config
dependencies:
- camel:aws
sources:
- content: |
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.aws.s3.S3Component;
/**
* FileOrganizer
*/
public class FileOrganizer extends RouteBuilder {
@Override
public void configure() throws Exception {
S3Component s3Component = getContext().getComponent("aws-s3", S3Component.class);
s3Component.getConfiguration().setAmazonS3Client(amazonS3Client());
from("aws-s3://data").to("log:message");
}
AmazonS3 amazonS3Client() throws Exception {
final String s3EndpointUrl = getContext().resolvePropertyPlaceholders("{{s3EndpointUrl}}");
final String minioAccessKey =
getContext().resolvePropertyPlaceholders("{{minioAccessKey}}");
final String minioSecretKey =
getContext().resolvePropertyPlaceholders("{{minioSecretKey}}");
EndpointConfiguration endpointConfiguration =
new EndpointConfiguration(s3EndpointUrl, null);
AWSCredentials credentials = new BasicAWSCredentials(minioAccessKey, minioSecretKey);
AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);
AmazonS3ClientBuilder clientBuilder =
AmazonS3ClientBuilder.standard().withCredentials(credentialsProvider)
.withEndpointConfiguration(endpointConfiguration);
return clientBuilder.build();
}
}
name: FileOrganizer.java
status:
context: ctx-bhgpqgg938dlliepild0
dependencies:
- camel:aws
- camel:core
- runtime:jvm
digest: vZpVeIJMmQaAvwhJH-QeVMRYwR4m2atgps6Zm7VychIw
image: docker-registry.default.svc:5000/cookbook/camel-k-ctx-bhgpqgg938dlliepild0:34798
phase: Running
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services