Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include SharedAccessSignature in SB & EH connection string model #11909

Closed
wants to merge 2 commits into from

Conversation

ramya-rao-a
Copy link
Contributor

@ramya-rao-a ramya-rao-a commented Oct 19, 2020

#11893 and #11894 are issues requesting a parser for Service Bus and Event Hubs connection strings.
We already have a method parseConnectionString<T>(connectionString): T exposed from @azure/core-amqp that does something like this. The differences are

The main motivation behind the issues that were logged is to assist with transforming a connection string for use with credential-based client creation. With this PR, the parseConnectionString method along with the EH & SB connection string models are good enough for the time being, though not perfect.

@richardpark-msft, @HarshaNalluru, @bterlson, @jsquire, Thoughts?

@ramya-rao-a
Copy link
Contributor Author

Looks like the catch is going to be in making the SharedAccessKey and SharedAccessKeyName optional in the EH & SB connection string models. That would be a breaking change for core-amqp

const parsed = parseConnectionString<
ServiceBusConnectionStringModel & { SharedAccessSignature: string }
>(connectionString);
const parsed = parseConnectionString<ServiceBusConnectionStringModel>(connectionString);
Copy link
Member

@HarshaNalluru HarshaNalluru Oct 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be exposing parseConnectionString methods from service-bus and event-hubs separately?
Which would be

export const parseSBConnectionString = (connectionString: string) =>
  parseConnectionString<ServiceBusConnectionStringModel>(connectionString);

This way, users would also get the type info if they use parseSBConnectionString method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do that if the parseSBConnectionString method would then follow all the requirements logged in #11893 and #11894. If we are going with an intermediate offering in the meantime, then I would keep this as is in core-amqp

Also, this might be a good opportunity to gather all our core-amqp v2 requirements and see if we want to make the jump

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other benefit of what @HarshaNalluru 's suggesting is that we can slim down the interface that we return since, as you've pointed out, the current interfaces have the [x: string]: any; which I'd rather not be on the hook for in the future.

@jsquire
Copy link
Member

jsquire commented Oct 19, 2020

I've no objections to writing this off as a language idiom, if that's the will of the JS team. The intent behind the issues is:

  • Ensure that the connection string parsed is a well-formed and valid connection string for the service. If the client would reject it, the parse method should likewise reject it. Without the specifics of the domain logic, the value of having the parser in each client library is weakened; it would potentially be better as a general-purpose parser in the Core library.

  • Ensure that the names from the output of the parser map to the input of creating the clients. As a caller, knowing that I have to translate EntityPath to EventHubName isn't overly obvious, for example. Knowing that you need to parse the host from the EndpointAddress and call it FullyQualifiedNamespace is even less obivous.

@ramya-rao-a
Copy link
Contributor Author

Thanks all

It does look like there are limitations to the parseConnectionString in core-amqp that we would not want to tie ourselves to.
Closing in favor of #11949

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants