in CWMetricsToOpenSearch/es_sink/es_transport.py [0:0]
def __init__(self, descriptor):
'''A transport object to send requests to Elasticsearch. Since the class
supports both Amazon ES domains and vanilla ES clusters, this needs
to provide request signing as well as HTTP auth. The ESDescriptor
specifies which of these to use. At present, there's no way to
add http auth AND sign requests.
TODO: implement lower-level request signing for signed HTTP auth
descriptor.signed: Set True to use SigV4 signing only
Set False for HTTP Auth or no auth
descriptor.http_auth: User name, password tuple '''
self._descriptor = descriptor
if descriptor.is_signed() and descriptor.is_http_auth():
raise BadAuth('You can\'t specify both HTTP auth and signed requests')
if descriptor.is_signed() and not descriptor.region:
raise ValueError('If you specify signed requests, you must also specify region')