Class: OpsManagerUiDrivers::Version17::Api
Instance Method Summary
collapse
#initialize
Instance Method Details
#deployed_product_guid_from_name(name) ⇒ Object
44
45
46
|
# File 'lib/ops_manager_ui_drivers/version17/api.rb', line 44
def deployed_product_guid_from_name(name)
get_deployed_products.find { |product| product['type'] == name }.try(:[], 'guid')
end
|
#director_vm_credentials ⇒ Object
34
35
36
37
38
|
# File 'lib/ops_manager_ui_drivers/version17/api.rb', line 34
def director_vm_credentials
response = JSON.parse(http.request(get("v0/deployed/director/credentials/vm_credentials", uaa_token.)).read_body)
response['credential']['value']
end
|
#export_installation ⇒ Object
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/ops_manager_ui_drivers/version17/api.rb', line 17
def export_installation
Tempfile.new('installation.zip').tap do |tmpfile|
http.request(get('v0/installation_asset_collection', uaa_token.)) do |response|
response.read_body do |chunk|
tmpfile.write(chunk)
end
end
tmpfile.close
end
end
|
#get_deployed_products ⇒ Object
40
41
42
|
# File 'lib/ops_manager_ui_drivers/version17/api.rb', line 40
def get_deployed_products
JSON.parse(http.request(get('v0/deployed/products', uaa_token.)).read_body)
end
|
#get_products ⇒ Object
13
14
15
|
# File 'lib/ops_manager_ui_drivers/version17/api.rb', line 13
def get_products
http.request(get('v0/available_products'), uaa_token.)
end
|
#most_recent_installation_log ⇒ Object
64
65
66
67
68
69
70
71
|
# File 'lib/ops_manager_ui_drivers/version17/api.rb', line 64
def most_recent_installation_log
return if most_recent_installation_id.empty?
installation_log_path = "v0/installations/#{most_recent_installation_id}/logs"
most_recent_installation_log = JSON.parse(http.request(get(installation_log_path, uaa_token.)).read_body)['logs']
most_recent_installation_log
end
|
#set_director_second_network(network_name) ⇒ Object
48
49
50
|
# File 'lib/ops_manager_ui_drivers/version17/api.rb', line 48
def set_director_second_network(network_name)
http.request(put('v0/staged/director/second_network', {second_network: {name: network_name}}.to_json, uaa_token.))
end
|
#set_feature_flag(flag_name, value) ⇒ Object
7
8
9
10
11
|
# File 'lib/ops_manager_ui_drivers/version17/api.rb', line 7
def set_feature_flag(flag_name, value)
feature_flag_path = File.join('feature_flags', flag_name)
http.request(put(feature_flag_path, enabled: value))
end
|
#state_change_success? ⇒ Boolean
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/ops_manager_ui_drivers/version17/api.rb', line 52
def state_change_success?
if most_recent_installation_id.empty?
return false
end
state = JSON.parse(
http.request(get("v0/installations/#{most_recent_installation_id}", uaa_token.)).read_body
)['status']
state == 'succeeded'
end
|
#vm_credentials(product_name, job_name) ⇒ Object
28
29
30
31
32
|
# File 'lib/ops_manager_ui_drivers/version17/api.rb', line 28
def vm_credentials(product_name, job_name)
product_guid = deployed_product_guid_from_name(product_name)
response = JSON.parse(http.request(get("v0/deployed/products/#{product_guid}/vm_credentials", uaa_token.)).read_body)
response.find { |credential| credential['name'].starts_with?(job_name) }
end
|