import { EventHubManagementClient , EventHubManagementModels } from '@azure/arm-eventhub' ; import { AzureWizardPromptStep } from 'vscode-azureextensionui' ; import { localize } from '../../../../localize' ; import { promptForResource } from '../../../../utils/azure' ; import { createEventHubClient } from '../../../../utils/azureClients' ; import { nonNullProp } from '../../../../utils/nonNull' ; import { IEventHubWizardContext } from './IEventHubWizardContext' ; export class EventHubListStep extends AzureWizardPromptStep < IEventHubWizardContext > { public async prompt ( context ) { const namespaceName = nonNullProp ( context , 'namespaceName' ) ; const resourceGroupName = nonNullProp ( context , 'resourceGroupName' ) ; const placeHolder = localize ( 'placeHolder' , 'Select an event hub' ) ; const client = await createEventHubClient ( context ) ; const result = await promptForResource ( context , placeHolder , client . eventHubs . listByNamespace ( resourceGroupName , namespaceName ) ) ; if ( result ) { context . eventhubname = nonNullProp ( result , 'name' ) ; } } public shouldPrompt ( context ) { return ! ! context . namespaceName && ! context . eventhubname ; } }