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.
62 63 64 65 66 |
# File 'lib/bosh/director/jobs/ssh.rb', line 62 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.
60 61 62 |
# File 'lib/bosh/director/jobs/ssh.rb', line 60 def ids @ids end |
#indexes ⇒ Object (readonly)
Returns the value of attribute indexes.
60 61 62 |
# File 'lib/bosh/director/jobs/ssh.rb', line 60 def indexes @indexes end |
#job ⇒ Object (readonly)
Returns the value of attribute job.
60 61 62 |
# File 'lib/bosh/director/jobs/ssh.rb', line 60 def job @job end |
Instance Method Details
#id_filter ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/bosh/director/jobs/ssh.rb', line 76 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
68 69 70 |
# File 'lib/bosh/director/jobs/ssh.rb', line 68 def ids_provided? @ids && @ids.size > 0 end |
#indexes_provided? ⇒ Boolean
72 73 74 |
# File 'lib/bosh/director/jobs/ssh.rb', line 72 def indexes_provided? @indexes && @indexes.size > 0 end |