-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3bf211
commit aa847a6
Showing
5 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace VanguardBackup\Vanguard\Actions; | ||
|
||
use VanguardBackup\Vanguard\Resources\SshKey; | ||
|
||
trait ManagesSshKeys | ||
{ | ||
/** | ||
* Get the Vanguard instance SSH public key. | ||
* | ||
* This key can be used for SSH authentication when connecting to remote servers. | ||
*/ | ||
public function getInstanceSshKey(): SshKey | ||
{ | ||
return new SshKey($this->get('ssh-key'), $this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace VanguardBackup\Vanguard\Resources; | ||
|
||
class SshKey extends Resource | ||
{ | ||
/** | ||
* The SSH public key. | ||
*/ | ||
public string $publicKey; | ||
|
||
/** | ||
* Create a new resource instance. | ||
*/ | ||
public function __construct(array $attributes, $vanguard = null) | ||
{ | ||
parent::__construct($attributes, $vanguard); | ||
|
||
$this->publicKey = $attributes['public_key']; | ||
} | ||
|
||
/** | ||
* Get the string representation of the SSH key. | ||
*/ | ||
public function __toString(): string | ||
{ | ||
return $this->publicKey; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters