| = OpenStack Swift Component |
| :doctitle: OpenStack Swift |
| :shortname: openstack-swift |
| :artifactid: camel-openstack |
| :description: Access OpenStack Swift object/blob store. |
| :since: 2.19 |
| :supportlevel: Stable |
| :tabs-sync-option: |
| :component-header: Only producer is supported |
| //Manually maintained attributes |
| :group: OpenStack |
| |
| *Since Camel {since}* |
| |
| *{component-header}* |
| |
| The Openstack Swift component allows messages to be sent to an OpenStack object storage services. |
| |
| == Dependencies |
| |
| Maven users will need to add the following dependency to their `pom.xml`. |
| |
| .pom.xml |
| [source,xml] |
| --------------------------------------- |
| <dependency> |
| <groupId>org.apache.camel</groupId> |
| <artifactId>camel-openstack</artifactId> |
| <version>${camel-version}</version> |
| </dependency> |
| --------------------------------------- |
| |
| where `${camel-version`} must be replaced by the actual version of Camel. |
| |
| |
| == URI Format |
| |
| ---------------------------- |
| openstack-swift://hosturl[?options] |
| ---------------------------- |
| |
| // component options: START |
| include::partial$component-configure-options.adoc[] |
| include::partial$component-endpoint-options.adoc[] |
| include::partial$component-endpoint-headers.adoc[] |
| // component options: END |
| |
| |
| == Usage |
| |
| You can use the following settings for each subsystem: |
| |
| === Containers |
| |
| ==== Operations you can perform with the Container producer |
| [width="100%",cols="20%,80%",options="header",] |
| |========================================================================= |
| |Operation | Description |
| |
| |`create` | Create a new container. |
| |
| |`get` | Get the container. |
| |
| |`getAll` | Get all containers. |
| |
| |`update` | Update the container. |
| |
| |`delete` | Delete the container. |
| |
| |`getMetadata` | Get metadata. |
| |
| |`createUpdateMetadata` | Create/update metadata. |
| |
| |`deleteMetadata` | Delete metadata. |
| |========================================================================= |
| |
| If you need more precise container settings, you can create a new object of the type `org.openstack4j.model.storage.object.options.CreateUpdateContainerOptions` (in case of create or update operation) |
| or `org.openstack4j.model.storage.object.options.ContainerListOptions` for listing containers and send in the message body. |
| |
| === Objects |
| |
| ==== Operations you can perform with the Object producer |
| [width="100%",cols="20%,80%",options="header",] |
| |========================================================================= |
| |Operation | Description |
| |
| |`create` | Create a new object. |
| |
| |`get` | Get the object. |
| |
| |`getAll` | Get all objects. |
| |
| |`update` | Get update the object. |
| |
| |`delete` | Delete the object. |
| |
| |`getMetadata` | Get metadata. |
| |
| |`createUpdateMetadata` | Create/update metadata. |
| |
| |========================================================================= |
| |
| === Example |
| |
| The following route stores each file of the `outbox` folder as an object of the `reports` container. |
| The endpoint is the address of the identity service (Keystone), and the credentials are property placeholders: |
| |
| [source,yaml] |
| ---- |
| - route: |
| from: |
| uri: file:outbox |
| steps: |
| - setHeader: |
| name: CamelOpenstackSwiftContainerName |
| expression: |
| constant: |
| expression: "reports" |
| - setHeader: |
| name: CamelOpenstackSwiftObjectName |
| expression: |
| simple: |
| expression: "${header.CamelFileName}" |
| - to: |
| uri: openstack-swift:http://controller:5000/v3 |
| parameters: |
| username: "{{openstack.username}}" |
| password: "{{openstack.password}}" |
| project: "{{openstack.project}}" |
| subsystem: objects |
| operation: create |
| - log: |
| message: "Stored ${header.CamelFileName} with ETag ${body}" |
| ---- |