// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
[id="extensions-hashicorp-vault"]
= Hashicorp Vault
:linkattrs:
:cq-artifact-id: camel-quarkus-hashicorp-vault
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Manage secrets in HashiCorp Vault Service
:cq-deprecated: false
:cq-jvm-since: 2.11.0
:cq-native-since: 3.15.0

ifeval::[{doc-show-badges} == true]
[.badges]
[.badge-key]##JVM since##[.badge-supported]##2.11.0## [.badge-key]##Native since##[.badge-supported]##3.15.0##
endif::[]

Manage secrets in HashiCorp Vault Service

[id="extensions-hashicorp-vault-whats-inside"]
== What's inside

* xref:{cq-camel-components}::hashicorp-vault-component.adoc[HashiCorp Vault component], URI syntax: `hashicorp-vault:secretsEngine`

Please refer to the above link for usage and configuration details.

[id="extensions-hashicorp-vault-maven-coordinates"]
== Maven coordinates

https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-hashicorp-vault[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]

Or add the coordinates to your existing project:

[source,xml]
----
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-hashicorp-vault</artifactId>
</dependency>
----
ifeval::[{doc-show-user-guide-link} == true]
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
endif::[]

[id="extensions-hashicorp-vault-usage"]
== Usage
[id="extensions-hashicorp-vault-usage-using-a-pojo-for-the-createsecret-operation-in-native-mode"]
=== Using a POJO for the `createSecret` operation in native mode

It is possible to use a POJO as the message body for the `createSecret` operation.
In native mode, you must register any such POJO classes for reflection. E.g. via the `@RegisterForReflection`
annotation or configuration property `quarkus.camel.native.reflection.include-patterns`.

For example.

[source,java]
----
@RegisterForReflection
public class Credentials {
    private String username;
    private String password;

    // Getters & setters
}
----

[source,java]
----
from("direct:createSecret")
    .process(new Processor() {
        @Override
        public void process(Exchange exchange) {
            Credentials credentials = new Credentials();
            credentials.setUsername("admin");
            credentials.setPassword("2s3cr3t");
            exchange.getMessage().setBody(credentials);
        }
    })
    .to("hashicorp-vault:secret?operation=createSecret&token=my-token&secretPath=my-secret")
----

Refer to the xref:user-guide/native-mode.adoc#reflection[Native mode] user guide for more information.

