Class: PcfPause::OpsManInfo
- Inherits:
-
Object
- Object
- PcfPause::OpsManInfo
- Defined in:
- lib/pcf_pause/ops_man_info.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #get_director_manifest ⇒ Object
- #get_manifest(product_id) ⇒ Object
- #get_product_id(type) ⇒ Object
- #get_products ⇒ Object
- #get_vm_credentials(product_id) ⇒ Object
- #get_vm_names(product_id) ⇒ Object
-
#initialize(url, username, password) ⇒ OpsManInfo
constructor
A new instance of OpsManInfo.
Constructor Details
#initialize(url, username, password) ⇒ OpsManInfo
Returns a new instance of OpsManInfo.
19 20 21 22 |
# File 'lib/pcf_pause/ops_man_info.rb', line 19 def initialize(url, username, password) @url = url @token = auth_header(username, password) end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
17 18 19 |
# File 'lib/pcf_pause/ops_man_info.rb', line 17 def token @token end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
17 18 19 |
# File 'lib/pcf_pause/ops_man_info.rb', line 17 def url @url end |
Instance Method Details
#get_director_manifest ⇒ Object
46 47 48 |
# File 'lib/pcf_pause/ops_man_info.rb', line 46 def get_director_manifest get_info 'deployed/director/manifest' end |
#get_manifest(product_id) ⇒ Object
28 29 30 |
# File 'lib/pcf_pause/ops_man_info.rb', line 28 def get_manifest(product_id) get_info "deployed/products/#{product_id}/manifest" end |
#get_product_id(type) ⇒ Object
50 51 52 |
# File 'lib/pcf_pause/ops_man_info.rb', line 50 def get_product_id(type) get_products.detect { |product_info| product_info['type'] == type }['guid'] end |
#get_products ⇒ Object
24 25 26 |
# File 'lib/pcf_pause/ops_man_info.rb', line 24 def get_products get_info 'deployed/products/' end |
#get_vm_credentials(product_id) ⇒ Object
32 33 34 |
# File 'lib/pcf_pause/ops_man_info.rb', line 32 def get_vm_credentials(product_id) get_info "deployed/products/#{product_id}/vm_credentials" end |
#get_vm_names(product_id) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/pcf_pause/ops_man_info.rb', line 36 def get_vm_names(product_id) manifest = get_manifest(product_id) key = if manifest.has_key?('jobs') # 1.7 manifest 'jobs' else 'instance_groups' end manifest[key].map { |vm| vm['name'] } end |