Class: OvirtSDK4::OpenstackVolumeAuthenticationKeysService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::OpenstackVolumeAuthenticationKeysService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (OpenstackVolumeAuthenticationKey) add(key, opts = {})
Adds a new
key
. -
- (OpenstackVolumeAuthenticationKeyService) key_service(id)
Locates the
key
service. -
- (Array<OpenstackVolumeAuthenticationKey>) list(opts = {})
Returns the representation of 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
- (OpenstackVolumeAuthenticationKey) add(key, opts = {})
Adds a new key
.
14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 |
# File 'lib/ovirtsdk4/services.rb', line 14538 def add(key, opts = {}) if key.is_a?(Hash) key = OvirtSDK4::OpenstackVolumeAuthenticationKey.new(key) end request = Request.new(:method => :POST, :path => @path) begin writer = XmlWriter.new(nil, true) OpenstackVolumeAuthenticationKeyWriter.write_one(key, writer, 'key') 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 OpenstackVolumeAuthenticationKeyReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (OpenstackVolumeAuthenticationKeyService) key_service(id)
Locates the key
service.
14602 14603 14604 |
# File 'lib/ovirtsdk4/services.rb', line 14602 def key_service(id) return OpenstackVolumeAuthenticationKeyService.new(@connection, "#{@path}/#{id}") end |
- (Array<OpenstackVolumeAuthenticationKey>) list(opts = {})
Returns the representation of the object managed by this service.
14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 |
# File 'lib/ovirtsdk4/services.rb', line 14573 def list(opts = {}) query = {} value = opts[:max] unless value.nil? value = Writer.render_integer(value) query['max'] = 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 OpenstackVolumeAuthenticationKeyReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 |
# File 'lib/ovirtsdk4/services.rb', line 14613 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return key_service(path) end return key_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
14629 14630 14631 |
# File 'lib/ovirtsdk4/services.rb', line 14629 def to_s return "#<#{OpenstackVolumeAuthenticationKeysService}:#{@path}>" end |