def __init__()

in CWMetricsToOpenSearch/es_sink/descriptor.py [0:0]


    def __init__(self, endpoint, index_descriptor, region=None, auth=None):
        """Describes an ELasticsearch sink.

           This could be refactored to be a little bit better. As of now, it
           supports Amazon ES endpoints as well as vanilla ES endpoints. It also
           supports ES V6 and ES V7 endpoints. These could be mixins.

           endpoint:            The base url to send REST API calls
           region:              For Amazon ES domains, the AWS region. E.g.
                                us-west-2
           indexing_descriptor: An IndexingDescriptor as above, specifying the
            `                   index name, es type, v7 status, and whether to
                                create indices with a timestamped name
           es_auth:             A subclass of the ESAuth class specifying how to
                                handle authentication of requests sent to the
                                Elasticsearch endpoint.
        """
        self._endpoint = endpoint

        if not isinstance(index_descriptor, IndexDescriptor):
            raise TypeError('Wrong type for index_descriptor')
        self._indexing = index_descriptor

        self._auth = auth
        if not auth:
            self._auth = ESNoAuth()

        if not issubclass(type(auth), ESAuth):
            raise ValueError('You must use the a child of the ESAuth class')


        if isinstance(auth, ESSigV4Auth) and not region:
            raise ValueError('You must specify a region to use SigV4Signing')
        self._region = region