Class: OvirtSDK4::OpenstackNetworkProvidersService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::OpenstackNetworkProvidersService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (OpenStackNetworkProvider) add(provider, opts = {})
The operation adds a new network provider to the system.
-
- (Array<OpenStackNetworkProvider>) list(opts = {})
Returns the representation of the object managed by this service.
-
- (OpenstackNetworkProviderService) provider_service(id)
Locates the
provider
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
- (OpenStackNetworkProvider) add(provider, opts = {})
The operation adds a new network provider to the system.
If the type
property is not present, a default value of NEUTRON
will be used.
14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 |
# File 'lib/ovirtsdk4/services.rb', line 14009 def add(provider, opts = {}) if provider.is_a?(Hash) provider = OvirtSDK4::OpenStackNetworkProvider.new(provider) end request = Request.new(:method => :POST, :path => @path) begin writer = XmlWriter.new(nil, true) OpenStackNetworkProviderWriter.write_one(provider, writer, 'provider') 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 OpenStackNetworkProviderReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Array<OpenStackNetworkProvider>) list(opts = {})
Returns the representation of the object managed by this service.
14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 |
# File 'lib/ovirtsdk4/services.rb', line 14044 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 OpenStackNetworkProviderReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (OpenstackNetworkProviderService) provider_service(id)
Locates the provider
service.
14073 14074 14075 |
# File 'lib/ovirtsdk4/services.rb', line 14073 def provider_service(id) return OpenstackNetworkProviderService.new(@connection, "#{@path}/#{id}") end |
- (Service) service(path)
Locates the service corresponding to the given path.
14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 |
# File 'lib/ovirtsdk4/services.rb', line 14084 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return provider_service(path) end return provider_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
14100 14101 14102 |
# File 'lib/ovirtsdk4/services.rb', line 14100 def to_s return "#<#{OpenstackNetworkProvidersService}:#{@path}>" end |