Class: Zanzibar::Actions::Get
Overview
Fetch a single secret
Instance Attribute Summary collapse
-
#scrt_id ⇒ Object
The id of the secret to download.
-
#zanibar_options ⇒ Object
The options to use when initializing our Zanzibar client.
Attributes inherited from Base
Instance Method Summary collapse
-
#construct_options ⇒ Object
Coalesce our options and some defaults to ensure we are ready to run.
-
#construct_wsdl ⇒ Object
Construct a WSDL URL from the server hostname if necessary.
-
#ensure_options ⇒ Object
Make sure a proper WSDL was constructed.
-
#fetch_secret(scrt_id) ⇒ Object
Actually download the secret.
-
#initialize(ui, options, scrt_id) ⇒ Get
constructor
Initialize the action.
-
#run ⇒ Object
Ensure we have the options we need and download the secret.
Constructor Details
#initialize(ui, options, scrt_id) ⇒ Get
Initialize the action
20 21 22 23 24 |
# File 'lib/zanzibar/actions/get.rb', line 20 def initialize(ui, , scrt_id) super(ui, ) @scrt_id = scrt_id = {} end |
Instance Attribute Details
#scrt_id ⇒ Object
The id of the secret to download
16 17 18 |
# File 'lib/zanzibar/actions/get.rb', line 16 def scrt_id @scrt_id end |
#zanibar_options ⇒ Object
The options to use when initializing our Zanzibar client
12 13 14 |
# File 'lib/zanzibar/actions/get.rb', line 12 def end |
Instance Method Details
#construct_options ⇒ Object
Coalesce our options and some defaults to ensure we are ready to run
50 51 52 53 54 55 56 57 58 |
# File 'lib/zanzibar/actions/get.rb', line 50 def [:wsdl] = construct_wsdl [:globals] = { ssl_verify_mode: :none } if ['ignoressl'] [:domain] = ['domain'] [:username] = ['username'] unless ['username'].nil? [:domain] = ['domain'] ? ['domain'] : 'local' [:fieldlabel] = ['fieldlabel'] || 'Password' [:filelabel] = ['filelabel'] if ['filelabel'] end |
#construct_wsdl ⇒ Object
Construct a WSDL URL from the server hostname if necessary
62 63 64 65 66 67 68 |
# File 'lib/zanzibar/actions/get.rb', line 62 def construct_wsdl if ['wsdl'].nil? && ['server'] DEFAULT_WSDL % ['server'] else ['wsdl'] end end |
#ensure_options ⇒ Object
Make sure a proper WSDL was constructed
72 73 74 75 |
# File 'lib/zanzibar/actions/get.rb', line 72 def return if [:wsdl] raise Error, NO_WSDL_ERROR end |
#fetch_secret(scrt_id) ⇒ Object
Actually download the secret
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/zanzibar/actions/get.rb', line 37 def fetch_secret(scrt_id) scrt = ::::.new() if [:filelabel] scrt.download_secret_file(scrt_id: scrt_id, type: [:filelabel]) else scrt.get_fieldlabel_value(scrt_id, [:fieldlabel]) end end |
#run ⇒ Object
Ensure we have the options we need and download the secret
28 29 30 31 32 33 |
# File 'lib/zanzibar/actions/get.rb', line 28 def run fetch_secret(@scrt_id) end |