Class: ESXThumbPrint
- Inherits:
-
ThumbPrint
- Object
- ThumbPrint
- ESXThumbPrint
- Defined in:
- lib/VMwareWebService/esx_thumb_print.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from ThumbPrint
#cert, #der_thumb_print, #host, #http, #thumb_print, #x509_cert
Instance Method Summary collapse
- #http_request ⇒ Object
-
#initialize(host, user, password) ⇒ ESXThumbPrint
constructor
A new instance of ESXThumbPrint.
- #to_cert ⇒ Object
- #uri ⇒ Object
Methods inherited from ThumbPrint
Constructor Details
#initialize(host, user, password) ⇒ ESXThumbPrint
Returns a new instance of ESXThumbPrint.
6 7 8 9 10 |
# File 'lib/VMwareWebService/esx_thumb_print.rb', line 6 def initialize(host, user, password) @user = user @password = password super(host) end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
4 5 6 |
# File 'lib/VMwareWebService/esx_thumb_print.rb', line 4 def password @password end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'lib/VMwareWebService/esx_thumb_print.rb', line 4 def user @user end |
Instance Method Details
#http_request ⇒ Object
17 18 19 20 21 22 |
# File 'lib/VMwareWebService/esx_thumb_print.rb', line 17 def http_request super @request = Net::HTTP::Get.new(uri.request_uri) @request.basic_auth(@user, @password) @request end |
#to_cert ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/VMwareWebService/esx_thumb_print.rb', line 24 def to_cert raise "Invalid Request" if @request.nil? response = @http.request(@request) unless response. == "OK" && response.code == "200" raise "Unable to get ESX Host SSL Certificate: Invalid HTTP Response #{response.} code #{response.code}" end response.body end |
#uri ⇒ Object
12 13 14 15 |
# File 'lib/VMwareWebService/esx_thumb_print.rb', line 12 def uri url = "https://#{@host}/host/ssl_cert" @uri = URI(url) end |