Class: OvirtSDK4::TemplateDiskService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::TemplateDiskService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (Object) copy(opts = {})
Executes the
copy
method. -
- (Object) export(opts = {})
Executes the
export
method. -
- (Disk) get(opts = {})
Returns the representation of the object managed by this service.
-
- (Object) remove(opts = {})
Deletes the object managed by this service.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (Object) copy(opts = {})
Executes the copy
method.
21872 21873 21874 21875 21876 21877 21878 21879 21880 21881 21882 21883 21884 21885 21886 21887 21888 21889 21890 |
# File 'lib/ovirtsdk4/services.rb', line 21872 def copy(opts = {}) action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = Request.new({ :method => :POST, :path => "#{@path}/copy", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (Object) export(opts = {})
Executes the export
method.
21895 21896 21897 21898 21899 21900 21901 21902 21903 21904 21905 21906 21907 21908 21909 21910 21911 21912 21913 |
# File 'lib/ovirtsdk4/services.rb', line 21895 def export(opts = {}) action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = Request.new({ :method => :POST, :path => "#{@path}/export", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (Disk) get(opts = {})
Returns the representation of the object managed by this service.
21922 21923 21924 21925 21926 21927 21928 21929 21930 21931 21932 21933 21934 21935 21936 21937 |
# File 'lib/ovirtsdk4/services.rb', line 21922 def get(opts = {}) query = {} request = Request.new(:method => :GET, :path => @path, :query => query) response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return DiskReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
21946 21947 21948 21949 21950 21951 21952 21953 21954 21955 21956 21957 21958 |
# File 'lib/ovirtsdk4/services.rb', line 21946 def remove(opts = {}) query = {} value = opts[:async] unless value.nil? value = Writer.render_boolean(value) query['async'] = value end request = Request.new(:method => :DELETE, :path => @path, :query => query) response = @connection.send(request) unless response.code == 200 check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
21967 21968 21969 21970 21971 21972 |
# File 'lib/ovirtsdk4/services.rb', line 21967 def service(path) if path.nil? || path == '' return self end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
- (String) to_s
Returns an string representation of this service.
21979 21980 21981 |
# File 'lib/ovirtsdk4/services.rb', line 21979 def to_s return "#<#{TemplateDiskService}:#{@path}>" end |