Пример #1
0
 @Override
 public void deleteVolume(String volumeId) {
   IaasProvider iaasInfo = getIaasProvider();
   ComputeServiceContext context = iaasInfo.getComputeService().getContext();
   String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);
   if (region == null) {
     log.fatal(
         "Cannot delete the volume [id]: "
             + volumeId
             + " of the [region] : "
             + region
             + " of Iaas : "
             + iaasInfo);
     return;
   }
   ElasticBlockStoreApi blockStoreApi =
       context.unwrapApi(AWSEC2Api.class).getElasticBlockStoreApiForRegion(region).get();
   blockStoreApi.deleteVolumeInRegion(region, volumeId);
   log.info(
       "Deletion of Volume [id]: "
           + volumeId
           + " was successful. [region] : "
           + region
           + " of Iaas : "
           + iaasInfo);
 }