import EventHubManagementClientOptionalParams return error

60 Views Asked by At

Typescript. I use "@azure/arm-eventhub": "^3.2.0", and want to

import { EventHubManagementClient, EventHubManagementClientOptionalParams } from @azure/arm-eventhub; 

return 'Module "@azure/arm-eventhub"

has no exported member 'EventHubManagementClientOptionalParams'.'** enter image description here

but I checked the doc, https://learn.microsoft.com/en-us/javascript/api/@azure/arm-eventhub/eventhubmanagementclient?view=azure-node-latest#@azure-arm-eventhub-eventhubmanagementclient-constructor enter image description here https://learn.microsoft.com/en-us/javascript/api/@azure/arm-eventhub/eventhubmanagementclientoptionalparams?view=azure-node-latest enter image description here

the constructor of Eventhubmanagementclient has Eventhubmanagementclientoptionalparams and Eventhubmanagementclientoptionalparams is from arm-eventhub.

I try to use them to config the TLS version 1.2 like this:

import { EventHubManagementClient, EventHubManagementClientOptionalParams } from '@azure/arm-eventhub';

 const clientOptions: EventHubManagementClientOptionalParams = {
    pipeline: {
      minimumTlsVersion: 'TLSv1_2'
    }
  };

  const client = new EventHubManagementClient(credentials as any, Config.ArmSubscribtionId, clientOptions);
1

There are 1 best solutions below

0
On

The doc page you referenced is for the latest version of @azure/arm-eventhub, which is at 5.1.0 currently.

v3.2.0 has been deprecated. It does have a different API, for example, the constructor looks like this (from https://www.npmjs.com/package/@azure/arm-eventhub/v/3.2.0?activeTab=code)

  constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.EventHubManagementClientOptions) {