Class: Bosh::Director::Jobs::Ssh::Target
- Defined in:
- lib/bosh/director/jobs/ssh.rb
Instance Attribute Summary collapse
-
#ids ⇒ Object
readonly
Returns the value of attribute ids.
-
#indexes ⇒ Object
readonly
Returns the value of attribute indexes.
-
#job ⇒ Object
readonly
Returns the value of attribute job.
Instance Method Summary collapse
- #id_filter ⇒ Object
- #ids_provided? ⇒ Boolean
- #indexes_provided? ⇒ Boolean
-
#initialize(target_payload) ⇒ Target
constructor
A new instance of Target.
Constructor Details
#initialize(target_payload) ⇒ Target
Returns a new instance of Target.
85 86 87 88 89 |
# File 'lib/bosh/director/jobs/ssh.rb', line 85 def initialize(target_payload) @job = target_payload['job'] @ids = target_payload['ids'] @indexes = target_payload['indexes'] end |
Instance Attribute Details
#ids ⇒ Object (readonly)
Returns the value of attribute ids.
83 84 85 |
# File 'lib/bosh/director/jobs/ssh.rb', line 83 def ids @ids end |
#indexes ⇒ Object (readonly)
Returns the value of attribute indexes.
83 84 85 |
# File 'lib/bosh/director/jobs/ssh.rb', line 83 def indexes @indexes end |
#job ⇒ Object (readonly)
Returns the value of attribute job.
83 84 85 |
# File 'lib/bosh/director/jobs/ssh.rb', line 83 def job @job end |
Instance Method Details
#id_filter ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/bosh/director/jobs/ssh.rb', line 99 def id_filter if !ids_provided? && indexes_provided? # for backwards compatibility with old cli return {index: @indexes} end filter = Hash.new { |h,k| h[k] = [] } @ids.each do |id| if id.to_s =~ /^\d+$/ filter[:index] << id.to_i else filter[:uuid] << id end end filter end |
#ids_provided? ⇒ Boolean
91 92 93 |
# File 'lib/bosh/director/jobs/ssh.rb', line 91 def ids_provided? @ids && @ids.size > 0 end |
#indexes_provided? ⇒ Boolean
95 96 97 |
# File 'lib/bosh/director/jobs/ssh.rb', line 95 def indexes_provided? @indexes && @indexes.size > 0 end |