Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #117 from WindowsAzure/dev

Merging dev and Storage Client Libraries 2.0
  • Loading branch information...
commit 598f5a0f6f0cc430e9e8a52a2e92f8fe7b8ec30d 2 parents 91a2789 + 7ba7ffb
@jeffwilcox jeffwilcox authored
Showing with 20,222 additions and 1,168 deletions.
  1. +108 −0 .gitignore
  2. +16 −4 README.md
  3. +3 −3 ...ft-azure-api/Configuration/Microsoft.WindowsAzure.Configuration/Microsoft.WindowsAzure.Configuration.csproj
  4. +2 −2 microsoft-azure-api/Configuration/Microsoft.WindowsAzure.Configuration/Properties/AssemblyInfo.cs
  5. +3 −0  microsoft-azure-api/Services/Storage/.gitattributes
  6. +0 −98 microsoft-azure-api/Services/Storage/AssemblyInfo.cs
  7. +0 −32 microsoft-azure-api/Services/Storage/GlobalSuppressions.cs
  8. +168 −0 microsoft-azure-api/Services/Storage/Lib/Common/AccessCondition.cs
  9. +281 −0 microsoft-azure-api/Services/Storage/Lib/Common/Auth/StorageCredentials.cs
  10. +27 −35 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/BlobAttributes.cs
  11. +4 −8 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/BlobContainerPermissions.cs
  12. +22 −8 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/BlobContainerProperties.cs
  13. +1 −4 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/BlobContainerPublicAccessType.cs
  14. +131 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/BlobContinuationToken.cs
  15. +8 −6 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/BlobListingDetails.cs
  16. +18 −11 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/BlobProperties.cs
  17. +232 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/BlobReadStreamBase.cs
  18. +105 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/BlobRequestOptions.cs
  19. +45 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/BlobResultSegment.cs
  20. +1 −4 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/BlobType.cs
  21. +258 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/BlobWriteStreamBase.cs
  22. +2 −5 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/BlockListingFilter.cs
  23. +1 −4 microsoft-azure-api/Services/Storage/{StorageClient/Protocol → Lib/Common/Blob}/BlockSearchMode.cs
  24. +313 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/CloudBlobClientBase.cs
  25. +241 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/CloudBlobContainerBase.cs
  26. +212 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/CloudBlobDirectoryBase.cs
  27. +420 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/CloudBlockBlobBase.cs
  28. +420 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/CloudPageBlobBase.cs
  29. +1 −4 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/ContainerListingDetails.cs
  30. +45 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/ContainerResultSegment.cs
  31. +97 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/CopyState.cs
  32. +50 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/CopyStatus.cs
  33. +1 −4 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/DeleteSnapshotsOption.cs
  34. +86 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/ICloudBlobBase.cs
  35. +1 −4 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/IListBlobItem.cs
  36. +8 −6 microsoft-azure-api/Services/Storage/{StorageClient/Protocol → Lib/Common/Blob}/LeaseAction.cs
  37. +40 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/LeaseDuration.cs
  38. +19 −17 ...e-api/Services/Storage/{StorageClient/Protocol/ConditionHeaderKind.cs → Lib/Common/Blob/LeaseState.cs}
  39. +4 −9 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/LeaseStatus.cs
  40. +4 −16 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/ListBlockItem.cs
  41. +4 −18 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/PageRange.cs
  42. +74 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/Protocol/BlobAccessPolicyResponse.cs
  43. +16 −12 ...es/Storage/{StorageClient/BlobContainerAttributes.cs → Lib/Common/Blob/Protocol/BlobContainerEntry.cs}
  44. +168 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/Protocol/BlobErrorCodeStrings.cs
  45. +204 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/Protocol/BlobHttpResponseParsersBase.cs
  46. +14 −9 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/Protocol/BlobListingContext.cs
  47. +103 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/Protocol/BlobRequest.cs
  48. +71 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/Protocol/ContainerHttpResponseParsersBase.cs
  49. +156 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/Protocol/GetBlockListResponse.cs
  50. +58 −46 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/Protocol/GetPageRangesResponse.cs
  51. +8 −9 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/Protocol/IListBlobEntry.cs
  52. +118 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/Protocol/ListBlobEntry.cs
  53. +9 −7 .../Storage/{StorageClient/Protocol/BlobPrefixEntry.cs → Lib/Common/Blob/Protocol/ListBlobPrefixEntry.cs}
  54. +507 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/Protocol/ListBlobsResponse.cs
  55. +335 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/Protocol/ListContainersResponse.cs
  56. +2 −5 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/Protocol/PageWrite.cs
  57. +8 −6 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Blob}/Protocol/PutBlockListItem.cs
  58. +3 −7 ...es/Storage/{StorageClient/SharedAccessPermissions.cs → Lib/Common/Blob/SharedAccessBlobPermissions.cs}
  59. +230 −0 microsoft-azure-api/Services/Storage/Lib/Common/Blob/SharedAccessBlobPolicies.cs
  60. +29 −29 ...api/Services/Storage/{StorageClient/SharedAccessPolicy.cs → Lib/Common/Blob/SharedAccessBlobPolicy.cs}
  61. +240 −227 microsoft-azure-api/Services/Storage/{ → Lib/Common}/CloudStorageAccount.cs
  62. +98 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Auth/CanonicalizationHelperBase.cs
  63. +601 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Auth/SharedAccessSignatureHelper.cs
  64. +10 −17 microsoft-azure-api/Services/Storage/{StorageClient/Protocol → Lib/Common/Core}/CanonicalizedString.cs
  65. +361 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Executor/ExecutionState.cs
  66. +119 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Executor/ExecutorBase.cs
  67. +93 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Executor/RESTCommand.cs
  68. +80 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Executor/RequestOptionsExtensions.cs
  69. +82 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Executor/StorageCommandBase.cs
  70. +8 −14 ...osoft-azure-api/Services/Storage/{StorageClient/Tasks/NullTaskReturn.cs → Lib/Common/Core/NullType.cs}
  71. +126 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/SR.cs
  72. +8 −6 microsoft-azure-api/Services/Storage/{StorageClient/Protocol → Lib/Common/Core}/UriQueryBuilder.cs
  73. +14 −10 ...azure-api/Services/Storage/{StorageClient/RetryPolicy.cs → Lib/Common/Core/Util/AsyncSemaphoreBase.cs}
  74. +220 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Util/CommonUtils.cs
  75. +52 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Util/CryptoUtility.cs
  76. +110 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Util/Exceptions.cs
  77. +109 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Util/General.cs
  78. +150 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Util/HttpUtility.cs
  79. +174 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Util/MD5Wrapper.cs
  80. +157 −66 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Core/Util}/NavigationHelper.cs
  81. +27 −17 ...ices/Storage/{StorageClient/Protocol/BlobContainerEntry.cs → Lib/Common/Core/Util/StreamDescriptor.cs}
  82. +180 −0 microsoft-azure-api/Services/Storage/Lib/Common/Core/Util/StreamExtensions.cs
  83. +32 −0 microsoft-azure-api/Services/Storage/Lib/Common/DoesServiceRequest.cs
  84. +27 −0 microsoft-azure-api/Services/Storage/Lib/Common/IContinuationToken.cs
  85. +47 −0 microsoft-azure-api/Services/Storage/Lib/Common/IRequestOptions.cs
  86. +139 −0 microsoft-azure-api/Services/Storage/Lib/Common/OperationContext.cs
  87. +30 −0 microsoft-azure-api/Services/Storage/Lib/Common/Properties/AssemblyInfo.cs
  88. +255 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/CloudQueueBase.cs
  89. +186 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/CloudQueueClientBase.cs
  90. +91 −65 ...-api/Services/Storage/{StorageClient/CloudQueueMessage.cs → Lib/Common/Queue/CloudQueueMessageBase.cs}
  91. +5 −9 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Queue}/MessageUpdateFields.cs
  92. +20 −11 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Queue}/Protocol/GetMessagesResponse.cs
  93. +28 −37 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Queue}/Protocol/ListQueuesResponse.cs
  94. +73 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/Protocol/QueueAccessPolicyResponse.cs
  95. +126 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/Protocol/QueueContinuationToken.cs
  96. +24 −20 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Queue}/Protocol/QueueEntry.cs
  97. +11 −9 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Queue/Protocol}/QueueErrorCodeStrings.cs
  98. +52 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/Protocol/QueueHttpResponseParsersBase.cs
  99. +51 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/Protocol/QueueListingContext.cs
  100. +6 −9 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Queue/Protocol}/QueueListingDetails.cs
  101. +8 −14 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Queue}/Protocol/QueueMessage.cs
  102. +39 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/Protocol/QueuePermissions.cs
  103. +79 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/Protocol/QueueRequest.cs
  104. +36 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/QueueMessageType.cs
  105. +79 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/QueueRequestOptions.cs
  106. +46 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/QueueResultSegment.cs
  107. +53 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/SharedAccessQueuePermissions.cs
  108. +230 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/SharedAccessQueuePolicies.cs
  109. +129 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/SharedAccessQueuePolicy.cs
  110. +65 −0 microsoft-azure-api/Services/Storage/Lib/Common/RequestEventArgs.cs
  111. +256 −0 microsoft-azure-api/Services/Storage/Lib/Common/RequestResult.cs
  112. +83 −0 microsoft-azure-api/Services/Storage/Lib/Common/ResultSegment.cs
  113. +106 −0 microsoft-azure-api/Services/Storage/Lib/Common/RetryPolicies/ExponentialRetry.cs
  114. +44 −0 microsoft-azure-api/Services/Storage/Lib/Common/RetryPolicies/IRetryPolicy.cs
  115. +90 −0 microsoft-azure-api/Services/Storage/Lib/Common/RetryPolicies/LinearRetry.cs
  116. +58 −0 microsoft-azure-api/Services/Storage/Lib/Common/RetryPolicies/NoRetry.cs
  117. +93 −0 microsoft-azure-api/Services/Storage/Lib/Common/Shared/Protocol/AccessPolicyResponseBase.cs
  118. +343 −106 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Shared}/Protocol/Constants.cs
  119. +137 −0 microsoft-azure-api/Services/Storage/Lib/Common/Shared/Protocol/HttpResponseParsersBase.cs
  120. +13 −9 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Shared}/Protocol/ListingContext.cs
  121. +5 −8 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Shared}/Protocol/LoggingOperations.cs
  122. +6 −9 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Shared}/Protocol/LoggingProperties.cs
  123. +5 −8 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Shared}/Protocol/MetricsLevel.cs
  124. +6 −9 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Shared}/Protocol/MetricsProperties.cs
  125. +83 −0 microsoft-azure-api/Services/Storage/Lib/Common/Shared/Protocol/Request.cs
  126. +98 −0 microsoft-azure-api/Services/Storage/Lib/Common/Shared/Protocol/Response.cs
  127. +24 −11 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Shared}/Protocol/ResponseParsingBase.cs
  128. +38 −23 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Shared}/Protocol/ServiceProperties.cs
  129. +172 −0 microsoft-azure-api/Services/Storage/Lib/Common/StorageException.cs
  130. +176 −0 microsoft-azure-api/Services/Storage/Lib/Common/StorageExtendedErrorInformation.cs
  131. +189 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/CloudTableBase.cs
  132. +260 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/CloudTableClientBase.cs
  133. +148 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/DynamicTableEntity.cs
  134. +66 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/EdmType.cs
  135. +628 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/EntityProperty.cs
  136. +32 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/EntityReadFlags.cs
  137. +29 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/EntityResolver.cs
  138. +54 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/EntityUtilities.cs
  139. +77 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/ITableEntity.cs
  140. +73 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/Protocol/TableAccessPolicyResponse.cs
  141. +124 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/Protocol/TableConstants.cs
  142. +13 −11 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Table/Protocol}/TableErrorCodeStrings.cs
  143. +38 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/Protocol/TableRequest.cs
  144. +72 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/QueryComparisons.cs
  145. +53 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/SharedAccessTablePermissions.cs
  146. +212 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/SharedAccessTablePolicies.cs
  147. +130 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/SharedAccessTablePolicy.cs
  148. +359 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableBatchOperationBase.cs
  149. +190 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableContinuationToken.cs
  150. +252 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableEntity.cs
  151. +253 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableOperationBase.cs
  152. +34 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableOperationType.cs
  153. +51 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableOperators.cs
  154. +39 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TablePermissions.cs
  155. +353 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableQueryBase.cs
  156. +351 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableQueryGenericBase.cs
  157. +90 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableQuerySegment.cs
  158. +82 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableRequestOptions.cs
  159. +44 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableResult.cs
  160. +83 −0 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableResultSegment.cs
  161. +12 −11 microsoft-azure-api/Services/Storage/{StorageClient → Lib/Common/Table}/TableServiceTable.cs
  162. +256 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/DotNet40.csproj
  163. +20 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/DotNet40.sln
  164. +12 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/ICancellableAsyncResult.cs
  165. BIN  microsoft-azure-api/Services/Storage/Lib/DotNet40/MSSharedLibKey.snk
  166. +52 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Properties/AssemblyInfo.cs
  167. +289 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Settings.StyleCop
  168. +1,126 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Table/CloudTable.cs
  169. +393 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Table/CloudTableClient.cs
  170. +78 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Table/Protocol/HttpResponseAdapterMessage.cs
  171. +105 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Table/Protocol/HttpWebRequestAdapterMessage.cs
  172. +182 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Table/Protocol/TableOperationHttpRequestFactory.cs
  173. +377 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Table/Protocol/TableOperationHttpResponseParsers.cs
  174. +131 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Table/TableBatchOperation.cs
  175. +289 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Table/TableOperation.cs
  176. +184 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Table/TableQuery.cs
Sorry, we could not display the entire diff because too many files (557) changed.
View
108 .gitignore
@@ -0,0 +1,108 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+
+[Dd]ebug*/
+[Rr]elease/
+
+build/
+
+
+[Tt]est[Rr]esult
+[Bb]uild[Ll]og.*
+
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+*.vssscc
+.builds
+
+*.pidb
+
+*.log
+*.scc
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+
+*.[Rr]e[Ss]harper
+
+# NCrunch
+*.ncrunch*
+.*crunch*.local.xml
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Publish Web Output
+*.Publish.xml
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+[Tt]est[Rr]esult*
+*.Cache
+ClientBin
+[Ss]tyle[Cc]op.*
+~$*
+*.dbmdl
+
+*.[Pp]ublish.xml
+
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+# NuGet
+packages/
View
20 README.md
@@ -1,4 +1,4 @@
-<h1>Windows Azure SDK for .NET (1.7.0.0)</h1>
+<h1>Windows Azure SDK for Windows 8 and .NET 4(2.0.0.0)</h1>
<p>This SDK allows you to build Windows Azure applications that take advantage of
Azure scalable cloud computing resources: table and blob storage, messaging through
Service Bus, distributed caching through cache.</p>
@@ -41,12 +41,22 @@ within your project you can also have them installed by the .NET package manager
<ul>
<li>Account: To use this SDK to call Windows Azure services, you need to first
create an account.</li>
- <li>Hosting: To host your Java code in Windows Azure, you additionally need
+ <li>Hosting: To host your .Net code in Windows Azure, you additionally need
to download the full Windows Azure SDK for .NET - which includes packaging,
emulation, and deployment tools.</li>
- <li>.NET Framework 3.5 or higher</li>
+ <li>Windows 8 or .NET Framework 4.0</li>
</ul>
+<h2>Dependencies</h2>
+<p>
+The 2.0.0.0 version depends on three libraries (collectively referred to as ODataLib), which are resolved through the ODataLib (version 5.0.2) packages available through NuGet and not the WCF Data Services installer which currently contains 5.0.0 versions.
+The ODataLib libraries can be downloaded directly or referenced by your code project through NuGet.
+The specific ODataLib packages are:<br/>
+http://nuget.org/packages/Microsoft.Data.OData/5.0.2<br/>
+http://nuget.org/packages/Microsoft.Data.Edm/5.0.2<br/>
+http://nuget.org/packages/System.Spatial/5.0.2<br/>
+</p>
+
<h2>Code Samples</h2>
<p>Note:</p>
<ul>
@@ -69,7 +79,9 @@ a <strong>client</strong> which allows performing actions on it. The resource is
var tableClient = storageAccount.CreateCloudTableClient();</pre></p>
<p>Now, to create a table entity using the client:<br/>
-<pre>tableClient.CreateTable("People");</pre></p>
+<pre>CloudTable peopleTable = tableClient.GetTableReference("people");
+peopleTable.Create();
+</pre></p>
<h1>Need Help?</h1>
<p>Be sure to check out the Windows Azure <a href="http://go.microsoft.com/fwlink/?LinkId=234489">
View
6 ...azure-api/Configuration/Microsoft.WindowsAzure.Configuration/Microsoft.WindowsAzure.Configuration.csproj
@@ -46,9 +46,9 @@
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+ <CodeAnalysisRuleSetDirectories>;$(ProgramFiles)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
- <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+ <CodeAnalysisRuleDirectories>;$(ProgramFiles)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<ItemGroup>
@@ -77,7 +77,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
- <None Include="MSSharedLibSN1024.snk" />
+ <None Include="MSSharedLibKey.snk" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
View
4 microsoft-azure-api/Configuration/Microsoft.WindowsAzure.Configuration/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3a4d8eda-db18-4c6f-9f84-4576bb255f30")]
-[assembly: AssemblyVersion("1.7.0.0")]
-[assembly: AssemblyFileVersion("1.7.0.0")]
+[assembly: AssemblyVersion("1.8.0.0")]
+[assembly: AssemblyFileVersion("1.8.0.0")]
View
3  microsoft-azure-api/Services/Storage/.gitattributes
@@ -0,0 +1,3 @@
+*.cs eol=crlf
+*.csproj eol=crlf
+*.sln eol=crlf
View
98 microsoft-azure-api/Services/Storage/AssemblyInfo.cs
@@ -1,98 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="AssemblyInfo.cs" company="Microsoft">
-// Copyright 2012 Microsoft Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// </copyright>
-// <summary>
-// Contains assembly information.
-// </summary>
-//-----------------------------------------------------------------------
-
-using System;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Security;
-using System.Reflection;
-
-#if UNSIGNED
-[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.StorageClient.Internal")]
-[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.StorageClient.ConvenienceTests")]
-[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.StorageClient.Protocol.Tests")]
-[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.Diagnostics")]
-[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.Diagnostics.Internal")]
-[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.CloudDrive")]
-[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.InternalAccessor")]
-#else
-[assembly: InternalsVisibleTo(
- "Microsoft.WindowsAzure.StorageClient.Internal, PublicKey=" +
- "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67" +
- "871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0b" +
- "d333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307" +
- "e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c3" +
- "08055da9")]
-[assembly: InternalsVisibleTo(
- "StorageClientConvenienceTests, PublicKey=" +
- "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67" +
- "871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0b" +
- "d333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307" +
- "e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c3" +
- "08055da9")]
-[assembly: InternalsVisibleTo(
- "StorageClientProtocolTests, PublicKey=" +
- "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67" +
- "871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0b" +
- "d333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307" +
- "e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c3" +
- "08055da9")]
-[assembly: InternalsVisibleTo(
- "StorageClientProtocolBillingTests, PublicKey=" +
- "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67" +
- "871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0b" +
- "d333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307" +
- "e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c3" +
- "08055da9")]
-[assembly: InternalsVisibleTo(
- "Microsoft.WindowsAzure.Diagnostics, PublicKey=" +
- "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67" +
- "871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0b" +
- "d333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307" +
- "e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c3" +
- "08055da9")]
-[assembly: InternalsVisibleTo(
- "Microsoft.WindowsAzure.Diagnostics.Internal, PublicKey=" +
- "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67" +
- "871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0b" +
- "d333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307" +
- "e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c3" +
- "08055da9")]
-[assembly: InternalsVisibleTo(
- "Microsoft.WindowsAzure.CloudDrive, PublicKey=" +
- "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67" +
- "871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0b" +
- "d333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307" +
- "e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c3" +
- "08055da9")]
-[assembly: InternalsVisibleTo(
- "Microsoft.WindowsAzure.InternalAccessor, PublicKey=" +
- "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67" +
- "871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0b" +
- "d333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307" +
- "e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c3" +
- "08055da9")]
-
-#endif
-[assembly: AssemblyVersion("1.7.0.0")]
-[assembly: CLSCompliant(true)]
-[assembly: AllowPartiallyTrustedCallers]
-[assembly: SecurityTransparent]
-[assembly: NeutralResourcesLanguageAttribute("en-US")]
View
32 microsoft-azure-api/Services/Storage/GlobalSuppressions.cs
@@ -1,32 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="GlobalSuppressions.cs" company="Microsoft">
-// Copyright 2012 Microsoft Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// </copyright>
-// <summary>
-// Defines suppressions for the project
-// </summary>
-//-----------------------------------------------------------------------
-//
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click
-// "In Project Suppression File".
-// You do not need to add suppressions to this file manually.
-
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1701:ResourceStringCompoundWordsShouldBeCasedCorrectly", MessageId = "ETag", Scope = "resource", Target = "Microsoft.WindowsAzure.StorageClient.SR.resources")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "string", Scope = "member", Target = "Microsoft.WindowsAzure.StorageClient.Protocol.CanonicalizationStrategy.#AppendStringToCanonicalizedString(System.Text.StringBuilder,System.String)")]
View
168 microsoft-azure-api/Services/Storage/Lib/Common/AccessCondition.cs
@@ -0,0 +1,168 @@
+// -----------------------------------------------------------------------------------------
+// <copyright file="AccessCondition.cs" company="Microsoft">
+// Copyright 2012 Microsoft Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// </copyright>
+// -----------------------------------------------------------------------------------------
+
+namespace Microsoft.WindowsAzure.Storage
+{
+ using System;
+
+ /// <summary>
+ /// Represents a set of access conditions to be used for operations against the storage services.
+ /// </summary>
+ public sealed class AccessCondition
+ {
+ /// <summary>
+ /// Time for IfModifiedSince.
+ /// </summary>
+ private DateTimeOffset? ifModifiedSinceDateTime;
+
+ /// <summary>
+ /// Time for IfUnmodifiedSince.
+ /// </summary>
+ private DateTimeOffset? ifNotModifiedSinceDateTime;
+
+ /// <summary>
+ /// Gets or sets an "etag" that must match the ETag of a resource.
+ /// </summary>
+ /// <value>A quoted ETag string. If <c>null</c>, no condition exists.</value>
+ public string IfMatchETag
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets an ETag that must not match the ETag of a resource.
+ /// </summary>
+ /// <value>A quoted ETag string, or <c>"*"</c> to match any ETag. If null, no condition exists.</value>
+ public string IfNoneMatchETag
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets a time that must be before the last modification of a resource.
+ /// </summary>
+ /// <value>A <c>DateTimeOffset</c> in UTC, or null if no condition exists.</value>
+ public DateTimeOffset? IfModifiedSinceTime
+ {
+ get
+ {
+ return this.ifModifiedSinceDateTime;
+ }
+
+ set
+ {
+ this.ifModifiedSinceDateTime = value.HasValue ? value.Value.ToUniversalTime() : value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a time that must not be before the last modification of a resource.
+ /// </summary>
+ /// <value>A <c>DateTimeOffset</c> in UTC, or null if no condition exists.</value>
+ public DateTimeOffset? IfNotModifiedSinceTime
+ {
+ get
+ {
+ return this.ifNotModifiedSinceDateTime;
+ }
+
+ set
+ {
+ this.ifNotModifiedSinceDateTime = value.HasValue ? value.Value.ToUniversalTime() : value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a lease ID that must match the lease on a resource.
+ /// </summary>
+ /// <value>A lease ID, or null if no condition exists.</value>
+ public string LeaseId
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Constructs an empty access condition.
+ /// </summary>
+ /// <returns>An empty access condition.</returns>
+ public static AccessCondition GenerateEmptyCondition()
+ {
+ return new AccessCondition();
+ }
+
+ /// <summary>
+ /// Constructs an access condition such that an operation will be performed only if the resource's ETag value
+ /// matches the specified ETag value.
+ /// </summary>
+ /// <param name="etag">The ETag value that must be matched.</param>
+ /// <returns>An <c>AccessCondition</c> object that represents the If-Match condition.</returns>
+ public static AccessCondition GenerateIfMatchCondition(string etag)
+ {
+ return new AccessCondition { IfMatchETag = etag };
+ }
+
+ /// <summary>
+ /// Constructs an access condition such that an operation will be performed only if the resource has been
+ /// modified since the specified time.
+ /// </summary>
+ /// <param name="modifiedTime">The time that must be before the last modified time of the resource.</param>
+ /// <returns>An <c>AccessCondition</c> object that represents the If-Modified-Since condition.</returns>
+ public static AccessCondition GenerateIfModifiedSinceCondition(DateTimeOffset modifiedTime)
+ {
+ return new AccessCondition { IfModifiedSinceTime = modifiedTime };
+ }
+
+ /// <summary>
+ /// Constructs an access condition such that an operation will be performed only if the resource's ETag value
+ /// does not match the specified ETag value.
+ /// </summary>
+ /// <param name="etag">The ETag value that must be matched, or <c>"*"</c>.</param>
+ /// <returns>An <c>AccessCondition</c> object that represents the If-None-Match condition.</returns>
+ /// <remarks>
+ /// If <c>"*"</c> is specified as the parameter then this condition requires that the resource does not exist.
+ /// </remarks>
+ public static AccessCondition GenerateIfNoneMatchCondition(string etag)
+ {
+ return new AccessCondition { IfNoneMatchETag = etag };
+ }
+
+ /// <summary>
+ /// Constructs an access condition such that an operation will be performed only if the resource has not been
+ /// modified since the specified time.
+ /// </summary>
+ /// <param name="modifiedTime">The time that must not be before the last modified time of the resource.</param>
+ /// <returns>An <c>AccessCondition</c> object that represents the If-Unmodified-Since condition.</returns>
+ public static AccessCondition GenerateIfNotModifiedSinceCondition(DateTimeOffset modifiedTime)
+ {
+ return new AccessCondition { IfNotModifiedSinceTime = modifiedTime };
+ }
+
+ /// <summary>
+ /// Constructs an access condition such that an operation will be performed only if the lease ID on the
+ /// resource matches the specified lease ID.
+ /// </summary>
+ /// <param name="leaseId">The lease ID that must match the lease ID of the resource.</param>
+ /// <returns>An <c>AccessCondition</c> object that represents the lease condition.</returns>
+ public static AccessCondition GenerateLeaseCondition(string leaseId)
+ {
+ return new AccessCondition { LeaseId = leaseId };
+ }
+ }
+}
View
281 microsoft-azure-api/Services/Storage/Lib/Common/Auth/StorageCredentials.cs
@@ -0,0 +1,281 @@
+//-----------------------------------------------------------------------
+// <copyright file="StorageCredentials.cs" company="Microsoft">
+// Copyright 2012 Microsoft Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace Microsoft.WindowsAzure.Storage.Auth
+{
+ using Microsoft.WindowsAzure.Storage.Core;
+ using Microsoft.WindowsAzure.Storage.Core.Util;
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
+
+ /// <summary>
+ /// Represents a set of credentials used to authenticate access to a Windows Azure storage account.
+ /// </summary>
+ public sealed class StorageCredentials
+ {
+ private UriQueryBuilder queryBuilder;
+
+ /// <summary>
+ /// Gets the associated shared access signature token for the credentials.
+ /// </summary>
+ /// <value>The shared access signature token.</value>
+ public string SASToken { get; private set; }
+
+ /// <summary>
+ /// Gets the associated account name for the credentials.
+ /// </summary>
+ /// <value>The account name.</value>
+ public string AccountName { get; private set; }
+
+ /// <summary>
+ /// Gets the associated key name for the credentials.
+ /// </summary>
+ /// <value>The key name.</value>
+ public string KeyName { get; private set; }
+
+ internal byte[] KeyValue { get; private set; }
+
+ /// <summary>
+ /// Gets a value indicating whether the credentials are for anonymous access.
+ /// </summary>
+ /// <value><c>true</c> if the credentials are for anonymous access; otherwise, <c>false</c>.</value>
+ public bool IsAnonymous
+ {
+ get
+ {
+ return (this.SASToken == null) && (this.AccountName == null);
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the credentials are a shared access signature token.
+ /// </summary>
+ /// <value><c>true</c> if the credentials are a shared access signature token; otherwise, <c>false</c>.</value>
+ public bool IsSAS
+ {
+ get
+ {
+ return (this.SASToken != null) && (this.AccountName == null);
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the credentials are a shared key.
+ /// </summary>
+ /// <value><c>true</c> if the credentials are a shared key; otherwise, <c>false</c>.</value>
+ public bool IsSharedKey
+ {
+ get
+ {
+ return (this.SASToken == null) && (this.AccountName != null);
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="StorageCredentials"/> class.
+ /// </summary>
+ public StorageCredentials()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="StorageCredentials"/> class with the specified account name and key value.
+ /// </summary>
+ /// <param name="accountName">A string that represents the name of the storage account.</param>
+ /// <param name="keyValue">A string that represents the Base-64-encoded account access key.</param>
+ public StorageCredentials(string accountName, string keyValue)
+ : this(accountName, keyValue, null)
+ {
+ }
+
+#if DNCP
+ /// <summary>
+ /// Initializes a new instance of the <see cref="StorageCredentials"/> class with the specified account name and key value.
+ /// </summary>
+ /// <param name="accountName">A string that represents the name of the storage account.</param>
+ /// <param name="keyValue">An array of bytes that represent the account access key.</param>
+ public StorageCredentials(string accountName, byte[] keyValue)
+ : this(accountName, keyValue, null)
+ {
+ }
+#endif
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="StorageCredentials"/> class with the specified account name, key value, and key name.
+ /// </summary>
+ /// <param name="accountName">A string that represents the name of the storage account.</param>
+ /// <param name="keyValue">A string that represents the Base-64-encoded account access key.</param>
+ /// <param name="keyName">A string that represents the name of the key.</param>
+ public StorageCredentials(string accountName, string keyValue, string keyName)
+ {
+ if (string.IsNullOrEmpty(accountName))
+ {
+ throw new ArgumentNullException("accountName");
+ }
+
+ this.AccountName = accountName;
+ this.UpdateKey(keyValue, keyName);
+ }
+
+#if DNCP
+ /// <summary>
+ /// Initializes a new instance of the <see cref="StorageCredentials"/> class with the specified account name, key value, and key name.
+ /// </summary>
+ /// <param name="accountName">A string that represents the name of the storage account.</param>
+ /// <param name="keyValue">An array of bytes that represent the account access key.</param>
+ /// <param name="keyName">A string that represents the name of the key.</param>
+ public StorageCredentials(string accountName, byte[] keyValue, string keyName)
+ {
+ if (string.IsNullOrEmpty(accountName))
+ {
+ throw new ArgumentNullException("accountName");
+ }
+
+ this.AccountName = accountName;
+ this.UpdateKey(keyValue, keyName);
+ }
+#endif
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="StorageCredentials"/> class with the specified shared access signature token.
+ /// </summary>
+ /// <param name="sasToken">A string representing the shared access signature token.</param>
+ public StorageCredentials(string sasToken)
+ {
+ if (string.IsNullOrEmpty(sasToken))
+ {
+ throw new ArgumentNullException("sasToken");
+ }
+
+ this.queryBuilder = new UriQueryBuilder();
+ IDictionary<string, string> parameters = HttpUtility.ParseQueryString(sasToken);
+ foreach (KeyValuePair<string, string> parameter in parameters)
+ {
+ this.queryBuilder.Add(parameter.Key, parameter.Value);
+ }
+
+ this.SASToken = sasToken;
+ }
+
+ /// <summary>
+ /// Updates the key value and key name for the credentials.
+ /// </summary>
+ /// <param name="keyValue">The key value, as a Base-64 encoded string, to update.</param>
+ /// <param name="keyName">The key name to update.</param>
+ public void UpdateKey(string keyValue, string keyName)
+ {
+ if (string.IsNullOrEmpty(keyValue))
+ {
+ throw new ArgumentNullException("keyValue");
+ }
+
+ this.KeyName = keyName;
+ this.KeyValue = Convert.FromBase64String(keyValue);
+ }
+
+#if DNCP
+
+ /// <summary>
+ /// Updates the key value and key name for the credentials.
+ /// </summary>
+ /// <param name="keyValue">The key value, as an array of bytes, to update.</param>
+ /// <param name="keyName">The key name to update.</param>
+ public void UpdateKey(byte[] keyValue, string keyName)
+ {
+ if (keyValue == null)
+ {
+ throw new ArgumentNullException("keyValue");
+ }
+
+ this.KeyName = keyName;
+ this.KeyValue = (byte[])keyValue.Clone();
+ }
+#endif
+
+ /// <summary>
+ /// Returns the key for the credentials.
+ /// </summary>
+ /// <returns>An array of bytes that contains the key.</returns>
+ public byte[] ExportKey()
+ {
+ return (byte[])this.KeyValue.Clone();
+ }
+
+ /// <summary>
+ /// Transforms a resource URI into a shared access signature URI, by appending a shared access token.
+ /// </summary>
+ /// <param name="resourceUri">A <see cref="Uri"/> object that represents the resource URI to be transformed.</param>
+ /// <returns>A <see cref="Uri"/> object that represents the signature, including the resource URI and the shared access token.</returns>
+ public Uri TransformUri(Uri resourceUri)
+ {
+ if (this.IsSAS)
+ {
+ return this.queryBuilder.AddToUri(resourceUri);
+ }
+ else
+ {
+ return resourceUri;
+ }
+ }
+
+ internal string GetBase64EncodedKey()
+ {
+ return (this.KeyValue == null) ? null : Convert.ToBase64String(this.KeyValue);
+ }
+
+ internal string ToString(bool exportSecrets)
+ {
+ if (this.IsSharedKey)
+ {
+ return string.Format(
+ "{0}={1};{2}={3}",
+ CloudStorageAccount.AccountNameSettingString,
+ this.AccountName,
+ CloudStorageAccount.AccountKeySettingString,
+ exportSecrets ? this.GetBase64EncodedKey() : "[key hidden]");
+ }
+
+ if (this.IsSAS)
+ {
+ return string.Format("{0}={1}", CloudStorageAccount.SharedAccessSignatureSettingString, exportSecrets ? this.SASToken : "[signature hidden]");
+ }
+
+ return string.Empty;
+ }
+
+ /// <summary>
+ /// Determines whether an other <see cref="StorageCredentials"/> object is equal to this one by comparing their SAS tokens, account names, key names, and key values.
+ /// </summary>
+ /// <param name="other">The <see cref="StorageCredentials"/> object to compare to this one.</param>
+ /// <returns><c>true</c> if the two <see cref="StorageCredentials"/> objects are equal; otherwise, <c>false</c>.</returns>
+ public bool Equals(StorageCredentials other)
+ {
+ if (other == null)
+ {
+ return false;
+ }
+ else
+ {
+ return string.Equals(this.SASToken, other.SASToken) &&
+ string.Equals(this.AccountName, other.AccountName) &&
+ string.Equals(this.KeyName, other.KeyName) &&
+ string.Equals(this.GetBase64EncodedKey(), other.GetBase64EncodedKey());
+ }
+ }
+ }
+}
View
62 .../Services/Storage/StorageClient/BlobAttributes.cs → ...ervices/Storage/Lib/Common/Blob/BlobAttributes.cs
@@ -13,47 +13,21 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
-// <summary>
-// Contains code for the BlobAttributes class.
-// </summary>
//-----------------------------------------------------------------------
-namespace Microsoft.WindowsAzure.StorageClient
+namespace Microsoft.WindowsAzure.Storage.Blob
{
using System;
- using System.Collections.Specialized;
- using System.ComponentModel;
- using Protocol;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using Microsoft.WindowsAzure.Storage.Core;
- /// <summary>
- /// Represents a blob's attributes.
- /// </summary>
- public class BlobAttributes
+ internal sealed class BlobAttributes
{
- /// <summary>
- /// Initializes a new instance of the <see cref="BlobAttributes"/> class.
- /// </summary>
- public BlobAttributes()
+ internal BlobAttributes()
{
this.Properties = new BlobProperties();
- this.Metadata = new NameValueCollection();
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="BlobAttributes"/> class from an existing <see cref="BlobAttributes"/> object.
- /// </summary>
- /// <param name="other">The set of blob attributes to clone.</param>
- public BlobAttributes(BlobAttributes other)
- {
- this.Properties = new BlobProperties(other.Properties);
-
- if (other.Metadata != null)
- {
- this.Metadata = new NameValueCollection(other.Metadata);
- }
-
- this.Snapshot = other.Snapshot;
- this.Uri = other.Uri;
+ this.Metadata = new Dictionary<string, string>();
}
/// <summary>
@@ -66,7 +40,7 @@ public BlobAttributes(BlobAttributes other)
/// Gets the user-defined metadata for the blob.
/// </summary>
/// <value>The blob's metadata, as a collection of name-value pairs.</value>
- public NameValueCollection Metadata { get; internal set; }
+ public IDictionary<string, string> Metadata { get; internal set; }
/// <summary>
/// Gets the blob's URI.
@@ -81,6 +55,24 @@ public BlobAttributes(BlobAttributes other)
/// <remarks>
/// If the blob is not a snapshot, the value of this property is <c>null</c>.
/// </remarks>
- public DateTime? Snapshot { get; internal set; }
+ public DateTimeOffset? SnapshotTime { get; internal set; }
+
+ /// <summary>
+ /// Gets the state of the most recent or pending copy operation.
+ /// </summary>
+ /// <value>A <see cref="CopyState"/> object containing the copy state, or null if no copy blob state exists for this blob.</value>
+ public CopyState CopyState { get; internal set; }
+
+ /// <summary>
+ /// Verifies that the blob is not a snapshot.
+ /// </summary>
+ internal void AssertNoSnapshot()
+ {
+ if (this.SnapshotTime != null)
+ {
+ string errorMessage = string.Format(CultureInfo.CurrentCulture, SR.CannotModifySnapshot);
+ throw new InvalidOperationException(errorMessage);
+ }
+ }
}
}
View
12 ...Storage/StorageClient/BlobContainerPermissions.cs → ...orage/Lib/Common/Blob/BlobContainerPermissions.cs
@@ -13,20 +13,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
-// <summary>
-// Contains code for the BlobContainerPermissions class.
-// </summary>
//-----------------------------------------------------------------------
-namespace Microsoft.WindowsAzure.StorageClient
+namespace Microsoft.WindowsAzure.Storage.Blob
{
using System;
- using System.Collections.Generic;
/// <summary>
/// Represents the permissions for a container.
/// </summary>
- public class BlobContainerPermissions
+ public sealed class BlobContainerPermissions
{
/// <summary>
/// Initializes a new instance of the <see cref="BlobContainerPermissions"/> class.
@@ -34,7 +30,7 @@ public class BlobContainerPermissions
public BlobContainerPermissions()
{
this.PublicAccess = BlobContainerPublicAccessType.Off;
- SharedAccessPolicies = new SharedAccessPolicies();
+ this.SharedAccessPolicies = new SharedAccessBlobPolicies();
}
/// <summary>
@@ -47,6 +43,6 @@ public BlobContainerPermissions()
/// Gets the set of shared access policies for the container.
/// </summary>
/// <value>The set of shared access policies for the container.</value>
- public SharedAccessPolicies SharedAccessPolicies { get; private set; }
+ public SharedAccessBlobPolicies SharedAccessPolicies { get; private set; }
}
}
View
30 .../Storage/StorageClient/BlobContainerProperties.cs → ...torage/Lib/Common/Blob/BlobContainerProperties.cs
@@ -13,20 +13,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
-// <summary>
-// Contains code for the BlobContainerProperties class.
-// </summary>
//-----------------------------------------------------------------------
-namespace Microsoft.WindowsAzure.StorageClient
+namespace Microsoft.WindowsAzure.Storage.Blob
{
using System;
- using System.Collections.Specialized;
/// <summary>
/// Represents the system properties for a container.
/// </summary>
- public class BlobContainerProperties
+ public sealed class BlobContainerProperties
{
/// <summary>
/// Gets the ETag value for the container.
@@ -40,9 +36,27 @@ public class BlobContainerProperties
public string ETag { get; internal set; }
/// <summary>
- /// Gets the container's last-modified time, expressed as a UTC value.
+ /// Gets the container's last-modified time.
/// </summary>
/// <value>The container's last-modified time.</value>
- public DateTime LastModifiedUtc { get; internal set; }
+ public DateTimeOffset? LastModified { get; internal set; }
+
+ /// <summary>
+ /// Gets the container's lease status.
+ /// </summary>
+ /// <value>A <see cref="LeaseStatus"/> object that indicates the container's lease status.</value>
+ public LeaseStatus LeaseStatus { get; internal set; }
+
+ /// <summary>
+ /// Gets the container's lease state.
+ /// </summary>
+ /// <value>A <see cref="LeaseState"/> object that indicates the container's lease state.</value>
+ public LeaseState LeaseState { get; internal set; }
+
+ /// <summary>
+ /// Gets the container's lease duration.
+ /// </summary>
+ /// <value>A <see cref="LeaseDuration"/> object that indicates the container's lease duration.</value>
+ public LeaseDuration LeaseDuration { get; internal set; }
}
}
View
5 ...ge/StorageClient/BlobContainerPublicAccessType.cs → .../Lib/Common/Blob/BlobContainerPublicAccessType.cs
@@ -13,12 +13,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
-// <summary>
-// Contains code for the BlobContainerPublicAccessType enumeration.
-// </summary>
//-----------------------------------------------------------------------
-namespace Microsoft.WindowsAzure.StorageClient
+namespace Microsoft.WindowsAzure.Storage.Blob
{
/// <summary>
/// Specifies the level of public access that is allowed on the container.
View
131 microsoft-azure-api/Services/Storage/Lib/Common/Blob/BlobContinuationToken.cs
@@ -0,0 +1,131 @@
+//-----------------------------------------------------------------------
+// <copyright file="BlobContinuationToken.cs" company="Microsoft">
+// Copyright 2012 Microsoft Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace Microsoft.WindowsAzure.Storage.Blob
+{
+ using System;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Xml;
+ using System.Xml.Serialization;
+ using Microsoft.WindowsAzure.Storage;
+ using Microsoft.WindowsAzure.Storage.Core;
+ using Microsoft.WindowsAzure.Storage.Core.Util;
+ using Microsoft.WindowsAzure.Storage.Shared.Protocol;
+
+ /// <summary>
+ /// Represents a continuation token for listing operations.
+ /// </summary>
+ /// <remarks> <see cref="BlobContinuationToken"/> continuation tokens are used in methods that return a <see cref="BlobResultSegment"/> object, such as <see cref="CloudBlobDirectory.ListBlobsSegmented(BlobContinuationToken)"/>.</remarks>
+ [SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1001:CommasMustBeSpacedCorrectly", Justification = "Reviewed.")]
+ public sealed class BlobContinuationToken : IContinuationToken
+#if DNCP
+ , IXmlSerializable
+#endif
+ {
+ /// <summary>
+ /// Gets or sets the next marker for continuing results for <see cref="ICloudBlob"/> enumeration operations.
+ /// </summary>
+ /// <value>The next marker.</value>
+ public string NextMarker { get; set; }
+
+#if DNCP
+ /// <summary>
+ /// Gets an XML representation of an object.
+ /// </summary>
+ /// <returns>
+ /// An <see cref="T:System.Xml.Schema.XmlSchema"/> that describes the XML representation of the object that is produced by the <see cref="M:System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter)"/> method and consumed by the <see cref="M:System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader)"/> method.
+ /// </returns>
+ public System.Xml.Schema.XmlSchema GetSchema()
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// Generates a serializable continuation token from its XML representation.
+ /// </summary>
+ /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the continuation token is deserialized.</param>
+ public void ReadXml(System.Xml.XmlReader reader)
+ {
+ CommonUtils.AssertNotNull("reader", reader);
+
+ reader.MoveToContent();
+
+ bool isEmptyElement = reader.IsEmptyElement;
+ reader.ReadStartElement();
+
+ if (!isEmptyElement)
+ {
+ while (reader.NodeType == XmlNodeType.Element && !reader.IsEmptyElement)
+ {
+ if (!reader.IsEmptyElement)
+ {
+ switch (reader.Name)
+ {
+ case Constants.ContinuationConstants.VersionElement:
+ string version = reader.ReadElementContentAsString();
+
+ // For future versioning
+ break;
+ case Constants.ContinuationConstants.NextMarkerElement:
+ this.NextMarker = reader.ReadElementContentAsString();
+ break;
+ case Constants.ContinuationConstants.TypeElement:
+ string continuationType = reader.ReadElementContentAsString();
+ if ("Blob" != continuationType)
+ {
+ throw new System.Xml.XmlException(SR.UnexpectedContinuationType);
+ }
+
+ break;
+ default:
+ throw new XmlException(string.Format(SR.UnexpectedElement, reader.Name));
+ }
+ }
+ else
+ {
+ throw new XmlException(string.Format(SR.UnexpectedEmptyElement, reader.Name));
+ }
+ }
+
+ reader.ReadEndElement();
+ }
+ }
+
+ /// <summary>
+ /// Converts a serializable continuation token into its XML representation.
+ /// </summary>
+ /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"/> stream to which the continuation token is serialized.</param>
+ public void WriteXml(XmlWriter writer)
+ {
+ CommonUtils.AssertNotNull("writer", writer);
+
+ writer.WriteStartElement(Constants.ContinuationConstants.ContinuationTopElement);
+
+ writer.WriteElementString(Constants.ContinuationConstants.VersionElement, Constants.ContinuationConstants.CurrentVersion);
+
+ writer.WriteElementString(Constants.ContinuationConstants.TypeElement, "Blob");
+
+ if (this.NextMarker != null)
+ {
+ writer.WriteElementString(Constants.ContinuationConstants.NextMarkerElement, this.NextMarker);
+ }
+
+ writer.WriteEndElement(); // End ContinuationToken
+ }
+#endif
+ }
+}
View
14 ...vices/Storage/StorageClient/BlobListingDetails.cs → ...ces/Storage/Lib/Common/Blob/BlobListingDetails.cs
@@ -13,12 +13,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
-// <summary>
-// Contains code for the BlobListingDetails enumeration.
-// </summary>
//-----------------------------------------------------------------------
-namespace Microsoft.WindowsAzure.StorageClient
+namespace Microsoft.WindowsAzure.Storage.Blob
{
using System;
@@ -49,8 +46,13 @@ public enum BlobListingDetails
UncommittedBlobs = 0x4,
/// <summary>
- /// List all available committed blobs, uncommitted blobs, and snapshots, and return all metadata for those blobs.
+ /// Include copy properties in the listing.
/// </summary>
- All = 0x7
+ Copy = 0x8,
+
+ /// <summary>
+ /// List all available committed blobs, uncommitted blobs, and snapshots, and return all metadata and copy status for those blobs.
+ /// </summary>
+ All = 0xF
}
}
View
29 .../Services/Storage/StorageClient/BlobProperties.cs → ...ervices/Storage/Lib/Common/Blob/BlobProperties.cs
@@ -13,28 +13,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
-// <summary>
-// Contains code for the BlobProperties class.
-// </summary>
//-----------------------------------------------------------------------
-namespace Microsoft.WindowsAzure.StorageClient
+namespace Microsoft.WindowsAzure.Storage.Blob
{
using System;
- using System.Collections.Specialized;
- using System.ComponentModel;
- using Protocol;
/// <summary>
/// Represents the system properties for a blob.
/// </summary>
- public class BlobProperties
+ public sealed class BlobProperties
{
/// <summary>
/// Initializes a new instance of the <see cref="BlobProperties"/> class.
/// </summary>
public BlobProperties()
{
+ this.Length = -1;
}
/// <summary>
@@ -49,7 +44,7 @@ public BlobProperties(BlobProperties other)
this.Length = other.Length;
this.ContentType = other.ContentType;
this.ETag = other.ETag;
- this.LastModifiedUtc = other.LastModifiedUtc;
+ this.LastModified = other.LastModified;
this.LeaseStatus = other.LeaseStatus;
}
@@ -101,7 +96,7 @@ public BlobProperties(BlobProperties other)
/// <summary>
/// Gets the blob's ETag value.
/// </summary>
- /// <value>The blob's quoted ETag value.</value>
+ /// <value>The blob's ETag value.</value>
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Naming",
"CA1702:CompoundWordsShouldBeCasedCorrectly",
@@ -113,7 +108,7 @@ public BlobProperties(BlobProperties other)
/// Gets the the last-modified time for the blob, expressed as a UTC value.
/// </summary>
/// <value>The blob's last-modified time, in UTC format.</value>
- public DateTime LastModifiedUtc { get; internal set; }
+ public DateTimeOffset? LastModified { get; internal set; }
/// <summary>
/// Gets the type of the blob.
@@ -126,5 +121,17 @@ public BlobProperties(BlobProperties other)
/// </summary>
/// <value>A <see cref="LeaseStatus"/> object that indicates the blob's lease status.</value>
public LeaseStatus LeaseStatus { get; internal set; }
+
+ /// <summary>
+ /// Gets the blob's lease state.
+ /// </summary>
+ /// <value>A <see cref="LeaseState"/> object that indicates the blob's lease state.</value>
+ public LeaseState LeaseState { get; internal set; }
+
+ /// <summary>
+ /// Gets the blob's lease duration.
+ /// </summary>
+ /// <value>A <see cref="LeaseDuration"/> object that indicates the blob's lease duration.</value>
+ public LeaseDuration LeaseDuration { get; internal set; }
}
}
View
232 microsoft-azure-api/Services/Storage/Lib/Common/Blob/BlobReadStreamBase.cs
@@ -0,0 +1,232 @@
+//-----------------------------------------------------------------------
+// <copyright file="BlobReadStreamBase.cs" company="Microsoft">
+// Copyright 2012 Microsoft Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace Microsoft.WindowsAzure.Storage.Blob
+{
+ using System;
+ using System.Diagnostics.CodeAnalysis;
+ using System.IO;
+ using Microsoft.WindowsAzure.Storage.Core;
+ using Microsoft.WindowsAzure.Storage.Core.Util;
+
+ [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed.")]
+ internal abstract class BlobReadStreamBase : Stream
+ {
+ protected ICloudBlob blob;
+ protected bool isLengthAvailable;
+ protected long currentOffset;
+ protected MemoryStream buffer;
+ protected AccessCondition accessCondition;
+ private bool lockedToETag;
+ protected BlobRequestOptions options;
+ protected OperationContext operationContext;
+ protected MD5Wrapper blobMD5;
+ protected Exception lastException;
+
+ /// <summary>
+ /// Initializes a new instance of the BlobReadStreamBase class.
+ /// </summary>
+ /// <param name="blob">Blob reference to read from</param>
+ /// <param name="accessCondition">An object that represents the access conditions for the blob. If null, no condition is used.</param>
+ /// <param name="options">An object that specifies any additional options for the request.</param>
+ /// <param name="operationContext">An <see cref="OperationContext"/> object for tracking the current operation.</param>
+ protected BlobReadStreamBase(ICloudBlob blob, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
+ {
+ this.blob = blob;
+ this.isLengthAvailable = false;
+ this.currentOffset = 0;
+ this.buffer = new MemoryStream();
+ this.accessCondition = accessCondition;
+ this.lockedToETag = false;
+ this.options = options;
+ this.operationContext = operationContext;
+ this.blobMD5 = options.DisableContentMD5Validation.Value ? null : new MD5Wrapper();
+ this.lastException = null;
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the current stream supports reading.
+ /// </summary>
+ public override bool CanRead
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the current stream supports seeking.
+ /// </summary>
+ public override bool CanSeek
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the current stream supports writing.
+ /// </summary>
+ public override bool CanWrite
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the position within the current stream.
+ /// </summary>
+ public override long Position
+ {
+ get
+ {
+ return this.currentOffset;
+ }
+
+ set
+ {
+ this.Seek(value, SeekOrigin.Begin);
+ }
+ }
+
+ /// <summary>
+ /// Sets the position within the current stream.
+ /// </summary>
+ /// <param name="offset">A byte offset relative to the origin parameter.</param>
+ /// <param name="origin">A value of type <c>SeekOrigin</c> indicating the reference
+ /// point used to obtain the new position.</param>
+ /// <returns>The new position within the current stream.</returns>
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ if (this.lastException != null)
+ {
+ throw this.lastException;
+ }
+
+ long newOffset;
+ switch (origin)
+ {
+ case SeekOrigin.Begin:
+ newOffset = offset;
+ break;
+
+ case SeekOrigin.Current:
+ newOffset = this.currentOffset + offset;
+ break;
+
+ case SeekOrigin.End:
+ newOffset = this.Length + offset;
+ break;
+
+ default:
+ CommonUtils.ArgumentOutOfRange("origin", origin);
+ throw new ArgumentOutOfRangeException();
+ }
+
+ CommonUtils.AssertInBounds("offset", newOffset, 0, this.Length);
+
+ if (newOffset != this.currentOffset)
+ {
+ this.blobMD5 = null;
+ this.buffer.SetLength(0);
+ this.currentOffset = newOffset;
+ }
+
+ return this.currentOffset;
+ }
+
+ /// <summary>
+ /// This operation is not supported in BlobReadStreamBase.
+ /// </summary>
+ /// <param name="value">Not used.</param>
+ public override void SetLength(long value)
+ {
+ throw new NotSupportedException();
+ }
+
+ /// <summary>
+ /// This operation is not supported in BlobReadStreamBase.
+ /// </summary>
+ /// <param name="buffer">Not used.</param>
+ /// <param name="offset">Not used.</param>
+ /// <param name="count">Not used.</param>
+ public override void Write(byte[] buffer, int offset, int count)
+ {
+ throw new NotSupportedException();
+ }
+
+ /// <summary>
+ /// This operation is not supported in BlobReadStreamBase.
+ /// </summary>
+ public override void Flush()
+ {
+ throw new NotSupportedException();
+ }
+
+ /// <summary>
+ /// Locks all further read operations to the current ETag value.
+ /// Therefore, if someone else writes to the blob while we are reading,
+ /// all our operations will start failing with condition mismatch error.
+ /// </summary>
+ protected void LockToETag()
+ {
+ if (!this.lockedToETag)
+ {
+ AccessCondition accessCondition = AccessCondition.GenerateIfMatchCondition(this.blob.Properties.ETag);
+ if (this.accessCondition != null)
+ {
+ accessCondition.LeaseId = this.accessCondition.LeaseId;
+ }
+
+ this.accessCondition = accessCondition;
+ this.lockedToETag = true;
+ }
+ }
+
+ /// <summary>
+ /// Updates the blob MD5 with newly downloaded content.
+ /// </summary>
+ /// <param name="buffer"></param>
+ /// <param name="offset"></param>
+ /// <param name="count"></param>
+ protected void VerifyBlobMD5(byte[] buffer, int offset, int count)
+ {
+ if ((this.blobMD5 != null) && (this.lastException == null))
+ {
+ this.blobMD5.UpdateHash(buffer, offset, count);
+
+ if ((this.currentOffset == this.Length) &&
+ !string.IsNullOrEmpty(this.blob.Properties.ContentMD5))
+ {
+ string computedMD5 = this.blobMD5.ComputeHash();
+ this.blobMD5 = null;
+ if (!computedMD5.Equals(this.blob.Properties.ContentMD5))
+ {
+ this.lastException = new IOException(string.Format(
+ SR.BlobDataCorrupted,
+ this.blob.Properties.ContentMD5,
+ computedMD5));
+ }
+ }
+ }
+ }
+ }
+}
View
105 microsoft-azure-api/Services/Storage/Lib/Common/Blob/BlobRequestOptions.cs
@@ -0,0 +1,105 @@
+//-----------------------------------------------------------------------
+// <copyright file="BlobRequestOptions.cs" company="Microsoft">
+// Copyright 2012 Microsoft Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace Microsoft.WindowsAzure.Storage.Blob
+{
+ using System;
+ using Microsoft.WindowsAzure.Storage;
+ using Microsoft.WindowsAzure.Storage.RetryPolicies;
+
+ /// <summary>
+ /// Represents a set of timeout and retry policy options that may be specified for a blob operation request.
+ /// </summary>
+ public sealed class BlobRequestOptions : IRequestOptions
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BlobRequestOptions"/> class.
+ /// </summary>
+ public BlobRequestOptions()
+ {
+ }
+
+ /// <summary>
+ /// Clones an instance of BlobRequestOptions so that we can apply defaults.
+ /// </summary>
+ /// <param name="other">BlobRequestOptions instance to be cloned.</param>
+ internal BlobRequestOptions(BlobRequestOptions other)
+ : this()
+ {
+ if (other != null)
+ {
+ this.RetryPolicy = other.RetryPolicy;
+ this.ServerTimeout = other.ServerTimeout;
+ this.MaximumExecutionTime = other.MaximumExecutionTime;
+ this.UseTransactionalMD5 = other.UseTransactionalMD5;
+ this.StoreBlobContentMD5 = other.StoreBlobContentMD5;
+ this.DisableContentMD5Validation = other.DisableContentMD5Validation;
+ }
+ }
+
+ internal static BlobRequestOptions ApplyDefaults(BlobRequestOptions options, BlobType blobType, CloudBlobClient serviceClient)
+ {
+ BlobRequestOptions modifiedOptions = new BlobRequestOptions(options);
+
+ modifiedOptions.RetryPolicy = modifiedOptions.RetryPolicy ?? serviceClient.RetryPolicy;
+ modifiedOptions.ServerTimeout = modifiedOptions.ServerTimeout ?? serviceClient.ServerTimeout;
+ modifiedOptions.MaximumExecutionTime = modifiedOptions.MaximumExecutionTime ?? serviceClient.MaximumExecutionTime;
+
+ modifiedOptions.DisableContentMD5Validation = modifiedOptions.DisableContentMD5Validation ?? false;
+ modifiedOptions.StoreBlobContentMD5 = modifiedOptions.StoreBlobContentMD5 ?? (blobType == BlobType.BlockBlob);
+ modifiedOptions.UseTransactionalMD5 = modifiedOptions.UseTransactionalMD5 ?? false;
+
+ return modifiedOptions;
+ }
+
+ /// <summary>
+ /// Gets or sets the retry policy.
+ /// </summary>
+ /// <value>The retry policy.</value>
+ public IRetryPolicy RetryPolicy { get; set; }
+
+ /// <summary>
+ /// Gets or sets the server timeout interval for the request.
+ /// </summary>
+ /// <value>The server timeout interval for the request.</value>
+ public TimeSpan? ServerTimeout { get; set; }
+
+ /// <summary>
+ /// Gets or sets the maximum execution time accross all potential retries etc.
+ /// </summary>
+ /// <value>The maximum execution time.</value>
+ public TimeSpan? MaximumExecutionTime { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value to calculate and send/validate content MD5 for transactions.
+ /// </summary>
+ /// <value>Use <c>true</c> to calculate and send/validate content MD5 for transactions; otherwise, <c>false</c>.</value>
+ public bool? UseTransactionalMD5 { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value to indicate that an MD5 hash will be calculated and stored when uploading a blob.
+ /// </summary>
+ /// <value>Use true to calculate and store an MD5 hash when uploading a blob; otherwise, false.</value>
+ public bool? StoreBlobContentMD5 { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value to indicate that MD5 validation will be disabled when downloading blobs.
+ /// </summary>
+ /// <value>Use true to disable MD5 validation; false to enable MD5 validation.</value>
+ public bool? DisableContentMD5Validation { get; set; }
+ }
+}
View
45 microsoft-azure-api/Services/Storage/Lib/Common/Blob/BlobResultSegment.cs
@@ -0,0 +1,45 @@
+//-----------------------------------------------------------------------
+// <copyright file="BlobResultSegment.cs" company="Microsoft">
+// Copyright 2012 Microsoft Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace Microsoft.WindowsAzure.Storage.Blob
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// Represents a segment of <see cref="IListBlobItem"/> results and contains continuation and pagination information.
+ /// </summary>
+ public sealed class BlobResultSegment
+ {
+ internal BlobResultSegment(IEnumerable<IListBlobItem> blobs, BlobContinuationToken continuationToken)
+ {
+ this.Results = blobs;
+ this.ContinuationToken = continuationToken;
+ }
+
+ /// <summary>
+ /// Gets an enumerable collection of <see cref="IListBlobItem"/> results.
+ /// </summary>
+ /// <value>An enumerable collection of results.</value>
+ public IEnumerable<IListBlobItem> Results { get; private set; }
+
+ /// <summary>
+ /// Gets the continuation token used to retrieve the next segment of <see cref="IListBlobItem"/> results.
+ /// </summary>
+ /// <value>The continuation token.</value>
+ public BlobContinuationToken ContinuationToken { get; private set; }
+ }
+}
View
5 ...re-api/Services/Storage/StorageClient/BlobType.cs → ...-api/Services/Storage/Lib/Common/Blob/BlobType.cs
@@ -13,12 +13,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
-// <summary>
-// Contains code for the BlobType enumeration.
-// </summary>
//-----------------------------------------------------------------------
-namespace Microsoft.WindowsAzure.StorageClient
+namespace Microsoft.WindowsAzure.Storage.Blob
{
/// <summary>
/// The type of a blob.
View
258 microsoft-azure-api/Services/Storage/Lib/Common/Blob/BlobWriteStreamBase.cs
@@ -0,0 +1,258 @@
+//-----------------------------------------------------------------------
+// <copyright file="BlobWriteStreamBase.cs" company="Microsoft">
+// Copyright 2012 Microsoft Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace Microsoft.WindowsAzure.Storage.Blob
+{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Text;
+ using System.Threading;
+ using Microsoft.WindowsAzure.Storage.Core.Util;
+ using Microsoft.WindowsAzure.Storage.Shared.Protocol;
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed.")]
+ internal abstract class BlobWriteStreamBase : Stream
+ {
+ protected CloudBlockBlob blockBlob;
+ protected CloudPageBlob pageBlob;
+ protected long pageBlobSize;
+ protected long currentOffset;
+ protected long currentPageOffset;
+ protected MemoryStream buffer;
+ protected List<string> blockList;
+ protected string blockIdPrefix;
+ protected AccessCondition accessCondition;
+ protected BlobRequestOptions options;
+ protected OperationContext operationContext;
+ protected int pendingWrites;
+ protected ManualResetEvent noPendingWritesEvent;
+ protected MD5Wrapper blobMD5;
+ protected MD5Wrapper blockMD5;
+ protected AsyncSemaphore parallelOperationSemaphore;
+ protected Exception lastException;
+
+ /// <summary>
+ /// Initializes a new instance of the BlobWriteStreamBase class.
+ /// </summary>
+ /// <param name="accessCondition">An object that represents the access conditions for the blob. If null, no condition is used.</param>
+ /// <param name="options">An object that specifies any additional options for the request.</param>
+ /// <param name="operationContext">An <see cref="OperationContext"/> object for tracking the current operation.</param>
+ private BlobWriteStreamBase(CloudBlobClient serviceClient, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
+ : base()
+ {
+ this.currentOffset = 0;
+ this.accessCondition = accessCondition;
+ this.options = options;
+ this.operationContext = operationContext;
+ this.pendingWrites = 0;
+ this.noPendingWritesEvent = new ManualResetEvent(true);
+ this.blobMD5 = options.StoreBlobContentMD5.Value ? new MD5Wrapper() : null;
+ this.blockMD5 = options.UseTransactionalMD5.Value ? new MD5Wrapper() : null;
+ this.parallelOperationSemaphore = new AsyncSemaphore(serviceClient.ParallelOperationThreadCount);
+ this.lastException = null;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the BlobWriteStreamBase class for a block blob.
+ /// </summary>
+ /// <param name="blockBlob">Blob reference to write to.</param>
+ /// <param name="accessCondition">An object that represents the access conditions for the blob. If null, no condition is used.</param>
+ /// <param name="options">An object that specifies any additional options for the request.</param>
+ /// <param name="operationContext">An <see cref="OperationContext"/> object for tracking the current operation.</param>
+ protected BlobWriteStreamBase(CloudBlockBlob blockBlob, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
+ : this(blockBlob.ServiceClient, accessCondition, options, operationContext)
+ {
+ this.blockBlob = blockBlob;
+ this.blockList = new List<string>();
+ this.blockIdPrefix = new Random().Next().ToString("X8") + "-";
+ this.buffer = new MemoryStream(this.Blob.StreamWriteSizeInBytes);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the BlobWriteStreamBase class for a page blob.
+ /// </summary>
+ /// <param name="pageBlob">Blob reference to write to.</param>
+ /// <param name="pageBlobSize">Size of the page blob.</param>
+ /// <param name="accessCondition">An object that represents the access conditions for the blob. If null, no condition is used.</param>
+ /// <param name="options">An object that specifies any additional options for the request.</param>
+ /// <param name="operationContext">An <see cref="OperationContext"/> object for tracking the current operation.</param>
+ protected BlobWriteStreamBase(CloudPageBlob pageBlob, long pageBlobSize, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
+ : this(pageBlob.ServiceClient, accessCondition, options, operationContext)
+ {
+ this.currentPageOffset = 0;
+ this.pageBlob = pageBlob;
+ this.pageBlobSize = pageBlobSize;
+ this.buffer = new MemoryStream(this.Blob.StreamWriteSizeInBytes);
+ }
+
+ protected ICloudBlob Blob
+ {
+ get
+ {
+ return (ICloudBlob)this.blockBlob ?? (ICloudBlob)this.pageBlob;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the current stream supports reading.
+ /// </summary>
+ public override bool CanRead
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the current stream supports seeking.
+ /// </summary>
+ public override bool CanSeek
+ {
+ get
+ {
+ return this.pageBlob != null;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the current stream supports writing.
+ /// </summary>
+ public override bool CanWrite
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// Gets the length in bytes of the stream.
+ /// </summary>
+ public override long Length
+ {
+ get
+ {
+ if (this.pageBlob != null)
+ {
+ return this.pageBlobSize;
+ }
+ else
+ {
+ throw new NotSupportedException();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the position within the current stream.
+ /// </summary>
+ public override long Position
+ {
+ get
+ {
+ return this.currentOffset;
+ }
+
+ set
+ {
+ this.Seek(value, SeekOrigin.Begin);
+ }
+ }
+
+ /// <summary>
+ /// This operation is not supported in BlobWriteStreamBase.
+ /// </summary>
+ /// <param name="buffer">Not used.</param>
+ /// <param name="offset">Not used.</param>
+ /// <param name="count">Not used.</param>
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ throw new NotSupportedException();
+ }
+
+ /// <summary>
+ /// Sets the position within the current stream.
+ /// </summary>
+ /// <param name="offset">A byte offset relative to the origin parameter.</param>
+ /// <param name="origin">A value of type <c>SeekOrigin</c> indicating the reference
+ /// point used to obtain the new position.</param>
+ /// <returns>The new position within the current stream.</returns>
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ if (!this.CanSeek)
+ {
+ throw new NotSupportedException();
+ }
+
+ if (this.lastException != null)
+ {
+ throw this.lastException;
+ }
+
+ long newOffset;
+ switch (origin)
+ {
+ case SeekOrigin.Begin:
+ newOffset = offset;
+ break;
+
+ case SeekOrigin.Current:
+ newOffset = this.currentOffset + offset;
+ break;
+
+ case SeekOrigin.End:
+ newOffset = this.Length + offset;
+ break;
+
+ default:
+ CommonUtils.ArgumentOutOfRange("origin", origin);
+ throw new ArgumentOutOfRangeException();
+ }
+
+ CommonUtils.AssertInBounds("offset", newOffset, 0, this.Length);
+
+ if ((newOffset % Constants.PageSize) != 0)
+ {
+ CommonUtils.ArgumentOutOfRange("offset", offset);
+ }
+
+ return newOffset;
+ }
+
+ /// <summary>
+ /// This operation is not supported in BlobWriteStreamBase.
+ /// </summary>
+ /// <param name="value">Not used.</param>
+ public override void SetLength(long value)
+ {
+ throw new NotSupportedException();
+ }
+
+ /// <summary>
+ /// Generates a new block ID to be used for PutBlock.
+ /// </summary>
+ /// <returns>Base64 encoded block ID</returns>
+ protected string GetCurrentBlockId()
+ {
+ string blockIdSuffix = this.blockList.Count.ToString("D6");
+ byte[] blockIdInBytes = Encoding.UTF8.GetBytes(this.blockIdPrefix + blockIdSuffix);
+ return Convert.ToBase64String(blockIdInBytes);
+ }
+ }
+}
View
7 ...vices/Storage/StorageClient/BlockListingFilter.cs → ...ces/Storage/Lib/Common/Blob/BlockListingFilter.cs
@@ -13,12 +13,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
-// <summary>
-// Contains code for the BlockListingFilter enumeration.
-// </summary>
//-----------------------------------------------------------------------
-namespace Microsoft.WindowsAzure.StorageClient
+namespace Microsoft.WindowsAzure.Storage.Blob
{
/// <summary>
/// Indicates whether to list only committed blocks, only uncommitted blocks, or all blocks.
@@ -40,4 +37,4 @@ public enum BlockListingFilter
/// </summary>
All
}
-}
+}
View
5 ...Storage/StorageClient/Protocol/BlockSearchMode.cs → ...rvices/Storage/Lib/Common/Blob/BlockSearchMode.cs
@@ -13,12 +13,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
-// <summary>
-// Contains code for the BlockSearchMode enumeration.
-// </summary>
//-----------------------------------------------------------------------
-namespace Microsoft.WindowsAzure.StorageClient.Protocol
+namespace Microsoft.WindowsAzure.Storage.Blob
{
/// <summary>
/// Indicates which block lists should be searched to find a specified block.
View
313 microsoft-azure-api/Services/Storage/Lib/Common/Blob/CloudBlobClientBase.cs
@@ -0,0 +1,313 @@
+//-----------------------------------------------------------------------
+// <copyright file="CloudBlobClient.cs" company="Microsoft">
+// Copyright 2012 Microsoft Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace Microsoft.WindowsAzure.Storage.Blob
+{
+ using System;
+ using System.Globalization;
+ using Microsoft.WindowsAzure.Storage.Auth;
+ using Microsoft.WindowsAzure.Storage.Core;
+ using Microsoft.WindowsAzure.Storage.Core.Util;
+ using Microsoft.WindowsAzure.Storage.RetryPolicies;
+ using Microsoft.WindowsAzure.Storage.Shared.Protocol;
+
+ /// <summary>
+ /// Provides a client-side logical representation of the Windows Azure Blob Service. This client is used to configure and execute requests against the Blob Service.
+ /// </summary>
+ /// <remarks>The service client encapsulates the base URI for the Blob service. If the service client will be used for authenticated access, it also encapsulates the credentials for accessing the storage account.</remarks>
+ public sealed partial class CloudBlobClient
+ {
+ /// <summary>
+ /// Constant for the max value of ParallelOperationThreadCount.
+ /// </summary>
+ private const int MaxParallelOperationThreadCount = 64;
+
+ /// <summary>
+ /// Stores the default delimiter.
+ /// </summary>
+ private string defaultDelimiter;
+
+ /// <summary>
+ /// Stores the parallelism factor.
+ /// </summary>
+ private int parallelismFactor = 1;
+
+ /// <summary>
+ /// Default is 32 MB.
+ /// </summary>
+ private long singleBlobUploadThresholdInBytes = Constants.MaxSingleUploadBlobSize / 2;
+
+ /// <summary>
+ /// The default server and client timeout interval.
+ /// </summary>
+ private TimeSpan? timeout;
+
+ /// <summary>
+ /// Max execution time accross all potential retries.
+ /// </summary>
+ private TimeSpan? maximumExecutionTime;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CloudBlobClient"/> class using the specified Blob service endpoint
+ /// and anonymous credentials.
+ /// </summary>
+ /// <param name="baseUri">The Blob service endpoint to use to create the client.</param>
+ public CloudBlobClient(Uri baseUri)
+ : this(baseUri, null /* credentials */)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CloudBlobClient"/> class using the specified Blob service endpoint
+ /// and account credentials.
+ /// </summary>
+ /// <param name="baseUri">The Blob service endpoint to use to create the client.</param>
+ /// <param name="credentials">The account credentials.</param>
+ public CloudBlobClient(Uri baseUri, StorageCredentials credentials)
+ : this(null /* usePathStyleUris */, baseUri, credentials)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CloudBlobClient"/> class.
+ /// </summary>
+ /// <param name="usePathStyleUris">True to use path style Uris.</param>
+ /// <param name="baseUri">The Blob service endpoint to use to create the client.</param>
+ /// <param name="credentials">The account credentials.</param>
+ internal CloudBlobClient(bool? usePathStyleUris, Uri baseUri, StorageCredentials credentials)
+ {
+ CommonUtils.AssertNotNull("baseUri", baseUri);
+
+ if (credentials == null)
+ {
+ credentials = new StorageCredentials();
+ }
+
+ if (baseUri == null)
+ {
+ throw new ArgumentNullException("baseUri");
+ }
+
+ if (!baseUri.IsAbsoluteUri)
+ {
+ string errorMessage = string.Format(CultureInfo.CurrentCulture, SR.RelativeAddressNotPermitted, baseUri.ToString());
+ throw new ArgumentException(errorMessage, "baseUri");
+ }
+
+ this.BaseUri = baseUri;
+ this.Credentials = credentials;
+ this.RetryPolicy = new ExponentialRetry();
+ this.ServerTimeout = Constants.DefaultServerSideTimeout;
+ this.DefaultDelimiter = NavigationHelper.Slash;
+
+ if (usePathStyleUris.HasValue)
+ {
+ this.UsePathStyleUris = usePathStyleUris.Value;
+ }
+ else
+ {
+ // Automatically decide whether to use host style uri or path style uri
+ this.UsePathStyleUris = CommonUtils.UsePathStyleAddressing(this.BaseUri);
+ }
+ }
+
+ /// <summary>
+ /// Gets the account credentials used to create the Blob service client.
+ /// </summary>
+ /// <value>The account credentials.</value>
+ public StorageCredentials Credentials { get; private set; }
+
+ /// <summary>
+ /// Gets the base URI for the Blob service client.
+ /// </summary>
+ /// <value>The base URI used to construct the Blob service client.</value>
+ public Uri BaseUri { get; private set; }
+
+ /// <summary>
+ /// Gets or sets the default retry policy for requests made via the Blob service client.
+ /// </summary>
+ /// <value>The retry policy.</value>
+ public IRetryPolicy RetryPolicy { get; set; }
+
+ /// <summary>
+ /// Gets or sets the default server and client timeout for requests.
+ /// </summary>
+ /// <value>The server and client timeout interval.</value>
+ public TimeSpan? ServerTimeout
+ {
+ get
+ {
+ return this.timeout;
+ }
+
+ set
+ {
+ if (value.HasValue)
+ {
+ CommonUtils.CheckTimeoutBounds(value.Value);
+ }
+
+ this.timeout = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the maximum execution time accross all potential retries.
+ /// </summary>
+ /// <value>The maximum execution time accross all potential retries.</value>
+ public TimeSpan? MaximumExecutionTime
+ {
+ get
+ {
+ return this.maximumExecutionTime;
+ }
+
+ set
+ {
+ if (value.HasValue)
+ {
+ CommonUtils.CheckTimeoutBounds(value.Value);
+ }
+
+ this.maximumExecutionTime = value;
+ }
+ }
+
+