Class: S3Ranger::CLI::Delete

Inherits:
BaseCmd
  • Object
show all
Defined in:
lib/s3ranger/cli.rb

Instance Method Summary collapse

Methods inherited from BaseCmd

#has_options?, #has_prefix?, #usage

Constructor Details

#initializeDelete

Returns a new instance of Delete.



199
200
201
202
203
204
205
# File 'lib/s3ranger/cli.rb', line 199

def initialize
  super 'delete', false, false

  @short_desc = "Delete a key from a bucket"

  @has_prefix = 'required'
end

Instance Method Details

#run(s3, bucket, key, file, args) ⇒ Object

Raises:



207
208
209
210
211
# File 'lib/s3ranger/cli.rb', line 207

def run s3, bucket, key, file, args
  raise WrongUsage.new(nil, "You need to inform a bucket") if not bucket
  raise WrongUsage.new(nil, "You need to inform a key") if not key
  s3.buckets[bucket].objects[key].delete
end