This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 481d0a2d2ee1803fcb0d700cb3a51fa6918cc4fd Author: Andrea Cosentino <[email protected]> AuthorDate: Wed Feb 23 11:00:15 2022 +0100 CAMEL-17700 - AWS Secret Manager Properties Source: Provide a fallback default value --- docs/user-manual/modules/ROOT/pages/security.adoc | 30 ++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/user-manual/modules/ROOT/pages/security.adoc b/docs/user-manual/modules/ROOT/pages/security.adoc index ea51160..8823024 100644 --- a/docs/user-manual/modules/ROOT/pages/security.adoc +++ b/docs/user-manual/modules/ROOT/pages/security.adoc @@ -100,6 +100,20 @@ At this point you'll be able to reference a property in the following way by usi Where `route` will be the name of the secret stored in the AWS Secrets Manager Service. +You could specify a default value in case the secret is not present on AWS Secret Manager: + +[source,xml] +---- +<camelContext> + <route> + <from uri="direct:start"/> + <to uri="{{aws:route:default}}"/> + </route> +</camelContext> +---- + +In this case if the secret doesn't exist, the property will fallback to "default" as value. + Also, you are able to get particular field of the secret, if you have for example a secret named database of this form: [source,json] @@ -121,13 +135,27 @@ You're able to do get single secret value in your route, like for example: <camelContext> <route> <from uri="direct:start"/> - <log message="Username is {{aws:database:username}}"/> + <log message="Username is {{aws:database/username}}"/> </route> </camelContext> ---- Or re-use the property as part of an endpoint. +You could specify a default value in case the particular field of secret is not present on AWS Secret Manager: + +[source,xml] +---- +<camelContext> + <route> + <from uri="direct:start"/> + <log message="Username is {{aws:database/username:admin}}"/> + </route> +</camelContext> +---- + +In this case if the secret doesn't exist or the secret exists, but the username field is not part of the secret, the property will fallback to "admin" as value. + NOTE: For the moment we are not considering the rotation function, if any will be applied, but it is in the work to be done. The only requirement is adding `camel-aws-secrets-manager` JAR to your Camel application.
