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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ URI

Returns a new instance of URI.



13
14
15
16
17
# File 'lib/fog/libvirt/models/compute/uri.rb', line 13

def initialize(uri)
  @parsed_uri=::URI.parse(uri)
  @uri=uri
  return self
end

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



11
12
13
# File 'lib/fog/libvirt/models/compute/uri.rb', line 11

def uri
  @uri
end

Instance Method Details

#commandObject



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

def command
  value("command")
end

#driverObject



33
34
35
36
37
38
# File 'lib/fog/libvirt/models/compute/uri.rb', line 33

def driver
  scheme=@parsed_uri.scheme
  return nil if scheme.nil?

  return scheme.split(/\+/).first
end

#hostObject



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

def host
  @parsed_uri.host
end

#keyfileObject



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

def keyfile
  value("command")
end

#nameObject



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

def name
  value("name")
end

#netcatObject



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

def netcat
  value("netcat")
end

#no_tty?Boolean

Returns:

  • (Boolean)


103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/fog/libvirt/models/compute/uri.rb', line 103

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)


88
89
90
91
92
93
94
95
96
97
# File 'lib/fog/libvirt/models/compute/uri.rb', line 88

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



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

def password
  @parsed_uri.password
end

#pkipathObject



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

def pkipath
  value("pkipath")
end

#portObject



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

def port
  @parsed_uri.port
end

#remote?Boolean

Returns:

  • (Boolean)


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

def remote?
  return !transport.nil?
end

#schemeObject



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

def scheme
  return @parsed_uri.scheme
end

#socketObject



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

def socket
  value("socket")
end

#ssh_enabled?Boolean

Returns:

  • (Boolean)


40
41
42
43
44
45
46
# File 'lib/fog/libvirt/models/compute/uri.rb', line 40

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



22
23
24
25
26
27
# File 'lib/fog/libvirt/models/compute/uri.rb', line 22

def transport
  scheme=@parsed_uri.scheme
  return nil if scheme.nil?

  return scheme.split(/\+/)[1]
end

#tty?Boolean

Returns:

  • (Boolean)


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

def tty?
  return !no_tty?
end

#userObject



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

def user
  @parsed_uri.user
end

#verify?Boolean

Returns:

  • (Boolean)


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

def verify?
  return !no_verify?
end