Esempio n. 1
0
 internal protected QueueStorage(StorageAccountInfo accountInfo, string version)
 {
     this.AccountInfo = accountInfo;
     Timeout          = DefaultTimeout;
     RetryPolicy      = DefaultRetryPolicy;
     Version          = version;
 }
Esempio n. 2
0
 /// <summary>
 /// Factory method for BlobStorage
 /// </summary>
 /// <param name="accountInfo">Account information</param>
 /// <returns>A newly created BlobStorage instance</returns>
 public static BlobStorage Create(StorageAccountInfo accountInfo)
 {
     return(new BlobStorageRest(
                accountInfo.BaseUri,
                accountInfo.UsePathStyleUris,
                accountInfo.AccountName,
                accountInfo.Base64Key
                ));
 }
Esempio n. 3
0
 /// <summary>
 /// Factory method for BlobStorage
 /// </summary>
 /// <param name="accountInfo">Account information</param>
 /// <returns>A newly created BlobStorage instance</returns>
 public static BlobStorage Create(StorageAccountInfo accountInfo)
 {
     return new BlobStorageRest(
         accountInfo.BaseUri,
         accountInfo.UsePathStyleUris,
         accountInfo.AccountName,
         accountInfo.Base64Key
         );
 }
Esempio n. 4
0
 internal QueueStorageRest(StorageAccountInfo accountInfo, string version)
     : base(accountInfo, version)
 {
     byte[] key = null;
     if (accountInfo.Base64Key != null)
     {
         key = Convert.FromBase64String(accountInfo.Base64Key);
     }
     _credentials = new SharedKeyCredentials(accountInfo.AccountName, key);
 }
Esempio n. 5
0
 internal QueueStorageRest(StorageAccountInfo accountInfo,string version)
     : base(accountInfo,version)
 {
     byte[] key = null;
     if (accountInfo.Base64Key != null)
     {
         key = Convert.FromBase64String(accountInfo.Base64Key);
     }
     _credentials = new SharedKeyCredentials(accountInfo.AccountName, key);
 }
Esempio n. 6
0
 internal protected MessageQueue(string name, StorageAccountInfo account)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentException("Queue name cannot be null or empty!");
     }
     if (account == null)
     {
         throw new ArgumentNullException("account");
     }
     if (!Utilities.IsValidContainerOrQueueName(name))
     {
         throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "The specified queue name \"{0}\" is not valid!" +
                                                   "Please choose a name that conforms to the naming conventions for queues!", name));
     }
     _name    = name;
     _account = account;
 }
Esempio n. 7
0
 internal QueueRest(
             string name,
             StorageAccountInfo account,
             TimeSpan timeout,
             RetryPolicy retryPolicy
             )
     : base(name, account)
 {
     byte[] key = null;
     if (AccountInfo.Base64Key != null)
     {
         key = Convert.FromBase64String(AccountInfo.Base64Key);
     }
     ResourceUriComponents uriComponents = new ResourceUriComponents(account.AccountName, name, null);
     _credentials = new SharedKeyCredentials(AccountInfo.AccountName, key);
     _queueUri = HttpRequestAccessor.ConstructResourceUri(account.BaseUri, uriComponents, account.UsePathStyleUris);
     Timeout = timeout;
     RetryPolicy = retryPolicy;
 }
Esempio n. 8
0
        internal static Storage.StorageAccountInfo GetAccountInfo(StorageType storageType, string accountName, string privateKey)
        {
            Uri baseUri = null;

            switch (storageType)
            {
                case StorageType.Blob:
                    baseUri = new Uri(BlobUri);
                    break;
                case StorageType.Table:
                    baseUri = new Uri(TableUri);
                    break;
                case StorageType.Queue:
                    baseUri = new Uri(QueueUri);
                    break;
            }

            Storage.StorageAccountInfo accountInfo = new Storage.StorageAccountInfo(baseUri, null, accountName, privateKey);
            return accountInfo;
        }
Esempio n. 9
0
        internal QueueRest(
            string name,
            StorageAccountInfo account,
            TimeSpan timeout,
            RetryPolicy retryPolicy
            )
            : base(name, account)
        {
            byte[] key = null;
            if (AccountInfo.Base64Key != null)
            {
                key = Convert.FromBase64String(AccountInfo.Base64Key);
            }
            ResourceUriComponents uriComponents = new ResourceUriComponents(account.AccountName, name, null);

            _credentials = new SharedKeyCredentials(AccountInfo.AccountName, key);
            _queueUri    = HttpRequestAccessor.ConstructResourceUri(account.BaseUri, uriComponents, account.UsePathStyleUris);
            Timeout      = timeout;
            RetryPolicy  = retryPolicy;
        }
Esempio n. 10
0
 /// <summary>
 /// Factory method for BlobStorage
 /// </summary>
 /// <param name="baseUri">The base URI of the blob storage service</param>
 /// <param name="usePathStyleUris">If true, path-style URIs (http://baseuri/accountname/containername/objectname) are used.
 /// If false host-style URIs (http://accountname.baseuri/containername/objectname) are used,
 /// where baseuri is the URI of the service.
 /// If null, the choice is made automatically: path-style URIs if host name part of base URI is an 
 /// IP addres, host-style otherwise.</param>
 /// <param name="accountName">The name of the storage account</param>
 /// <param name="base64Key">Authentication key used for signing requests</param>
 /// <returns>A newly created BlobStorage instance</returns>
 public static BlobStorage Create(
                             Uri baseUri,
                             bool? usePathStyleUris,
                             string accountName,
                             string base64Key
                             )
 {
     //We create a StorageAccountInfo and then extract the properties of that object.
     //This is because the constructor of StorageAccountInfo does normalization of BaseUri.
     StorageAccountInfo accountInfo = new StorageAccountInfo(
                                         baseUri,
                                         usePathStyleUris,
                                         accountName,
                                         base64Key
                                         );
     return new BlobStorageRest(
         accountInfo.BaseUri,
         accountInfo.UsePathStyleUris,
         accountInfo.AccountName,
         accountInfo.Base64Key
         );
 }
Esempio n. 11
0
        /// <summary>
        /// Factory method for BlobStorage
        /// </summary>
        /// <param name="baseUri">The base URI of the blob storage service</param>
        /// <param name="usePathStyleUris">If true, path-style URIs (http://baseuri/accountname/containername/objectname) are used.
        /// If false host-style URIs (http://accountname.baseuri/containername/objectname) are used,
        /// where baseuri is the URI of the service.
        /// If null, the choice is made automatically: path-style URIs if host name part of base URI is an
        /// IP addres, host-style otherwise.</param>
        /// <param name="accountName">The name of the storage account</param>
        /// <param name="base64Key">Authentication key used for signing requests</param>
        /// <returns>A newly created BlobStorage instance</returns>
        public static BlobStorage Create(
            Uri baseUri,
            bool?usePathStyleUris,
            string accountName,
            string base64Key
            )
        {
            //We create a StorageAccountInfo and then extract the properties of that object.
            //This is because the constructor of StorageAccountInfo does normalization of BaseUri.
            StorageAccountInfo accountInfo = new StorageAccountInfo(
                baseUri,
                usePathStyleUris,
                accountName,
                base64Key
                );

            return(new BlobStorageRest(
                       accountInfo.BaseUri,
                       accountInfo.UsePathStyleUris,
                       accountInfo.AccountName,
                       accountInfo.Base64Key
                       ));
        }
Esempio n. 12
0
 public static QueueStorage Create(StorageAccountInfo accountInfo)
 {
     return new QueueStorageRest(accountInfo, null);
 }
Esempio n. 13
0
 internal static string GetInitExceptionDescription(StorageAccountInfo info, string desc)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("The reason for this exception is typically that the endpoints are not correctly configured. " + Environment.NewLine);
     if (info == null)
     {
         builder.Append("The current " + desc + " is null. Please specify a table endpoint!" + Environment.NewLine);
     }
     else
     {
         string baseUri = (info.BaseUri == null) ? "null" : info.BaseUri.ToString();
         builder.Append("The current " + desc + " is: " + baseUri + ", usePathStyleUris is: " + info.UsePathStyleUris + Environment.NewLine);
         builder.Append("Please also make sure that the account name and the shared key are specified correctly. This information cannot be shown here because of security reasons.");
     }
     return builder.ToString();
 }
Esempio n. 14
0
 internal static string GetInitExceptionDescription(StorageAccountInfo table, StorageAccountInfo blob)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append(GetInitExceptionDescription(table, "table storage configuration"));
     builder.Append(GetInitExceptionDescription(blob, "blob storage configuration"));
     return builder.ToString();
 }
Esempio n. 15
0
 public static QueueStorage Create(StorageAccountInfo accountInfo, string version)
 {
     return(new QueueStorageRest(accountInfo, version));
 }
Esempio n. 16
0
 public static QueueStorage Create(StorageAccountInfo accountInfo)
 {
     return(new QueueStorageRest(accountInfo, null));
 }
Esempio n. 17
0
 internal static void CheckAllowInsecureEndpoints(bool allowInsecureRemoteEndpoints, StorageAccountInfo info)
 {
     if (info == null)
     {
         throw new ArgumentNullException("info");
     }
     if (allowInsecureRemoteEndpoints)
     {
         return;
     }
     if (info.BaseUri == null || string.IsNullOrEmpty(info.BaseUri.Scheme))
     {
         throw new SecurityException("allowInsecureRemoteEndpoints is set to false (default setting) but the endpoint URL seems to be empty or there is no URL scheme." +
                                     "Please configure the provider to use an https enpoint for the storage endpoint or " +
                                     "explicitly set the configuration option allowInsecureRemoteEndpoints to true.");
     }
     if (info.BaseUri.Scheme.ToUpper(CultureInfo.InvariantCulture) == Uri.UriSchemeHttps.ToUpper(CultureInfo.InvariantCulture))
     {
         return;
     }
     if (info.BaseUri.IsLoopback)
     {
         return;
     }
     throw new SecurityException("The provider is configured with allowInsecureRemoteEndpoints set to false (default setting) but the endpoint for " +
                                 "the storage system does not seem to be an https or local endpoint. " +
                                 "Please configure the provider to use an https enpoint for the storage endpoint or " +
                                 "explicitly set the configuration option allowInsecureRemoteEndpoints to true.");
 }
Esempio n. 18
0
 protected CacheStore(string accountName, string sharedKey, string endPointUri, bool? usePathStyleUris)
 {
     storageAccountInfo = new StorageAccountInfo(new Uri(endPointUri), usePathStyleUris, accountName, sharedKey);
 }
Esempio n. 19
0
 internal protected QueueStorage(StorageAccountInfo accountInfo,string version)
 {
     this.AccountInfo = accountInfo;
     Timeout = DefaultTimeout;
     RetryPolicy = DefaultRetryPolicy;
     Version = version;
 }
 public LocationCacheDataServiceContext(StorageAccountInfo info)
     : base(info)
 {
 }
Esempio n. 21
0
 internal protected MessageQueue(string name, StorageAccountInfo account)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentException("Queue name cannot be null or empty!");
     }
     if (account == null)
     {
         throw new ArgumentNullException("account");
     }
     if (!Utilities.IsValidContainerOrQueueName(name))
     {
         throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "The specified queue name \"{0}\" is not valid!" +
                     "Please choose a name that conforms to the naming conventions for queues!", name));
     }
     _name = name;
     _account = account;
 }
Esempio n. 22
0
 internal protected QueueStorage(StorageAccountInfo accountInfo)
 {
     this.AccountInfo = accountInfo;
     Timeout          = DefaultTimeout;
     RetryPolicy      = DefaultRetryPolicy;
 }
Esempio n. 23
0
 public static QueueStorage Create(StorageAccountInfo accountInfo,string version)
 {
     return new QueueStorageRest(accountInfo,version);
 }
Esempio n. 24
0
 internal BlobProvider(StorageAccountInfo info, string containerName)
 {
     this._info = info;
     this._containerName = containerName;
 }