Pantheon\Terminus\Collections\SSHKeys::addKey PHP Method

addKey() public method

Adds an SSH key to the user's Pantheon account
public addKey ( string $key_file ) : array
$key_file string Full path of the SSH key to add
return array
    public function addKey($key_file)
    {
        if (!file_exists($key_file)) {
            throw new TerminusException('The file {file} cannot be accessed by Terminus.', ['file' => $key_file], 1);
        }
        $response = $this->request->request('users/' . $this->getUser()->id . '/keys', ['form_params' => rtrim(file_get_contents($key_file)), 'method' => 'post']);
        return (array) $response['data'];
    }