Class: OvirtSDK4::StorageDomainsService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::StorageDomainsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (StorageDomain) add(storage_domain, opts = {})
Adds a new
storage_domain
. -
- (Array<StorageDomain>) list(opts = {})
Returns the representation of the object managed by this service.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (StorageDomainService) storage_domain_service(id)
Locates the
storage_domain
service. -
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (StorageDomain) add(storage_domain, opts = {})
Adds a new storage_domain
.
19922 19923 19924 19925 19926 19927 19928 19929 19930 19931 19932 19933 19934 19935 19936 19937 19938 19939 19940 19941 19942 19943 19944 19945 19946 |
# File 'lib/ovirtsdk4/services.rb', line 19922 def add(storage_domain, opts = {}) if storage_domain.is_a?(Hash) storage_domain = OvirtSDK4::StorageDomain.new(storage_domain) end request = Request.new(:method => :POST, :path => @path) begin writer = XmlWriter.new(nil, true) StorageDomainWriter.write_one(storage_domain, writer, 'storage_domain') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 201, 202 begin reader = XmlReader.new(response.body) return StorageDomainReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Array<StorageDomain>) list(opts = {})
Returns the representation of the object managed by this service.
19965 19966 19967 19968 19969 19970 19971 19972 19973 19974 19975 19976 19977 19978 19979 19980 19981 19982 19983 19984 19985 19986 19987 19988 19989 19990 19991 19992 19993 19994 19995 19996 19997 19998 19999 |
# File 'lib/ovirtsdk4/services.rb', line 19965 def list(opts = {}) query = {} value = opts[:case_sensitive] unless value.nil? value = Writer.render_boolean(value) query['case_sensitive'] = value end value = opts[:filter] unless value.nil? value = Writer.render_boolean(value) query['filter'] = value end value = opts[:max] unless value.nil? value = Writer.render_integer(value) query['max'] = value end value = opts[:search] unless value.nil? query['search'] = value end 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 StorageDomainReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
20019 20020 20021 20022 20023 20024 20025 20026 20027 20028 |
# File 'lib/ovirtsdk4/services.rb', line 20019 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return storage_domain_service(path) end return storage_domain_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (StorageDomainService) storage_domain_service(id)
Locates the storage_domain
service.
20008 20009 20010 |
# File 'lib/ovirtsdk4/services.rb', line 20008 def storage_domain_service(id) return StorageDomainService.new(@connection, "#{@path}/#{id}") end |
- (String) to_s
Returns an string representation of this service.
20035 20036 20037 |
# File 'lib/ovirtsdk4/services.rb', line 20035 def to_s return "#<#{StorageDomainsService}:#{@path}>" end |