Search in sources :

Example 86 with ActionResponse

use of org.openstack4j.model.common.ActionResponse in project camel by apache.

the class UserProducer method doDelete.

private void doDelete(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(KeystoneConstants.USER_ID, String.class), String.class);
    ObjectHelper.notEmpty(id, "User ID");
    final ActionResponse response = osV3Client.identity().users().delete(id);
    checkFailure(response, msg, "Delete user with ID " + id);
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 87 with ActionResponse

use of org.openstack4j.model.common.ActionResponse in project camel by apache.

the class NetworkProducer method doDelete.

private void doDelete(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(NeutronConstants.NETWORK_ID, String.class), String.class);
    ObjectHelper.notEmpty(id, "Network ID");
    final ActionResponse response = os.networking().network().delete(id);
    checkFailure(response, msg, "Delete network" + id);
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 88 with ActionResponse

use of org.openstack4j.model.common.ActionResponse in project camel by apache.

the class PortProducer method doDelete.

private void doDelete(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(NeutronConstants.PORT_ID, String.class), String.class);
    ObjectHelper.notEmpty(id, "Port ID");
    final ActionResponse response = os.networking().port().delete(id);
    checkFailure(response, msg, "Delete port with ID " + id);
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 89 with ActionResponse

use of org.openstack4j.model.common.ActionResponse in project camel by apache.

the class ContainerProducer method doUpdate.

private void doUpdate(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String name = msg.getHeader(OpenstackConstants.NAME, msg.getHeader(SwiftConstants.CONTAINER_NAME, String.class), String.class);
    ObjectHelper.notEmpty(name, "Container name");
    final CreateUpdateContainerOptions options = messageToCreateUpdateOptions(msg);
    final ActionResponse out = os.objectStorage().containers().update(name, options);
    checkFailure(out, msg, "Update container " + name);
}
Also used : CreateUpdateContainerOptions(org.openstack4j.model.storage.object.options.CreateUpdateContainerOptions) Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 90 with ActionResponse

use of org.openstack4j.model.common.ActionResponse in project camel by apache.

the class ObjectProducer method doDelete.

private void doDelete(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String containerName = msg.getHeader(SwiftConstants.CONTAINER_NAME, String.class);
    final String objectName = msg.getHeader(SwiftConstants.OBJECT_NAME, String.class);
    ObjectHelper.notEmpty(containerName, "Container name");
    ObjectHelper.notEmpty(objectName, "Object name");
    final ActionResponse out = os.objectStorage().objects().delete(containerName, objectName);
    msg.setBody(out.getFault());
    msg.setFault(!out.isSuccess());
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Aggregations

ActionResponse (org.openstack4j.model.common.ActionResponse)123 AbstractTest (org.openstack4j.api.AbstractTest)54 Test (org.testng.annotations.Test)54 Message (org.apache.camel.Message)25 ArrayList (java.util.ArrayList)2 CreateUpdateContainerOptions (org.openstack4j.model.storage.object.options.CreateUpdateContainerOptions)2 TroveBuilders (org.openstack4j.openstack.trove.builder.TroveBuilders)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 InputStream (java.io.InputStream)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)1 ResponseToActionResponse (org.openstack4j.core.transport.functions.ResponseToActionResponse)1 Action (org.openstack4j.model.compute.Action)1 User (org.openstack4j.model.identity.v3.User)1 Volume (org.openstack4j.model.storage.block.Volume)1 VolumeSnapshot (org.openstack4j.model.storage.block.VolumeSnapshot)1 KeystoneUser (org.openstack4j.openstack.identity.v3.domain.KeystoneUser)1 TroveDatabase (org.openstack4j.openstack.trove.domain.TroveDatabase)1