use of com.emc.storageos.cinder.model.ConsistencyGroupDetail in project coprhd-controller by CoprHD.
the class AbstractConsistencyGroupService method getConsistencyGroupDetail.
/**
* This function return detail of consistency group in pojo class object
*
* @param blockConsistencyGroup
* @return ConsistencyGroupDetail
*/
protected ConsistencyGroupDetail getConsistencyGroupDetail(BlockConsistencyGroup blockConsistencyGroup) {
ConsistencyGroupDetail response = new ConsistencyGroupDetail();
if (blockConsistencyGroup != null) {
response.id = CinderApiUtils.splitString(blockConsistencyGroup.getId().toString(), ":", 3);
response.name = blockConsistencyGroup.getLabel();
response.created_at = CinderApiUtils.timeFormat(blockConsistencyGroup.getCreationTime());
if (blockConsistencyGroup.getTag() != null) {
for (ScopedLabel tag : blockConsistencyGroup.getTag()) {
switch(tag.getScope()) {
case "availability_zone":
response.availability_zone = tag.getLabel();
case "status":
response.status = tag.getLabel();
case "description":
response.description = tag.getLabel();
}
}
}
}
return response;
}
use of com.emc.storageos.cinder.model.ConsistencyGroupDetail in project coprhd-controller by CoprHD.
the class ConsistencyGroupService method getCosistencyGroup.
/**
* This function handles Get request for a consistency group detail
*
* @param openstackTenantId Openstack tenant id
* @param consistencyGroupId Consistency group id
* @param isV1Call openstack cinder V1 call
* @param header HTTP header
* @brief Get Consistency Group Info
* @return Response
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{consistencyGroup_id}")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public Response getCosistencyGroup(@PathParam("tenant_id") String openstackTenantId, @PathParam("consistencyGroup_id") String consistencyGroupId, @HeaderParam("X-Cinder-V1-Call") String isV1Call, @Context HttpHeaders header) {
Project project = getCinderHelper().getProject(openstackTenantId, getUserFromContext());
if (project == null) {
String message = "Bad Request: Project with the OpenStack Tenant Id : " + openstackTenantId + " does not exist";
_log.error(message);
return CinderApiUtils.createErrorResponse(400, message);
}
final BlockConsistencyGroup blockConsistencyGroup = findConsistencyGroup(consistencyGroupId, openstackTenantId);
if (blockConsistencyGroup == null) {
return CinderApiUtils.createErrorResponse(404, "Invalid Request: No Such Consistency Group Found");
} else if (!consistencyGroupId.equals(CinderApiUtils.splitString(blockConsistencyGroup.getId().toString(), ":", 3))) {
_log.error("Bad Request : There is no consistency group with id {} , please retry with correct consistency group id", consistencyGroupId);
return CinderApiUtils.createErrorResponse(400, "Bad Request : There is no consistency group exist, please retry with correct consistency group id");
} else {
ConsistencyGroupDetail response = getConsistencyGroupDetail(blockConsistencyGroup);
return CinderApiUtils.getCinderResponse(response, header, true, CinderConstants.STATUS_OK);
}
}
Aggregations