Class: Fog::Compute::LibvirtUtil::URI

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/libvirt/models/compute/util/uri.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#uriObject (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

#commandObject



71
72
73
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 71

def command
  value("command")
end

#driverObject



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

#hostObject



55
56
57
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 55

def host
  @parsed_uri.host
end

#keyfileObject



79
80
81
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 79

def keyfile
  value("command")
end

#nameObject



67
68
69
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 67

def name
  value("name")
end

#netcatObject



83
84
85
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 83

def netcat
  value("netcat")
end

#no_tty?Boolean

Returns:

  • (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

Returns:

  • (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

#passwordObject



63
64
65
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 63

def password
  @parsed_uri.password
end

#pkipathObject



119
120
121
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 119

def pkipath
  value("pkipath")
end

#portObject



59
60
61
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 59

def port
  @parsed_uri.port
end

#remote?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 47

def remote?
  return !transport.nil?
end

#schemeObject



28
29
30
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 28

def scheme
  return @parsed_uri.scheme
end

#socketObject



75
76
77
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 75

def socket
  value("socket")
end

#ssh_enabled?Boolean

Returns:

  • (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

#transportObject

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

Returns:

  • (Boolean)


115
116
117
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 115

def tty?
  return !no_tty?
end

#userObject



51
52
53
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 51

def user
  @parsed_uri.user
end

#verify?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 98

def verify?
  return !no_verify?
end