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

- (URI) initialize(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

- (Object) uri (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

- (Object) command



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

def command
  value("command")
end

- (Object) driver



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

- (Object) host



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

def host
  @parsed_uri.host
end

- (Object) keyfile



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

def keyfile
  value("keyfile")
end

- (Object) name



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

def name
  value("name")
end

- (Object) netcat



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

def netcat
  value("netcat")
end

- (Boolean) no_tty?

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

- (Boolean) no_verify?

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

- (Object) password



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

def password
  @parsed_uri.password
end

- (Object) pkipath



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

def pkipath
  value("pkipath")
end

- (Object) port



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

def port
  @parsed_uri.port
end

- (Boolean) remote?

Returns:

  • (Boolean)


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

def remote?
  return !transport.nil?
end

- (Object) scheme



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

def scheme
  return @parsed_uri.scheme
end

- (Object) socket



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

def socket
  value("socket")
end

- (Boolean) ssh_enabled?

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

- (Object) transport

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

- (Boolean) tty?

Returns:

  • (Boolean)


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

def tty?
  return !no_tty?
end

- (Object) user



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

def user
  @parsed_uri.user
end

- (Boolean) verify?

Returns:

  • (Boolean)


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

def verify?
  return !no_verify?
end