LinkORB\Component\Etcd\Client::rm PHP Method

rm() public method

remove a key
public rm ( string $key ) : array | stdClas\stdClass
$key string
return array | stdClas\stdClass
    public function rm($key)
    {
        $request = $this->guzzleclient->delete($this->buildKeyUri($key));
        $response = $request->send();
        $body = $response->json();
        if (isset($body['errorCode'])) {
            throw new EtcdException($body['message'], $body['errorCode']);
        }
        return $body;
    }

Usage Example

Example #1
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $server = $input->getArgument('server');
     $key = $input->getArgument('key');
     $output->writeln("<info>Removing key `{$key}`</info>");
     $client = new EtcdClient($server);
     $data = $client->rm($key);
     $json = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
     echo $json;
 }
All Usage Examples Of LinkORB\Component\Etcd\Client::rm