Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
vscode-kubernetes-tools-api
Advanced tools
Changelog
1.3.0
Thanks to @amsoedal and @evidolob
Readme
A NPM package providing documentation and helpers for using the Kubernetes extension for Visual Studio Code in your own VS Code extensions. You can use this to:
kubectl
features in a way that's consistent with the core extensionThe package includes TypeScript type declarations and JSDoc comments. For usage information and samples, see https://aka.ms/vscodekubeapi.
// Using TypeScript for sample purposes but it all works in JavaScript too!
import * as vscode from 'vscode';
import * as k8s from 'vscode-kubernetes-tools-api';
export function activate(context: vscode.ExtensionContext) {
const disposable = vscode.commands.registerCommand('k8stop.top', showResourceUsage);
context.subscriptions.push(disposable);
}
async function showResourceUsage(target?: any): Promise<void> {
// Standard pattern for accessing the APIs
const explorer = await k8s.extension.clusterExplorer.v1_1;
if (!explorer.available) {
vscode.window.showErrorMessage(`Command not available: ${explorer.reason}`);
return;
}
const kubectl = await k8s.extension.kubectl.v1;
if (!kubectl.available) {
vscode.window.showErrorMessage(`kubectl not available: ${kubectl.reason}`);
return;
}
// Example of using the Cluster Explorer API to figure out what was clicked
const node = explorer.api.resolveCommandTarget(target);
if (node && node.nodeType === 'resource' && node.resourceKind.manifestKind === 'Node') {
// Example of using the kubectl API to invoke a command
const topResult = await kubectl.api.invokeCommand(`top node ${node.name}`);
if (!topResult || topResult.code !== 0) {
vscode.window.showErrorMessage(`Can't get resource usage: ${topResult ? topResult.stderr : 'unable to run kubectl'}`);
return;
}
const topCommandOutput = topResult.stdout;
// show topCommandOutput as required;
}
}
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
FAQs
Documents and encapsulates the API for the Kubernetes extension for Visual Studio Code
The npm package vscode-kubernetes-tools-api receives a total of 388 weekly downloads. As such, vscode-kubernetes-tools-api popularity was classified as not popular.
We found that vscode-kubernetes-tools-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.