Class List Method List File List

# Class: VertxServiceDiscovery::HttpEndpoint

Inherits:
  Object
  - Object
  - VertxServiceDiscovery::HttpEndpoint
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/http_endpoint.rb

## Overview

for HTTP endpoint (REST api). Consumers receive a HTTP client configured with the host and port of the endpoint.

## Class Method Summary (collapse)

- + (Hash) create_record(param_1 = nil, param_2 = nil, param_3 = nil, param_4 = nil, param_5 = nil, param_6 = nil)
  Same as #create_record but let you configure whether or not the service is using https.
- + (void) get_client(discovery = nil, filter = nil) { ... }
  Convenient method that looks for a HTTP endpoint and provides the configured .

## Class Method Details

### + (`Hash`) createRecord(name, host) + (`Hash`) createRecord(name, host, port, root) + (`Hash`) createRecord(name, host, port, root, metadata) + (`Hash`) createRecord(name, ssl, host, port, root, metadata)

Same as #create_record but let you configure whether or not the service is using `https`.

Overloads:

- + (`Hash`) createRecord(name, host)

  Parameters:

  - name (`String`) —
    the name
  - host (`String`) —
    the host
- + (`Hash`) createRecord(name, host, port, root)

  Parameters:

  - name (`String`) —
    the service name
  - host (`String`) —
    the host, must be public
  - port (`Fixnum`) —
    the port
  - root (`String`) —
    the root, if not set "/" is used
- + (`Hash`) createRecord(name, host, port, root, metadata)

  Parameters:

  - name (`String`) —
    the service name
  - host (`String`) —
    the host (IP or DNS name), it must be the _public_ IP / name
  - port (`Fixnum`) —
    the port, it must be the _public_ port
  - root (`String`) —
    the path of the service, "/" if not set
  - metadata (`Hash{String => Object}`) —
    additional metadata
- + (`Hash`) createRecord(name, ssl, host, port, root, metadata)

  Parameters:

  - name (`String`) —
    the service name
  - ssl (`true`, `false`) —
    whether or not the service is using HTTPS
  - host (`String`) —
    the host (IP or DNS name), it must be the _public_ IP / name
  - port (`Fixnum`) —
    the port, it must be the _public_ port
  - root (`String`) —
    the path of the service, "/" if not set
  - metadata (`Hash{String => Object}`) —
    additional metadata

Returns:

- (`Hash`) —
  the created record

Raises:

- (`ArgumentError`)

    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/http_endpoint.rb', line 43

    def self.create_record(param_1=nil,param_2=nil,param_3=nil,param_4=nil,param_5=nil,param_6=nil)
      if param_1.class == String && param_2.class == String && !block_given? && param_3 == nil && param_4 == nil && param_5 == nil && param_6 == nil
        return Java::IoVertxServicediscoveryTypes::HttpEndpoint.java_method(:createRecord, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(param_1,param_2) != nil ? JSON.parse(Java::IoVertxServicediscoveryTypes::HttpEndpoint.java_method(:createRecord, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(param_1,param_2).toJson.encode) : nil
      elsif param_1.class == String && param_2.class == String && param_3.class == Fixnum && param_4.class == String && !block_given? && param_5 == nil && param_6 == nil
        return Java::IoVertxServicediscoveryTypes::HttpEndpoint.java_method(:createRecord, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::int.java_class,Java::java.lang.String.java_class]).call(param_1,param_2,param_3,param_4) != nil ? JSON.parse(Java::IoVertxServicediscoveryTypes::HttpEndpoint.java_method(:createRecord, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::int.java_class,Java::java.lang.String.java_class]).call(param_1,param_2,param_3,param_4).toJson.encode) : nil
      elsif param_1.class == String && param_2.class == String && param_3.class == Fixnum && param_4.class == String && param_5.class == Hash && !block_given? && param_6 == nil
        return Java::IoVertxServicediscoveryTypes::HttpEndpoint.java_method(:createRecord, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(param_1,param_2,param_3,param_4,::Vertx::Util::Utils.to_json_object(param_5)) != nil ? JSON.parse(Java::IoVertxServicediscoveryTypes::HttpEndpoint.java_method(:createRecord, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(param_1,param_2,param_3,param_4,::Vertx::Util::Utils.to_json_object(param_5)).toJson.encode) : nil
      elsif param_1.class == String && (param_2.class == TrueClass || param_2.class == FalseClass) && param_3.class == String && param_4.class == Fixnum && param_5.class == String && param_6.class == Hash && !block_given?
        return Java::IoVertxServicediscoveryTypes::HttpEndpoint.java_method(:createRecord, [Java::java.lang.String.java_class,Java::boolean.java_class,Java::java.lang.String.java_class,Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(param_1,param_2,param_3,param_4,param_5,::Vertx::Util::Utils.to_json_object(param_6)) != nil ? JSON.parse(Java::IoVertxServicediscoveryTypes::HttpEndpoint.java_method(:createRecord, [Java::java.lang.String.java_class,Java::boolean.java_class,Java::java.lang.String.java_class,Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(param_1,param_2,param_3,param_4,param_5,::Vertx::Util::Utils.to_json_object(param_6)).toJson.encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling create_record(param_1,param_2,param_3,param_4,param_5,param_6)"
    end

### + (`void`) get_client(discovery = nil, filter = nil) { ... }

This method returns an undefined value.

Convenient method that looks for a HTTP endpoint and provides the configured . The async result is marked as failed is there are no matching services, or if the lookup fails.

Parameters:

- discovery (`::VertxServiceDiscovery::ServiceDiscovery`) (defaults to: `nil`) —
  The service discovery instance
- filter (`Hash{String => Object}`) (defaults to: `nil`) —
  The filter, optional

Yields:

- The result handler

Raises:

- (`ArgumentError`)

    61
    62
    63
    64
    65
    66
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-service-discovery/http_endpoint.rb', line 61

    def self.get_client(discovery=nil,filter=nil)
      if discovery.class.method_defined?(:j_del) && filter.class == Hash && block_given?
        return Java::IoVertxServicediscoveryTypes::HttpEndpoint.java_method(:getClient, [Java::IoVertxServicediscovery::ServiceDiscovery.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(discovery.j_del,::Vertx::Util::Utils.to_json_object(filter),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::HttpClient) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling get_client(discovery,filter)"
    end