-
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.
Signed-off-by: Timothy Johnson <[email protected]>
- Loading branch information
Showing
8 changed files
with
167 additions
and
3 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,35 @@ | ||
/** | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import type { ICommandDefinition } from "@zowe/imperative"; | ||
import { SshSession } from "@zowe/zos-uss-for-zowe-sdk"; | ||
import { Constants } from "../Constants"; | ||
import { ServerInstallDefinition } from "./install/Install.definition"; | ||
import { ServerUninstallDefinition } from "./uninstall/Uninstall.definition"; | ||
|
||
const ServerDefinition: ICommandDefinition = { | ||
name: "server", | ||
aliases: ["srv"], | ||
summary: "Manage the Zowe SSH server", | ||
description: "Manage the Zowe SSH server", | ||
type: "group", | ||
children: [ServerInstallDefinition, ServerUninstallDefinition], | ||
passOn: [ | ||
{ | ||
property: "options", | ||
value: [...SshSession.SSH_CONNECTION_OPTIONS, Constants.OPT_SERVER_PATH], | ||
merge: true, | ||
ignoreNodes: [{ type: "group" }], | ||
}, | ||
], | ||
}; | ||
|
||
export = ServerDefinition; |
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,32 @@ | ||
/** | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import type { ICommandDefinition } from "@zowe/imperative"; | ||
|
||
export const ServerInstallDefinition: ICommandDefinition = { | ||
handler: __dirname + "/Install.handler", | ||
type: "command", | ||
name: "install", | ||
aliases: ["up"], | ||
summary: "Install Zowe SSH server on z/OS host", | ||
description: "Install Zowe SSH server on z/OS host", | ||
examples: [ | ||
{ | ||
description: "Install Zowe SSH server in the default location", | ||
options: "", | ||
}, | ||
{ | ||
description: 'Install Zowe SSH server in the directory "/tmp/zowe-server"', | ||
options: '--server-path "/tmp/zowe-server"', | ||
}, | ||
], | ||
profile: { optional: ["ssh"] }, | ||
}; |
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,30 @@ | ||
/** | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import { ConfigUtils, ICommandHandler, IHandlerParameters } from "@zowe/imperative"; | ||
import { ZSshClient, ZSshUtils } from "zowe-native-proto-sdk"; | ||
import { Constants } from "../../Constants"; | ||
|
||
export default class ServerInstallHandler implements ICommandHandler { | ||
public async process(params: IHandlerParameters): Promise<void> { | ||
const session = ZSshUtils.buildSession(params.arguments); | ||
const serverPath = params.arguments.serverPath ?? ZSshClient.DEFAULT_SERVER_PATH; | ||
params.response.progress.startSpinner("Deploying Zowe SSH server..."); | ||
try { | ||
await ZSshUtils.installServer(session, serverPath, Constants.ZSSH_BIN_DIR); | ||
} finally { | ||
params.response.progress.endSpinner(); | ||
} | ||
params.response.console.log( | ||
`Installed Zowe SSH server on ${ConfigUtils.getActiveProfileName("ssh", params.arguments)}`, | ||
); | ||
} | ||
} |
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,32 @@ | ||
/** | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import type { ICommandDefinition } from "@zowe/imperative"; | ||
|
||
export const ServerUninstallDefinition: ICommandDefinition = { | ||
handler: __dirname + "/Uninstall.handler", | ||
type: "command", | ||
name: "uninstall", | ||
aliases: ["rm"], | ||
summary: "Uninstall Zowe SSH server on z/OS host", | ||
description: "Uninstall Zowe SSH server on z/OS host", | ||
examples: [ | ||
{ | ||
description: "Uninstall Zowe SSH server from the default location", | ||
options: "", | ||
}, | ||
{ | ||
description: 'Uninstall Zowe SSH server from the directory "/tmp/zowe-server"', | ||
options: '--server-path "/tmp/zowe-server"', | ||
}, | ||
], | ||
profile: { optional: ["ssh"] }, | ||
}; |
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,25 @@ | ||
/** | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import { ConfigUtils, ICommandHandler, IHandlerParameters } from "@zowe/imperative"; | ||
import { ZSshClient, ZSshUtils } from "zowe-native-proto-sdk"; | ||
import { Constants } from "../../Constants"; | ||
|
||
export default class ServerUninstallHandler implements ICommandHandler { | ||
public async process(params: IHandlerParameters): Promise<void> { | ||
const session = ZSshUtils.buildSession(params.arguments); | ||
const serverPath = params.arguments.serverPath ?? ZSshClient.DEFAULT_SERVER_PATH; | ||
await ZSshUtils.uninstallServer(session, serverPath, Constants.ZSSH_BIN_DIR); | ||
params.response.console.log( | ||
`Uninstalled Zowe SSH server from ${ConfigUtils.getActiveProfileName("ssh", params.arguments)}`, | ||
); | ||
} | ||
} |
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