aws_account_utils 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cdc1bfeb1376e9bffa076150d73b0962bd9bb69
4
- data.tar.gz: 5901819531b21ed4a3d5f5bbaa6f9deafbd1c44a
3
+ metadata.gz: 85f32a777448e44c4427fba054cd2538709eec5e
4
+ data.tar.gz: fe866c5493265e7cc1cc0dbe0fb242bb34befa38
5
5
  SHA512:
6
- metadata.gz: 5bb6b0094d7e5b269c3f541a4c425989bbe695f6908f4fe1d11611f2ae9e72ccd04d7f6ff298f61ecdad80471e68b9f96e458c5a5df8f3b5caa58caf277e63c0
7
- data.tar.gz: 6939a40b12e209fa685c09accb8bf36ddf87e498616f10852d7842b3b194d3d2d1a974e53a8eb4d2fff173917fc90b47c6a8655365c11461aa4b6964cd6539b9
6
+ metadata.gz: 4f543711bf33001e2ad630f5448fe2fa8adce4a6811fdcc14f00b0c3276532985a368e860f6991679dfdc204026cbe25377f512abd26e1addaac6978fad01ee3
7
+ data.tar.gz: 8cca8925fed7092ce42273039e6975875737917c12240d7c4aa081781318e0c866a52bcfdcec66c0746ee8376ddc9e4688e5fbf119f0ad1b895d8c94ad20d39d
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,7 @@
1
+ ## v0.1.3
2
+
3
+ * Added close account method
4
+
5
+ ## v0.1.0
6
+
7
+ * First release
data/Gemfile CHANGED
@@ -2,3 +2,9 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in aws_account_utils.gemspec
4
4
  gemspec
5
+
6
+ group :test do
7
+ gem 'rspec'
8
+ gem 'simplecov', require: false
9
+ gem 'coveralls', require: false
10
+ end
data/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ [![Build Status](https://travis-ci.org/intuit/aws_account_utils.svg?branch=feature_delete_account)](https://travis-ci.org/intuit/aws_account_utils)
2
+ [![Coverage Status](https://coveralls.io/repos/intuit/aws_account_utils/badge.svg?branch=feature_delete_account&service=github)](https://coveralls.io/github/intuit/aws_account_utils)
3
+ [![Gem Version](https://badge.fury.io/rb/aws_account_utils.svg)](https://badge.fury.io/rb/aws_account_utils)
4
+ [![Code Climate](https://codeclimate.com/github/intuit/aws_account_utils.png)](https://codeclimate.com/github/intuit/aws_account_utils)
5
+
1
6
  # AwsAccountUtils
2
7
 
3
8
  A collection of helpers for creating and modifying AWS account details that can not be done using any existing AWS API
@@ -6,6 +11,8 @@ Special Note: the `create_account` operation requires that your IP be white-list
6
11
 
7
12
  ## Installation
8
13
 
14
+ NOTE: Ruby 2.2 is required!
15
+
9
16
  Add this line to your application's Gemfile:
10
17
 
11
18
  ```ruby
data/Rakefile CHANGED
@@ -1 +1,3 @@
1
- require "bundler/gem_tasks"
1
+ require 'rspec/core/rake_task'
2
+ task :default => :spec
3
+ RSpec::Core::RakeTask.new
@@ -18,7 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency 'bundler', '~> 1.9'
21
+ spec.required_ruby_version = '~> 2.1'
22
+
23
+ spec.add_development_dependency 'bundler', '>= 1.6.5'
22
24
  spec.add_development_dependency 'webmock', '~> 1.21', '>= 1.21.0'
23
25
  spec.add_development_dependency 'guard-rspec', '~> 4.3', '>= 4.3.1'
24
26
  spec.add_development_dependency 'simplecov', '~> 0.8', '>= 0.8.2'
@@ -1,3 +1,4 @@
1
+ require 'aws_account_utils/account'
1
2
  require 'aws_account_utils/base'
2
3
  require 'aws_account_utils/version'
3
4
  require 'aws_account_utils/account_logger'
@@ -53,6 +54,14 @@ module AwsAccountUtils
53
54
  browser.close rescue nil
54
55
  end
55
56
 
57
+ def close_account(account_email:, account_password:)
58
+ resp = account.close(account_email, account_password)
59
+ logger.info 'Closed Account.' if resp
60
+ resp
61
+ ensure
62
+ browser.close rescue nil
63
+ end
64
+
56
65
  def confirm_consolidated_billing(account_email:, account_password:, confirmation_link:)
57
66
  resp = consolidated_billing.confirm account_email, account_password, confirmation_link
58
67
  logger.info 'Consolidated billing has been confirmed' if resp
@@ -162,6 +171,10 @@ module AwsAccountUtils
162
171
  @challenge_questions ||= ChallengeQuestions.new logger, browser
163
172
  end
164
173
 
174
+ def account
175
+ @account ||= Account.new logger, browser
176
+ end
177
+
165
178
  def consolidated_billing
166
179
  @consolidated_billing ||= ConsolidatedBilling.new logger, browser
167
180
  end
@@ -0,0 +1,44 @@
1
+ require 'aws_account_utils/base'
2
+ require 'aws_account_utils/login'
3
+
4
+ module AwsAccountUtils
5
+ class Account < Base
6
+ attr_reader :logger, :browser
7
+
8
+ def initialize(logger, browser)
9
+ @logger = logger
10
+ @browser = browser
11
+ end
12
+
13
+ def close(account_email, account_password)
14
+ logger.debug "Closing AWS account."
15
+
16
+ Login.new(logger, browser).execute url,
17
+ account_email,
18
+ account_password
19
+
20
+ browser.checkbox(:ng_model =>'isClosingAccount').when_present.set
21
+ screenshot(browser, "3")
22
+
23
+ browser.button(:text => /Close Account/).when_present.click
24
+ screenshot(browser, "2")
25
+
26
+ browser.wait_until{ browser.text.include? 'Are you sure you want to close your account?'}
27
+ browser.span(:text => /Close Account/).when_present.click
28
+ screenshot(browser, "3")
29
+
30
+ browser.p(:text => /Are you sure you want to close your account?/).wait_while_present
31
+
32
+ browser.wait_until{ browser.text.include? 'Account has been closed'}
33
+
34
+ rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e
35
+ screenshot(browser, "error")
36
+ raise StandardError, "#{self.class.name} - #{e}"
37
+ end
38
+
39
+ private
40
+ def url
41
+ 'https://console.aws.amazon.com/billing/home?#/account'
42
+ end
43
+ end
44
+ end
@@ -1,3 +1,3 @@
1
1
  module AwsAccountUtils
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -1,6 +1,7 @@
1
1
  require 'aws_account_utils/base'
2
2
  require 'watir-webdriver'
3
3
  Watir::HTMLElement.attributes << :ng_model
4
+ Watir::HTMLElement.attributes << :ng_click
4
5
 
5
6
  module AwsAccountUtils
6
7
  class WatirBrowser
@@ -45,6 +46,5 @@ module AwsAccountUtils
45
46
  def proxy
46
47
  @proxy ||= ENV['HTTP_PROXY']
47
48
  end
48
-
49
49
  end
50
50
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_account_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - keviny22
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-08 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.9'
19
+ version: 1.6.5
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.9'
26
+ version: 1.6.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: webmock
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -171,10 +171,11 @@ executables: []
171
171
  extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
- - ".codeclimate.yml"
174
+ - ".coveralls.yml"
175
175
  - ".gitignore"
176
176
  - ".ruby-gemset"
177
177
  - ".ruby-version"
178
+ - CHANGELOG.md
178
179
  - CODE_OF_CONDUCT.md
179
180
  - Gemfile
180
181
  - README.md
@@ -183,6 +184,7 @@ files:
183
184
  - bin/console
184
185
  - bin/setup
185
186
  - lib/aws_account_utils.rb
187
+ - lib/aws_account_utils/account.rb
186
188
  - lib/aws_account_utils/account_logger.rb
187
189
  - lib/aws_account_utils/account_registration.rb
188
190
  - lib/aws_account_utils/alternate_contacts.rb
@@ -210,9 +212,9 @@ require_paths:
210
212
  - lib
211
213
  required_ruby_version: !ruby/object:Gem::Requirement
212
214
  requirements:
213
- - - ">="
215
+ - - "~>"
214
216
  - !ruby/object:Gem::Version
215
- version: '0'
217
+ version: '2.1'
216
218
  required_rubygems_version: !ruby/object:Gem::Requirement
217
219
  requirements:
218
220
  - - ">="
@@ -1,50 +0,0 @@
1
- # This is a sample .codeclimate.yml configured for Engine analysis on Code
2
- # Climate Platform. For an overview of the Code Climate Platform, see here:
3
- # http://docs.codeclimate.com/article/300-the-codeclimate-platform
4
-
5
- # Under the engines key, you can configure which engines will analyze your repo.
6
- # Each key is an engine name. For each value, you need to specify enabled: true
7
- # to enable the engine as well as any other engines-specific configuration.
8
-
9
- # For more details, see here:
10
- # http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
11
-
12
- # For a list of all available engines, see here:
13
- # http://docs.codeclimate.com/article/296-engines-available-engines
14
-
15
- engines:
16
- # to turn on an engine, add it here and set enabled to `true`
17
- # to turn off an engine, set enabled to `false` or remove it
18
- rubocop:
19
- enabled: true
20
- golint:
21
- enabled: false
22
- gofmt:
23
- enabled: false
24
- eslint:
25
- enabled: false
26
- csslint:
27
- enabled: false
28
-
29
- # Engines can analyze files and report issues on them, but you can separately
30
- # decide which files will receive ratings based on those issues. This is
31
- # specified by path patterns under the ratings key.
32
-
33
- # For more details see here:
34
- # http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
35
-
36
- # Note: If the ratings key is not specified, this will result in a 0.0 GPA on your dashboard.
37
-
38
- ratings:
39
- paths:
40
- # - app/**
41
- - lib/**
42
- - "**.rb"
43
- # - "**.go"
44
-
45
- # You can globally exclude files from being analyzed by any engine using the
46
- # exclude_paths key.
47
-
48
- #exclude_paths:
49
- #- spec/**/*
50
- #- vendor/**/*