Class: AwsAccountUtils::RootAccessKeys

Inherits:
Base
  • Object
show all
Defined in:
lib/aws_account_utils/root_access_keys.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#screenshot

Constructor Details

#initialize(logger, browser) ⇒ RootAccessKeys

Returns a new instance of RootAccessKeys.



7
8
9
10
# File 'lib/aws_account_utils/root_access_keys.rb', line 7

def initialize(logger, browser)
  @logger = logger
  @browser = browser
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



5
6
7
# File 'lib/aws_account_utils/root_access_keys.rb', line 5

def browser
  @browser
end

#loggerObject (readonly)

Returns the value of attribute logger.



5
6
7
# File 'lib/aws_account_utils/root_access_keys.rb', line 5

def logger
  @logger
end

Instance Method Details

#create(account_email, account_password) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/aws_account_utils/root_access_keys.rb', line 12

def create(, )
  logger.debug "Creating root access/secret key"
  Login.new(logger, browser).execute url,
                                     ,
                                     
  clear_warning if browser.div(:id => 'modal-content', :text => warning_text)
  browser.i(:xpath => "id('credaccordion')/div[3]/div[1]/div/div[1]/i").when_present.click
  browser.button(:text => /Create New Access Key/).when_present.click
  browser.a(:text => /Show Access Key/).when_present.click
  screenshot(browser, "1")
  parse_keys browser.text
rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e
  screenshot(browser, "error")
  raise StandardError, "#{self.class.name} - #{e}"
end

#delete(account_email, account_password) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/aws_account_utils/root_access_keys.rb', line 28

def delete(, )
  logger.debug "Deleting root access/secret key"
  Login.new(logger, browser).execute url,
                                     ,
                                     
  clear_warning if browser.div(:id => 'modal-content', :text => warning_text)
  browser.i(:xpath => "id('credaccordion')/div[3]/div[1]/div/div[1]/i").when_present.click
  keys_to_delete? ? delete_all_keys : true
rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e
  screenshot(browser, "error")
  raise StandardError, "#{self.class.name} - #{e}"
end