# SPDX-License-Identifier: Apache-2.0## The OpenSearch Contributors require contributions made to# this file be licensed under the Apache-2.0 license or a# compatible open source license.## Modifications Copyright OpenSearch Contributors. See# GitHub history for details.fromtypingimportAny,Mapping,Optionalfrom.clientimportClientfrom.utilsimportNamespacedClient
[docs]defget(self,url:str,headers:Optional[Mapping[str,Any]]=None,params:Optional[Mapping[str,Any]]=None,body:Any=None,)->Any:""" Perform a GET request and return the data. :arg url: absolute url (without host) to target :arg headers: dictionary of headers, will be handed over to the underlying :class:`~opensearchpy.Connection` class :arg params: dictionary of query parameters, will be handed over to the underlying :class:`~opensearchpy.Connection` class for serialization :arg body: body of the request, will be serialized using serializer and passed to the connection """returnself.transport.perform_request("GET",url=url,headers=headers,params=params,body=body)
[docs]defhead(self,url:str,headers:Optional[Mapping[str,Any]]=None,params:Optional[Mapping[str,Any]]=None,body:Any=None,)->Any:""" Perform a HEAD request and return the data. :arg url: absolute url (without host) to target :arg headers: dictionary of headers, will be handed over to the underlying :class:`~opensearchpy.Connection` class :arg params: dictionary of query parameters, will be handed over to the underlying :class:`~opensearchpy.Connection` class for serialization :arg body: body of the request, will be serialized using serializer and passed to the connection """returnself.transport.perform_request("HEAD",url=url,headers=headers,params=params,body=body)
[docs]defpost(self,url:str,headers:Optional[Mapping[str,Any]]=None,params:Optional[Mapping[str,Any]]=None,body:Any=None,)->Any:""" Perform a POST request and return the data. :arg url: absolute url (without host) to target :arg headers: dictionary of headers, will be handed over to the underlying :class:`~opensearchpy.Connection` class :arg params: dictionary of query parameters, will be handed over to the underlying :class:`~opensearchpy.Connection` class for serialization :arg body: body of the request, will be serialized using serializer and passed to the connection """returnself.transport.perform_request("POST",url=url,headers=headers,params=params,body=body)
[docs]defdelete(self,url:str,headers:Optional[Mapping[str,Any]]=None,params:Optional[Mapping[str,Any]]=None,body:Any=None,)->Any:""" Perform a DELETE request and return the data. :arg url: absolute url (without host) to target :arg headers: dictionary of headers, will be handed over to the underlying :class:`~opensearchpy.Connection` class :arg params: dictionary of query parameters, will be handed over to the underlying :class:`~opensearchpy.Connection` class for serialization :arg body: body of the request, will be serialized using serializer and passed to the connection """returnself.transport.perform_request("DELETE",url=url,headers=headers,params=params,body=body)
[docs]defput(self,url:str,headers:Optional[Mapping[str,Any]]=None,params:Optional[Mapping[str,Any]]=None,body:Any=None,)->Any:""" Perform a PUT request and return the data. :arg url: absolute url (without host) to target :arg headers: dictionary of headers, will be handed over to the underlying :class:`~opensearchpy.Connection` class :arg params: dictionary of query parameters, will be handed over to the underlying :class:`~opensearchpy.Connection` class for serialization :arg body: body of the request, will be serialized using serializer and passed to the connection """returnself.transport.perform_request("PUT",url=url,headers=headers,params=params,body=body)