Class: OvirtSDK4::GlusterBrickService
- Inherits:
-
MeasurableService
- Object
- Service
- MeasurableService
- OvirtSDK4::GlusterBrickService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (GlusterBrick) get(opts = {})
Returns the representation of the object managed by this service.
-
- (Object) remove(opts = {})
Removes this brick from the volume and deletes it from the database.
-
- (Object) replace(opts = {})
Replaces this brick with a new one.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (StatisticsService) statistics_service
Locates the
statistics
service. -
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (GlusterBrick) get(opts = {})
Returns the representation of the object managed by this service.
27952 27953 27954 27955 27956 27957 27958 27959 27960 27961 27962 27963 27964 27965 27966 27967 |
# File 'lib/ovirtsdk4/services.rb', line 27952 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 GlusterBrickReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Object) remove(opts = {})
Removes this brick from the volume and deletes it from the database.
27976 27977 27978 27979 27980 27981 27982 27983 27984 27985 27986 27987 27988 |
# File 'lib/ovirtsdk4/services.rb', line 27976 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 |
- (Object) replace(opts = {})
Replaces this brick with a new one. The property brick
is required.
27993 27994 27995 27996 27997 27998 27999 28000 28001 28002 28003 28004 28005 28006 28007 28008 28009 28010 28011 |
# File 'lib/ovirtsdk4/services.rb', line 27993 def replace(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}/replace", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
28028 28029 28030 28031 28032 28033 28034 28035 28036 28037 28038 28039 |
# File 'lib/ovirtsdk4/services.rb', line 28028 def service(path) if path.nil? || path == '' return self end if path == 'statistics' return statistics_service end if path.start_with?('statistics/') return statistics_service.service(path[11..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
- (StatisticsService) statistics_service
Locates the statistics
service.
28017 28018 28019 |
# File 'lib/ovirtsdk4/services.rb', line 28017 def statistics_service return StatisticsService.new(@connection, "#{@path}/statistics") end |
- (String) to_s
Returns an string representation of this service.
28046 28047 28048 |
# File 'lib/ovirtsdk4/services.rb', line 28046 def to_s return "#<#{GlusterBrickService}:#{@path}>" end |