Class: ElasticSearch::Thrift::RestRequest

Inherits:
Object
  • Object
show all
Includes:
Thrift::Struct, Thrift::Struct_Union
Defined in:
lib/elasticsearch/transport/thrift/elasticsearch_types.rb

Constant Summary collapse

METHOD =
1
URI =
2
PARAMS =
3
HEADERS =
4
BODY =
5
FIELDS =
{
  METHOD => {:type => ::Thrift::Types::I32, :name => 'method', :enum_class => ElasticSearch::Thrift::Method},
  URI => {:type => ::Thrift::Types::STRING, :name => 'uri'},
  PARAMS => {:type => ::Thrift::Types::MAP, :name => 'params', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true},
  HEADERS => {:type => ::Thrift::Types::MAP, :name => 'headers', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true},
  BODY => {:type => ::Thrift::Types::STRING, :name => 'body', :binary => true, :optional => true}
}

Instance Method Summary collapse

Instance Method Details

#struct_fieldsObject



86
# File 'lib/elasticsearch/transport/thrift/elasticsearch_types.rb', line 86

def struct_fields; FIELDS; end

#validateObject

Raises:

  • (::Thrift::ProtocolException)


88
89
90
91
92
93
94
# File 'lib/elasticsearch/transport/thrift/elasticsearch_types.rb', line 88

def validate
  raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field method is unset!') unless @method
  raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field uri is unset!') unless @uri
  unless @method.nil? || ElasticSearch::Thrift::Method::VALID_VALUES.include?(@method)
    raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field method!')
  end
end