/// <summary>
        /// Adds SAS uri configuration.
        /// </summary>
        /// <param name="azureStorageAttachmentConfiguration"></param>
        /// <param name="messagePropertyToIdentifySasUri">The <see cref="Message"/> user property used for SAS uri.</param>
        /// <param name="sasTokenValidationTime">The time SAS uri is valid for.</param>
        /// <returns></returns>
        public static AzureStorageAttachmentConfiguration WithSasUri(
            this AzureStorageAttachmentConfiguration azureStorageAttachmentConfiguration,
            string messagePropertyToIdentifySasUri = DefaultMessagePropertyToIdentitySasUri,
            TimeSpan?sasTokenValidationTime        = null)
        {
            if (sasTokenValidationTime == null)
            {
                sasTokenValidationTime = DefaultSasTokenValidationTime;
            }
            Guard.AgainstNegativeOrZeroTimeSpan(nameof(sasTokenValidationTime), sasTokenValidationTime);

            azureStorageAttachmentConfiguration.MessagePropertyForSasUri = messagePropertyToIdentifySasUri;
            azureStorageAttachmentConfiguration.SasTokenValidationTime   = sasTokenValidationTime.Value;

            return(azureStorageAttachmentConfiguration);
        }
 public AzureStorageAttachment(AzureStorageAttachmentConfiguration configuration)
 {
     Guard.AgainstNull(nameof(configuration), configuration);
     this.configuration = configuration;
 }
 /// <summary>Instantiate plugin with the required configuration.</summary>
 /// <param name="client"><see cref="QueueClient"/>, <see cref="SubscriptionClient"/>, <see cref="QueueClient"/>, <see cref="MessageSender"/>, <see cref="MessageReceiver"/>, or <see cref="SessionClient"/> to register plugin with.</param>
 /// <param name="configuration"><see cref="AzureStorageAttachmentConfiguration"/> object.</param>
 public static void RegisterAzureStorageAttachmentPlugin(this ClientEntity client, AzureStorageAttachmentConfiguration configuration)
 {
     client.RegisterPlugin(new AzureStorageAttachment(configuration));
 }
        /// <summary>Instantiate plugin with the required configuration.</summary>
        /// <param name="client"><see cref="QueueClient"/>, <see cref="SubscriptionClient"/>, <see cref="QueueClient"/>, <see cref="MessageSender"/>, <see cref="MessageReceiver"/>, or <see cref="SessionClient"/> to register plugin with.</param>
        /// <param name="configuration"><see cref="AzureStorageAttachmentConfiguration"/> object.</param>
        /// <returns>Registered plugin as <see cref="ServiceBusPlugin"/>.</returns>
        public static ServiceBusPlugin RegisterAzureStorageAttachmentPlugin(this ClientEntity client, AzureStorageAttachmentConfiguration configuration)
        {
            ServiceBusPlugin plugin = new AzureStorageAttachment(configuration);

            client.RegisterPlugin(plugin);

            return(plugin);
        }