Sha256: 1d90ccc829057e2e3f7a78ec81544655143658b333f3edea1220fdca7a0ca2c4

Contents?: true

Size: 699 Bytes

Versions: 5

Compression:

Stored size: 699 Bytes

Contents

module FluentECS
  module Resource
    def self.included(base)
      base.include HTTParty
      base.base_uri 'http://localhost:51678/v1'
      base.format :json

      base.extend ClassMethods
    end

    module ClassMethods
      attr_accessor :resource_endpoint

      def get
        response = super(resource_endpoint)
        if response.success?
          response.parsed_response
        else
          err = "GET #{base_uri}#{resource_endpoint}" \
                " failed with code: #{response.code}"
          raise RequestError, err
        end
      rescue Errno::ECONNREFUSED, HTTParty::Error, Timeout::Error => e
        raise IntrospectError, e.message
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
fluent-plugin-ecs-metadata-filter-v2-0.2.0 lib/fluent_ecs/resource.rb
serafini010-ecs-metadata-filter-0.2.0 lib/fluent_ecs/resource.rb
fluent-plugin-ecs-metadata-filter-0.2.0 lib/fluent_ecs/resource.rb
fluent-plugin-ecs-metadata-filter-0.1.1 lib/fluent_ecs/resource.rb
fluent-plugin-ecs-metadata-filter-0.1.0 lib/fluent_ecs/resource.rb