Class: Zanzibar::Actions::Get
Overview
Fetch a single secret
Instance Attribute Summary collapse
-
#scrt_id ⇒ Object
Returns the value of attribute scrt_id.
-
#zanibar_options ⇒ Object
Returns the value of attribute zanibar_options.
Attributes inherited from Base
Instance Method Summary collapse
- #construct_options ⇒ Object
- #construct_wsdl ⇒ Object
- #ensure_options ⇒ Object
- #fetch_secret(scrt_id, label = nil) ⇒ Object
-
#initialize(ui, options, scrt_id) ⇒ Get
constructor
A new instance of Get.
- #run ⇒ Object
Constructor Details
#initialize(ui, options, scrt_id) ⇒ Get
Returns a new instance of Get.
13 14 15 16 17 |
# File 'lib/zanzibar/actions/get.rb', line 13 def initialize(ui, , scrt_id) super(ui, ) @scrt_id = scrt_id @zanzibar_options = {} end |
Instance Attribute Details
#scrt_id ⇒ Object
Returns the value of attribute scrt_id.
11 12 13 |
# File 'lib/zanzibar/actions/get.rb', line 11 def scrt_id @scrt_id end |
#zanibar_options ⇒ Object
Returns the value of attribute zanibar_options.
10 11 12 |
# File 'lib/zanzibar/actions/get.rb', line 10 def @zanibar_options end |
Instance Method Details
#construct_options ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/zanzibar/actions/get.rb', line 37 def @zanzibar_options[:wsdl] = construct_wsdl @zanzibar_options[:globals] = { ssl_verify_mode: :none } if ['ignoressl'] @zanzibar_options[:domain] = ['domain'] @zanzibar_options[:username] = ['username'] unless ['username'].nil? @zanzibar_options[:domain] = ['domain'] ? ['domain'] : 'local' end |
#construct_wsdl ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/zanzibar/actions/get.rb', line 45 def construct_wsdl if ['wsdl'].nil? && ['server'] DEFAULT_WSDL % ['server'] else ['wsdl'] end end |
#ensure_options ⇒ Object
53 54 55 56 |
# File 'lib/zanzibar/actions/get.rb', line 53 def return if @zanzibar_options[:wsdl] fail Error, NO_WSDL_ERROR end |
#fetch_secret(scrt_id, label = nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/zanzibar/actions/get.rb', line 26 def fetch_secret(scrt_id, label = nil) scrt = ::Zanzibar::Zanzibar.new(@zanzibar_options) if label scrt.download_secret_file(scrt_id: scrt_id, type: label) else scrt.get_password(scrt_id) end end |
#run ⇒ Object
19 20 21 22 23 24 |
# File 'lib/zanzibar/actions/get.rb', line 19 def run fetch_secret(@scrt_id, ['filelabel']) end |