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



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

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

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri



8
9
10
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 8

def uri
  @uri
end

Instance Method Details

#commandObject



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

def command
  value("command")
end

#driverObject



30
31
32
33
34
35
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 30

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

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

#hostObject



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

def host
  @parsed_uri.host
end

#keyfileObject



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

def keyfile
  value("keyfile")
end

#nameObject



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

def name
  value("name")
end

#netcatObject



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

def netcat
  value("netcat")
end

#no_tty?Boolean



100
101
102
103
104
105
106
107
108
109
110
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 100

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



85
86
87
88
89
90
91
92
93
94
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 85

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



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

def password
  @parsed_uri.password
end

#pkipathObject



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

def pkipath
  value("pkipath")
end

#portObject



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

def port
  @parsed_uri.port
end

#remote?Boolean



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

def remote?
  return !transport.nil?
end

#schemeObject



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

def scheme
  return @parsed_uri.scheme
end

#socketObject



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

def socket
  value("socket")
end

#ssh_enabled?Boolean



37
38
39
40
41
42
43
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 37

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



19
20
21
22
23
24
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 19

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

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

#tty?Boolean



112
113
114
# File 'lib/fog/libvirt/models/compute/util/uri.rb', line 112

def tty?
  return !no_tty?
end

#userObject



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

def user
  @parsed_uri.user
end

#verify?Boolean



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

def verify?
  return !no_verify?
end