cloud_powers 0.2.7.5 → 0.2.7.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd1ef85d301fd73bf38db0132fcbe17db2bff9cf
4
- data.tar.gz: 5c6dc0a78d34e694a66e3a77549d128eecc4b050
3
+ metadata.gz: 1538ba3fa5987dc1fec3bf6980eaecb2a2f72f85
4
+ data.tar.gz: d227eb099350cce6f37bf1a6bd670671ce5bb26d
5
5
  SHA512:
6
- metadata.gz: bf6eb4c1cc74ed62eba6312d179914865a8e9ef2369d545c2e445a1152111a2e7f05650c6054c50dd4622b7072147d6e6c1ec9ce41917dc346e3879f1ce5201d
7
- data.tar.gz: c1e07579e5e8b22719870a23d8782d7c2653476ced2e3fc3b2a358646ebf2fec8840f81bc5d91a7bad35f144908073664df43141e227b0bf22ea70202a7e0a3a
6
+ metadata.gz: df43a33011900b9097712283c2afb19f9abcbe40f04ea7f74a5e9892b69e2aa18b5b413dd99571dfc064325add2f24735af3a72c197d523bf72685fcd8ce13ab
7
+ data.tar.gz: 28c44b1cff2482c324a2e067edf70d6f9f2c71d81040d2db7beebf30e496dce8b45ce9af7dd6803612bb66d620b8d47543a463e1dc908cab16855adf8e959384
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloud_powers (0.2.7.5)
4
+ cloud_powers (0.2.7.6)
5
5
  activesupport-core-ext (~> 4)
6
6
  aws-sdk (~> 2)
7
7
  dotenv (~> 2.1)
@@ -19,7 +19,7 @@ module Smash
19
19
  # passed.
20
20
  #
21
21
  # Parameters
22
- # * args +Hash+|+JSON+|+Array+|+enumerable list+
22
+ # * args +Hash+|+JSON+|+Array+|+Enumerable+
23
23
  # * * expample +Hash+:
24
24
  # * * * each key is a module or class that is in CloudPowers and each value
25
25
  # is either an array of configurations information or a single configuration.
@@ -1,3 +1,3 @@
1
1
  module CloudPowers
2
- VERSION = "0.2.7.5"
2
+ VERSION = "0.2.7.6"
3
3
  end
@@ -4,28 +4,30 @@ module Smash
4
4
  module AwsStubs
5
5
 
6
6
  # Stub metadata for EC2 instance
7
- INSTANCE_METADATA_STUB = {
8
- 'ami-id' => 'ami-1234',
9
- 'ami-launch-index' => '1',
10
- 'ami-manifest-path' => '',
11
- 'block-device-mapping/' => '',
12
- 'hostname' => '',
13
- 'instance-action' => '',
14
- 'instance-id' => 'asd-1234',
15
- 'instance-type' => 't2.nano',
16
- 'kernel-id' => '',
17
- 'local-hostname' => 'ip-10-251-50-12.ec2.internal',
18
- 'local-ipv4' => '',
19
- 'mac network/' => '',
20
- 'placement/' => 'boogers',
21
- 'public-hostname' => 'ec2-203-0-113-25.compute-1.amazonaws.com',
22
- 'public-ipv4' => 'adsfasdfasfd',
23
- 'public-keys/' => 'jfakdsjfkdlsajfkldsajflkasjdfklajsdflkajsldkfjalsdfjaklsdjflasjfklasjdfkals',
24
- 'public-keys/0' => 'asdjfkasdjfkasdjflasjdfklsajdlkfjaldkgfjalkdfgjklsdfjgklsdjfklsjlkdfjakdlfjalskdfjlas',
25
- 'reservation-id' => 'r-fea54097',
26
- 'security-groups' => 'groupidygroupgroupgroup',
27
- 'services/' => ''
28
- }
7
+ def instance_metadata_stub(opts = {})
8
+ {
9
+ 'ami-id' => 'ami-1234',
10
+ 'ami-launch-index' => '1',
11
+ 'ami-manifest-path' => '',
12
+ 'block-device-mapping/' => '',
13
+ 'hostname' => '',
14
+ 'instance-action' => '',
15
+ 'instance-id' => 'asd-1234',
16
+ 'instance-type' => 't2.nano',
17
+ 'kernel-id' => '',
18
+ 'local-hostname' => 'ip-10-251-50-12.ec2.internal',
19
+ 'local-ipv4' => '',
20
+ 'mac network/' => '',
21
+ 'placement/' => 'boogers',
22
+ 'public-hostname' => 'ec2-203-0-113-25.compute-1.amazonaws.com',
23
+ 'public-ipv4' => 'adsfasdfasfd',
24
+ 'public-keys/' => 'jfakdsjfkdlsajfkldsajflkasjdfklajsdflkajsldkfjalsdfjaklsdjflasjfklasjdfkals',
25
+ 'public-keys/0' => 'asdjfkasdjfkasdjflasjdfklsajdlkfjaldkgfjalkdfgjklsdfjgklsdjfklsjlkdfjakdlfjalskdfjlas',
26
+ 'reservation-id' => 'r-fea54097',
27
+ 'security-groups' => 'groupidygroupgroupgroup',
28
+ 'services/' => ''
29
+ }
30
+ end
29
31
 
30
32
  # Get or create an EC2 client and cache that client so that a Context is more well tied together
31
33
  #
@@ -39,24 +41,16 @@ module Smash
39
41
  # <tt>AWS::EC2::Client</tt>
40
42
  #
41
43
  # Example
42
- # config = stub_responses: {
43
- # run_instances: {
44
- # instances: [{ instance_id: 'asd-1234', launch_time: Time.now, state: { name: 'running' }]
45
- # },
46
- # describe_instances: {
47
- # reservations: [
48
- # { instances: [{ instance_id: 'asd-1234', state: { code: 200, name: 'running' } }] }
49
- # ] },
50
- # describe_images: {
51
- # images: [{ image_id: 'asdf', state: 'available' }]
52
- # }
53
- # }
54
- #
55
- # ec2(config) # sets and gets an <tt>EC2::Client</tt> that is stubbed with the return data in the config <tt>Hash</tt>
44
+ # ec2(Smash::CloudPowers::AwsStubs.node_stub) # sets and gets an <tt>EC2::Client</tt> that is stubbed with the return data in the config <tt>Hash</tt>
56
45
  #
57
46
  # images = ec2.describe_images
58
47
  # images.first[:image_id]
59
48
  # # => 'asdf'
49
+ #
50
+ # Notes
51
+ # * defaults can't be overriden or don't have good support for
52
+ # for it yet but you can use this hash as a guide
53
+ # for your own custom configuration
60
54
  def self.node_stub(opts = {})
61
55
  {
62
56
  stub_responses: {
@@ -103,20 +97,15 @@ module Smash
103
97
  # AWS::SNS client
104
98
  #
105
99
  # Example
106
- # config = {
107
- # stub_responses: {
108
- # create_topic: {},
109
- # delete_topic: {},
110
- # list_topics: [],
111
- # publish: {},
112
- # subscribe: {}
113
- # }
114
- # }
115
- #
116
- # sns(config) # sets and gets an Kinesis client
100
+ # sns(Smash::CloudPowers::AwsStubs.broadcast_stub) # sets and gets an Kinesis client
117
101
  #
118
102
  # create_channel!('testBroadcast')
119
103
  # # => true
104
+ #
105
+ # Notes
106
+ # * defaults can't be overriden or don't have good support for
107
+ # for it yet but you can use this hash as a guide
108
+ # for your own custom configuration
120
109
  def self.broadcast_stub(opts = {})
121
110
  arn = "arn:aws:sns:us-west-2:8123456789:#{opts[:name] || 'testChannel'}"
122
111
  stub = {
@@ -142,35 +131,24 @@ module Smash
142
131
  # AWS::Kinesis client
143
132
  #
144
133
  # Example
145
- # config = {
146
- # stub_responses: {
147
- # create_stream: {},
148
- # put_record: {
149
- # shard_id: opts[:shard_id] || 'idididididididid',
150
- # sequence_number: opts[:sequence_number] || Time.now.to_i.to_s
151
- # },
152
- # describe_stream: {
153
- # stream_description: {
154
- # stream_name: opts[:name] || 'somePipe',
155
- # stream_arn: 'arnarnarnarnar',
156
- # stream_status: 'ACTIVE',
157
- # }
158
- # }
159
- # }
160
- # }
161
- # }
162
- #
163
- # kinesis(config) # sets and gets an Kinesis client
134
+ # # sets and gets an Kinesis client. No need to set a variable because one was
135
+ # # just created as +@kinesis+ and is set to the client
136
+ # kinesis(Smash::CloudPowers::AwsStubs.pipe_stub)
164
137
  #
165
138
  # pipe_to('somePipe') { update_body(status: 'waHoo') }
166
139
  # # => sequence_number: '1676151970'
140
+ #
141
+ # Notes
142
+ # * defaults can't be overriden or don't have good support for
143
+ # for it yet but you can use this hash as a guide
144
+ # for your own custom configuration
167
145
  def self.pipe_stub(opts = {})
168
146
  stub = {
169
147
  stub_responses: {
170
148
  create_stream: {},
171
149
  put_record: {
172
150
  shard_id: opts[:shard_id] || 'idididididididid',
173
- sequence_number: opts[:sequence_number] || '1234'
151
+ sequence_number: opts[:sequence_number] || '1676151970'
174
152
  },
175
153
  describe_stream: {
176
154
  stream_description: {
@@ -211,15 +189,14 @@ module Smash
211
189
  # AWS::S3 client
212
190
  #
213
191
  # Example
214
- # config = {
215
- # stub_responses: {
216
- # head_bucket: {}
217
- # }
218
- # }
219
- #
220
- # s3(config)
192
+ # s3(Smash::CloudPowers::AwsStubs.storage_stub)
221
193
  # expect(s3.head_bucket).to be_empty
222
194
  # # passing expectation
195
+ #
196
+ # Notes
197
+ # * defaults can't be overriden or don't have good support for
198
+ # for it yet but you can use this hash as a guide
199
+ # for your own custom configuration
223
200
  def self.storage_stub(opts = {})
224
201
  {
225
202
  stub_responses: {
@@ -231,17 +208,23 @@ module Smash
231
208
  # Stub data for an SQS client
232
209
  #
233
210
  # Parameters
234
- # * opts <tt>Hash</tt>
235
- # * * stub_responses: defaulted to false but it can be overriden with the desired responses for local testing
236
- # * * region: defaulted to use the `#region()` method
237
- # * * AWS::Credentials object, which will also scour the context and environment for your keys
211
+ # * opts +Hash+ (optional)
212
+ # * * +:stub_responses+ - defaulted to false but it can be overriden with the desired responses for local testing
213
+ # * * +:region+ - defaulted to use the +#region()+ method
214
+ # * * +AWS::Credentials+ object, which will also scour the context and environment for your keys
238
215
  #
239
216
  # Returns
240
217
  # AWS::SQS client
241
218
  #
242
219
  # Example
220
+ # sqs(Smash::CloudPowers::AwsStubs.queue_stub(name: 'someQueue'))
243
221
  # create_queue('someQueue') # uses AWS::SQS
244
- # some_queue_url = queue_search('someQueue').first # uses AWS::SQS
222
+ # # => 'https://sqs.us-west-2.amazonaws.com/12345678/someQueue'
223
+ #
224
+ # Notes
225
+ # * defaults can't be overriden or don't have good support for
226
+ # for it yet but you can use this hash as a guide
227
+ # for your own custom configuration
245
228
  def self.queue_stub(opts = {})
246
229
  {
247
230
  stub_responses: {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud_powers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7.5
4
+ version: 0.2.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Phillipps