This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from eclipse-che/che#12306
Add ssh-plugin
- Loading branch information
Showing
15 changed files
with
613 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
node_modules | ||
# Dependency directories | ||
node_modules/ | ||
|
||
# Logs | ||
yarn-error.log | ||
|
||
# IntelliJ | ||
.idea | ||
|
||
# VS Code | ||
.vscode/* | ||
|
||
# Generated files | ||
*.theia | ||
|
||
|
||
# MacOS | ||
.DS_Store | ||
.theia | ||
.idea |
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
43 changes: 43 additions & 0 deletions
43
extensions/eclipse-che-theia-plugin-ext/src/browser/che-ssh-main.ts
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,43 @@ | ||
/********************************************************************* | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
**********************************************************************/ | ||
|
||
import { che as cheApi } from '@eclipse-che/api'; | ||
import { interfaces } from 'inversify'; | ||
import { CheApiService, CheSshMain } from '../common/che-protocol'; | ||
|
||
export class CheSshMainImpl implements CheSshMain { | ||
|
||
private readonly cheApiService: CheApiService; | ||
|
||
constructor(container: interfaces.Container) { | ||
this.cheApiService = container.get(CheApiService); | ||
} | ||
|
||
async $generate(service: string, name: string): Promise<cheApi.ssh.SshPair> { | ||
return this.cheApiService.generateSshKey(service, name); | ||
} | ||
|
||
async $create(sshKeyPair: cheApi.ssh.SshPair): Promise<void> { | ||
return this.cheApiService.createSshKey(sshKeyPair); | ||
} | ||
|
||
async $get(service: string, name: string): Promise<cheApi.ssh.SshPair> { | ||
return this.cheApiService.getSshKey(service, name); | ||
} | ||
|
||
async $getAll(service: string): Promise<cheApi.ssh.SshPair[]> { | ||
return this.cheApiService.getAllSshKey(service); | ||
} | ||
|
||
async $deleteKey(service: string, name: string): Promise<void> { | ||
return this.cheApiService.deleteSshKey(service, name); | ||
} | ||
|
||
} |
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
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
78 changes: 78 additions & 0 deletions
78
extensions/eclipse-che-theia-plugin-ext/src/plugin/che-ssh.ts
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,78 @@ | ||
/********************************************************************* | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
**********************************************************************/ | ||
|
||
import { RPCProtocol } from '@theia/plugin-ext/lib/api/rpc-protocol'; | ||
import { PLUGIN_RPC_CONTEXT, CheSshMain, CheSsh } from '../common/che-protocol'; | ||
import { che as cheApi } from '@eclipse-che/api'; | ||
|
||
export class CheSshImpl implements CheSsh { | ||
|
||
private readonly sshMain: CheSshMain; | ||
|
||
constructor(rpc: RPCProtocol) { | ||
this.sshMain = rpc.getProxy(PLUGIN_RPC_CONTEXT.CHE_SSH_MAIN); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
async generate(service: string, name: string): Promise<cheApi.ssh.SshPair> { | ||
try { | ||
return this.sshMain.$generate(service, name); | ||
} catch (e) { | ||
throw new Error(e); | ||
} | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
async create(sshKeyPair: cheApi.ssh.SshPair): Promise<void> { | ||
try { | ||
return this.sshMain.$create(sshKeyPair); | ||
} catch (e) { | ||
throw new Error(e); | ||
} | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
async getAll(service: string): Promise<cheApi.ssh.SshPair[]> { | ||
try { | ||
return this.sshMain.$getAll(service); | ||
} catch (e) { | ||
throw new Error(e); | ||
} | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
async get(service: string, name: string): Promise<cheApi.ssh.SshPair> { | ||
try { | ||
return this.sshMain.$get(service, name); | ||
} catch (e) { | ||
throw new Error(e); | ||
} | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
async delete(service: string, name: string): Promise<void> { | ||
try { | ||
return this.sshMain.$deleteKey(service, name); | ||
} catch (e) { | ||
throw new Error(e); | ||
} | ||
} | ||
|
||
} |
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
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,3 @@ | ||
dist/ | ||
node_modules/ | ||
lib/ |
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,15 @@ | ||
# Theia - SSH Plug-in | ||
|
||
The SSH Plug-in allows to manage the SSH public/private key pairs stored in Che workspace. | ||
|
||
![Theia](https://user-images.githubusercontent.com/7668752/46194687-ca8b0d80-c30a-11e8-9eb1-fe8e6232486c.png) | ||
|
||
Adds the following commands (shortcut `F1`): | ||
- SSH: generate key pair... | ||
- SSH: create key pair... | ||
- SSH: view public key... | ||
- SSH: delete key pair... | ||
|
||
## License | ||
|
||
[EPL-2.0](http://www.eclipse.org/legal/epl-2.0) |
Oops, something went wrong.