aws-sdk-enhanced 2.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 79beea32d322d7c8d081f6f8cc04fce8bb1d69a3
4
+ data.tar.gz: f13a2353bf13a51bed23a7dcfc31e627446fbea5
5
+ SHA512:
6
+ metadata.gz: 14cffbe6cfb5cee1d0abd0e011705c9cfa1d5ac4508f015c3609b469bd65b049ffcf16b7f7c208ee2fe9e5142545319bd588fda21b205d7519baa2849487e4c9
7
+ data.tar.gz: 020d9a0af2f6fa6c0e4e1f2648cc1f0691ff34cc5978a5b20be4519226143ca44087dddc3ae06bb43e5ba617c3a4c34824c703de3ae1abfc6ac8b15a6dac9918
@@ -0,0 +1,7 @@
1
+ = aws-sdk-enhanced
2
+
3
+ == Version 2.0.0
4
+ * Implements TagHashable module
5
+ * Applies TagHashable to Aws::EC2::Instance
6
+ * Implements Aws::AutoScaling::Group class
7
+
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 David Dawson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,30 @@
1
+ = aws-sdk-enhanced
2
+
3
+ Extends aws-sdk--roughly following a decorator pattern--to make it easier to use.
4
+
5
+ Major versions of this gem are compatible with the corresponding major version of aws-sdk. Note you may use any version of aws-sdk you wish so long as the major version is compatible (you may use aws-sdk version 2.1.23 with aws-sdk-enhanced version 2.0.1).
6
+
7
+ Currently, this library simply provides a convenience class for retrieving auto scaling groups by name and allows convenient access of specific tags on EC2 instance and auto scaling groups.
8
+
9
+ == Installation
10
+
11
+ Add the following to your Gemfile:
12
+
13
+ gem 'aws-sdk-enhanced', '~> 2.0', require: 'aws-sdk/enhanced'
14
+
15
+ Alternatively, with aws-sdk-enhanced installed:
16
+
17
+ require 'aws-sdk/enhanced'
18
+
19
+ This gem depends on and thus requires 'aws-sdk', so an explicit "require 'aws-sdk'" is not necessary.
20
+
21
+ == Synopsis
22
+
23
+ require 'aws-sdk/enhanced'
24
+
25
+ instance = Aws::EC2::Instance.new('i-abc1234')
26
+ value = instance.tag_hash['MyTag']
27
+
28
+ # note no Aws::AutoScaling::Group class exists in aws-sdk
29
+ group = Aws::AutoScaling::Group.new('my_auto_scaling_group')
30
+ value = group.tag_hash['MyTag']
@@ -0,0 +1,7 @@
1
+ require 'aws-sdk'
2
+
3
+ require 'aws-sdk/enhanced/modules/tag_hashable'
4
+
5
+ require 'aws-sdk/enhanced/auto_scaling'
6
+ require 'aws-sdk/enhanced/ec2'
7
+
@@ -0,0 +1,43 @@
1
+ module Aws
2
+ module AutoScaling
3
+
4
+ class Group
5
+
6
+ include Aws::Enhanced::TagHashable
7
+
8
+ def initialize(name, options = {})
9
+ options = {
10
+ client: Aws::AutoScaling::Client.new
11
+ }.merge(options)
12
+
13
+ @client = options[:client]
14
+ response = @client.describe_auto_scaling_groups(auto_scaling_group_names: [ name ])
15
+ @group = response.auto_scaling_groups.first
16
+ end
17
+
18
+ def exists?
19
+ !@group.nil?
20
+ end
21
+
22
+ def respond_to?(sym, include_all = false)
23
+ has_method?(sym) || super(sym, include_all)
24
+ end
25
+
26
+ def method_missing(sym, *args, &block)
27
+ if has_method?(sym)
28
+ @group.send(sym, *args, &block)
29
+ else
30
+ super(sym, *args, &block)
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def has_method?(m)
37
+ exists? && @group.respond_to?(m)
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+ end
@@ -0,0 +1,9 @@
1
+ module Aws
2
+ module EC2
3
+
4
+ class Instance
5
+ include Aws::Enhanced::TagHashable
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ module Aws
2
+ module Enhanced
3
+
4
+ module TagHashable
5
+ def tag_hash
6
+ @_tag_hash ||= begin
7
+ result = {}
8
+ self.tags.each do |tag|
9
+ result[tag.key] = tag.value
10
+ end
11
+ result
12
+ end
13
+ end
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ module Aws
2
+ module Enhanced
3
+ VERSION = '2.0.0'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws-sdk-enhanced
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - David Dawson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ description: Extensions to aws-sdk, adding more natural access to attributes in AutoScaling,
28
+ EC2, and more
29
+ email: daws23@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files:
33
+ - README.rdoc
34
+ - CHANGELOG.rdoc
35
+ - LICENSE.txt
36
+ files:
37
+ - CHANGELOG.rdoc
38
+ - LICENSE.txt
39
+ - README.rdoc
40
+ - lib/aws-sdk/enhanced.rb
41
+ - lib/aws-sdk/enhanced/auto_scaling.rb
42
+ - lib/aws-sdk/enhanced/ec2.rb
43
+ - lib/aws-sdk/enhanced/modules/tag_hashable.rb
44
+ - lib/aws-sdk/enhanced/version.rb
45
+ homepage: https://github.com/daws/aws-sdk-enhanced
46
+ licenses:
47
+ - MIT
48
+ metadata: {}
49
+ post_install_message:
50
+ rdoc_options:
51
+ - "--main"
52
+ - README.rdoc
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 2.4.5
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Extensions to aws-sdk to make it easier to use
71
+ test_files: []