Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAMEL-21025 - Camel-AWS-Secrets-Manager: Give the ability of refreshing the context on Secrets update by using Eventbridge service instead of pure Cloudtrail - Spring Boot support #1187

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"ironMQCloud": { "index": 1, "kind": "parameter", "displayName": "Iron MQCloud", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "https:\/\/mq-aws-us-east-1-1.iron.io", "configurationClass": "org.apache.camel.component.ironmq.IronMQConfiguration", "configurationField": "configuration", "description": "IronMq Cloud url. Urls for public clusters: https:\/\/mq-aws-us-east-1-1.iron.io (US) and https:\/\/mq-aws-eu-west-1-1.iron.io (EU)" },
"preserveHeaders": { "index": 2, "kind": "parameter", "displayName": "Preserve Headers", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.ironmq.IronMQConfiguration", "configurationField": "configuration", "description": "Should message headers be preserved when publishing messages. This will add the Camel headers to the Iron MQ message as a json payload with a header list, and a message body. Useful when Camel is both consumer and producer." },
"projectId": { "index": 3, "kind": "parameter", "displayName": "Project Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ironmq.IronMQConfiguration", "configurationField": "configuration", "description": "IronMQ projectId" },
"batchDelete": { "index": 4, "kind": "parameter", "displayName": "Batch Delete", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.ironmq.IronMQConfiguration", "configurationField": "configuration", "description": "Should messages be deleted in one batch. This will limit the number of api requests since messages are deleted in one request, instead of one pr. exchange. If enabled care should be taken that the consumer is idempotent when processing exchanges." },
"batchDelete": { "index": 4, "kind": "parameter", "displayName": "Batch Delete", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.ironmq.IronMQConfiguration", "configurationField": "configuration", "description": "Should messages be deleted in one batch. This will limit the number of api requests since messages are deleted in one request, instead of one per exchange. If enabled care should be taken that the consumer is idempotent when processing exchanges." },
"concurrentConsumers": { "index": 5, "kind": "parameter", "displayName": "Concurrent Consumers", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.ironmq.IronMQConfiguration", "configurationField": "configuration", "description": "The number of concurrent consumers." },
"maxMessagesPerPoll": { "index": 6, "kind": "parameter", "displayName": "Max Messages Per Poll", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.ironmq.IronMQConfiguration", "configurationField": "configuration", "description": "Number of messages to poll pr. call. Maximum is 100." },
"maxMessagesPerPoll": { "index": 6, "kind": "parameter", "displayName": "Max Messages Per Poll", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.ironmq.IronMQConfiguration", "configurationField": "configuration", "description": "Number of messages to poll per call. Maximum is 100." },
"sendEmptyMessageWhenIdle": { "index": 7, "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." },
"timeout": { "index": 8, "kind": "parameter", "displayName": "Timeout", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60, "configurationClass": "org.apache.camel.component.ironmq.IronMQConfiguration", "configurationField": "configuration", "description": "After timeout (in seconds), item will be placed back onto the queue." },
"wait": { "index": 9, "kind": "parameter", "displayName": "Wait", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ironmq.IronMQConfiguration", "configurationField": "configuration", "description": "Time in seconds to wait for a message to become available. This enables long polling. Default is 0 (does not wait), maximum is 30." },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"component": {
"kind": "component",
"name": "langchain4j-chat",
"title": "langChain4j Chat",
"title": "LangChain4j Chat",
"description": "LangChain4j Chat component",
"deprecated": false,
"firstVersion": "4.5.0",
Expand Down
13 changes: 13 additions & 0 deletions core/camel-spring-boot/src/main/docs/spring-boot.json
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,19 @@
"description": "Define the secrets to look at",
"sourceType": "org.apache.camel.spring.boot.vault.AwsVaultConfigurationProperties"
},
{
"name": "camel.vault.aws.sqs-queue-url",
"type": "java.lang.String",
"description": "In case of usage of SQS notification this field will specified the Queue URL to use",
"sourceType": "org.apache.camel.spring.boot.vault.AwsVaultConfigurationProperties"
},
{
"name": "camel.vault.aws.use-sqs-notification",
"type": "java.lang.Boolean",
"description": "Whether to use AWS SQS for secrets updates notification, this will require setting up Eventbridge\/Cloudtrail\/SQS communication",
"sourceType": "org.apache.camel.spring.boot.vault.AwsVaultConfigurationProperties",
"defaultValue": false
},
{
"name": "camel.vault.azure.azure-identity-enabled",
"type": "java.lang.Boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public AwsVaultConfiguration awsVaultConfiguration(AwsVaultConfigurationProperti
answer.setRefreshEnabled(config.isRefreshEnabled());
answer.setRefreshPeriod(config.getRefreshPeriod());
answer.setSecrets(config.getSecrets());
answer.setUseSqsNotification(config.isUseSqsNotification());
answer.setSqsQueueUrl(config.getSqsQueueUrl());
return answer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ public class AwsVaultConfigurationProperties {
* Define the secrets to look at
*/
private String secrets;

/**
* Whether to use AWS SQS for secrets updates notification, this will require setting up Eventbridge/Cloudtrail/SQS
* communication
*/
private boolean useSqsNotification;

/**
* In case of usage of SQS notification this field will specified the Queue URL to use
*/
private String sqsQueueUrl;

public String getAccessKey() {
return accessKey;
Expand Down Expand Up @@ -137,4 +148,20 @@ public String getSecrets() {
public void setSecrets(String secrets) {
this.secrets = secrets;
}

public boolean isUseSqsNotification() {
return useSqsNotification;
}

public void setUseSqsNotification(boolean useSqsNotification) {
this.useSqsNotification = useSqsNotification;
}

public String getSqsQueueUrl() {
return sqsQueueUrl;
}

public void setSqsQueueUrl(String sqsQueueUrl) {
this.sqsQueueUrl = sqsQueueUrl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"camel.vault.aws.secretKey=mySecretKey", "camel.vault.aws.region=myRegion",
"camel.vault.aws.defaultCredentialsProvider=false", "camel.vault.aws.refreshPeriod=60000",
"camel.vault.aws.refreshEnabled=false", "camel.vault.aws.secrets=supersecret",
"camel.vault.aws.profile-credentials-provider=true", "camel.vault.aws.profile-name=test" })
"camel.vault.aws.profile-credentials-provider=true", "camel.vault.aws.profile-name=test", "camel.vault.aws.use-sqs-notification=true", "camel.vault.aws.sqs-queue-url=http://sqs-2" })
public class AwsVaultConfigurationTest {

@Autowired
Expand All @@ -49,5 +49,7 @@ public void testAwsVault() throws Exception {
Assertions.assertEquals("supersecret", camelContext.getVaultConfiguration().aws().getSecrets());
Assertions.assertEquals("test", camelContext.getVaultConfiguration().aws().getProfileName());
Assertions.assertEquals(true, camelContext.getVaultConfiguration().aws().isProfileCredentialsProvider());
Assertions.assertEquals(true, camelContext.getVaultConfiguration().aws().isUseSqsNotification());
Assertions.assertEquals("http://sqs-2", camelContext.getVaultConfiguration().aws().getSqsQueueUrl());
}
}
Loading