-
Notifications
You must be signed in to change notification settings - Fork 55
EventHub created through sendRequest can not be deleted through sendRequest #469
Copy link
Copy link
Open
Description
Package Version: 2.6.1
- nodejs
- nodejs version:
14.18.3 - os name/version:
macOS Monterey 12.4
- nodejs version:
Describe the bug
Looking for a bit of guidance.
I am creating and using an Event Hub as follows:
const tokenCredentials = (await AzAuth.loginWithUsernamePasswordWithAuthResponse(username, password)).credentials;
const client = new msREST.ServiceClient(tokenCredentials);
async createEventHub() {
const req: AzREST.RequestPrepareOptions = {
url: 'https://management.azure.com/subscriptions/[REDACTED]/resourceGroups/myGroup/providers/Microsoft.EventHub/namespaces/myNamespace/eventhubs/myEventHub?api-version=2017-04-01',
method: 'PUT',
body: {
messageRetentionInDays: 1;
partitionIds: [];
partitionCount: 1;
captureDescription: null;
}
};
return await client.sendRequest(req);
}
async deleteEventHub() {
const req: AzREST.RequestPrepareOptions = {
url: 'https://management.azure.com/subscriptions/[REDACTED]/resourceGroups/myGroup/providers/Microsoft.EventHub/namespaces/myNamespace/eventhubs/myEventHub?api-version=2017-04-01',
method: 'DELETE',
};
return await client.sendRequest(req);
}
await createEventHub();
// Create a Producer, send some events
await deleteEventHub();
I'm finding I can create the EventHub and use the Producer but when I attempt to delete the EventHub, the request response is 200 but the event hub is not deleted. Whats odd is that the Message Retention value will change from 1 to 7. I then have to delete it through the Portal.
If I create an EventHub through the portal UI, the delete through REST works on that EventHub.
Any ideas as to why this is?
As a note, with CURL, this works:
curl -X PUT -H 'Authorization: Bearer <token>' -H "content-type: application/json" 'https://management.azure.com/subscriptions/[REDACTED]/resourceGroups/myGroup/providers/Microsoft.EventHub/namespaces/myNamespace/eventhubs/testhub?api-version=2017-04-01' -v -d '{"properties": { "messageRetentionInDays": 1, "partitionIds": [], "partitionCount": 1, "captureDescription": null }}'
curl -X DELETE -H 'Authorization: Bearer <token>' -H "content-type: application/json" 'https://management.azure.com/subscriptions/[REDACTED]/resourceGroups/myGroup/providers/Microsoft.EventHub/namespaces/myNamespace/eventhubs/testhub?api-version=2017-04-01'
Expected behavior
Expect the EventHub to be deleted from the ResourceGroup.
Screenshots
N/A
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels