cloudstrap 0.30.3.pre → 0.30.11.pre

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: cc52292c5203623fd695f66cc5c2276b89064ad5
4
- data.tar.gz: e8244ba8ba5803e52b9ea733f85b3753ec71a57a
3
+ metadata.gz: af78d0f9db12b433e2a8886976d388be204d880b
4
+ data.tar.gz: 19666e8b0b9ce8ec5d8af47615673936039e135b
5
5
  SHA512:
6
- metadata.gz: 945880c50affe195293385818416f0d2ab15fc5516ec6751bdf281d703909c09c954ed601967be3620a6901e02254cac791988b25de73d8c6b93dc59c87b72e1
7
- data.tar.gz: 339b02c7a8221c7a8e11676ac719190e0169e9e56b149d01dfc5600426816980068e45b01dfd4f549b51efaedbb39d21589bfaa267f98aa831c0a542d9fd58e1
6
+ metadata.gz: e4190fbba94980ac361156dbc2f33f158bf56502c9784b071ef6a422fcd71e9964ded94984c5f9a3bd9d9c0ff20945a39c7888cc26e7676e35ed4173471262c5
7
+ data.tar.gz: 530b03724f25b4b169177eb3325fd1456056a513eae1a96ad791500ca3dc5312b88a48c37202a9a1c3522db1ca52c8f4d018942b4c2feaa47385d085da5c5dd0
@@ -377,6 +377,26 @@ module StackatoLKG
377
377
  .select { |tag| value.nil? || tag.value == value }
378
378
  end
379
379
 
380
+ Contract None => ArrayOf[::Aws::EC2::Types::Region]
381
+ def regions
382
+ @regions ||= regions!
383
+ end
384
+
385
+ Contract None => ArrayOf[::Aws::EC2::Types::Region]
386
+ def regions!
387
+ @regions = call_api(:describe_regions).regions
388
+ end
389
+
390
+ Contract None => ArrayOf[String]
391
+ def region_names
392
+ regions.map(&:region_name)
393
+ end
394
+
395
+ Contract String => Bool
396
+ def valid_region?(region_name)
397
+ region_names.include? region_name
398
+ end
399
+
380
400
  private
381
401
 
382
402
  def client
@@ -4,6 +4,7 @@ require 'securerandom'
4
4
 
5
5
  require_relative 'amazon'
6
6
  require_relative 'config'
7
+ require_relative 'errors'
7
8
  require_relative 'hdp/bootstrap_properties'
8
9
  require_relative 'ssh'
9
10
 
@@ -12,6 +13,18 @@ module StackatoLKG
12
13
  include ::Contracts::Core
13
14
  include ::Contracts::Builtin
14
15
 
16
+ Contract None => BootstrapAgent
17
+ def initialize
18
+ validate_configuration!
19
+ self
20
+ end
21
+
22
+ Contract None => Any
23
+ def validate_configuration! # TODO: Does this really belong in BootstrapAgent?
24
+ return if ec2.valid_region?(config.region)
25
+ raise ::Cloudstrap::ConfigurationError, "Region #{config.region} is not valid"
26
+ end
27
+
15
28
  Contract None => String
16
29
  def create_vpc
17
30
  cache.store(:vpc_id, ec2.create_vpc.vpc_id).tap do |vpc_id|
@@ -0,0 +1,4 @@
1
+ module Cloudstrap
2
+ class Error < ::RuntimeError; end
3
+ class ConfigurationError < Error; end
4
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.3.pre
4
+ version: 0.30.11.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Olstrom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-23 00:00:00.000000000 Z
11
+ date: 2016-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -210,6 +210,7 @@ files:
210
210
  - lib/cloudstrap/amazon/support/rate_limit_handler.rb
211
211
  - lib/cloudstrap/bootstrap_agent.rb
212
212
  - lib/cloudstrap/config.rb
213
+ - lib/cloudstrap/errors.rb
213
214
  - lib/cloudstrap/hdp/bootstrap_properties.rb
214
215
  - lib/cloudstrap/seed_properties.rb
215
216
  - lib/cloudstrap/ssh.rb