s7p7
s7p7

Reputation: 1

NoMethodError: undefined method `exists?' for #<Aws::Resources::Collection:0x00000100b690f8>

unless skip_error_checks
  bucket_source = @@s3.bucket(from_bucket)
  bucket_dest = @@s3.bucket(to_bucket)
  old_object = bucket_source.objects(name)
  new_object = bucket_dest.objects(new_name)
  new_exists = new_object.exists?
  old_exists = old_object.exists?
  if new_exists && old_exists
    return error("#{name} in #{from_bucket} and #{new_name} in #{to_bucket} exist.")
  elsif new_exists && !old_exists
    return error("This action has been done already.")
  elsif !old_exists
    return error("#{name} in #{from_bucket} do not exist it may have been permanently deleted.")
  end

i'm using aws-sdk 2.1.4 even though i followed documentation of aws-sdk seeing nomethod error,Does anyone had same issue

Upvotes: 0

Views: 1205

Answers (1)

Mohammad
Mohammad

Reputation: 3396

The exists? method has been removed as of version 2.

Some methods have been added to only some classes. If you want to add additional exists? the solution is given by the provided link:

To add additional #exists? methods, a waiter must be added to the resource class as Exists and that waiter must be defined in the *.waiters.json document for that service.

Upvotes: 1

Related Questions