-
Notifications
You must be signed in to change notification settings - Fork 283
[Discussion] How to declare ClientOptions #300
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
Comments
Also, @rylev brought this up before, but it sounds like we should favor composition over derivation, such that a So logical structure would look like this using Storage as an example again: #[derive(Clone, Debug, Default)]
struct StorageClientOptions {
version: StorageClientServiceVersion,
options: azure_core::ClientOptions,
} I also recommend we derive |
The code you posted above looks good. My only nit would be perhaps a better name for the #[derive(Clone, Debug, Default)]
struct StorageClientOptions {
version: StorageClientServiceVersion,
options: azure_core::ClientOptions,
} Question: what would be the default |
We always default to the latest (hardcoded) at the time of compilation. Release semvers never refer to service preview versions - only "beta" (we stopped using "preview" because that causes support lifecycle confusion with the service) semvers can do that, but I'm not sure how those work with cargo. I'll have that in the guidelines to match our other SDKs as well. |
Starting with PR #288 we need to define how
ClientOptions
should be defined throughout our SDKs. Based on our general designs and .NET designs - more specifically for service versions - client options should be optional with good defaults.In PR #288 I'm suggesting we implement the
Default
trait along with setters that allow for a pattern like:Alternatively, a service version could be passed into a
new
associated function like we do for .NET and Java, at least.The underpinning concept is that nothing in
ClientOptions
should be required, or that should be in the associatedClient
class'snew
method (or similar).The Azure SDK guidelines isn't typically specific on how client options are implemented, but it state that we should follow a convention of:
The text was updated successfully, but these errors were encountered: