export async function removeNamespace()

in src/entityExplorer.ts [272:286]


export async function removeNamespace(namespace: WskNamespace, context: vscode.ExtensionContext) {
    const manager = new StorageManager(context.globalState);

    // @ts-ignore
    const client: { apiKey: string } = namespace.client.namespaces.client.options;
    const apihost = namespace.wskEndpoint.apihost;
    const api_key = client.apiKey;

    const endpoints = manager.getEndpoints();
    const endpoint = endpoints[apihost];
    if (endpoint) {
        endpoint.namespaces = endpoint.namespaces.filter((n) => n.api_key !== api_key);
        await context.globalState.update('endpoints', endpoints);
    }
}