@Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof DescribeVolumesRequest == false) return false;
    DescribeVolumesRequest other = (DescribeVolumesRequest) obj;

    if (other.getVolumeIds() == null ^ this.getVolumeIds() == null) return false;
    if (other.getVolumeIds() != null && other.getVolumeIds().equals(this.getVolumeIds()) == false)
      return false;
    if (other.getFilters() == null ^ this.getFilters() == null) return false;
    if (other.getFilters() != null && other.getFilters().equals(this.getFilters()) == false)
      return false;
    return true;
  }
Esempio n. 2
0
  /**
   * Describe a set of specific EBS volumes.
   *
   * @param volumeIds the volume ids
   * @return the volumes
   */
  public List<Volume> describeVolumes(String... volumeIds) {
    if (volumeIds == null || volumeIds.length == 0) {
      LOGGER.info("Getting all EBS volumes.");
    } else {
      LOGGER.info(String.format("Getting EBS volumes for %d ids.", volumeIds.length));
    }

    AmazonEC2 ec2Client = ec2Client();
    DescribeVolumesRequest request = new DescribeVolumesRequest();
    if (volumeIds != null) {
      request.setVolumeIds(Arrays.asList(volumeIds));
    }
    DescribeVolumesResult result = ec2Client.describeVolumes(request);
    List<Volume> volumes = result.getVolumes();

    LOGGER.info(String.format("Got %d EBS volumes.", volumes.size()));
    return volumes;
  }