Class: Fog::Compute::LibvirtUtil::URI
- Inherits:
-
Object
- Object
- Fog::Compute::LibvirtUtil::URI
- Defined in:
- lib/fog/libvirt/models/compute/util/uri.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #command ⇒ Object
- #driver ⇒ Object
- #host ⇒ Object
-
#initialize(uri) ⇒ URI
constructor
A new instance of URI.
- #keyfile ⇒ Object
- #name ⇒ Object
- #netcat ⇒ Object
- #no_tty? ⇒ Boolean
- #no_verify? ⇒ Boolean
- #password ⇒ Object
- #pkipath ⇒ Object
- #port ⇒ Object
- #remote? ⇒ Boolean
- #scheme ⇒ Object
- #socket ⇒ Object
- #ssh_enabled? ⇒ Boolean
-
#transport ⇒ Object
Transport will be part of the scheme The part after the plus sign f.i.
- #tty? ⇒ Boolean
- #user ⇒ Object
- #verify? ⇒ Boolean
Constructor Details
#initialize(uri) ⇒ URI
Returns a new instance of URI.
12 13 14 15 16 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 12 def initialize(uri) @parsed_uri=::URI.parse(uri) @uri=uri return self end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
10 11 12 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 10 def uri @uri end |
Instance Method Details
#command ⇒ Object
71 72 73 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 71 def command value("command") end |
#driver ⇒ Object
32 33 34 35 36 37 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 32 def driver scheme=@parsed_uri.scheme return nil if scheme.nil? return scheme.split(/\+/).first end |
#host ⇒ Object
55 56 57 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 55 def host @parsed_uri.host end |
#keyfile ⇒ Object
79 80 81 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 79 def keyfile value("command") end |
#name ⇒ Object
67 68 69 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 67 def name value("name") end |
#netcat ⇒ Object
83 84 85 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 83 def netcat value("netcat") end |
#no_tty? ⇒ Boolean
102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 102 def no_tty? no_tty=value("no_tty") return false if no_tty.nil? if no_tty=="0" return false else return true end end |
#no_verify? ⇒ Boolean
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 87 def no_verify? no_verify=value("no_verify") return false if no_verify.nil? if no_verify.to_s=="0" return false else return true end end |
#password ⇒ Object
63 64 65 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 63 def password @parsed_uri.password end |
#pkipath ⇒ Object
119 120 121 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 119 def pkipath value("pkipath") end |
#port ⇒ Object
59 60 61 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 59 def port @parsed_uri.port end |
#remote? ⇒ Boolean
47 48 49 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 47 def remote? return !transport.nil? end |
#scheme ⇒ Object
28 29 30 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 28 def scheme return @parsed_uri.scheme end |
#socket ⇒ Object
75 76 77 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 75 def socket value("socket") end |
#ssh_enabled? ⇒ Boolean
39 40 41 42 43 44 45 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 39 def ssh_enabled? if remote? return transport.include?("ssh") else return false end end |
#transport ⇒ Object
Transport will be part of the scheme The part after the plus sign f.i. qemu+ssh
21 22 23 24 25 26 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 21 def transport scheme=@parsed_uri.scheme return nil if scheme.nil? return scheme.split(/\+/)[1] end |
#tty? ⇒ Boolean
115 116 117 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 115 def tty? return !no_tty? end |
#user ⇒ Object
51 52 53 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 51 def user @parsed_uri.user end |
#verify? ⇒ Boolean
98 99 100 |
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 98 def verify? return !no_verify? end |