Class: Rudy::CLI::AWS::EC2::Groups

Inherits:
CommandBase
  • Object
show all
Defined in:
lib/rudy/cli/aws/ec2/groups.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

#authorize_groupsObject



45
# File 'lib/rudy/cli/aws/ec2/groups.rb', line 45

def authorize_groups; modify_group(:authorize); end

#authorize_groups_valid?Boolean

Returns:

  • (Boolean)


44
# File 'lib/rudy/cli/aws/ec2/groups.rb', line 44

def authorize_groups_valid?; modify_group_valid?; end

#create_groupsObject



15
16
17
18
19
20
21
22
23
# File 'lib/rudy/cli/aws/ec2/groups.rb', line 15

def create_groups
  opts = check_options
  execute_action { 
    @rgroups.create(@argv.name, @option.description, opts[:addresses], opts[:ports], opts[:protocols])
  }
  @rgroups.list(@argv.name) do |group|
    puts @@global.verbose > 0 ? group.inspect : group.dump(@@global.format)
  end
end

#create_groups_valid?Boolean

Returns:

  • (Boolean)

Raises:

  • (Drydock::ArgError)


9
10
11
12
13
14
# File 'lib/rudy/cli/aws/ec2/groups.rb', line 9

def create_groups_valid?
  @rgroups = Rudy::AWS::EC2::Groups.new(@@global.accesskey, @@global.secretkey, @@global.region)
  raise Drydock::ArgError.new('group name', @alias) unless @argv.name
  raise "Group #{@argv.name} alread exists" if @rgroups.exists?(@argv.name)
  true
end

#destroy_groupsObject



33
34
35
36
37
38
39
# File 'lib/rudy/cli/aws/ec2/groups.rb', line 33

def destroy_groups
  puts "Destroying group: #{@argv.name}"
  execute_check(:medium)
  execute_action { @rgroups.destroy(@argv.name) }
  @argv.clear # so groups will print all other groups
  groups
end

#destroy_groups_valid?Boolean

Returns:

  • (Boolean)

Raises:

  • (Drydock::ArgError)


26
27
28
29
30
31
# File 'lib/rudy/cli/aws/ec2/groups.rb', line 26

def destroy_groups_valid?
  @rgroups = Rudy::AWS::EC2::Groups.new(@@global.accesskey, @@global.secretkey, @@global.region)
  raise Drydock::ArgError.new('group name', @alias) unless @argv.name
  raise "Group #{@argv.name} does not exist" unless @rgroups.exists?(@argv.name)
  true
end

#groupsObject



47
48
49
50
51
52
53
54
# File 'lib/rudy/cli/aws/ec2/groups.rb', line 47

def groups
  opts = {}
  name = @option.all ? nil : @argv.name
  rgroups = Rudy::AWS::EC2::Groups.new(@@global.accesskey, @@global.secretkey, @@global.region)
  rgroups.list(name).each do |group|
    puts @@global.verbose > 0 ? group.inspect : group.dump(@@global.format)
  end
end

#revoke_groupsObject



42
# File 'lib/rudy/cli/aws/ec2/groups.rb', line 42

def revoke_groups; modify_group(:revoke); end

#revoke_groups_valid?Boolean

Returns:

  • (Boolean)


41
# File 'lib/rudy/cli/aws/ec2/groups.rb', line 41

def revoke_groups_valid?; modify_group_valid?; end