Class: OvirtSDK4::ExternalHostProviderService
- Inherits:
-
ExternalProviderService
- Object
- Service
- ExternalProviderService
- OvirtSDK4::ExternalHostProviderService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (ExternalProviderCertificatesService) certificates_service
Locates the
certificates
service. -
- (ExternalComputeResourcesService) compute_resources_service
Locates the
compute_resources
service. -
- (ExternalDiscoveredHostsService) discovered_hosts_service
Locates the
discovered_hosts
service. -
- (ExternalHostProvider) get(opts = {})
Returns the representation of the object managed by this service.
-
- (ExternalHostGroupsService) host_groups_service
Locates the
host_groups
service. -
- (ExternalHostsService) hosts_service
Locates the
hosts
service. -
- (Object) import_certificates(opts = {})
Executes the
import_certificates
method. -
- (Object) remove(opts = {})
Deletes the object managed by this service.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (Object) test_connectivity(opts = {})
Executes the
test_connectivity
method. -
- (String) to_s
Returns an string representation of this service.
-
- (Object) update(provider)
Updates the object managed by this service.
Instance Method Details
- (ExternalProviderCertificatesService) certificates_service
Locates the certificates
service.
27838 27839 27840 |
# File 'lib/ovirtsdk4/services.rb', line 27838 def certificates_service return ExternalProviderCertificatesService.new(@connection, "#{@path}/certificates") end |
- (ExternalComputeResourcesService) compute_resources_service
Locates the compute_resources
service.
27846 27847 27848 |
# File 'lib/ovirtsdk4/services.rb', line 27846 def compute_resources_service return ExternalComputeResourcesService.new(@connection, "#{@path}/computeresources") end |
- (ExternalDiscoveredHostsService) discovered_hosts_service
Locates the discovered_hosts
service.
27854 27855 27856 |
# File 'lib/ovirtsdk4/services.rb', line 27854 def discovered_hosts_service return ExternalDiscoveredHostsService.new(@connection, "#{@path}/discoveredhosts") end |
- (ExternalHostProvider) get(opts = {})
Returns the representation of the object managed by this service.
27720 27721 27722 27723 27724 27725 27726 27727 27728 27729 27730 27731 27732 27733 27734 27735 |
# File 'lib/ovirtsdk4/services.rb', line 27720 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 ExternalHostProviderReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (ExternalHostGroupsService) host_groups_service
Locates the host_groups
service.
27862 27863 27864 |
# File 'lib/ovirtsdk4/services.rb', line 27862 def host_groups_service return ExternalHostGroupsService.new(@connection, "#{@path}/hostgroups") end |
- (ExternalHostsService) hosts_service
Locates the hosts
service.
27870 27871 27872 |
# File 'lib/ovirtsdk4/services.rb', line 27870 def hosts_service return ExternalHostsService.new(@connection, "#{@path}/hosts") end |
- (Object) import_certificates(opts = {})
Executes the import_certificates
method.
27740 27741 27742 27743 27744 27745 27746 27747 27748 27749 27750 27751 27752 27753 27754 27755 27756 27757 27758 |
# File 'lib/ovirtsdk4/services.rb', line 27740 def import_certificates(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}/importcertificates", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
27767 27768 27769 27770 27771 27772 27773 27774 27775 27776 27777 27778 27779 |
# File 'lib/ovirtsdk4/services.rb', line 27767 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.
27881 27882 27883 27884 27885 27886 27887 27888 27889 27890 27891 27892 27893 27894 27895 27896 27897 27898 27899 27900 27901 27902 27903 27904 27905 27906 27907 27908 27909 27910 27911 27912 27913 27914 27915 27916 |
# File 'lib/ovirtsdk4/services.rb', line 27881 def service(path) if path.nil? || path == '' return self end if path == 'certificates' return certificates_service end if path.start_with?('certificates/') return certificates_service.service(path[13..-1]) end if path == 'computeresources' return compute_resources_service end if path.start_with?('computeresources/') return compute_resources_service.service(path[17..-1]) end if path == 'discoveredhosts' return discovered_hosts_service end if path.start_with?('discoveredhosts/') return discovered_hosts_service.service(path[16..-1]) end if path == 'hostgroups' return host_groups_service end if path.start_with?('hostgroups/') return host_groups_service.service(path[11..-1]) end if path == 'hosts' return hosts_service end if path.start_with?('hosts/') return hosts_service.service(path[6..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
- (Object) test_connectivity(opts = {})
Executes the test_connectivity
method.
27784 27785 27786 27787 27788 27789 27790 27791 27792 27793 27794 27795 27796 27797 27798 27799 27800 27801 27802 |
# File 'lib/ovirtsdk4/services.rb', line 27784 def test_connectivity(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}/testconnectivity", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (String) to_s
Returns an string representation of this service.
27923 27924 27925 |
# File 'lib/ovirtsdk4/services.rb', line 27923 def to_s return "#<#{ExternalHostProviderService}:#{@path}>" end |
- (Object) update(provider)
Updates the object managed by this service.
27807 27808 27809 27810 27811 27812 27813 27814 27815 27816 27817 27818 27819 27820 27821 27822 27823 27824 27825 27826 27827 27828 27829 27830 27831 27832 |
# File 'lib/ovirtsdk4/services.rb', line 27807 def update(provider) if provider.is_a?(Hash) provider = OvirtSDK4::ExternalHostProvider.new(provider) end request = Request.new(:method => :PUT, :path => @path) begin writer = XmlWriter.new(nil, true) ExternalHostProviderWriter.write_one(provider, writer, 'provider') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return ExternalHostProviderReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end |