Class: Rudy::CLI::AWS::S3::Buckets

Inherits:
CommandBase
  • Object
show all
Defined in:
lib/rudy/cli/aws/s3/buckets.rb

Instance Attribute Summary

Attributes inherited from CommandBase

#config

Instance Method Summary collapse

Methods included from Huxtable

change_environment, change_position, change_region, change_role, change_zone, #check_keys, #config_dirname, create_domain, #current_group_name, #current_machine_address, #current_machine_count, #current_machine_group, #current_machine_hostname, #current_machine_image, #current_machine_name, #current_machine_size, #current_user, #current_user_keypairpath, debug?, #debug?, domain, domain_exists?, #group_metadata, #has_keypair?, #has_keys?, #has_pem_keys?, #has_root_keypair?, keypair_path_to_name, #known_machine_group?, #root_keypairname, #root_keypairpath, #switch_user, update_config, update_global, update_logger, #user_keypairname, #user_keypairpath

Instance Method Details

#bucketsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rudy/cli/aws/s3/buckets.rb', line 9

def buckets
  raise "No bucket name supplied" if !@argv.name && @option.list
  s3 = Rudy::AWS::S3.new(@@global.accesskey, @@global.secretkey, @@global.region)
  unless @option.list
    (s3.list_buckets || []).each do |b|
      puts b.name
    end
  else
    puts "All objects in #{@argv.name}:"
    (s3.list_bucket_objects(@argv.name) || []).each do |o|
      puts o
    end
  end
end

#create_bucketsObject



28
29
30
31
32
# File 'lib/rudy/cli/aws/s3/buckets.rb', line 28

def create_buckets
  s3 = Rudy::AWS::S3.new(@@global.accesskey, @@global.secretkey, @@global.region)
  s3.create_bucket(@argv.name, @option.location)
  buckets
end

#create_buckets_valid?Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/rudy/cli/aws/s3/buckets.rb', line 24

def create_buckets_valid?
  raise "No bucket name supplied" unless @argv.name
  true
end

#destroy_bucketsObject



38
39
40
41
42
43
# File 'lib/rudy/cli/aws/s3/buckets.rb', line 38

def destroy_buckets
  execute_check(:medium)
  s3 = Rudy::AWS::S3.new(@@global.accesskey, @@global.secretkey, @@global.region)
  s3.destroy_bucket(@argv.name)
  buckets
end

#destroy_buckets_valid?Boolean

Returns:

  • (Boolean)


34
35
36
37
# File 'lib/rudy/cli/aws/s3/buckets.rb', line 34

def destroy_buckets_valid?
  raise "No bucket name supplied" unless @argv.name
  true
end