Laravel Forge JavaScript SDK
SSH Keys
SSH Keys
Create a SSH key
Method
forge.ssh.create(server_id, payload)
Usage
1const forge = new Forge('API_TOKEN');23const key = await forge.ssh.create(server_id, payload);
Payload
1{2 name: 'test-key',3 key: 'KEY_CONTENT',4 username: 'forge'5}
Payload Parameters
Key | Description |
---|---|
name | The name of the ssh key. |
key | The content of the key. |
username | The username of the user you want to add the key to. If you are not using User Isolation, this will be forge . |
Example Response
1{2 "key": {3 "id": 9,4 "name": "test-key",5 "username": "forge",6 "status": "installing",7 "created_at": "2016-12-16 16:31:16"8 }9}
List all SSH keys
Method
forge.ssh.list(server_id)
Usage
1const forge = new Forge('API_TOKEN');23const keys = await forge.ssh.list(server_id);
Example Response
1{2 "keys": [3 {4 "id": 9,5 "name": "test-key",6 "username": "forge",7 "status": "installing",8 "created_at": "2016-12-16 16:31:16"9 }10 ]11}
Get a SSH key
Method
forge.ssh.get(server_id, key_id)
Usage
1const forge = new Forge('API_TOKEN');23const key = await forge.ssh.get(server_id, key_id);
Example Response
1{2 "key": {3 "id": 9,4 "name": "test-key",5 "username": "forge",6 "status": "installing",7 "created_at": "2016-12-16 16:31:16"8 }9}
Delete a SSH key
Method
forge.ssh.delete(server_id, key_id)
Usage
1const forge = new Forge('API_TOKEN');23await forge.ssh.delete(server_id, key_id);
Edit this page on GitHub