-
Notifications
You must be signed in to change notification settings - Fork 20
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
Public default settings #191
Public default settings #191
Conversation
❌ Build ServiceBus.AttachmentPlugin 0.0.765-preview failed (commit 30cf7520a7 by @) |
README.source.md
Outdated
```c# | ||
new AzureStorageAttachmentConfiguration(storageConnectionString).WithSasUri(messagePropertyToIdentifySasUri: "mySasUriProperty"); | ||
``` | ||
Default SAS token validation time is 7 days. The value is available via `AzureStorageAttachmentConfigurationExtensions.DefaultSasTokenValidationTime` constant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 on documenting the default value.
``` | ||
Default SAS token validation time is 7 days. The value is available via `AzureStorageAttachmentConfigurationExtensions.DefaultSasTokenValidationTime` constant. | ||
|
||
snippet: Configure_blob_sas_uri_override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for replacing hardcoded snippet with a verifiable code snippet 👏
@@ -11,6 +11,8 @@ namespace Microsoft.Azure.ServiceBus | |||
} | |||
public static class AzureStorageAttachmentConfigurationExtensions | |||
{ | |||
public const string DefaultMessagePropertyToIdentitySasUri = "$attachment.sas.uri"; | |||
public static readonly System.TimeSpan DefaultSasTokenValidationTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the value of exposing this? If the default is documented and known, how you would use this publicly exposed member field in your code? I'd like to understand how it would be used in the customer/user code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument is the same as on #185
Focusing on
ContainerName
andMessagePropertyToIdentifyAttachmentBlob
let's assume you're using the defaults. Both properties,ContainerName
andMessagePropertyToIdentifyAttachmentBlob
have their defaults provided by the plugin which you'd need to use. Those are well documented and will not change to keep wire compatibility. You can use those strings in your code. My understanding is you don't like to use the strings and rather have something strongly types exposed by theAzureStorageAttachmentConfiguration
class. That can be done, don't see an issue with it.
I would like to have access to a strongly typed values, so I don't have to worry about the values, even though I know they won't change. It reduces complexity (albeit not much) in my code.
I hope it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to have access to a strongly typed values, so I don't have to worry about the values, even though I know they won't change.
Absolutely. That's why it makes sense to have access to the defaults of the SAS URI property, the container name, and the blob identifier property. I can trace how you'd be using that in your code if you need to access the SAS URI property/container/message property for blob name. What I don't see is how the default SAS token validation time is used?
It reduces complexity (albeit not much) in my code.
@sorenhansen, could you show please demonstrate how AzureStorageAttachmentConfigurationExtensions.DefaultSasTokenValidationTime
would help with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SeanFeldman Sorry, I didn't catch that you specifically meant DefaultSasTokenValidationTime
I agree that making DefaultSasTokenValidationTime
public could be a bit much. It just made sense to me to make all default values public in case there would be a use case for them. In my particular case, I only need DefaultMessagePropertyToIdentitySasUri
.
I guess you would rather leave DefaultSasTokenValidationTime
internal for now, and then only expose it when it's absolutely needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I've been trained over the time not to reveal anything that is not absolutely necessary. Once it's public, you need to worry about deprecation and migration. When it stays internal, can do whatever is needed with it.
I would suggest removing that bit only. It's still good to mention the default value in the documentation for readers to have an idea. Additionally, some XML documentation can be added to the code, on the parameter, mentioning the default value here:
Line 18 in 7dfff04
/// <param name="sasTokenValidationTime">The time blob SAS URI is valid for.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sorenhansen, will you do the update or should I?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SeanFeldman I'll do the update. Just been busy the last few days 🙂
I plan on doing it later today
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SeanFeldman I've updated the code, making DefaultSasTokenValidationTime
internal again, and documenting the default value in the AzureStorageAttachmentConfigurationExtensions.WithBlobSasUri
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I have reviewed and left a comment.
Sorry for nitpicking. Don't want to release your good changes without ensuring we're not causing more work to the users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not at all nitpicking 🙂
When I made DefaultMessagePropertyToIdentitySasUri
public, I was a bit unhappy with it being in another class than the other constants, so I'm glad you pushed me to refactor it.
I've updated the PR with your proposed changes. I've left DefaultSasTokenValidationTime
in AzureStorageAttachmentConfigurationExtensions
as it's still internal
- Document default value in constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I've reviewed the code, I have realized that API wise it's awkward to have these constants that logically belong to the same group , to be spread across several types. This is what it looks from the user perspective:
Would be weird to access AzureStorageAttachmentConfigurationExtensions
for one constant and AzureStorageAttachmentConfiguration
for another two.
Perhaps those should be united under AzureStorageAttachmentConfigurationConstants
in the root namespace Microsoft.Azure.ServiceBus
? That way it's not hidden, will be side-by-side with the AzureStorageAttachmentConfiguration
which is used anyways, and will be easily discoverable.
…figurationConstants class
internal static TimeSpan DefaultSasTokenValidationTime = TimeSpan.FromDays(7); | ||
/// <summary> | ||
/// Default time the blob SAS URI is valid for. | ||
/// </summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment probably can go away
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
Thank you, @sorenhansen! |
Continuing along the lines of PR #189, this PR makes
DefaultMessagePropertyToIdentitySasUri
andDefaultSasTokenValidationTime
public.Again, the reason being that the default values can be used by consumers in order (for example) to implement cleanup.