Search in sources :

Example 81 with ActionResponse

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

the class VolumeProducer method doUpdate.

private void doUpdate(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(CinderConstants.VOLUME_ID, String.class), String.class);
    final Volume vol = messageToVolume(msg);
    ObjectHelper.notEmpty(id, "Cinder Volume ID");
    ObjectHelper.notEmpty(vol.getDescription(), "Cinder Volume Description");
    ObjectHelper.notEmpty(vol.getName(), "Cinder Volume Name");
    final ActionResponse out = os.blockStorage().volumes().update(id, vol.getName(), vol.getDescription());
    checkFailure(out, msg, "Update volume " + id);
}
Also used : Message(org.apache.camel.Message) Volume(org.openstack4j.model.storage.block.Volume) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 82 with ActionResponse

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

the class GlanceProducer method doDelete.

private void doDelete(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String imageId = msg.getHeader(OpenstackConstants.ID, String.class);
    ObjectHelper.notEmpty(imageId, "ImageID");
    final ActionResponse response = os.compute().images().delete(imageId);
    checkFailure(response, msg, "Delete image " + imageId);
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 83 with ActionResponse

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

the class GroupProducer method doRemoveUserFromGroup.

private void doRemoveUserFromGroup(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String userId = msg.getHeader(KeystoneConstants.USER_ID, String.class);
    final String groupId = msg.getHeader(KeystoneConstants.GROUP_ID, String.class);
    ObjectHelper.notEmpty(userId, "User ID");
    ObjectHelper.notEmpty(groupId, "Group ID");
    final ActionResponse response = osV3Client.identity().groups().removeUserFromGroup(groupId, userId);
    checkFailure(response, msg, String.format("Delete user %s from group %s", userId, groupId));
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 84 with ActionResponse

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

the class GroupProducer method doCheckUserGroup.

private void doCheckUserGroup(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String userId = msg.getHeader(KeystoneConstants.USER_ID, String.class);
    final String groupId = msg.getHeader(KeystoneConstants.GROUP_ID, String.class);
    ObjectHelper.notEmpty(userId, "User ID");
    ObjectHelper.notEmpty(groupId, "Group ID");
    final ActionResponse response = osV3Client.identity().groups().checkGroupUser(groupId, userId);
    msg.setBody(response.isSuccess());
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 85 with ActionResponse

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

the class ProjectProducer method doDelete.

private void doDelete(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String id = msg.getHeader(OpenstackConstants.ID, String.class);
    ObjectHelper.notEmpty(id, "Project ID");
    final ActionResponse response = osV3Client.identity().projects().delete(id);
    checkFailure(response, msg, "Delete project with ID " + id);
}
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