diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e550eb..b20580d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 0.0.8 + +* Updated Kubectl API with option of showing forwarded ports in user interface. + +## 0.0.7 + +* Updated Cluster Explorer API to offer re-use of built-in resource folder and grouping folder + ## 0.0.6 * Updated Cluster Explorer API to support customising the appearance of existing nodes diff --git a/package.json b/package.json index 8cea706..5a8e0e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vscode-kubernetes-tools-api", - "version": "0.0.7", + "version": "0.0.8", "description": "Documents and encapsulates the API for the Kubernetes extension for Visual Studio Code", "main": "js/index.js", "types": "js/index.d.ts", diff --git a/ts/kubectl/v1.ts b/ts/kubectl/v1.ts index 7e56e6a..2ea0634 100644 --- a/ts/kubectl/v1.ts +++ b/ts/kubectl/v1.ts @@ -21,10 +21,11 @@ export interface KubectlV1 { * @param podNamespace The namespace containing the pod. * @param localPort The local port to be forwarded. * @param remotePort The port on the pod to which to forward. + * @param options Options for port forwarding. * @returns A Disposable which can be used to terminate port forwarding, or undefined * if port forwarding failed. */ - portForward(podName: string, podNamespace: string | undefined, localPort: number, remotePort: number): Promise; + portForward(podName: string, podNamespace: string | undefined, localPort: number, remotePort: number, options?: KubectlV1.PortForwardOptions): Promise; } export namespace KubectlV1 { @@ -45,4 +46,58 @@ export namespace KubectlV1 { */ readonly stderr: string; } + + /** + * Options for performing port forwarding using kubectl. + */ + export interface PortForwardOptions { + /** + * Specifies whether and how to display the forwarded port in the Visual Studio + * Code user interface. If not present, the forwarded port is not shown. + */ + readonly showInUI?: PortForwardUIOptions; + } + + /** + * Specifies that the forwarded port should not be shown in the Visual Studio Code + * user interface. This is equivalent to omitting the PortForwardOptions.showInUI property. + */ + export interface PortForwardNoUIOptions { + /** + * Specifies that the port-forward should not be displayed in any location. + */ + readonly location: 'none'; + } + + /** + * Specifies that the forwarded port should be shown in the Visual Studio Code + * status bar. When any forwarded ports have this set, the status bar displays + * a "Kubectl Port Forwarding" indicator which the user can click to see a + * list of active port-forwards. + */ + export interface PortForwardStatusBarUIOptions { + /** + * Specifies the status bar as the display location. + */ + readonly location: 'status-bar'; + /** + * A string to be shown alongside the port-forward if the user displays the + * list. This helps the user to identify the purpose of the port-forward. + */ + readonly description?: string; + /** + * A function to be called if the user cancels port forwarding via the + * list of active port-forwards. This can be used to clean up associated + * state (for example, to note that the port will need to be re-forwarded + * if the user wants to perform whatever operation was using the forwarded + * port again), to provide information to the user, etc. + */ + readonly onCancel?: () => void; + } + + /** + * Specifies whether and how to display a forwarded port in the Visual Studio + * Code user interface. + */ + export type PortForwardUIOptions = PortForwardNoUIOptions | PortForwardStatusBarUIOptions; }