Class: PcfPause::OpsManInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/pcf_pause/ops_man_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#tokenObject (readonly)

Returns the value of attribute token.



17
18
19
# File 'lib/pcf_pause/ops_man_info.rb', line 17

def token
  @token
end

#urlObject (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_manifestObject



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_productsObject



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