Search in sources :

Example 6 with ActionResponse

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

the class RegionProducer method doDelete.

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

Example 7 with ActionResponse

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

the class ContainerProducer method doCreate.

private void doCreate(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().create(name, options);
    checkFailure(out, msg, "Create container " + name);
}
Also used : CreateUpdateContainerOptions(org.openstack4j.model.storage.object.options.CreateUpdateContainerOptions) Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 8 with ActionResponse

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

the class ContainerProducer method doDelete.

private void doDelete(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 ActionResponse out = os.objectStorage().containers().delete(name);
    checkFailure(out, msg, "Delete container " + name);
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 9 with ActionResponse

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

the class DomainProducer method doDelete.

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

Example 10 with ActionResponse

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

the class GroupProducer method doAddUser.

private void doAddUser(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().addUserToGroup(groupId, userId);
    checkFailure(response, msg, String.format("Add user %s to group %s", userId, groupId));
}
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