def setUpClass(cls):
     super(TestCollector, cls).setUpClass()
     e = utils.parse_grpc_endpoint(ENDPOINT)
     cls.client = pygrpc.client(endpoint=e['endpoint'],
                                ssl_enabled=e['ssl_enabled'])
     cls.secret_data = {
         'aws_access_key_id': os.environ.get('AWS_ACCESS_KEY_ID'),
         'aws_secret_access_key': os.environ.get('AWS_SECRET_ACCESS_KEY'),
     }
Esempio n. 2
0
    def initialize(self, endpoint):
        """ Initialize based on endpoint
        Args:
            endpoint (message): endpoint message
        """
        e = parse_grpc_endpoint(endpoint)
        self.client = pygrpc.client(endpoint=e['endpoint'], ssl_enabled=e['ssl_enabled'], max_message_length=1024*1024*32)

        if self.client is None:
            _LOGGER.error(f'[initialize] Cannot access gRPC server. '
                          f'(host: {e.get("hostname")}, port: {e.get("port")}, version: plugin)')
            raise ERROR_GRPC_CONFIGURATION(endpoint=endpoint)
Esempio n. 3
0
    def __init__(self, transaction, config):
        super().__init__(transaction, config)

        if 'endpoint' not in self.config:
            raise ERROR_WRONG_CONFIGURATION(key='endpoint')

        if len(self.config['endpoint']) > 1:
            raise ERROR_WRONG_CONFIGURATION(key='too many endpoint')

        for version, uri in self.config['endpoint'].items():
            e = parse_grpc_endpoint(uri)
            self.client = pygrpc.client(endpoint=e['endpoint'], ssl_enabled=e['ssl_enabled'])
Esempio n. 4
0
 def _init_client(self):
     for version, uri in self.config['endpoint'].items():
         e = parse_grpc_endpoint(uri)
         self.client = pygrpc.client(endpoint=e['endpoint'],
                                     ssl_enabled=e['ssl_enabled'])
Esempio n. 5
0
 def _init_client(self):
     e = parse_grpc_endpoint(self._endpoints[self._service])
     self._client = pygrpc.client(endpoint=e['endpoint'],
                                  ssl_enabled=e['ssl_enabled'])