aws_account_utils 0.1.3 → 0.1.4
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 +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/LICENSE +20 -0
- data/README.md +37 -3
- data/Rakefile +1 -0
- data/aws_account_utils.gemspec +1 -1
- data/lib/aws_account_utils.rb +16 -2
- data/lib/aws_account_utils/company_name.rb +35 -0
- data/lib/aws_account_utils/version.rb +1 -1
- data/lib/aws_account_utils/watir_browser.rb +7 -3
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd2fc4b4d415b2a0e009fc0c45ca4229f35b52df
|
4
|
+
data.tar.gz: 6e00bc736c4a4936d7a2e24600209907d03be45d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee23f14287d6477ee440318f4916b239d5388e49dd3a9062d48aad7efdcccb91ae3f9f59e84973c66c678e63ebb063b339de38316c911372c5af19652c74772e
|
7
|
+
data.tar.gz: 100c953341ea98e55f613609f7106758835db7be61d7744ff632289cb4b95823531c4c050c5e804d700154ee5cfe422dcf03e17eebbcb3ca693361afad656adb
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.3
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2015 Intuit Inc
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[](https://gitter.im/intuit/aws_account_utils?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
1
2
|
[](https://travis-ci.org/intuit/aws_account_utils)
|
2
3
|
[](https://coveralls.io/github/intuit/aws_account_utils)
|
3
4
|
[](https://badge.fury.io/rb/aws_account_utils)
|
@@ -5,6 +6,8 @@
|
|
5
6
|
|
6
7
|
# AwsAccountUtils
|
7
8
|
|
9
|
+
[](https://gitter.im/intuit/aws_account_utils?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
10
|
+
|
8
11
|
A collection of helpers for creating and modifying AWS account details that can not be done using any existing AWS API
|
9
12
|
|
10
13
|
Special Note: the `create_account` operation requires that your IP be white-listed by AWS in order to bypass the CAPTCHA
|
@@ -34,8 +37,8 @@ Overview
|
|
34
37
|
|
35
38
|
If you are required to go through a proxy, the following should be set prior to execution.
|
36
39
|
```
|
37
|
-
export
|
38
|
-
export
|
40
|
+
export AWS_ACCOUNT_UTILS_HTTP_PROXY=myproxyhots.com
|
41
|
+
export AWS_ACCOUNT_UTILS_HTTP_PROXY_PORT=80
|
39
42
|
```
|
40
43
|
|
41
44
|
```ruby
|
@@ -62,6 +65,7 @@ aws_utils = AwsAccountUtils::AwsAccountUtils.new(
|
|
62
65
|
* [request_consolidated_billing](#request_consolidated_billing)
|
63
66
|
* [set_alternate_contacts](#set_alternate_contacts)
|
64
67
|
* [set_challenge_questions](#set_challenge_questions)
|
68
|
+
* [set_company_name](#set_company_name)
|
65
69
|
|
66
70
|
create_account
|
67
71
|
------------
|
@@ -95,7 +99,7 @@ resp #=> String
|
|
95
99
|
account_name: (required, String) - The account name to associate with this new account
|
96
100
|
account_email: (required, String) - The email to associate with this new account
|
97
101
|
account_password: (required, String) - The password to use with this new account
|
98
|
-
account_details: (required, Hash) - Hash of account
|
102
|
+
account_details: (required, Hash) - Hash of account details
|
99
103
|
```
|
100
104
|
|
101
105
|
**Returns:**
|
@@ -465,6 +469,36 @@ answers: (optional, Hash) - A hash of answers to fill in for the security questi
|
|
465
469
|
|
466
470
|
---
|
467
471
|
|
472
|
+
set_company_name
|
473
|
+
------------
|
474
|
+
|
475
|
+
> Sets company name for the account (any time after account is created)
|
476
|
+
|
477
|
+
`set_company_name(account_email:, account_password:, company_name:)`
|
478
|
+
|
479
|
+
**Examples:**
|
480
|
+
```Ruby
|
481
|
+
|
482
|
+
resp = aws_utils.set_alternate_contacts(account_email: 'adfefef@gmail.com',
|
483
|
+
account_password: 'foobar1212121,
|
484
|
+
name: 'The Munsters, Inc.')
|
485
|
+
resp #=> True/False
|
486
|
+
```
|
487
|
+
|
488
|
+
**Parameters:**
|
489
|
+
```
|
490
|
+
account_email: (required, String) - The email address to use with this account
|
491
|
+
account_password: (required, String) - The password to use with this account
|
492
|
+
contact_info: (required, String) - The company name to add to this account
|
493
|
+
|
494
|
+
```
|
495
|
+
|
496
|
+
**Returns:**
|
497
|
+
|
498
|
+
`#return => Boolean`
|
499
|
+
|
500
|
+
---
|
501
|
+
|
468
502
|
## Development
|
469
503
|
|
470
504
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
data/aws_account_utils.gemspec
CHANGED
@@ -18,7 +18,7 @@ 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.required_ruby_version = '~> 2.
|
21
|
+
spec.required_ruby_version = '~> 2.2'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler', '>= 1.6.5'
|
24
24
|
spec.add_development_dependency 'webmock', '~> 1.21', '>= 1.21.0'
|
data/lib/aws_account_utils.rb
CHANGED
@@ -13,6 +13,7 @@ require 'aws_account_utils/consolidated_billing'
|
|
13
13
|
require 'aws_account_utils/root_access_keys'
|
14
14
|
require 'aws_account_utils/password'
|
15
15
|
require 'aws_account_utils/alternate_contacts'
|
16
|
+
require 'aws_account_utils/company_name'
|
16
17
|
require 'aws_account_utils/logout'
|
17
18
|
|
18
19
|
module AwsAccountUtils
|
@@ -148,12 +149,21 @@ module AwsAccountUtils
|
|
148
149
|
raise ArgumentError, "contact_info: must be a hash." unless contact_info.is_a?(Hash)
|
149
150
|
|
150
151
|
resp = alternate_contacts.set account_email, account_password, contact_info
|
151
|
-
logger.info 'Set
|
152
|
+
logger.info 'Set alternate contacts.' if resp
|
152
153
|
resp
|
153
154
|
ensure
|
154
155
|
browser.close rescue nil
|
155
156
|
end
|
156
157
|
|
158
|
+
def set_company_name(account_email:, account_password:, name:)
|
159
|
+
resp = company_name.set account_email, account_password, name
|
160
|
+
logger.info 'Set company name.' if resp
|
161
|
+
resp
|
162
|
+
ensure
|
163
|
+
browser.close rescue nil
|
164
|
+
end
|
165
|
+
|
166
|
+
|
157
167
|
private
|
158
168
|
def account_registration
|
159
169
|
@account_registration ||= AccountRegistration.new logger, browser
|
@@ -163,6 +173,10 @@ module AwsAccountUtils
|
|
163
173
|
@alternate_contacts ||= AlternateContacts.new logger, browser
|
164
174
|
end
|
165
175
|
|
176
|
+
def company_name
|
177
|
+
@company_name ||= CompanyName.new logger, browser
|
178
|
+
end
|
179
|
+
|
166
180
|
def browser
|
167
181
|
@browser ||= WatirBrowser.new(logger).create
|
168
182
|
end
|
@@ -211,4 +225,4 @@ module AwsAccountUtils
|
|
211
225
|
@logout ||= Logout.new logger, browser
|
212
226
|
end
|
213
227
|
end
|
214
|
-
end
|
228
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'aws_account_utils/base'
|
2
|
+
require 'aws_account_utils/login'
|
3
|
+
|
4
|
+
module AwsAccountUtils
|
5
|
+
class CompanyName < Base
|
6
|
+
attr_reader :logger, :browser
|
7
|
+
|
8
|
+
def initialize(logger, browser)
|
9
|
+
@logger = logger
|
10
|
+
@browser = browser
|
11
|
+
end
|
12
|
+
|
13
|
+
def set(account_email, account_password, company_name)
|
14
|
+
logger.debug "Updating Company Name details."
|
15
|
+
Login.new(logger, browser).execute url,
|
16
|
+
account_email,
|
17
|
+
account_password
|
18
|
+
browser.a(:xpath => '//a[@ng-click="toggleEditingContactInfoState()"]').when_present.click
|
19
|
+
browser.input(:xpath => '//input[@ng-model="address.company"]').to_subtype.set(company_name)
|
20
|
+
# screenshot(browser, "1")
|
21
|
+
browser.button(:xpath => '//button[@ng-click="updateContactInformation()"]').when_present.click
|
22
|
+
browser.div(:xpath => '//div[@ng-show="options.status == \'success\'"]').wait_until_present
|
23
|
+
true
|
24
|
+
rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e
|
25
|
+
screenshot(browser, "error")
|
26
|
+
raise StandardError, "#{self.class.name} - #{e}"
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
def url
|
31
|
+
'https://console.aws.amazon.com/billing/home?#/account'
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -35,16 +35,20 @@ module AwsAccountUtils
|
|
35
35
|
def proxy_settings
|
36
36
|
{
|
37
37
|
'http' => proxy,
|
38
|
-
'http_port' =>
|
38
|
+
'http_port' => proxy_port,
|
39
39
|
'ssl' => proxy,
|
40
|
-
'ssl_port' =>
|
40
|
+
'ssl_port' => proxy_port,
|
41
41
|
'no_proxies_on' => '127.0.0.1',
|
42
42
|
'type' => 1
|
43
43
|
}
|
44
44
|
end
|
45
45
|
|
46
46
|
def proxy
|
47
|
-
@proxy ||= ENV['
|
47
|
+
@proxy ||= ENV['AWS_ACCOUNT_UTILS_HTTP_PROXY']
|
48
|
+
end
|
49
|
+
|
50
|
+
def proxy_port
|
51
|
+
@proxy_port ||= ENV['AWS_ACCOUNT_UTILS_HTTP_PROXY_PORT']
|
48
52
|
end
|
49
53
|
end
|
50
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_account_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- keviny22
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -178,6 +178,7 @@ files:
|
|
178
178
|
- CHANGELOG.md
|
179
179
|
- CODE_OF_CONDUCT.md
|
180
180
|
- Gemfile
|
181
|
+
- LICENSE
|
181
182
|
- README.md
|
182
183
|
- Rakefile
|
183
184
|
- aws_account_utils.gemspec
|
@@ -190,6 +191,7 @@ files:
|
|
190
191
|
- lib/aws_account_utils/alternate_contacts.rb
|
191
192
|
- lib/aws_account_utils/base.rb
|
192
193
|
- lib/aws_account_utils/challenge_questions.rb
|
194
|
+
- lib/aws_account_utils/company_name.rb
|
193
195
|
- lib/aws_account_utils/consolidated_billing.rb
|
194
196
|
- lib/aws_account_utils/customer_information.rb
|
195
197
|
- lib/aws_account_utils/customize_url.rb
|
@@ -214,7 +216,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
216
|
requirements:
|
215
217
|
- - "~>"
|
216
218
|
- !ruby/object:Gem::Version
|
217
|
-
version: '2.
|
219
|
+
version: '2.2'
|
218
220
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
221
|
requirements:
|
220
222
|
- - ">="
|
@@ -222,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
224
|
version: '0'
|
223
225
|
requirements: []
|
224
226
|
rubyforge_project:
|
225
|
-
rubygems_version: 2.
|
227
|
+
rubygems_version: 2.4.5.1
|
226
228
|
signing_key:
|
227
229
|
specification_version: 4
|
228
230
|
summary: A set of helper methods for configuring aspects of AWS that do not have an
|