Simplify cosmos client construction #886
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR builds on #884 to slim down the instantiation of the cosmos client. It does away with
CosmosOptions
and adds more lenient bounds on the constructor. This PR is best reviewed on a per-commit basis. Thanks!Example
Details
The
CosmosOptions
struct is a thin wrapper around theazure_core::ClientOptions
struct. It doesn't expose any custom fields, and forwards all calls directly to the internalClientOptions
struct.CosmosOptions
has two constructors: the emptynew
method /Default
implementation, and thenew_with_transaction_name
method. The latter which is only used inside theCosmosClient::new_with_transaction
method, so removing it hasn't removed any existing functionality.We know that we want to expose the ability to add custom pipeline plugins (middleware) to the clients. But this can be done by exposing builder methods on the client, and we don't need an
Options
struct to achieve this. On the contrary: the work in this PR is intended as prep work to enable the implementation of a builder structure.So to summarize: no existing functionality is lost, and this sets us up to implement pipeline extensions using builder methods on the client.