pryaws 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/pryaws ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pryaws'
3
+ require 'pry'
4
+
5
+ def die(msg)
6
+ puts msg
7
+ exit 1
8
+ end
9
+
10
+ def get_proxy()
11
+ e = ENV['https_proxy']
12
+ if e && !e.empty?
13
+ if !e.start_with? "http"
14
+ e = "https://#{e}"
15
+ end
16
+ end
17
+ return e
18
+ end
19
+
20
+ die 'AWS_ACCESS_KEY_ID not set' if ENV['AWS_ACCESS_KEY_ID'].nil?
21
+ die 'AWS_SECRET_ACCESS_KEY not set' if ENV['AWS_SECRET_ACCESS_KEY'].nil?
22
+
23
+ AWS.config({
24
+ :region => 'eu-west-1',
25
+ :http_wire_trace => ENV.include?("AWS_DEBUG"),
26
+ :proxy_uri => get_proxy()
27
+ })
28
+
29
+ sqs = AWS::SQS.new()
30
+ sns = AWS::SNS.new()
31
+ s3 = AWS::S3.new()
32
+ ec2 = AWS::EC2.new()
33
+ as = AWS::AutoScaling.new()
34
+ cw = AWS::CloudWatch.new()
35
+ sdb = AWS::SimpleDB.new()
36
+ cf = AWS::CloudFormation.new()
37
+
38
+ puts 'Available: sqs, sns, s3, ec2, as, cw, sdb, cf'
39
+ binding.pry()
@@ -0,0 +1,26 @@
1
+ require 'aws'
2
+ require 'aws-sdk'
3
+
4
+ module AWS
5
+ class AutoScaling
6
+
7
+ def find_for_instance_id(instance_id)
8
+ instances[instance_id].group()
9
+ end
10
+
11
+ # http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/AutoScaling/Group.html
12
+ class Group
13
+
14
+ def info
15
+ "#{name} #{min_size}..#{max_size} [#{auto_scaling_instances.map{|i| i.id}.join(',')}]"
16
+ end
17
+
18
+ def set_min_max(min, max)
19
+ update(:max_size => min, :min_size => max)
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+
26
+ end
@@ -0,0 +1,27 @@
1
+ require 'aws'
2
+ require 'aws-sdk'
3
+
4
+ module AWS
5
+
6
+ class AutoScaling
7
+
8
+ def find_for_instance_id(instance_id)
9
+ instances[instance_id].group()
10
+ end
11
+
12
+ # http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/AutoScaling/Group.html
13
+ class Group
14
+
15
+ def info()
16
+ "#{name} #{min_size}..#{max_size} [#{auto_scaling_instances.map{|i| i.id}.join(',')}]"
17
+ end
18
+
19
+ def set_min_max(min, max)
20
+ update(:max_size => min, :min_size => max)
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+
27
+ end
data/lib/pryaws/ec2.rb ADDED
@@ -0,0 +1,31 @@
1
+ require 'aws'
2
+ require 'aws-sdk'
3
+
4
+ module AWS
5
+
6
+ #http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/EC2.html
7
+ class EC2
8
+
9
+ def find_by_name(name)
10
+ instances.tagged('Name').tagged_values(name)
11
+ end
12
+
13
+ class InstanceCollection
14
+
15
+ def info()
16
+ map(&:info).to_a()
17
+ end
18
+
19
+ end
20
+
21
+ class Instance
22
+
23
+ def info()
24
+ "#{id()} #{tags['Name']}"
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
31
+ end
data/lib/pryaws/sns.rb ADDED
@@ -0,0 +1,23 @@
1
+ require 'aws'
2
+ require 'aws-sdk'
3
+
4
+ module AWS
5
+
6
+ class SNS
7
+
8
+ class TopicCollection
9
+
10
+ if !self.respond_to?(:named)
11
+ def named(name)
12
+ each do |topic|
13
+ return topic if topic.name == name
14
+ end
15
+ nil
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
23
+ end
data/lib/pryaws.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'pryaws/auto-scaling.rb'
2
+ require 'pryaws/cloud-formation.rb'
3
+ require 'pryaws/ec2.rb'
4
+ require 'pryaws/sns.rb'
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pryaws
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - haku
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-11-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: aws-sdk
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: pry
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Loads a batch of helpers that make the AWS SDK easier to interact with
47
+ and drop to binding.pry().
48
+ email:
49
+ executables:
50
+ - pryaws
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - lib/pryaws.rb
55
+ - lib/pryaws/auto-scaling.rb
56
+ - lib/pryaws/cloud-formation.rb
57
+ - lib/pryaws/ec2.rb
58
+ - lib/pryaws/sns.rb
59
+ - bin/pryaws
60
+ homepage: https://github.com/haku/pryaws
61
+ licenses: []
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 1.8.25
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: Interactive AWS console using Ruby Pry.
84
+ test_files: []