Open proxy connection to a device's management interface.

        :param id: Device ID as an int.
        :return: :class:`devices.Connection <devices.Connection>` object
        :rtype: devices.Connection
321760
def connect(self, id): # pylint: disable=invalid-name,redefined-builtin
        
        schema = ConnectionSchema()
        resp = self.service.post(self.base+str(id)+'/connect/')
        return self.service.decode(schema, resp)
701256
async def connect(self, conn_id, connection_string):
        

        if connection_string.startswith('device/'):
            adapter_id, local_conn = self._find_best_adapter(connection_string, conn_id)
            translate_conn = True
        elif connection_string.startswith('adapter/'):
            adapter_str, _, local_conn = connection_string[8:].partition('/')
            adapter_id = int(adapter_str)
            translate_conn = False
        else:
            raise DeviceAdapterError(conn_id, 'connect', 'invalid connection string format')

        if self.adapters[adapter_id].can_connect() is False:
            raise DeviceAdapterError(conn_id, 'connect', 'chosen adapter cannot handle another connection')

        # Make sure to set up the connection information before
        # so there are no races with events coming soon after connect.
        self._setup_connection(conn_id, local_conn)
        self._track_property(conn_id, 'adapter', adapter_id)
        self._track_property(conn_id, 'translate', translate_conn)

        try:
            await self.adapters[adapter_id].connect(conn_id, local_conn)
        except:
            self._teardown_connection(conn_id)
            raise
1141882
def _get_interface(self, name):
        """"""
        return proxy_new(
            self.connection,
            Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES |
            Gio.DBusProxyFlags.DO_NOT_CONNECT_SIGNALS,
            info=None,
            name=self.bus_name,
            object_path=self.object_path,
            interface_name=name,
        )
1364004
def get(self, id):
        
        with rconnect() as conn:
            if id is None:
                raise ValueError

            if isinstance(id, uuid.UUID):
                id = str(id)

            if type(id) != str and type(id) != unicode:
                raise ValueError

            try:
                query = self._base().get(id)
                log.debug(query)
                rv = query.run(conn)
            except ReqlOpFailedError as e:
                log.warn(e)
                raise
            except Exception as e:
                log.warn(e)
                raise
            if rv is not None:
                return self._model(rv)

            return None
846351
def with_connection
    connection_id = current_connection_id
    fresh_connection = true unless @reserved_connections[connection_id]
    yield connection
  ensure
    release_connection(connection_id) if fresh_connection
  end
845972
async def disconnect(self, conn_id):
        

        resp = await self._execute(self._adapter.disconnect_sync, conn_id)
        _raise_error(conn_id, 'disconnect', resp)
        self._teardown_connection(conn_id, force=True)
564973
async def connect(self, conn_id, connection_string):
        

        self._logger.info("Inside connect, conn_id=%d, conn_string=%s", conn_id, connection_string)

        try:
            self._setup_connection(conn_id, connection_string)

            resp = await self._execute(self._adapter.connect_sync, conn_id, connection_string)
            _raise_error(conn_id, 'connect', resp)
        except:
            self._teardown_connection(conn_id, force=True)
            raise
106312
def connection_made(self, address):
        """"""
        self._proxy = PickleProxy(self.loop, self)
        for d in self._proxy_deferreds:
            d.callback(self._proxy)
1181130
def send_connect_request(self, connection_id):
        
        connect_message = ConnectionRequest(endpoint=self._public_endpoint)
        self._safe_send(
            validator_pb2.Message.NETWORK_CONNECT,
            connect_message.SerializeToString(),
            connection_id,
            callback=partial(
                self._inbound_connection_request_callback,
                connection_id=connection_id))
377344
def get_by_id(self, id_networkv4):
        

        uri = 'api/networkv4/%s/' % id_networkv4

        return super(ApiNetworkIPv4, self).get(uri)
235100
def put(self, device_id: int) -> Device:
        
        device = self._get_or_abort(device_id)
        self.update(device)
        session.commit()
        session.add(device)
        return device
258238
def id_request(self, device_id):
        """"""
        self.logger.info("\nid_request for device %s", device_id)
        device_id = device_id.upper()

        self.direct_command(device_id, '10', '00')

        sleep(2)

        status = self.get_buffer_status(device_id)
        if not status:
            sleep(1)
            status = self.get_buffer_status(device_id)

        return status
553896
public ProxyPolicyHandler removeProxyPolicyHandler(String id) {
    return (id != null && this.proxyPolicyHandlers != null) ?
        (ProxyPolicyHandler)this.proxyPolicyHandlers.remove(id) :
        null;
    }
749045
def get(self, id):
        
        id = utils.lowerFirst(id)
        if id in self._settings:
            return self._settings[id]
        raise NotFound('Invalid setting id: %s' % id)
417908
async def _create_proxy_connection(self, req, *args, **kwargs):
        
        if req.proxy.scheme == 'http':
            return await super()._create_proxy_connection(req, *args, **kwargs)
        else:
            return await self._create_socks_connection(req=req)
1188353
def loadAddressbyID(self, id, callback=None, errback=None):
        
        import ns1.ipam
        address = ns1.ipam.Address(self.config, id=id)
        return address.load(callback=callback, errback=errback)
100874
def _on_connection(self, data, unique_id):
        
        if unique_id is None:
            unique_id = self.stream_unique_id
        self.connection_id = data.get('connectionId')
        logger.info('[Connect: %s]: connection_id: %s' % (unique_id, self.connection_id))