| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // This file was automatically generated. Do not edit. |
| | 5 | |
|
| | 6 | | #pragma warning disable IDE0016 // Null check can be simplified |
| | 7 | | #pragma warning disable IDE0017 // Variable declaration can be inlined |
| | 8 | | #pragma warning disable IDE0018 // Object initialization can be simplified |
| | 9 | | #pragma warning disable SA1402 // File may only contain a single type |
| | 10 | |
|
| | 11 | | #region Service |
| | 12 | | namespace Azure.Storage.Blobs |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// Azure Blob Storage |
| | 16 | | /// </summary> |
| | 17 | | internal static partial class BlobRestClient |
| | 18 | | { |
| | 19 | | #region Service operations |
| | 20 | | /// <summary> |
| | 21 | | /// Service operations for Azure Blob Storage |
| | 22 | | /// </summary> |
| | 23 | | public static partial class Service |
| | 24 | | { |
| | 25 | | #region Service.SetPropertiesAsync |
| | 26 | | /// <summary> |
| | 27 | | /// Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytic |
| | 28 | | /// </summary> |
| | 29 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 30 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 31 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 32 | | /// <param name="blobServiceProperties">The StorageService properties.</param> |
| | 33 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 34 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 35 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 36 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 37 | | /// <param name="operationName">Operation name.</param> |
| | 38 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 39 | | /// <returns>Azure.Response</returns> |
| | 40 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> SetPropertiesAsync( |
| | 41 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 42 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 43 | | System.Uri resourceUri, |
| | 44 | | Azure.Storage.Blobs.Models.BlobServiceProperties blobServiceProperties, |
| | 45 | | string version, |
| | 46 | | int? timeout = default, |
| | 47 | | string requestId = default, |
| | 48 | | bool async = true, |
| | 49 | | string operationName = "ServiceClient.SetProperties", |
| | 50 | | System.Threading.CancellationToken cancellationToken = default) |
| | 51 | | { |
| | 52 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 53 | | try |
| | 54 | | { |
| | 55 | | _scope.AddAttribute("url", resourceUri); |
| | 56 | | _scope.Start(); |
| | 57 | | using (Azure.Core.HttpMessage _message = SetPropertiesAsync_CreateMessage( |
| | 58 | | pipeline, |
| | 59 | | resourceUri, |
| | 60 | | blobServiceProperties, |
| | 61 | | version, |
| | 62 | | timeout, |
| | 63 | | requestId)) |
| | 64 | | { |
| | 65 | | if (async) |
| | 66 | | { |
| | 67 | | // Send the request asynchronously if we're being called via an async path |
| | 68 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 69 | | } |
| | 70 | | else |
| | 71 | | { |
| | 72 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 73 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 74 | | pipeline.Send(_message, cancellationToken); |
| | 75 | | } |
| | 76 | | Azure.Response _response = _message.Response; |
| | 77 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 78 | | return SetPropertiesAsync_CreateResponse(clientDiagnostics, _response); |
| | 79 | | } |
| | 80 | | } |
| | 81 | | catch (System.Exception ex) |
| | 82 | | { |
| | 83 | | _scope.Failed(ex); |
| | 84 | | throw; |
| | 85 | | } |
| | 86 | | finally |
| | 87 | | { |
| | 88 | | _scope.Dispose(); |
| | 89 | | } |
| | 90 | | } |
| | 91 | |
|
| | 92 | | /// <summary> |
| | 93 | | /// Create the Service.SetPropertiesAsync request. |
| | 94 | | /// </summary> |
| | 95 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 96 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 97 | | /// <param name="blobServiceProperties">The StorageService properties.</param> |
| | 98 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 99 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 100 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 101 | | /// <returns>The Service.SetPropertiesAsync Message.</returns> |
| | 102 | | internal static Azure.Core.HttpMessage SetPropertiesAsync_CreateMessage( |
| | 103 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 104 | | System.Uri resourceUri, |
| | 105 | | Azure.Storage.Blobs.Models.BlobServiceProperties blobServiceProperties, |
| | 106 | | string version, |
| | 107 | | int? timeout = default, |
| | 108 | | string requestId = default) |
| | 109 | | { |
| | 110 | | // Validation |
| | 111 | | if (resourceUri == null) |
| | 112 | | { |
| | 113 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 114 | | } |
| | 115 | | if (blobServiceProperties == null) |
| | 116 | | { |
| | 117 | | throw new System.ArgumentNullException(nameof(blobServiceProperties)); |
| | 118 | | } |
| | 119 | | if (version == null) |
| | 120 | | { |
| | 121 | | throw new System.ArgumentNullException(nameof(version)); |
| | 122 | | } |
| | 123 | |
|
| | 124 | | // Create the request |
| | 125 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 126 | | Azure.Core.Request _request = _message.Request; |
| | 127 | |
|
| | 128 | | // Set the endpoint |
| | 129 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 130 | | _request.Uri.Reset(resourceUri); |
| | 131 | | _request.Uri.AppendQuery("restype", "service", escapeValue: false); |
| | 132 | | _request.Uri.AppendQuery("comp", "properties", escapeValue: false); |
| | 133 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 134 | |
|
| | 135 | | // Add request headers |
| | 136 | | _request.Headers.SetValue("x-ms-version", version); |
| | 137 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 138 | |
|
| | 139 | | // Create the body |
| | 140 | | System.Xml.Linq.XElement _body = Azure.Storage.Blobs.Models.BlobServiceProperties.ToXml(blobServicePrope |
| | 141 | | string _text = _body.ToString(System.Xml.Linq.SaveOptions.DisableFormatting); |
| | 142 | | _request.Headers.SetValue("Content-Type", "application/xml"); |
| | 143 | | _request.Headers.SetValue("Content-Length", _text.Length.ToString(System.Globalization.CultureInfo.Invar |
| | 144 | | _request.Content = Azure.Core.RequestContent.Create(System.Text.Encoding.UTF8.GetBytes(_text)); |
| | 145 | |
|
| | 146 | | return _message; |
| | 147 | | } |
| | 148 | |
|
| | 149 | | /// <summary> |
| | 150 | | /// Create the Service.SetPropertiesAsync response or throw a failure exception. |
| | 151 | | /// </summary> |
| | 152 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 153 | | /// <param name="response">The raw Response.</param> |
| | 154 | | /// <returns>The Service.SetPropertiesAsync Azure.Response.</returns> |
| | 155 | | internal static Azure.Response SetPropertiesAsync_CreateResponse( |
| | 156 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 157 | | Azure.Response response) |
| | 158 | | { |
| | 159 | | // Process the response |
| | 160 | | switch (response.Status) |
| | 161 | | { |
| | 162 | | case 202: |
| | 163 | | { |
| | 164 | | return response; |
| | 165 | | } |
| | 166 | | default: |
| | 167 | | { |
| | 168 | | // Create the result |
| | 169 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 170 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 171 | |
|
| | 172 | | throw _value.CreateException(clientDiagnostics, response); |
| | 173 | | } |
| | 174 | | } |
| | 175 | | } |
| | 176 | | #endregion Service.SetPropertiesAsync |
| | 177 | |
|
| | 178 | | #region Service.GetPropertiesAsync |
| | 179 | | /// <summary> |
| | 180 | | /// gets the properties of a storage account's Blob service, including properties for Storage Analytics and |
| | 181 | | /// </summary> |
| | 182 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 183 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 184 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 185 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 186 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 187 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 188 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 189 | | /// <param name="operationName">Operation name.</param> |
| | 190 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 191 | | /// <returns>Storage Service Properties.</returns> |
| | 192 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobServicePr |
| | 193 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 194 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 195 | | System.Uri resourceUri, |
| | 196 | | string version, |
| | 197 | | int? timeout = default, |
| | 198 | | string requestId = default, |
| | 199 | | bool async = true, |
| | 200 | | string operationName = "ServiceClient.GetProperties", |
| | 201 | | System.Threading.CancellationToken cancellationToken = default) |
| | 202 | | { |
| | 203 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 204 | | try |
| | 205 | | { |
| | 206 | | _scope.AddAttribute("url", resourceUri); |
| | 207 | | _scope.Start(); |
| | 208 | | using (Azure.Core.HttpMessage _message = GetPropertiesAsync_CreateMessage( |
| | 209 | | pipeline, |
| | 210 | | resourceUri, |
| | 211 | | version, |
| | 212 | | timeout, |
| | 213 | | requestId)) |
| | 214 | | { |
| | 215 | | if (async) |
| | 216 | | { |
| | 217 | | // Send the request asynchronously if we're being called via an async path |
| | 218 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 219 | | } |
| | 220 | | else |
| | 221 | | { |
| | 222 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 223 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 224 | | pipeline.Send(_message, cancellationToken); |
| | 225 | | } |
| | 226 | | Azure.Response _response = _message.Response; |
| | 227 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 228 | | return GetPropertiesAsync_CreateResponse(clientDiagnostics, _response); |
| | 229 | | } |
| | 230 | | } |
| | 231 | | catch (System.Exception ex) |
| | 232 | | { |
| | 233 | | _scope.Failed(ex); |
| | 234 | | throw; |
| | 235 | | } |
| | 236 | | finally |
| | 237 | | { |
| | 238 | | _scope.Dispose(); |
| | 239 | | } |
| | 240 | | } |
| | 241 | |
|
| | 242 | | /// <summary> |
| | 243 | | /// Create the Service.GetPropertiesAsync request. |
| | 244 | | /// </summary> |
| | 245 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 246 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 247 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 248 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 249 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 250 | | /// <returns>The Service.GetPropertiesAsync Message.</returns> |
| | 251 | | internal static Azure.Core.HttpMessage GetPropertiesAsync_CreateMessage( |
| | 252 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 253 | | System.Uri resourceUri, |
| | 254 | | string version, |
| | 255 | | int? timeout = default, |
| | 256 | | string requestId = default) |
| | 257 | | { |
| | 258 | | // Validation |
| | 259 | | if (resourceUri == null) |
| | 260 | | { |
| | 261 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 262 | | } |
| | 263 | | if (version == null) |
| | 264 | | { |
| | 265 | | throw new System.ArgumentNullException(nameof(version)); |
| | 266 | | } |
| | 267 | |
|
| | 268 | | // Create the request |
| | 269 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 270 | | Azure.Core.Request _request = _message.Request; |
| | 271 | |
|
| | 272 | | // Set the endpoint |
| | 273 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 274 | | _request.Uri.Reset(resourceUri); |
| | 275 | | _request.Uri.AppendQuery("restype", "service", escapeValue: false); |
| | 276 | | _request.Uri.AppendQuery("comp", "properties", escapeValue: false); |
| | 277 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 278 | |
|
| | 279 | | // Add request headers |
| | 280 | | _request.Headers.SetValue("x-ms-version", version); |
| | 281 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 282 | |
|
| | 283 | | return _message; |
| | 284 | | } |
| | 285 | |
|
| | 286 | | /// <summary> |
| | 287 | | /// Create the Service.GetPropertiesAsync response or throw a failure exception. |
| | 288 | | /// </summary> |
| | 289 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 290 | | /// <param name="response">The raw Response.</param> |
| | 291 | | /// <returns>The Service.GetPropertiesAsync Azure.Response{Azure.Storage.Blobs.Models.BlobServiceProperties} |
| | 292 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobServiceProperties> GetPropertiesAsync_CreateRe |
| | 293 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 294 | | Azure.Response response) |
| | 295 | | { |
| | 296 | | // Process the response |
| | 297 | | switch (response.Status) |
| | 298 | | { |
| | 299 | | case 200: |
| | 300 | | { |
| | 301 | | // Create the result |
| | 302 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 303 | | Azure.Storage.Blobs.Models.BlobServiceProperties _value = Azure.Storage.Blobs.Models.BlobService |
| | 304 | |
|
| | 305 | | // Create the response |
| | 306 | | return Response.FromValue(_value, response); |
| | 307 | | } |
| | 308 | | case 304: |
| | 309 | | { |
| | 310 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.BlobServiceProperties>(response); |
| | 311 | | } |
| | 312 | | default: |
| | 313 | | { |
| | 314 | | // Create the result |
| | 315 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 316 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 317 | |
|
| | 318 | | throw _value.CreateException(clientDiagnostics, response); |
| | 319 | | } |
| | 320 | | } |
| | 321 | | } |
| | 322 | | #endregion Service.GetPropertiesAsync |
| | 323 | |
|
| | 324 | | #region Service.GetStatisticsAsync |
| | 325 | | /// <summary> |
| | 326 | | /// Retrieves statistics related to replication for the Blob service. It is only available on the secondary |
| | 327 | | /// </summary> |
| | 328 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 329 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 330 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 331 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 332 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 333 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 334 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 335 | | /// <param name="operationName">Operation name.</param> |
| | 336 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 337 | | /// <returns>Statistics for the storage service.</returns> |
| | 338 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobServiceSt |
| | 339 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 340 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 341 | | System.Uri resourceUri, |
| | 342 | | string version, |
| | 343 | | int? timeout = default, |
| | 344 | | string requestId = default, |
| | 345 | | bool async = true, |
| | 346 | | string operationName = "ServiceClient.GetStatistics", |
| | 347 | | System.Threading.CancellationToken cancellationToken = default) |
| | 348 | | { |
| | 349 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 350 | | try |
| | 351 | | { |
| | 352 | | _scope.AddAttribute("url", resourceUri); |
| | 353 | | _scope.Start(); |
| | 354 | | using (Azure.Core.HttpMessage _message = GetStatisticsAsync_CreateMessage( |
| | 355 | | pipeline, |
| | 356 | | resourceUri, |
| | 357 | | version, |
| | 358 | | timeout, |
| | 359 | | requestId)) |
| | 360 | | { |
| | 361 | | if (async) |
| | 362 | | { |
| | 363 | | // Send the request asynchronously if we're being called via an async path |
| | 364 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 365 | | } |
| | 366 | | else |
| | 367 | | { |
| | 368 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 369 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 370 | | pipeline.Send(_message, cancellationToken); |
| | 371 | | } |
| | 372 | | Azure.Response _response = _message.Response; |
| | 373 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 374 | | return GetStatisticsAsync_CreateResponse(clientDiagnostics, _response); |
| | 375 | | } |
| | 376 | | } |
| | 377 | | catch (System.Exception ex) |
| | 378 | | { |
| | 379 | | _scope.Failed(ex); |
| | 380 | | throw; |
| | 381 | | } |
| | 382 | | finally |
| | 383 | | { |
| | 384 | | _scope.Dispose(); |
| | 385 | | } |
| | 386 | | } |
| | 387 | |
|
| | 388 | | /// <summary> |
| | 389 | | /// Create the Service.GetStatisticsAsync request. |
| | 390 | | /// </summary> |
| | 391 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 392 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 393 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 394 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 395 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 396 | | /// <returns>The Service.GetStatisticsAsync Message.</returns> |
| | 397 | | internal static Azure.Core.HttpMessage GetStatisticsAsync_CreateMessage( |
| | 398 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 399 | | System.Uri resourceUri, |
| | 400 | | string version, |
| | 401 | | int? timeout = default, |
| | 402 | | string requestId = default) |
| | 403 | | { |
| | 404 | | // Validation |
| | 405 | | if (resourceUri == null) |
| | 406 | | { |
| | 407 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 408 | | } |
| | 409 | | if (version == null) |
| | 410 | | { |
| | 411 | | throw new System.ArgumentNullException(nameof(version)); |
| | 412 | | } |
| | 413 | |
|
| | 414 | | // Create the request |
| | 415 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 416 | | Azure.Core.Request _request = _message.Request; |
| | 417 | |
|
| | 418 | | // Set the endpoint |
| | 419 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 420 | | _request.Uri.Reset(resourceUri); |
| | 421 | | _request.Uri.AppendQuery("restype", "service", escapeValue: false); |
| | 422 | | _request.Uri.AppendQuery("comp", "stats", escapeValue: false); |
| | 423 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 424 | |
|
| | 425 | | // Add request headers |
| | 426 | | _request.Headers.SetValue("x-ms-version", version); |
| | 427 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 428 | |
|
| | 429 | | return _message; |
| | 430 | | } |
| | 431 | |
|
| | 432 | | /// <summary> |
| | 433 | | /// Create the Service.GetStatisticsAsync response or throw a failure exception. |
| | 434 | | /// </summary> |
| | 435 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 436 | | /// <param name="response">The raw Response.</param> |
| | 437 | | /// <returns>The Service.GetStatisticsAsync Azure.Response{Azure.Storage.Blobs.Models.BlobServiceStatistics} |
| | 438 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobServiceStatistics> GetStatisticsAsync_CreateRe |
| | 439 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 440 | | Azure.Response response) |
| | 441 | | { |
| | 442 | | // Process the response |
| | 443 | | switch (response.Status) |
| | 444 | | { |
| | 445 | | case 200: |
| | 446 | | { |
| | 447 | | // Create the result |
| | 448 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 449 | | Azure.Storage.Blobs.Models.BlobServiceStatistics _value = Azure.Storage.Blobs.Models.BlobService |
| | 450 | |
|
| | 451 | | // Create the response |
| | 452 | | return Response.FromValue(_value, response); |
| | 453 | | } |
| | 454 | | case 304: |
| | 455 | | { |
| | 456 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.BlobServiceStatistics>(response); |
| | 457 | | } |
| | 458 | | default: |
| | 459 | | { |
| | 460 | | // Create the result |
| | 461 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 462 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 463 | |
|
| | 464 | | throw _value.CreateException(clientDiagnostics, response); |
| | 465 | | } |
| | 466 | | } |
| | 467 | | } |
| | 468 | | #endregion Service.GetStatisticsAsync |
| | 469 | |
|
| | 470 | | #region Service.ListBlobContainersSegmentAsync |
| | 471 | | /// <summary> |
| | 472 | | /// The List Containers Segment operation returns a list of the containers under the specified account |
| | 473 | | /// </summary> |
| | 474 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 475 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 476 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 477 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 478 | | /// <param name="prefix">Filters the results to return only containers whose name begins with the specified |
| | 479 | | /// <param name="marker">A string value that identifies the portion of the list of containers to be returned |
| | 480 | | /// <param name="maxresults">Specifies the maximum number of containers to return. If the request does not s |
| | 481 | | /// <param name="include">Include this parameter to specify that the container's metadata be returned as par |
| | 482 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 483 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 484 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 485 | | /// <param name="operationName">Operation name.</param> |
| | 486 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 487 | | /// <returns>An enumeration of containers</returns> |
| | 488 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobContainer |
| | 489 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 490 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 491 | | System.Uri resourceUri, |
| | 492 | | string version, |
| | 493 | | string prefix = default, |
| | 494 | | string marker = default, |
| | 495 | | int? maxresults = default, |
| | 496 | | System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.ListContainersIncludeType> include = d |
| | 497 | | int? timeout = default, |
| | 498 | | string requestId = default, |
| | 499 | | bool async = true, |
| | 500 | | string operationName = "ServiceClient.ListBlobContainersSegment", |
| | 501 | | System.Threading.CancellationToken cancellationToken = default) |
| | 502 | | { |
| | 503 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 504 | | try |
| | 505 | | { |
| | 506 | | _scope.AddAttribute("url", resourceUri); |
| | 507 | | _scope.Start(); |
| | 508 | | using (Azure.Core.HttpMessage _message = ListBlobContainersSegmentAsync_CreateMessage( |
| | 509 | | pipeline, |
| | 510 | | resourceUri, |
| | 511 | | version, |
| | 512 | | prefix, |
| | 513 | | marker, |
| | 514 | | maxresults, |
| | 515 | | include, |
| | 516 | | timeout, |
| | 517 | | requestId)) |
| | 518 | | { |
| | 519 | | if (async) |
| | 520 | | { |
| | 521 | | // Send the request asynchronously if we're being called via an async path |
| | 522 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 523 | | } |
| | 524 | | else |
| | 525 | | { |
| | 526 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 527 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 528 | | pipeline.Send(_message, cancellationToken); |
| | 529 | | } |
| | 530 | | Azure.Response _response = _message.Response; |
| | 531 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 532 | | return ListBlobContainersSegmentAsync_CreateResponse(clientDiagnostics, _response); |
| | 533 | | } |
| | 534 | | } |
| | 535 | | catch (System.Exception ex) |
| | 536 | | { |
| | 537 | | _scope.Failed(ex); |
| | 538 | | throw; |
| | 539 | | } |
| | 540 | | finally |
| | 541 | | { |
| | 542 | | _scope.Dispose(); |
| | 543 | | } |
| | 544 | | } |
| | 545 | |
|
| | 546 | | /// <summary> |
| | 547 | | /// Create the Service.ListBlobContainersSegmentAsync request. |
| | 548 | | /// </summary> |
| | 549 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 550 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 551 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 552 | | /// <param name="prefix">Filters the results to return only containers whose name begins with the specified |
| | 553 | | /// <param name="marker">A string value that identifies the portion of the list of containers to be returned |
| | 554 | | /// <param name="maxresults">Specifies the maximum number of containers to return. If the request does not s |
| | 555 | | /// <param name="include">Include this parameter to specify that the container's metadata be returned as par |
| | 556 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 557 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 558 | | /// <returns>The Service.ListBlobContainersSegmentAsync Message.</returns> |
| | 559 | | internal static Azure.Core.HttpMessage ListBlobContainersSegmentAsync_CreateMessage( |
| | 560 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 561 | | System.Uri resourceUri, |
| | 562 | | string version, |
| | 563 | | string prefix = default, |
| | 564 | | string marker = default, |
| | 565 | | int? maxresults = default, |
| | 566 | | System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.ListContainersIncludeType> include = d |
| | 567 | | int? timeout = default, |
| | 568 | | string requestId = default) |
| | 569 | | { |
| | 570 | | // Validation |
| | 571 | | if (resourceUri == null) |
| | 572 | | { |
| | 573 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 574 | | } |
| | 575 | | if (version == null) |
| | 576 | | { |
| | 577 | | throw new System.ArgumentNullException(nameof(version)); |
| | 578 | | } |
| | 579 | |
|
| | 580 | | // Create the request |
| | 581 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 582 | | Azure.Core.Request _request = _message.Request; |
| | 583 | |
|
| | 584 | | // Set the endpoint |
| | 585 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 586 | | _request.Uri.Reset(resourceUri); |
| | 587 | | _request.Uri.AppendQuery("comp", "list", escapeValue: false); |
| | 588 | | if (prefix != null) { _request.Uri.AppendQuery("prefix", prefix); } |
| | 589 | | if (marker != null) { _request.Uri.AppendQuery("marker", marker); } |
| | 590 | | if (maxresults != null) { _request.Uri.AppendQuery("maxresults", maxresults.Value.ToString(System.Global |
| | 591 | | if (include != null) { _request.Uri.AppendQuery("include", string.Join(",", System.Linq.Enumerable.Selec |
| | 592 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 593 | |
|
| | 594 | | // Add request headers |
| | 595 | | _request.Headers.SetValue("x-ms-version", version); |
| | 596 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 597 | |
|
| | 598 | | return _message; |
| | 599 | | } |
| | 600 | |
|
| | 601 | | /// <summary> |
| | 602 | | /// Create the Service.ListBlobContainersSegmentAsync response or throw a failure exception. |
| | 603 | | /// </summary> |
| | 604 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 605 | | /// <param name="response">The raw Response.</param> |
| | 606 | | /// <returns>The Service.ListBlobContainersSegmentAsync Azure.Response{Azure.Storage.Blobs.Models.BlobContai |
| | 607 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobContainersSegment> ListBlobContainersSegmentAs |
| | 608 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 609 | | Azure.Response response) |
| | 610 | | { |
| | 611 | | // Process the response |
| | 612 | | switch (response.Status) |
| | 613 | | { |
| | 614 | | case 200: |
| | 615 | | { |
| | 616 | | // Create the result |
| | 617 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 618 | | Azure.Storage.Blobs.Models.BlobContainersSegment _value = Azure.Storage.Blobs.Models.BlobContain |
| | 619 | |
|
| | 620 | | // Create the response |
| | 621 | | return Response.FromValue(_value, response); |
| | 622 | | } |
| | 623 | | case 304: |
| | 624 | | { |
| | 625 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.BlobContainersSegment>(response); |
| | 626 | | } |
| | 627 | | default: |
| | 628 | | { |
| | 629 | | // Create the result |
| | 630 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 631 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 632 | |
|
| | 633 | | throw _value.CreateException(clientDiagnostics, response); |
| | 634 | | } |
| | 635 | | } |
| | 636 | | } |
| | 637 | | #endregion Service.ListBlobContainersSegmentAsync |
| | 638 | |
|
| | 639 | | #region Service.GetUserDelegationKeyAsync |
| | 640 | | /// <summary> |
| | 641 | | /// Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer t |
| | 642 | | /// </summary> |
| | 643 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 644 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 645 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 646 | | /// <param name="keyInfo">Key information</param> |
| | 647 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 648 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 649 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 650 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 651 | | /// <param name="operationName">Operation name.</param> |
| | 652 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 653 | | /// <returns>A user delegation key</returns> |
| | 654 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.UserDelegatio |
| | 655 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 656 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 657 | | System.Uri resourceUri, |
| | 658 | | Azure.Storage.Blobs.Models.KeyInfo keyInfo, |
| | 659 | | string version, |
| | 660 | | int? timeout = default, |
| | 661 | | string requestId = default, |
| | 662 | | bool async = true, |
| | 663 | | string operationName = "ServiceClient.GetUserDelegationKey", |
| | 664 | | System.Threading.CancellationToken cancellationToken = default) |
| | 665 | | { |
| | 666 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 667 | | try |
| | 668 | | { |
| | 669 | | _scope.AddAttribute("url", resourceUri); |
| | 670 | | _scope.Start(); |
| | 671 | | using (Azure.Core.HttpMessage _message = GetUserDelegationKeyAsync_CreateMessage( |
| | 672 | | pipeline, |
| | 673 | | resourceUri, |
| | 674 | | keyInfo, |
| | 675 | | version, |
| | 676 | | timeout, |
| | 677 | | requestId)) |
| | 678 | | { |
| | 679 | | if (async) |
| | 680 | | { |
| | 681 | | // Send the request asynchronously if we're being called via an async path |
| | 682 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 683 | | } |
| | 684 | | else |
| | 685 | | { |
| | 686 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 687 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 688 | | pipeline.Send(_message, cancellationToken); |
| | 689 | | } |
| | 690 | | Azure.Response _response = _message.Response; |
| | 691 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 692 | | return GetUserDelegationKeyAsync_CreateResponse(clientDiagnostics, _response); |
| | 693 | | } |
| | 694 | | } |
| | 695 | | catch (System.Exception ex) |
| | 696 | | { |
| | 697 | | _scope.Failed(ex); |
| | 698 | | throw; |
| | 699 | | } |
| | 700 | | finally |
| | 701 | | { |
| | 702 | | _scope.Dispose(); |
| | 703 | | } |
| | 704 | | } |
| | 705 | |
|
| | 706 | | /// <summary> |
| | 707 | | /// Create the Service.GetUserDelegationKeyAsync request. |
| | 708 | | /// </summary> |
| | 709 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 710 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 711 | | /// <param name="keyInfo">Key information</param> |
| | 712 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 713 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 714 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 715 | | /// <returns>The Service.GetUserDelegationKeyAsync Message.</returns> |
| | 716 | | internal static Azure.Core.HttpMessage GetUserDelegationKeyAsync_CreateMessage( |
| | 717 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 718 | | System.Uri resourceUri, |
| | 719 | | Azure.Storage.Blobs.Models.KeyInfo keyInfo, |
| | 720 | | string version, |
| | 721 | | int? timeout = default, |
| | 722 | | string requestId = default) |
| | 723 | | { |
| | 724 | | // Validation |
| | 725 | | if (resourceUri == null) |
| | 726 | | { |
| | 727 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 728 | | } |
| | 729 | | if (keyInfo == null) |
| | 730 | | { |
| | 731 | | throw new System.ArgumentNullException(nameof(keyInfo)); |
| | 732 | | } |
| | 733 | | if (version == null) |
| | 734 | | { |
| | 735 | | throw new System.ArgumentNullException(nameof(version)); |
| | 736 | | } |
| | 737 | |
|
| | 738 | | // Create the request |
| | 739 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 740 | | Azure.Core.Request _request = _message.Request; |
| | 741 | |
|
| | 742 | | // Set the endpoint |
| | 743 | | _request.Method = Azure.Core.RequestMethod.Post; |
| | 744 | | _request.Uri.Reset(resourceUri); |
| | 745 | | _request.Uri.AppendQuery("restype", "service", escapeValue: false); |
| | 746 | | _request.Uri.AppendQuery("comp", "userdelegationkey", escapeValue: false); |
| | 747 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 748 | |
|
| | 749 | | // Add request headers |
| | 750 | | _request.Headers.SetValue("x-ms-version", version); |
| | 751 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 752 | |
|
| | 753 | | // Create the body |
| | 754 | | System.Xml.Linq.XElement _body = Azure.Storage.Blobs.Models.KeyInfo.ToXml(keyInfo, "KeyInfo", ""); |
| | 755 | | string _text = _body.ToString(System.Xml.Linq.SaveOptions.DisableFormatting); |
| | 756 | | _request.Headers.SetValue("Content-Type", "application/xml"); |
| | 757 | | _request.Headers.SetValue("Content-Length", _text.Length.ToString(System.Globalization.CultureInfo.Invar |
| | 758 | | _request.Content = Azure.Core.RequestContent.Create(System.Text.Encoding.UTF8.GetBytes(_text)); |
| | 759 | |
|
| | 760 | | return _message; |
| | 761 | | } |
| | 762 | |
|
| | 763 | | /// <summary> |
| | 764 | | /// Create the Service.GetUserDelegationKeyAsync response or throw a failure exception. |
| | 765 | | /// </summary> |
| | 766 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 767 | | /// <param name="response">The raw Response.</param> |
| | 768 | | /// <returns>The Service.GetUserDelegationKeyAsync Azure.Response{Azure.Storage.Blobs.Models.UserDelegationK |
| | 769 | | internal static Azure.Response<Azure.Storage.Blobs.Models.UserDelegationKey> GetUserDelegationKeyAsync_Creat |
| | 770 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 771 | | Azure.Response response) |
| | 772 | | { |
| | 773 | | // Process the response |
| | 774 | | switch (response.Status) |
| | 775 | | { |
| | 776 | | case 200: |
| | 777 | | { |
| | 778 | | // Create the result |
| | 779 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 780 | | Azure.Storage.Blobs.Models.UserDelegationKey _value = Azure.Storage.Blobs.Models.UserDelegationK |
| | 781 | |
|
| | 782 | | // Create the response |
| | 783 | | return Response.FromValue(_value, response); |
| | 784 | | } |
| | 785 | | default: |
| | 786 | | { |
| | 787 | | // Create the result |
| | 788 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 789 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 790 | |
|
| | 791 | | throw _value.CreateException(clientDiagnostics, response); |
| | 792 | | } |
| | 793 | | } |
| | 794 | | } |
| | 795 | | #endregion Service.GetUserDelegationKeyAsync |
| | 796 | |
|
| | 797 | | #region Service.GetAccountInfoAsync |
| | 798 | | /// <summary> |
| | 799 | | /// Returns the sku name and account kind |
| | 800 | | /// </summary> |
| | 801 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 802 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 803 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 804 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 805 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 806 | | /// <param name="operationName">Operation name.</param> |
| | 807 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 808 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.AccountInfo}</returns> |
| | 809 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.AccountInfo>> |
| | 810 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 811 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 812 | | System.Uri resourceUri, |
| | 813 | | string version, |
| | 814 | | bool async = true, |
| | 815 | | string operationName = "ServiceClient.GetAccountInfo", |
| | 816 | | System.Threading.CancellationToken cancellationToken = default) |
| | 817 | | { |
| | 818 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 819 | | try |
| | 820 | | { |
| | 821 | | _scope.AddAttribute("url", resourceUri); |
| | 822 | | _scope.Start(); |
| | 823 | | using (Azure.Core.HttpMessage _message = GetAccountInfoAsync_CreateMessage( |
| | 824 | | pipeline, |
| | 825 | | resourceUri, |
| | 826 | | version)) |
| | 827 | | { |
| | 828 | | if (async) |
| | 829 | | { |
| | 830 | | // Send the request asynchronously if we're being called via an async path |
| | 831 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 832 | | } |
| | 833 | | else |
| | 834 | | { |
| | 835 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 836 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 837 | | pipeline.Send(_message, cancellationToken); |
| | 838 | | } |
| | 839 | | Azure.Response _response = _message.Response; |
| | 840 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 841 | | return GetAccountInfoAsync_CreateResponse(clientDiagnostics, _response); |
| | 842 | | } |
| | 843 | | } |
| | 844 | | catch (System.Exception ex) |
| | 845 | | { |
| | 846 | | _scope.Failed(ex); |
| | 847 | | throw; |
| | 848 | | } |
| | 849 | | finally |
| | 850 | | { |
| | 851 | | _scope.Dispose(); |
| | 852 | | } |
| | 853 | | } |
| | 854 | |
|
| | 855 | | /// <summary> |
| | 856 | | /// Create the Service.GetAccountInfoAsync request. |
| | 857 | | /// </summary> |
| | 858 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 859 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 860 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 861 | | /// <returns>The Service.GetAccountInfoAsync Message.</returns> |
| | 862 | | internal static Azure.Core.HttpMessage GetAccountInfoAsync_CreateMessage( |
| | 863 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 864 | | System.Uri resourceUri, |
| | 865 | | string version) |
| | 866 | | { |
| | 867 | | // Validation |
| | 868 | | if (resourceUri == null) |
| | 869 | | { |
| | 870 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 871 | | } |
| | 872 | | if (version == null) |
| | 873 | | { |
| | 874 | | throw new System.ArgumentNullException(nameof(version)); |
| | 875 | | } |
| | 876 | |
|
| | 877 | | // Create the request |
| | 878 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 879 | | Azure.Core.Request _request = _message.Request; |
| | 880 | |
|
| | 881 | | // Set the endpoint |
| | 882 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 883 | | _request.Uri.Reset(resourceUri); |
| | 884 | | _request.Uri.AppendQuery("restype", "account", escapeValue: false); |
| | 885 | | _request.Uri.AppendQuery("comp", "properties", escapeValue: false); |
| | 886 | |
|
| | 887 | | // Add request headers |
| | 888 | | _request.Headers.SetValue("x-ms-version", version); |
| | 889 | |
|
| | 890 | | return _message; |
| | 891 | | } |
| | 892 | |
|
| | 893 | | /// <summary> |
| | 894 | | /// Create the Service.GetAccountInfoAsync response or throw a failure exception. |
| | 895 | | /// </summary> |
| | 896 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 897 | | /// <param name="response">The raw Response.</param> |
| | 898 | | /// <returns>The Service.GetAccountInfoAsync Azure.Response{Azure.Storage.Blobs.Models.AccountInfo}.</return |
| | 899 | | internal static Azure.Response<Azure.Storage.Blobs.Models.AccountInfo> GetAccountInfoAsync_CreateResponse( |
| | 900 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 901 | | Azure.Response response) |
| | 902 | | { |
| | 903 | | // Process the response |
| | 904 | | switch (response.Status) |
| | 905 | | { |
| | 906 | | case 200: |
| | 907 | | { |
| | 908 | | // Create the result |
| | 909 | | Azure.Storage.Blobs.Models.AccountInfo _value = new Azure.Storage.Blobs.Models.AccountInfo(); |
| | 910 | |
|
| | 911 | | // Get response headers |
| | 912 | | string _header; |
| | 913 | | if (response.Headers.TryGetValue("x-ms-sku-name", out _header)) |
| | 914 | | { |
| | 915 | | _value.SkuName = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseSkuName(_header); |
| | 916 | | } |
| | 917 | | if (response.Headers.TryGetValue("x-ms-account-kind", out _header)) |
| | 918 | | { |
| | 919 | | _value.AccountKind = (Azure.Storage.Blobs.Models.AccountKind)System.Enum.Parse(typeof(Azure. |
| | 920 | | } |
| | 921 | |
|
| | 922 | | // Create the response |
| | 923 | | return Response.FromValue(_value, response); |
| | 924 | | } |
| | 925 | | case 304: |
| | 926 | | { |
| | 927 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.AccountInfo>(response); |
| | 928 | | } |
| | 929 | | default: |
| | 930 | | { |
| | 931 | | // Create the result |
| | 932 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 933 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 934 | |
|
| | 935 | | throw _value.CreateException(clientDiagnostics, response); |
| | 936 | | } |
| | 937 | | } |
| | 938 | | } |
| | 939 | | #endregion Service.GetAccountInfoAsync |
| | 940 | |
|
| | 941 | | #region Service.SubmitBatchAsync |
| | 942 | | /// <summary> |
| | 943 | | /// The Batch operation allows multiple API calls to be embedded into a single HTTP request. |
| | 944 | | /// </summary> |
| | 945 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 946 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 947 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 948 | | /// <param name="body">Initial data</param> |
| | 949 | | /// <param name="contentLength">The length of the request.</param> |
| | 950 | | /// <param name="multipartContentType">Required. The value of this header must be multipart/mixed with a bat |
| | 951 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 952 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 953 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 954 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 955 | | /// <param name="operationName">Operation name.</param> |
| | 956 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 957 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobBatchResult}</returns> |
| | 958 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobBatchResu |
| | 959 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 960 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 961 | | System.Uri resourceUri, |
| | 962 | | System.IO.Stream body, |
| | 963 | | long contentLength, |
| | 964 | | string multipartContentType, |
| | 965 | | string version, |
| | 966 | | int? timeout = default, |
| | 967 | | string requestId = default, |
| | 968 | | bool async = true, |
| | 969 | | string operationName = "ServiceClient.SubmitBatch", |
| | 970 | | System.Threading.CancellationToken cancellationToken = default) |
| | 971 | | { |
| | 972 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 973 | | try |
| | 974 | | { |
| | 975 | | _scope.AddAttribute("url", resourceUri); |
| | 976 | | _scope.Start(); |
| | 977 | | using (Azure.Core.HttpMessage _message = SubmitBatchAsync_CreateMessage( |
| | 978 | | pipeline, |
| | 979 | | resourceUri, |
| | 980 | | body, |
| | 981 | | contentLength, |
| | 982 | | multipartContentType, |
| | 983 | | version, |
| | 984 | | timeout, |
| | 985 | | requestId)) |
| | 986 | | { |
| | 987 | | if (async) |
| | 988 | | { |
| | 989 | | // Send the request asynchronously if we're being called via an async path |
| | 990 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 991 | | } |
| | 992 | | else |
| | 993 | | { |
| | 994 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 995 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 996 | | pipeline.Send(_message, cancellationToken); |
| | 997 | | } |
| | 998 | | Azure.Response _response = _message.Response; |
| | 999 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1000 | | return SubmitBatchAsync_CreateResponse(clientDiagnostics, _response); |
| | 1001 | | } |
| | 1002 | | } |
| | 1003 | | catch (System.Exception ex) |
| | 1004 | | { |
| | 1005 | | _scope.Failed(ex); |
| | 1006 | | throw; |
| | 1007 | | } |
| | 1008 | | finally |
| | 1009 | | { |
| | 1010 | | _scope.Dispose(); |
| | 1011 | | } |
| | 1012 | | } |
| | 1013 | |
|
| | 1014 | | /// <summary> |
| | 1015 | | /// Create the Service.SubmitBatchAsync request. |
| | 1016 | | /// </summary> |
| | 1017 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1018 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 1019 | | /// <param name="body">Initial data</param> |
| | 1020 | | /// <param name="contentLength">The length of the request.</param> |
| | 1021 | | /// <param name="multipartContentType">Required. The value of this header must be multipart/mixed with a bat |
| | 1022 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1023 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1024 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 1025 | | /// <returns>The Service.SubmitBatchAsync Message.</returns> |
| | 1026 | | internal static Azure.Core.HttpMessage SubmitBatchAsync_CreateMessage( |
| | 1027 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1028 | | System.Uri resourceUri, |
| | 1029 | | System.IO.Stream body, |
| | 1030 | | long contentLength, |
| | 1031 | | string multipartContentType, |
| | 1032 | | string version, |
| | 1033 | | int? timeout = default, |
| | 1034 | | string requestId = default) |
| | 1035 | | { |
| | 1036 | | // Validation |
| | 1037 | | if (resourceUri == null) |
| | 1038 | | { |
| | 1039 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1040 | | } |
| | 1041 | | if (body == null) |
| | 1042 | | { |
| | 1043 | | throw new System.ArgumentNullException(nameof(body)); |
| | 1044 | | } |
| | 1045 | | if (multipartContentType == null) |
| | 1046 | | { |
| | 1047 | | throw new System.ArgumentNullException(nameof(multipartContentType)); |
| | 1048 | | } |
| | 1049 | | if (version == null) |
| | 1050 | | { |
| | 1051 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1052 | | } |
| | 1053 | |
|
| | 1054 | | // Create the request |
| | 1055 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1056 | | Azure.Core.Request _request = _message.Request; |
| | 1057 | |
|
| | 1058 | | // Set the endpoint |
| | 1059 | | _request.Method = Azure.Core.RequestMethod.Post; |
| | 1060 | | _request.Uri.Reset(resourceUri); |
| | 1061 | | _request.Uri.AppendQuery("comp", "batch", escapeValue: false); |
| | 1062 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1063 | |
|
| | 1064 | | // Add request headers |
| | 1065 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 1066 | | _request.Headers.SetValue("Content-Type", multipartContentType); |
| | 1067 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1068 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 1069 | |
|
| | 1070 | | // Create the body |
| | 1071 | | _request.Content = Azure.Core.RequestContent.Create(body); |
| | 1072 | |
|
| | 1073 | | return _message; |
| | 1074 | | } |
| | 1075 | |
|
| | 1076 | | /// <summary> |
| | 1077 | | /// Create the Service.SubmitBatchAsync response or throw a failure exception. |
| | 1078 | | /// </summary> |
| | 1079 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1080 | | /// <param name="response">The raw Response.</param> |
| | 1081 | | /// <returns>The Service.SubmitBatchAsync Azure.Response{Azure.Storage.Blobs.Models.BlobBatchResult}.</retur |
| | 1082 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobBatchResult> SubmitBatchAsync_CreateResponse( |
| | 1083 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1084 | | Azure.Response response) |
| | 1085 | | { |
| | 1086 | | // Process the response |
| | 1087 | | switch (response.Status) |
| | 1088 | | { |
| | 1089 | | case 202: |
| | 1090 | | { |
| | 1091 | | // Create the result |
| | 1092 | | Azure.Storage.Blobs.Models.BlobBatchResult _value = new Azure.Storage.Blobs.Models.BlobBatchResu |
| | 1093 | | _value.Content = response.ContentStream; // You should manually wrap with RetriableStream! |
| | 1094 | |
|
| | 1095 | | // Get response headers |
| | 1096 | | string _header; |
| | 1097 | | if (response.Headers.TryGetValue("Content-Type", out _header)) |
| | 1098 | | { |
| | 1099 | | _value.ContentType = _header; |
| | 1100 | | } |
| | 1101 | |
|
| | 1102 | | // Create the response |
| | 1103 | | return Response.FromValue(_value, response); |
| | 1104 | | } |
| | 1105 | | default: |
| | 1106 | | { |
| | 1107 | | // Create the result |
| | 1108 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1109 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 1110 | |
|
| | 1111 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1112 | | } |
| | 1113 | | } |
| | 1114 | | } |
| | 1115 | | #endregion Service.SubmitBatchAsync |
| | 1116 | |
|
| | 1117 | | #region Service.FilterBlobsAsync |
| | 1118 | | /// <summary> |
| | 1119 | | /// The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given |
| | 1120 | | /// </summary> |
| | 1121 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 1122 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1123 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 1124 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1125 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1126 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 1127 | | /// <param name="where">Filters the results to return only to return only blobs whose tags match the specifi |
| | 1128 | | /// <param name="marker">A string value that identifies the portion of the list of containers to be returned |
| | 1129 | | /// <param name="maxresults">Specifies the maximum number of containers to return. If the request does not s |
| | 1130 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 1131 | | /// <param name="operationName">Operation name.</param> |
| | 1132 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 1133 | | /// <returns>The result of a Filter Blobs API call</returns> |
| | 1134 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.FilterBlobSeg |
| | 1135 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1136 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1137 | | System.Uri resourceUri, |
| | 1138 | | string version, |
| | 1139 | | int? timeout = default, |
| | 1140 | | string requestId = default, |
| | 1141 | | string where = default, |
| | 1142 | | string marker = default, |
| | 1143 | | int? maxresults = default, |
| | 1144 | | bool async = true, |
| | 1145 | | string operationName = "ServiceClient.FilterBlobs", |
| | 1146 | | System.Threading.CancellationToken cancellationToken = default) |
| | 1147 | | { |
| | 1148 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 1149 | | try |
| | 1150 | | { |
| | 1151 | | _scope.AddAttribute("url", resourceUri); |
| | 1152 | | _scope.Start(); |
| | 1153 | | using (Azure.Core.HttpMessage _message = FilterBlobsAsync_CreateMessage( |
| | 1154 | | pipeline, |
| | 1155 | | resourceUri, |
| | 1156 | | version, |
| | 1157 | | timeout, |
| | 1158 | | requestId, |
| | 1159 | | where, |
| | 1160 | | marker, |
| | 1161 | | maxresults)) |
| | 1162 | | { |
| | 1163 | | if (async) |
| | 1164 | | { |
| | 1165 | | // Send the request asynchronously if we're being called via an async path |
| | 1166 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1167 | | } |
| | 1168 | | else |
| | 1169 | | { |
| | 1170 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1171 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1172 | | pipeline.Send(_message, cancellationToken); |
| | 1173 | | } |
| | 1174 | | Azure.Response _response = _message.Response; |
| | 1175 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1176 | | return FilterBlobsAsync_CreateResponse(clientDiagnostics, _response); |
| | 1177 | | } |
| | 1178 | | } |
| | 1179 | | catch (System.Exception ex) |
| | 1180 | | { |
| | 1181 | | _scope.Failed(ex); |
| | 1182 | | throw; |
| | 1183 | | } |
| | 1184 | | finally |
| | 1185 | | { |
| | 1186 | | _scope.Dispose(); |
| | 1187 | | } |
| | 1188 | | } |
| | 1189 | |
|
| | 1190 | | /// <summary> |
| | 1191 | | /// Create the Service.FilterBlobsAsync request. |
| | 1192 | | /// </summary> |
| | 1193 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1194 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 1195 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1196 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1197 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 1198 | | /// <param name="where">Filters the results to return only to return only blobs whose tags match the specifi |
| | 1199 | | /// <param name="marker">A string value that identifies the portion of the list of containers to be returned |
| | 1200 | | /// <param name="maxresults">Specifies the maximum number of containers to return. If the request does not s |
| | 1201 | | /// <returns>The Service.FilterBlobsAsync Message.</returns> |
| | 1202 | | internal static Azure.Core.HttpMessage FilterBlobsAsync_CreateMessage( |
| | 1203 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1204 | | System.Uri resourceUri, |
| | 1205 | | string version, |
| | 1206 | | int? timeout = default, |
| | 1207 | | string requestId = default, |
| | 1208 | | string where = default, |
| | 1209 | | string marker = default, |
| | 1210 | | int? maxresults = default) |
| | 1211 | | { |
| | 1212 | | // Validation |
| | 1213 | | if (resourceUri == null) |
| | 1214 | | { |
| | 1215 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1216 | | } |
| | 1217 | | if (version == null) |
| | 1218 | | { |
| | 1219 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1220 | | } |
| | 1221 | |
|
| | 1222 | | // Create the request |
| | 1223 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1224 | | Azure.Core.Request _request = _message.Request; |
| | 1225 | |
|
| | 1226 | | // Set the endpoint |
| | 1227 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 1228 | | _request.Uri.Reset(resourceUri); |
| | 1229 | | _request.Uri.AppendQuery("comp", "blobs", escapeValue: false); |
| | 1230 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1231 | | if (where != null) { _request.Uri.AppendQuery("where", where); } |
| | 1232 | | if (marker != null) { _request.Uri.AppendQuery("marker", marker); } |
| | 1233 | | if (maxresults != null) { _request.Uri.AppendQuery("maxresults", maxresults.Value.ToString(System.Global |
| | 1234 | |
|
| | 1235 | | // Add request headers |
| | 1236 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1237 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 1238 | |
|
| | 1239 | | return _message; |
| | 1240 | | } |
| | 1241 | |
|
| | 1242 | | /// <summary> |
| | 1243 | | /// Create the Service.FilterBlobsAsync response or throw a failure exception. |
| | 1244 | | /// </summary> |
| | 1245 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1246 | | /// <param name="response">The raw Response.</param> |
| | 1247 | | /// <returns>The Service.FilterBlobsAsync Azure.Response{Azure.Storage.Blobs.Models.FilterBlobSegment}.</ret |
| | 1248 | | internal static Azure.Response<Azure.Storage.Blobs.Models.FilterBlobSegment> FilterBlobsAsync_CreateResponse |
| | 1249 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1250 | | Azure.Response response) |
| | 1251 | | { |
| | 1252 | | // Process the response |
| | 1253 | | switch (response.Status) |
| | 1254 | | { |
| | 1255 | | case 200: |
| | 1256 | | { |
| | 1257 | | // Create the result |
| | 1258 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1259 | | Azure.Storage.Blobs.Models.FilterBlobSegment _value = Azure.Storage.Blobs.Models.FilterBlobSegme |
| | 1260 | |
|
| | 1261 | | // Create the response |
| | 1262 | | return Response.FromValue(_value, response); |
| | 1263 | | } |
| | 1264 | | case 304: |
| | 1265 | | { |
| | 1266 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.FilterBlobSegment>(response); |
| | 1267 | | } |
| | 1268 | | default: |
| | 1269 | | { |
| | 1270 | | // Create the result |
| | 1271 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1272 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 1273 | |
|
| | 1274 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1275 | | } |
| | 1276 | | } |
| | 1277 | | } |
| | 1278 | | #endregion Service.FilterBlobsAsync |
| | 1279 | | } |
| | 1280 | | #endregion Service operations |
| | 1281 | |
|
| | 1282 | | #region Container operations |
| | 1283 | | /// <summary> |
| | 1284 | | /// Container operations for Azure Blob Storage |
| | 1285 | | /// </summary> |
| | 1286 | | public static partial class Container |
| | 1287 | | { |
| | 1288 | | #region Container.CreateAsync |
| | 1289 | | /// <summary> |
| | 1290 | | /// creates a new container under the specified account. If the container with the same name already exists, |
| | 1291 | | /// </summary> |
| | 1292 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 1293 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1294 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 1295 | | /// <param name="access">Specifies whether data in the container may be accessed publicly and the level of a |
| | 1296 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1297 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1298 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 1299 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 1300 | | /// <param name="defaultEncryptionScope">Optional. Version 2019-07-07 and later. Specifies the default enc |
| | 1301 | | /// <param name="preventEncryptionScopeOverride">Optional. Version 2019-07-07 and newer. If true, prevents |
| | 1302 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 1303 | | /// <param name="operationName">Operation name.</param> |
| | 1304 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 1305 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobContainerInfo}</returns> |
| | 1306 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobContainer |
| | 1307 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1308 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1309 | | System.Uri resourceUri, |
| | 1310 | | Azure.Storage.Blobs.Models.PublicAccessType access, |
| | 1311 | | string version, |
| | 1312 | | int? timeout = default, |
| | 1313 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 1314 | | string requestId = default, |
| | 1315 | | string defaultEncryptionScope = default, |
| | 1316 | | bool? preventEncryptionScopeOverride = default, |
| | 1317 | | bool async = true, |
| | 1318 | | string operationName = "ContainerClient.Create", |
| | 1319 | | System.Threading.CancellationToken cancellationToken = default) |
| | 1320 | | { |
| | 1321 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 1322 | | try |
| | 1323 | | { |
| | 1324 | | _scope.AddAttribute("url", resourceUri); |
| | 1325 | | _scope.Start(); |
| | 1326 | | using (Azure.Core.HttpMessage _message = CreateAsync_CreateMessage( |
| | 1327 | | pipeline, |
| | 1328 | | resourceUri, |
| | 1329 | | access, |
| | 1330 | | version, |
| | 1331 | | timeout, |
| | 1332 | | metadata, |
| | 1333 | | requestId, |
| | 1334 | | defaultEncryptionScope, |
| | 1335 | | preventEncryptionScopeOverride)) |
| | 1336 | | { |
| | 1337 | | if (async) |
| | 1338 | | { |
| | 1339 | | // Send the request asynchronously if we're being called via an async path |
| | 1340 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1341 | | } |
| | 1342 | | else |
| | 1343 | | { |
| | 1344 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1345 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1346 | | pipeline.Send(_message, cancellationToken); |
| | 1347 | | } |
| | 1348 | | Azure.Response _response = _message.Response; |
| | 1349 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1350 | | return CreateAsync_CreateResponse(clientDiagnostics, _response); |
| | 1351 | | } |
| | 1352 | | } |
| | 1353 | | catch (System.Exception ex) |
| | 1354 | | { |
| | 1355 | | _scope.Failed(ex); |
| | 1356 | | throw; |
| | 1357 | | } |
| | 1358 | | finally |
| | 1359 | | { |
| | 1360 | | _scope.Dispose(); |
| | 1361 | | } |
| | 1362 | | } |
| | 1363 | |
|
| | 1364 | | /// <summary> |
| | 1365 | | /// Create the Container.CreateAsync request. |
| | 1366 | | /// </summary> |
| | 1367 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1368 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 1369 | | /// <param name="access">Specifies whether data in the container may be accessed publicly and the level of a |
| | 1370 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1371 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1372 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 1373 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 1374 | | /// <param name="defaultEncryptionScope">Optional. Version 2019-07-07 and later. Specifies the default enc |
| | 1375 | | /// <param name="preventEncryptionScopeOverride">Optional. Version 2019-07-07 and newer. If true, prevents |
| | 1376 | | /// <returns>The Container.CreateAsync Message.</returns> |
| | 1377 | | internal static Azure.Core.HttpMessage CreateAsync_CreateMessage( |
| | 1378 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1379 | | System.Uri resourceUri, |
| | 1380 | | Azure.Storage.Blobs.Models.PublicAccessType access, |
| | 1381 | | string version, |
| | 1382 | | int? timeout = default, |
| | 1383 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 1384 | | string requestId = default, |
| | 1385 | | string defaultEncryptionScope = default, |
| | 1386 | | bool? preventEncryptionScopeOverride = default) |
| | 1387 | | { |
| | 1388 | | // Validation |
| | 1389 | | if (resourceUri == null) |
| | 1390 | | { |
| | 1391 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1392 | | } |
| | 1393 | | if (version == null) |
| | 1394 | | { |
| | 1395 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1396 | | } |
| | 1397 | |
|
| | 1398 | | // Create the request |
| | 1399 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1400 | | Azure.Core.Request _request = _message.Request; |
| | 1401 | |
|
| | 1402 | | // Set the endpoint |
| | 1403 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 1404 | | _request.Uri.Reset(resourceUri); |
| | 1405 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 1406 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1407 | |
|
| | 1408 | | // Add request headers |
| | 1409 | | if (access != Azure.Storage.Blobs.Models.PublicAccessType.None) { _request.Headers.SetValue("x-ms-blob-p |
| | 1410 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1411 | | if (metadata != null) { |
| | 1412 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 1413 | | { |
| | 1414 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 1415 | | } |
| | 1416 | | } |
| | 1417 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 1418 | | if (defaultEncryptionScope != null) { _request.Headers.SetValue("x-ms-default-encryption-scope", default |
| | 1419 | | if (preventEncryptionScopeOverride != null) { |
| | 1420 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 1421 | | _request.Headers.SetValue("x-ms-deny-encryption-scope-override", preventEncryptionScopeOverride.Value.To |
| | 1422 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 1423 | | } |
| | 1424 | |
|
| | 1425 | | return _message; |
| | 1426 | | } |
| | 1427 | |
|
| | 1428 | | /// <summary> |
| | 1429 | | /// Create the Container.CreateAsync response or throw a failure exception. |
| | 1430 | | /// </summary> |
| | 1431 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1432 | | /// <param name="response">The raw Response.</param> |
| | 1433 | | /// <returns>The Container.CreateAsync Azure.Response{Azure.Storage.Blobs.Models.BlobContainerInfo}.</return |
| | 1434 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo> CreateAsync_CreateResponse( |
| | 1435 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1436 | | Azure.Response response) |
| | 1437 | | { |
| | 1438 | | // Process the response |
| | 1439 | | switch (response.Status) |
| | 1440 | | { |
| | 1441 | | case 201: |
| | 1442 | | { |
| | 1443 | | // Create the result |
| | 1444 | | Azure.Storage.Blobs.Models.BlobContainerInfo _value = new Azure.Storage.Blobs.Models.BlobContain |
| | 1445 | |
|
| | 1446 | | // Get response headers |
| | 1447 | | string _header; |
| | 1448 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 1449 | | { |
| | 1450 | | _value.ETag = new Azure.ETag(_header); |
| | 1451 | | } |
| | 1452 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 1453 | | { |
| | 1454 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 1455 | | } |
| | 1456 | |
|
| | 1457 | | // Create the response |
| | 1458 | | return Response.FromValue(_value, response); |
| | 1459 | | } |
| | 1460 | | default: |
| | 1461 | | { |
| | 1462 | | // Create the result |
| | 1463 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1464 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 1465 | |
|
| | 1466 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1467 | | } |
| | 1468 | | } |
| | 1469 | | } |
| | 1470 | | #endregion Container.CreateAsync |
| | 1471 | |
|
| | 1472 | | #region Container.GetPropertiesAsync |
| | 1473 | | /// <summary> |
| | 1474 | | /// returns all user-defined metadata and system properties for the specified container. The data returned d |
| | 1475 | | /// </summary> |
| | 1476 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 1477 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1478 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 1479 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1480 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1481 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 1482 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 1483 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 1484 | | /// <param name="operationName">Operation name.</param> |
| | 1485 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 1486 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.FlattenedContainerItem}</returns> |
| | 1487 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.FlattenedCont |
| | 1488 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1489 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1490 | | System.Uri resourceUri, |
| | 1491 | | string version, |
| | 1492 | | int? timeout = default, |
| | 1493 | | string leaseId = default, |
| | 1494 | | string requestId = default, |
| | 1495 | | bool async = true, |
| | 1496 | | string operationName = "ContainerClient.GetProperties", |
| | 1497 | | System.Threading.CancellationToken cancellationToken = default) |
| | 1498 | | { |
| | 1499 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 1500 | | try |
| | 1501 | | { |
| | 1502 | | _scope.AddAttribute("url", resourceUri); |
| | 1503 | | _scope.Start(); |
| | 1504 | | using (Azure.Core.HttpMessage _message = GetPropertiesAsync_CreateMessage( |
| | 1505 | | pipeline, |
| | 1506 | | resourceUri, |
| | 1507 | | version, |
| | 1508 | | timeout, |
| | 1509 | | leaseId, |
| | 1510 | | requestId)) |
| | 1511 | | { |
| | 1512 | | if (async) |
| | 1513 | | { |
| | 1514 | | // Send the request asynchronously if we're being called via an async path |
| | 1515 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1516 | | } |
| | 1517 | | else |
| | 1518 | | { |
| | 1519 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1520 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1521 | | pipeline.Send(_message, cancellationToken); |
| | 1522 | | } |
| | 1523 | | Azure.Response _response = _message.Response; |
| | 1524 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1525 | | return GetPropertiesAsync_CreateResponse(clientDiagnostics, _response); |
| | 1526 | | } |
| | 1527 | | } |
| | 1528 | | catch (System.Exception ex) |
| | 1529 | | { |
| | 1530 | | _scope.Failed(ex); |
| | 1531 | | throw; |
| | 1532 | | } |
| | 1533 | | finally |
| | 1534 | | { |
| | 1535 | | _scope.Dispose(); |
| | 1536 | | } |
| | 1537 | | } |
| | 1538 | |
|
| | 1539 | | /// <summary> |
| | 1540 | | /// Create the Container.GetPropertiesAsync request. |
| | 1541 | | /// </summary> |
| | 1542 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1543 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 1544 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1545 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1546 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 1547 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 1548 | | /// <returns>The Container.GetPropertiesAsync Message.</returns> |
| | 1549 | | internal static Azure.Core.HttpMessage GetPropertiesAsync_CreateMessage( |
| | 1550 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1551 | | System.Uri resourceUri, |
| | 1552 | | string version, |
| | 1553 | | int? timeout = default, |
| | 1554 | | string leaseId = default, |
| | 1555 | | string requestId = default) |
| | 1556 | | { |
| | 1557 | | // Validation |
| | 1558 | | if (resourceUri == null) |
| | 1559 | | { |
| | 1560 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1561 | | } |
| | 1562 | | if (version == null) |
| | 1563 | | { |
| | 1564 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1565 | | } |
| | 1566 | |
|
| | 1567 | | // Create the request |
| | 1568 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1569 | | Azure.Core.Request _request = _message.Request; |
| | 1570 | |
|
| | 1571 | | // Set the endpoint |
| | 1572 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 1573 | | _request.Uri.Reset(resourceUri); |
| | 1574 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 1575 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1576 | |
|
| | 1577 | | // Add request headers |
| | 1578 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1579 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 1580 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 1581 | |
|
| | 1582 | | return _message; |
| | 1583 | | } |
| | 1584 | |
|
| | 1585 | | /// <summary> |
| | 1586 | | /// Create the Container.GetPropertiesAsync response or throw a failure exception. |
| | 1587 | | /// </summary> |
| | 1588 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1589 | | /// <param name="response">The raw Response.</param> |
| | 1590 | | /// <returns>The Container.GetPropertiesAsync Azure.Response{Azure.Storage.Blobs.Models.FlattenedContainerIt |
| | 1591 | | internal static Azure.Response<Azure.Storage.Blobs.Models.FlattenedContainerItem> GetPropertiesAsync_CreateR |
| | 1592 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1593 | | Azure.Response response) |
| | 1594 | | { |
| | 1595 | | // Process the response |
| | 1596 | | switch (response.Status) |
| | 1597 | | { |
| | 1598 | | case 200: |
| | 1599 | | { |
| | 1600 | | // Create the result |
| | 1601 | | Azure.Storage.Blobs.Models.FlattenedContainerItem _value = new Azure.Storage.Blobs.Models.Flatte |
| | 1602 | |
|
| | 1603 | | // Get response headers |
| | 1604 | | string _header; |
| | 1605 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompare |
| | 1606 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 1607 | | { |
| | 1608 | | if (_headerPair.Name.StartsWith("x-ms-meta-", System.StringComparison.InvariantCulture)) |
| | 1609 | | { |
| | 1610 | | _value.Metadata[_headerPair.Name.Substring(10)] = _headerPair.Value; |
| | 1611 | | } |
| | 1612 | | } |
| | 1613 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 1614 | | { |
| | 1615 | | _value.ETag = new Azure.ETag(_header); |
| | 1616 | | } |
| | 1617 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 1618 | | { |
| | 1619 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 1620 | | } |
| | 1621 | | if (response.Headers.TryGetValue("x-ms-lease-duration", out _header)) |
| | 1622 | | { |
| | 1623 | | _value.LeaseDuration = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseDurationTy |
| | 1624 | | } |
| | 1625 | | if (response.Headers.TryGetValue("x-ms-lease-state", out _header)) |
| | 1626 | | { |
| | 1627 | | _value.LeaseState = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseState(_header |
| | 1628 | | } |
| | 1629 | | if (response.Headers.TryGetValue("x-ms-lease-status", out _header)) |
| | 1630 | | { |
| | 1631 | | _value.LeaseStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseStatus(_head |
| | 1632 | | } |
| | 1633 | | if (response.Headers.TryGetValue("x-ms-blob-public-access", out _header)) |
| | 1634 | | { |
| | 1635 | | _value.BlobPublicAccess = Azure.Storage.Blobs.BlobRestClient.Serialization.ParsePublicAccess |
| | 1636 | | } |
| | 1637 | | if (response.Headers.TryGetValue("x-ms-has-immutability-policy", out _header)) |
| | 1638 | | { |
| | 1639 | | _value.HasImmutabilityPolicy = bool.Parse(_header); |
| | 1640 | | } |
| | 1641 | | if (response.Headers.TryGetValue("x-ms-has-legal-hold", out _header)) |
| | 1642 | | { |
| | 1643 | | _value.HasLegalHold = bool.Parse(_header); |
| | 1644 | | } |
| | 1645 | | if (response.Headers.TryGetValue("x-ms-default-encryption-scope", out _header)) |
| | 1646 | | { |
| | 1647 | | _value.DefaultEncryptionScope = _header; |
| | 1648 | | } |
| | 1649 | | if (response.Headers.TryGetValue("x-ms-deny-encryption-scope-override", out _header)) |
| | 1650 | | { |
| | 1651 | | _value.DenyEncryptionScopeOverride = bool.Parse(_header); |
| | 1652 | | } |
| | 1653 | |
|
| | 1654 | | // Create the response |
| | 1655 | | return Response.FromValue(_value, response); |
| | 1656 | | } |
| | 1657 | | case 304: |
| | 1658 | | { |
| | 1659 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.FlattenedContainerItem>(response); |
| | 1660 | | } |
| | 1661 | | default: |
| | 1662 | | { |
| | 1663 | | // Create the result |
| | 1664 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1665 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 1666 | |
|
| | 1667 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1668 | | } |
| | 1669 | | } |
| | 1670 | | } |
| | 1671 | | #endregion Container.GetPropertiesAsync |
| | 1672 | |
|
| | 1673 | | #region Container.DeleteAsync |
| | 1674 | | /// <summary> |
| | 1675 | | /// operation marks the specified container for deletion. The container and any blobs contained within it ar |
| | 1676 | | /// </summary> |
| | 1677 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 1678 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1679 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 1680 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1681 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1682 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 1683 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 1684 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 1685 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 1686 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 1687 | | /// <param name="operationName">Operation name.</param> |
| | 1688 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 1689 | | /// <returns>Azure.Response</returns> |
| | 1690 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> DeleteAsync( |
| | 1691 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1692 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1693 | | System.Uri resourceUri, |
| | 1694 | | string version, |
| | 1695 | | int? timeout = default, |
| | 1696 | | string leaseId = default, |
| | 1697 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 1698 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 1699 | | string requestId = default, |
| | 1700 | | bool async = true, |
| | 1701 | | string operationName = "ContainerClient.Delete", |
| | 1702 | | System.Threading.CancellationToken cancellationToken = default) |
| | 1703 | | { |
| | 1704 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 1705 | | try |
| | 1706 | | { |
| | 1707 | | _scope.AddAttribute("url", resourceUri); |
| | 1708 | | _scope.Start(); |
| | 1709 | | using (Azure.Core.HttpMessage _message = DeleteAsync_CreateMessage( |
| | 1710 | | pipeline, |
| | 1711 | | resourceUri, |
| | 1712 | | version, |
| | 1713 | | timeout, |
| | 1714 | | leaseId, |
| | 1715 | | ifModifiedSince, |
| | 1716 | | ifUnmodifiedSince, |
| | 1717 | | requestId)) |
| | 1718 | | { |
| | 1719 | | if (async) |
| | 1720 | | { |
| | 1721 | | // Send the request asynchronously if we're being called via an async path |
| | 1722 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1723 | | } |
| | 1724 | | else |
| | 1725 | | { |
| | 1726 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1727 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1728 | | pipeline.Send(_message, cancellationToken); |
| | 1729 | | } |
| | 1730 | | Azure.Response _response = _message.Response; |
| | 1731 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1732 | | return DeleteAsync_CreateResponse(clientDiagnostics, _response); |
| | 1733 | | } |
| | 1734 | | } |
| | 1735 | | catch (System.Exception ex) |
| | 1736 | | { |
| | 1737 | | _scope.Failed(ex); |
| | 1738 | | throw; |
| | 1739 | | } |
| | 1740 | | finally |
| | 1741 | | { |
| | 1742 | | _scope.Dispose(); |
| | 1743 | | } |
| | 1744 | | } |
| | 1745 | |
|
| | 1746 | | /// <summary> |
| | 1747 | | /// Create the Container.DeleteAsync request. |
| | 1748 | | /// </summary> |
| | 1749 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1750 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 1751 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1752 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1753 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 1754 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 1755 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 1756 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 1757 | | /// <returns>The Container.DeleteAsync Message.</returns> |
| | 1758 | | internal static Azure.Core.HttpMessage DeleteAsync_CreateMessage( |
| | 1759 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1760 | | System.Uri resourceUri, |
| | 1761 | | string version, |
| | 1762 | | int? timeout = default, |
| | 1763 | | string leaseId = default, |
| | 1764 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 1765 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 1766 | | string requestId = default) |
| | 1767 | | { |
| | 1768 | | // Validation |
| | 1769 | | if (resourceUri == null) |
| | 1770 | | { |
| | 1771 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1772 | | } |
| | 1773 | | if (version == null) |
| | 1774 | | { |
| | 1775 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1776 | | } |
| | 1777 | |
|
| | 1778 | | // Create the request |
| | 1779 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1780 | | Azure.Core.Request _request = _message.Request; |
| | 1781 | |
|
| | 1782 | | // Set the endpoint |
| | 1783 | | _request.Method = Azure.Core.RequestMethod.Delete; |
| | 1784 | | _request.Uri.Reset(resourceUri); |
| | 1785 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 1786 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1787 | |
|
| | 1788 | | // Add request headers |
| | 1789 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1790 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 1791 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 1792 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 1793 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 1794 | |
|
| | 1795 | | return _message; |
| | 1796 | | } |
| | 1797 | |
|
| | 1798 | | /// <summary> |
| | 1799 | | /// Create the Container.DeleteAsync response or throw a failure exception. |
| | 1800 | | /// </summary> |
| | 1801 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1802 | | /// <param name="response">The raw Response.</param> |
| | 1803 | | /// <returns>The Container.DeleteAsync Azure.Response.</returns> |
| | 1804 | | internal static Azure.Response DeleteAsync_CreateResponse( |
| | 1805 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1806 | | Azure.Response response) |
| | 1807 | | { |
| | 1808 | | // Process the response |
| | 1809 | | switch (response.Status) |
| | 1810 | | { |
| | 1811 | | case 202: |
| | 1812 | | { |
| | 1813 | | return response; |
| | 1814 | | } |
| | 1815 | | default: |
| | 1816 | | { |
| | 1817 | | // Create the result |
| | 1818 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1819 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 1820 | |
|
| | 1821 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1822 | | } |
| | 1823 | | } |
| | 1824 | | } |
| | 1825 | | #endregion Container.DeleteAsync |
| | 1826 | |
|
| | 1827 | | #region Container.SetMetadataAsync |
| | 1828 | | /// <summary> |
| | 1829 | | /// operation sets one or more user-defined name-value pairs for the specified container. |
| | 1830 | | /// </summary> |
| | 1831 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 1832 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1833 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 1834 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1835 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1836 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 1837 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 1838 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 1839 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 1840 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 1841 | | /// <param name="operationName">Operation name.</param> |
| | 1842 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 1843 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobContainerInfo}</returns> |
| | 1844 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobContainer |
| | 1845 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1846 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1847 | | System.Uri resourceUri, |
| | 1848 | | string version, |
| | 1849 | | int? timeout = default, |
| | 1850 | | string leaseId = default, |
| | 1851 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 1852 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 1853 | | string requestId = default, |
| | 1854 | | bool async = true, |
| | 1855 | | string operationName = "ContainerClient.SetMetadata", |
| | 1856 | | System.Threading.CancellationToken cancellationToken = default) |
| | 1857 | | { |
| | 1858 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 1859 | | try |
| | 1860 | | { |
| | 1861 | | _scope.AddAttribute("url", resourceUri); |
| | 1862 | | _scope.Start(); |
| | 1863 | | using (Azure.Core.HttpMessage _message = SetMetadataAsync_CreateMessage( |
| | 1864 | | pipeline, |
| | 1865 | | resourceUri, |
| | 1866 | | version, |
| | 1867 | | timeout, |
| | 1868 | | leaseId, |
| | 1869 | | metadata, |
| | 1870 | | ifModifiedSince, |
| | 1871 | | requestId)) |
| | 1872 | | { |
| | 1873 | | if (async) |
| | 1874 | | { |
| | 1875 | | // Send the request asynchronously if we're being called via an async path |
| | 1876 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1877 | | } |
| | 1878 | | else |
| | 1879 | | { |
| | 1880 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1881 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1882 | | pipeline.Send(_message, cancellationToken); |
| | 1883 | | } |
| | 1884 | | Azure.Response _response = _message.Response; |
| | 1885 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1886 | | return SetMetadataAsync_CreateResponse(clientDiagnostics, _response); |
| | 1887 | | } |
| | 1888 | | } |
| | 1889 | | catch (System.Exception ex) |
| | 1890 | | { |
| | 1891 | | _scope.Failed(ex); |
| | 1892 | | throw; |
| | 1893 | | } |
| | 1894 | | finally |
| | 1895 | | { |
| | 1896 | | _scope.Dispose(); |
| | 1897 | | } |
| | 1898 | | } |
| | 1899 | |
|
| | 1900 | | /// <summary> |
| | 1901 | | /// Create the Container.SetMetadataAsync request. |
| | 1902 | | /// </summary> |
| | 1903 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1904 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 1905 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1906 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1907 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 1908 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 1909 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 1910 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 1911 | | /// <returns>The Container.SetMetadataAsync Message.</returns> |
| | 1912 | | internal static Azure.Core.HttpMessage SetMetadataAsync_CreateMessage( |
| | 1913 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1914 | | System.Uri resourceUri, |
| | 1915 | | string version, |
| | 1916 | | int? timeout = default, |
| | 1917 | | string leaseId = default, |
| | 1918 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 1919 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 1920 | | string requestId = default) |
| | 1921 | | { |
| | 1922 | | // Validation |
| | 1923 | | if (resourceUri == null) |
| | 1924 | | { |
| | 1925 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1926 | | } |
| | 1927 | | if (version == null) |
| | 1928 | | { |
| | 1929 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1930 | | } |
| | 1931 | |
|
| | 1932 | | // Create the request |
| | 1933 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1934 | | Azure.Core.Request _request = _message.Request; |
| | 1935 | |
|
| | 1936 | | // Set the endpoint |
| | 1937 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 1938 | | _request.Uri.Reset(resourceUri); |
| | 1939 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 1940 | | _request.Uri.AppendQuery("comp", "metadata", escapeValue: false); |
| | 1941 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1942 | |
|
| | 1943 | | // Add request headers |
| | 1944 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1945 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 1946 | | if (metadata != null) { |
| | 1947 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 1948 | | { |
| | 1949 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 1950 | | } |
| | 1951 | | } |
| | 1952 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 1953 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 1954 | |
|
| | 1955 | | return _message; |
| | 1956 | | } |
| | 1957 | |
|
| | 1958 | | /// <summary> |
| | 1959 | | /// Create the Container.SetMetadataAsync response or throw a failure exception. |
| | 1960 | | /// </summary> |
| | 1961 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1962 | | /// <param name="response">The raw Response.</param> |
| | 1963 | | /// <returns>The Container.SetMetadataAsync Azure.Response{Azure.Storage.Blobs.Models.BlobContainerInfo}.</r |
| | 1964 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo> SetMetadataAsync_CreateResponse |
| | 1965 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1966 | | Azure.Response response) |
| | 1967 | | { |
| | 1968 | | // Process the response |
| | 1969 | | switch (response.Status) |
| | 1970 | | { |
| | 1971 | | case 200: |
| | 1972 | | { |
| | 1973 | | // Create the result |
| | 1974 | | Azure.Storage.Blobs.Models.BlobContainerInfo _value = new Azure.Storage.Blobs.Models.BlobContain |
| | 1975 | |
|
| | 1976 | | // Get response headers |
| | 1977 | | string _header; |
| | 1978 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 1979 | | { |
| | 1980 | | _value.ETag = new Azure.ETag(_header); |
| | 1981 | | } |
| | 1982 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 1983 | | { |
| | 1984 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 1985 | | } |
| | 1986 | |
|
| | 1987 | | // Create the response |
| | 1988 | | return Response.FromValue(_value, response); |
| | 1989 | | } |
| | 1990 | | default: |
| | 1991 | | { |
| | 1992 | | // Create the result |
| | 1993 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1994 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 1995 | |
|
| | 1996 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1997 | | } |
| | 1998 | | } |
| | 1999 | | } |
| | 2000 | | #endregion Container.SetMetadataAsync |
| | 2001 | |
|
| | 2002 | | #region Container.GetAccessPolicyAsync |
| | 2003 | | /// <summary> |
| | 2004 | | /// gets the permissions for the specified container. The permissions indicate whether container data may be |
| | 2005 | | /// </summary> |
| | 2006 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2007 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2008 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2009 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2010 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2011 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 2012 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2013 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2014 | | /// <param name="operationName">Operation name.</param> |
| | 2015 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2016 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobContainerAccessPolicy}</returns> |
| | 2017 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobContainer |
| | 2018 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2019 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2020 | | System.Uri resourceUri, |
| | 2021 | | string version, |
| | 2022 | | int? timeout = default, |
| | 2023 | | string leaseId = default, |
| | 2024 | | string requestId = default, |
| | 2025 | | bool async = true, |
| | 2026 | | string operationName = "ContainerClient.GetAccessPolicy", |
| | 2027 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2028 | | { |
| | 2029 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2030 | | try |
| | 2031 | | { |
| | 2032 | | _scope.AddAttribute("url", resourceUri); |
| | 2033 | | _scope.Start(); |
| | 2034 | | using (Azure.Core.HttpMessage _message = GetAccessPolicyAsync_CreateMessage( |
| | 2035 | | pipeline, |
| | 2036 | | resourceUri, |
| | 2037 | | version, |
| | 2038 | | timeout, |
| | 2039 | | leaseId, |
| | 2040 | | requestId)) |
| | 2041 | | { |
| | 2042 | | if (async) |
| | 2043 | | { |
| | 2044 | | // Send the request asynchronously if we're being called via an async path |
| | 2045 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2046 | | } |
| | 2047 | | else |
| | 2048 | | { |
| | 2049 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2050 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2051 | | pipeline.Send(_message, cancellationToken); |
| | 2052 | | } |
| | 2053 | | Azure.Response _response = _message.Response; |
| | 2054 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2055 | | return GetAccessPolicyAsync_CreateResponse(clientDiagnostics, _response); |
| | 2056 | | } |
| | 2057 | | } |
| | 2058 | | catch (System.Exception ex) |
| | 2059 | | { |
| | 2060 | | _scope.Failed(ex); |
| | 2061 | | throw; |
| | 2062 | | } |
| | 2063 | | finally |
| | 2064 | | { |
| | 2065 | | _scope.Dispose(); |
| | 2066 | | } |
| | 2067 | | } |
| | 2068 | |
|
| | 2069 | | /// <summary> |
| | 2070 | | /// Create the Container.GetAccessPolicyAsync request. |
| | 2071 | | /// </summary> |
| | 2072 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2073 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2074 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2075 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2076 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 2077 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2078 | | /// <returns>The Container.GetAccessPolicyAsync Message.</returns> |
| | 2079 | | internal static Azure.Core.HttpMessage GetAccessPolicyAsync_CreateMessage( |
| | 2080 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2081 | | System.Uri resourceUri, |
| | 2082 | | string version, |
| | 2083 | | int? timeout = default, |
| | 2084 | | string leaseId = default, |
| | 2085 | | string requestId = default) |
| | 2086 | | { |
| | 2087 | | // Validation |
| | 2088 | | if (resourceUri == null) |
| | 2089 | | { |
| | 2090 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 2091 | | } |
| | 2092 | | if (version == null) |
| | 2093 | | { |
| | 2094 | | throw new System.ArgumentNullException(nameof(version)); |
| | 2095 | | } |
| | 2096 | |
|
| | 2097 | | // Create the request |
| | 2098 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 2099 | | Azure.Core.Request _request = _message.Request; |
| | 2100 | |
|
| | 2101 | | // Set the endpoint |
| | 2102 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 2103 | | _request.Uri.Reset(resourceUri); |
| | 2104 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 2105 | | _request.Uri.AppendQuery("comp", "acl", escapeValue: false); |
| | 2106 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 2107 | |
|
| | 2108 | | // Add request headers |
| | 2109 | | _request.Headers.SetValue("x-ms-version", version); |
| | 2110 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 2111 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 2112 | |
|
| | 2113 | | return _message; |
| | 2114 | | } |
| | 2115 | |
|
| | 2116 | | /// <summary> |
| | 2117 | | /// Create the Container.GetAccessPolicyAsync response or throw a failure exception. |
| | 2118 | | /// </summary> |
| | 2119 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 2120 | | /// <param name="response">The raw Response.</param> |
| | 2121 | | /// <returns>The Container.GetAccessPolicyAsync Azure.Response{Azure.Storage.Blobs.Models.BlobContainerAcces |
| | 2122 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobContainerAccessPolicy> GetAccessPolicyAsync_Cr |
| | 2123 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2124 | | Azure.Response response) |
| | 2125 | | { |
| | 2126 | | // Process the response |
| | 2127 | | switch (response.Status) |
| | 2128 | | { |
| | 2129 | | case 200: |
| | 2130 | | { |
| | 2131 | | // Create the result |
| | 2132 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2133 | | Azure.Storage.Blobs.Models.BlobContainerAccessPolicy _value = new Azure.Storage.Blobs.Models.Blo |
| | 2134 | | _value.SignedIdentifiers = |
| | 2135 | | System.Linq.Enumerable.ToList( |
| | 2136 | | System.Linq.Enumerable.Select( |
| | 2137 | | _xml.Element(System.Xml.Linq.XName.Get("SignedIdentifiers", "")).Elements(System.Xml |
| | 2138 | | Azure.Storage.Blobs.Models.BlobSignedIdentifier.FromXml)); |
| | 2139 | |
|
| | 2140 | | // Get response headers |
| | 2141 | | string _header; |
| | 2142 | | if (response.Headers.TryGetValue("x-ms-blob-public-access", out _header)) |
| | 2143 | | { |
| | 2144 | | _value.BlobPublicAccess = Azure.Storage.Blobs.BlobRestClient.Serialization.ParsePublicAccess |
| | 2145 | | } |
| | 2146 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 2147 | | { |
| | 2148 | | _value.ETag = new Azure.ETag(_header); |
| | 2149 | | } |
| | 2150 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 2151 | | { |
| | 2152 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 2153 | | } |
| | 2154 | |
|
| | 2155 | | // Create the response |
| | 2156 | | return Response.FromValue(_value, response); |
| | 2157 | | } |
| | 2158 | | case 304: |
| | 2159 | | { |
| | 2160 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.BlobContainerAccessPolicy>(response); |
| | 2161 | | } |
| | 2162 | | default: |
| | 2163 | | { |
| | 2164 | | // Create the result |
| | 2165 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2166 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 2167 | |
|
| | 2168 | | throw _value.CreateException(clientDiagnostics, response); |
| | 2169 | | } |
| | 2170 | | } |
| | 2171 | | } |
| | 2172 | | #endregion Container.GetAccessPolicyAsync |
| | 2173 | |
|
| | 2174 | | #region Container.SetAccessPolicyAsync |
| | 2175 | | /// <summary> |
| | 2176 | | /// sets the permissions for the specified container. The permissions indicate whether blobs in a container |
| | 2177 | | /// </summary> |
| | 2178 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2179 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2180 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2181 | | /// <param name="access">Specifies whether data in the container may be accessed publicly and the level of a |
| | 2182 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2183 | | /// <param name="permissions">the acls for the container</param> |
| | 2184 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2185 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 2186 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 2187 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 2188 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2189 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2190 | | /// <param name="operationName">Operation name.</param> |
| | 2191 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2192 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobContainerInfo}</returns> |
| | 2193 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobContainer |
| | 2194 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2195 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2196 | | System.Uri resourceUri, |
| | 2197 | | Azure.Storage.Blobs.Models.PublicAccessType access, |
| | 2198 | | string version, |
| | 2199 | | System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobSignedIdentifier> permissions = de |
| | 2200 | | int? timeout = default, |
| | 2201 | | string leaseId = default, |
| | 2202 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 2203 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 2204 | | string requestId = default, |
| | 2205 | | bool async = true, |
| | 2206 | | string operationName = "ContainerClient.SetAccessPolicy", |
| | 2207 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2208 | | { |
| | 2209 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2210 | | try |
| | 2211 | | { |
| | 2212 | | _scope.AddAttribute("url", resourceUri); |
| | 2213 | | _scope.Start(); |
| | 2214 | | using (Azure.Core.HttpMessage _message = SetAccessPolicyAsync_CreateMessage( |
| | 2215 | | pipeline, |
| | 2216 | | resourceUri, |
| | 2217 | | access, |
| | 2218 | | version, |
| | 2219 | | permissions, |
| | 2220 | | timeout, |
| | 2221 | | leaseId, |
| | 2222 | | ifModifiedSince, |
| | 2223 | | ifUnmodifiedSince, |
| | 2224 | | requestId)) |
| | 2225 | | { |
| | 2226 | | if (async) |
| | 2227 | | { |
| | 2228 | | // Send the request asynchronously if we're being called via an async path |
| | 2229 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2230 | | } |
| | 2231 | | else |
| | 2232 | | { |
| | 2233 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2234 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2235 | | pipeline.Send(_message, cancellationToken); |
| | 2236 | | } |
| | 2237 | | Azure.Response _response = _message.Response; |
| | 2238 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2239 | | return SetAccessPolicyAsync_CreateResponse(clientDiagnostics, _response); |
| | 2240 | | } |
| | 2241 | | } |
| | 2242 | | catch (System.Exception ex) |
| | 2243 | | { |
| | 2244 | | _scope.Failed(ex); |
| | 2245 | | throw; |
| | 2246 | | } |
| | 2247 | | finally |
| | 2248 | | { |
| | 2249 | | _scope.Dispose(); |
| | 2250 | | } |
| | 2251 | | } |
| | 2252 | |
|
| | 2253 | | /// <summary> |
| | 2254 | | /// Create the Container.SetAccessPolicyAsync request. |
| | 2255 | | /// </summary> |
| | 2256 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2257 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2258 | | /// <param name="access">Specifies whether data in the container may be accessed publicly and the level of a |
| | 2259 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2260 | | /// <param name="permissions">the acls for the container</param> |
| | 2261 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2262 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 2263 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 2264 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 2265 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2266 | | /// <returns>The Container.SetAccessPolicyAsync Message.</returns> |
| | 2267 | | internal static Azure.Core.HttpMessage SetAccessPolicyAsync_CreateMessage( |
| | 2268 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2269 | | System.Uri resourceUri, |
| | 2270 | | Azure.Storage.Blobs.Models.PublicAccessType access, |
| | 2271 | | string version, |
| | 2272 | | System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobSignedIdentifier> permissions = de |
| | 2273 | | int? timeout = default, |
| | 2274 | | string leaseId = default, |
| | 2275 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 2276 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 2277 | | string requestId = default) |
| | 2278 | | { |
| | 2279 | | // Validation |
| | 2280 | | if (resourceUri == null) |
| | 2281 | | { |
| | 2282 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 2283 | | } |
| | 2284 | | if (version == null) |
| | 2285 | | { |
| | 2286 | | throw new System.ArgumentNullException(nameof(version)); |
| | 2287 | | } |
| | 2288 | |
|
| | 2289 | | // Create the request |
| | 2290 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 2291 | | Azure.Core.Request _request = _message.Request; |
| | 2292 | |
|
| | 2293 | | // Set the endpoint |
| | 2294 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 2295 | | _request.Uri.Reset(resourceUri); |
| | 2296 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 2297 | | _request.Uri.AppendQuery("comp", "acl", escapeValue: false); |
| | 2298 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 2299 | |
|
| | 2300 | | // Add request headers |
| | 2301 | | if (access != Azure.Storage.Blobs.Models.PublicAccessType.None) { _request.Headers.SetValue("x-ms-blob-p |
| | 2302 | | _request.Headers.SetValue("x-ms-version", version); |
| | 2303 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 2304 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 2305 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 2306 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 2307 | |
|
| | 2308 | | // Create the body |
| | 2309 | | System.Xml.Linq.XElement _body = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get("SignedIdentifie |
| | 2310 | | if (permissions != null) |
| | 2311 | | { |
| | 2312 | | foreach (Azure.Storage.Blobs.Models.BlobSignedIdentifier _child in permissions) |
| | 2313 | | { |
| | 2314 | | _body.Add(Azure.Storage.Blobs.Models.BlobSignedIdentifier.ToXml(_child)); |
| | 2315 | | } |
| | 2316 | | } |
| | 2317 | | string _text = _body.ToString(System.Xml.Linq.SaveOptions.DisableFormatting); |
| | 2318 | | _request.Headers.SetValue("Content-Type", "application/xml"); |
| | 2319 | | _request.Headers.SetValue("Content-Length", _text.Length.ToString(System.Globalization.CultureInfo.Invar |
| | 2320 | | _request.Content = Azure.Core.RequestContent.Create(System.Text.Encoding.UTF8.GetBytes(_text)); |
| | 2321 | |
|
| | 2322 | | return _message; |
| | 2323 | | } |
| | 2324 | |
|
| | 2325 | | /// <summary> |
| | 2326 | | /// Create the Container.SetAccessPolicyAsync response or throw a failure exception. |
| | 2327 | | /// </summary> |
| | 2328 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 2329 | | /// <param name="response">The raw Response.</param> |
| | 2330 | | /// <returns>The Container.SetAccessPolicyAsync Azure.Response{Azure.Storage.Blobs.Models.BlobContainerInfo} |
| | 2331 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo> SetAccessPolicyAsync_CreateResp |
| | 2332 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2333 | | Azure.Response response) |
| | 2334 | | { |
| | 2335 | | // Process the response |
| | 2336 | | switch (response.Status) |
| | 2337 | | { |
| | 2338 | | case 200: |
| | 2339 | | { |
| | 2340 | | // Create the result |
| | 2341 | | Azure.Storage.Blobs.Models.BlobContainerInfo _value = new Azure.Storage.Blobs.Models.BlobContain |
| | 2342 | |
|
| | 2343 | | // Get response headers |
| | 2344 | | string _header; |
| | 2345 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 2346 | | { |
| | 2347 | | _value.ETag = new Azure.ETag(_header); |
| | 2348 | | } |
| | 2349 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 2350 | | { |
| | 2351 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 2352 | | } |
| | 2353 | |
|
| | 2354 | | // Create the response |
| | 2355 | | return Response.FromValue(_value, response); |
| | 2356 | | } |
| | 2357 | | default: |
| | 2358 | | { |
| | 2359 | | // Create the result |
| | 2360 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2361 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 2362 | |
|
| | 2363 | | throw _value.CreateException(clientDiagnostics, response); |
| | 2364 | | } |
| | 2365 | | } |
| | 2366 | | } |
| | 2367 | | #endregion Container.SetAccessPolicyAsync |
| | 2368 | |
|
| | 2369 | | #region Container.RestoreAsync |
| | 2370 | | /// <summary> |
| | 2371 | | /// Restores a previously-deleted container. |
| | 2372 | | /// </summary> |
| | 2373 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2374 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2375 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2376 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2377 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2378 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2379 | | /// <param name="deletedContainerName">Optional. Version 2019-12-12 and laster. Specifies the name of the |
| | 2380 | | /// <param name="deletedContainerVersion">Optional. Version 2019-12-12 and laster. Specifies the version o |
| | 2381 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2382 | | /// <param name="operationName">Operation name.</param> |
| | 2383 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2384 | | /// <returns>Azure.Response</returns> |
| | 2385 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> RestoreAsync( |
| | 2386 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2387 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2388 | | System.Uri resourceUri, |
| | 2389 | | string version, |
| | 2390 | | int? timeout = default, |
| | 2391 | | string requestId = default, |
| | 2392 | | string deletedContainerName = default, |
| | 2393 | | string deletedContainerVersion = default, |
| | 2394 | | bool async = true, |
| | 2395 | | string operationName = "ContainerClient.Restore", |
| | 2396 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2397 | | { |
| | 2398 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2399 | | try |
| | 2400 | | { |
| | 2401 | | _scope.AddAttribute("url", resourceUri); |
| | 2402 | | _scope.Start(); |
| | 2403 | | using (Azure.Core.HttpMessage _message = RestoreAsync_CreateMessage( |
| | 2404 | | pipeline, |
| | 2405 | | resourceUri, |
| | 2406 | | version, |
| | 2407 | | timeout, |
| | 2408 | | requestId, |
| | 2409 | | deletedContainerName, |
| | 2410 | | deletedContainerVersion)) |
| | 2411 | | { |
| | 2412 | | if (async) |
| | 2413 | | { |
| | 2414 | | // Send the request asynchronously if we're being called via an async path |
| | 2415 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2416 | | } |
| | 2417 | | else |
| | 2418 | | { |
| | 2419 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2420 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2421 | | pipeline.Send(_message, cancellationToken); |
| | 2422 | | } |
| | 2423 | | Azure.Response _response = _message.Response; |
| | 2424 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2425 | | return RestoreAsync_CreateResponse(clientDiagnostics, _response); |
| | 2426 | | } |
| | 2427 | | } |
| | 2428 | | catch (System.Exception ex) |
| | 2429 | | { |
| | 2430 | | _scope.Failed(ex); |
| | 2431 | | throw; |
| | 2432 | | } |
| | 2433 | | finally |
| | 2434 | | { |
| | 2435 | | _scope.Dispose(); |
| | 2436 | | } |
| | 2437 | | } |
| | 2438 | |
|
| | 2439 | | /// <summary> |
| | 2440 | | /// Create the Container.RestoreAsync request. |
| | 2441 | | /// </summary> |
| | 2442 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2443 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2444 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2445 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2446 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2447 | | /// <param name="deletedContainerName">Optional. Version 2019-12-12 and laster. Specifies the name of the |
| | 2448 | | /// <param name="deletedContainerVersion">Optional. Version 2019-12-12 and laster. Specifies the version o |
| | 2449 | | /// <returns>The Container.RestoreAsync Message.</returns> |
| | 2450 | | internal static Azure.Core.HttpMessage RestoreAsync_CreateMessage( |
| | 2451 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2452 | | System.Uri resourceUri, |
| | 2453 | | string version, |
| | 2454 | | int? timeout = default, |
| | 2455 | | string requestId = default, |
| | 2456 | | string deletedContainerName = default, |
| | 2457 | | string deletedContainerVersion = default) |
| | 2458 | | { |
| | 2459 | | // Validation |
| | 2460 | | if (resourceUri == null) |
| | 2461 | | { |
| | 2462 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 2463 | | } |
| | 2464 | | if (version == null) |
| | 2465 | | { |
| | 2466 | | throw new System.ArgumentNullException(nameof(version)); |
| | 2467 | | } |
| | 2468 | |
|
| | 2469 | | // Create the request |
| | 2470 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 2471 | | Azure.Core.Request _request = _message.Request; |
| | 2472 | |
|
| | 2473 | | // Set the endpoint |
| | 2474 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 2475 | | _request.Uri.Reset(resourceUri); |
| | 2476 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 2477 | | _request.Uri.AppendQuery("comp", "undelete", escapeValue: false); |
| | 2478 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 2479 | |
|
| | 2480 | | // Add request headers |
| | 2481 | | _request.Headers.SetValue("x-ms-version", version); |
| | 2482 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 2483 | | if (deletedContainerName != null) { _request.Headers.SetValue("x-ms-deleted-container-name", deletedCont |
| | 2484 | | if (deletedContainerVersion != null) { _request.Headers.SetValue("x-ms-deleted-container-version", delet |
| | 2485 | |
|
| | 2486 | | return _message; |
| | 2487 | | } |
| | 2488 | |
|
| | 2489 | | /// <summary> |
| | 2490 | | /// Create the Container.RestoreAsync response or throw a failure exception. |
| | 2491 | | /// </summary> |
| | 2492 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 2493 | | /// <param name="response">The raw Response.</param> |
| | 2494 | | /// <returns>The Container.RestoreAsync Azure.Response.</returns> |
| | 2495 | | internal static Azure.Response RestoreAsync_CreateResponse( |
| | 2496 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2497 | | Azure.Response response) |
| | 2498 | | { |
| | 2499 | | // Process the response |
| | 2500 | | switch (response.Status) |
| | 2501 | | { |
| | 2502 | | case 201: |
| | 2503 | | { |
| | 2504 | | return response; |
| | 2505 | | } |
| | 2506 | | default: |
| | 2507 | | { |
| | 2508 | | // Create the result |
| | 2509 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2510 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 2511 | |
|
| | 2512 | | throw _value.CreateException(clientDiagnostics, response); |
| | 2513 | | } |
| | 2514 | | } |
| | 2515 | | } |
| | 2516 | | #endregion Container.RestoreAsync |
| | 2517 | |
|
| | 2518 | | #region Container.AcquireLeaseAsync |
| | 2519 | | /// <summary> |
| | 2520 | | /// [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 1 |
| | 2521 | | /// </summary> |
| | 2522 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2523 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2524 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2525 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2526 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2527 | | /// <param name="duration">Specifies the duration of the lease, in seconds, or negative one (-1) for a lease |
| | 2528 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The Blob service returns 400 ( |
| | 2529 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 2530 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 2531 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2532 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2533 | | /// <param name="operationName">Operation name.</param> |
| | 2534 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2535 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobLease}</returns> |
| | 2536 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>> A |
| | 2537 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2538 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2539 | | System.Uri resourceUri, |
| | 2540 | | string version, |
| | 2541 | | int? timeout = default, |
| | 2542 | | long? duration = default, |
| | 2543 | | string proposedLeaseId = default, |
| | 2544 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 2545 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 2546 | | string requestId = default, |
| | 2547 | | bool async = true, |
| | 2548 | | string operationName = "ContainerClient.AcquireLease", |
| | 2549 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2550 | | { |
| | 2551 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2552 | | try |
| | 2553 | | { |
| | 2554 | | _scope.AddAttribute("url", resourceUri); |
| | 2555 | | _scope.Start(); |
| | 2556 | | using (Azure.Core.HttpMessage _message = AcquireLeaseAsync_CreateMessage( |
| | 2557 | | pipeline, |
| | 2558 | | resourceUri, |
| | 2559 | | version, |
| | 2560 | | timeout, |
| | 2561 | | duration, |
| | 2562 | | proposedLeaseId, |
| | 2563 | | ifModifiedSince, |
| | 2564 | | ifUnmodifiedSince, |
| | 2565 | | requestId)) |
| | 2566 | | { |
| | 2567 | | if (async) |
| | 2568 | | { |
| | 2569 | | // Send the request asynchronously if we're being called via an async path |
| | 2570 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2571 | | } |
| | 2572 | | else |
| | 2573 | | { |
| | 2574 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2575 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2576 | | pipeline.Send(_message, cancellationToken); |
| | 2577 | | } |
| | 2578 | | Azure.Response _response = _message.Response; |
| | 2579 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2580 | | return AcquireLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 2581 | | } |
| | 2582 | | } |
| | 2583 | | catch (System.Exception ex) |
| | 2584 | | { |
| | 2585 | | _scope.Failed(ex); |
| | 2586 | | throw; |
| | 2587 | | } |
| | 2588 | | finally |
| | 2589 | | { |
| | 2590 | | _scope.Dispose(); |
| | 2591 | | } |
| | 2592 | | } |
| | 2593 | |
|
| | 2594 | | /// <summary> |
| | 2595 | | /// Create the Container.AcquireLeaseAsync request. |
| | 2596 | | /// </summary> |
| | 2597 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2598 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2599 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2600 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2601 | | /// <param name="duration">Specifies the duration of the lease, in seconds, or negative one (-1) for a lease |
| | 2602 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The Blob service returns 400 ( |
| | 2603 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 2604 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 2605 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2606 | | /// <returns>The Container.AcquireLeaseAsync Message.</returns> |
| | 2607 | | internal static Azure.Core.HttpMessage AcquireLeaseAsync_CreateMessage( |
| | 2608 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2609 | | System.Uri resourceUri, |
| | 2610 | | string version, |
| | 2611 | | int? timeout = default, |
| | 2612 | | long? duration = default, |
| | 2613 | | string proposedLeaseId = default, |
| | 2614 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 2615 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 2616 | | string requestId = default) |
| | 2617 | | { |
| | 2618 | | // Validation |
| | 2619 | | if (resourceUri == null) |
| | 2620 | | { |
| | 2621 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 2622 | | } |
| | 2623 | | if (version == null) |
| | 2624 | | { |
| | 2625 | | throw new System.ArgumentNullException(nameof(version)); |
| | 2626 | | } |
| | 2627 | |
|
| | 2628 | | // Create the request |
| | 2629 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 2630 | | Azure.Core.Request _request = _message.Request; |
| | 2631 | |
|
| | 2632 | | // Set the endpoint |
| | 2633 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 2634 | | _request.Uri.Reset(resourceUri); |
| | 2635 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 2636 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 2637 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 2638 | |
|
| | 2639 | | // Add request headers |
| | 2640 | | _request.Headers.SetValue("x-ms-lease-action", "acquire"); |
| | 2641 | | _request.Headers.SetValue("x-ms-version", version); |
| | 2642 | | if (duration != null) { _request.Headers.SetValue("x-ms-lease-duration", duration.Value.ToString(System. |
| | 2643 | | if (proposedLeaseId != null) { _request.Headers.SetValue("x-ms-proposed-lease-id", proposedLeaseId); } |
| | 2644 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 2645 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 2646 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 2647 | |
|
| | 2648 | | return _message; |
| | 2649 | | } |
| | 2650 | |
|
| | 2651 | | /// <summary> |
| | 2652 | | /// Create the Container.AcquireLeaseAsync response or throw a failure exception. |
| | 2653 | | /// </summary> |
| | 2654 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 2655 | | /// <param name="response">The raw Response.</param> |
| | 2656 | | /// <returns>The Container.AcquireLeaseAsync Azure.Response{Azure.Storage.Blobs.Models.BlobLease}.</returns> |
| | 2657 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobLease> AcquireLeaseAsync_CreateResponse( |
| | 2658 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2659 | | Azure.Response response) |
| | 2660 | | { |
| | 2661 | | // Process the response |
| | 2662 | | switch (response.Status) |
| | 2663 | | { |
| | 2664 | | case 201: |
| | 2665 | | { |
| | 2666 | | // Create the result |
| | 2667 | | Azure.Storage.Blobs.Models.BlobLease _value = new Azure.Storage.Blobs.Models.BlobLease(); |
| | 2668 | |
|
| | 2669 | | // Get response headers |
| | 2670 | | string _header; |
| | 2671 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 2672 | | { |
| | 2673 | | _value.ETag = new Azure.ETag(_header); |
| | 2674 | | } |
| | 2675 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 2676 | | { |
| | 2677 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 2678 | | } |
| | 2679 | | if (response.Headers.TryGetValue("x-ms-lease-id", out _header)) |
| | 2680 | | { |
| | 2681 | | _value.LeaseId = _header; |
| | 2682 | | } |
| | 2683 | |
|
| | 2684 | | // Create the response |
| | 2685 | | return Response.FromValue(_value, response); |
| | 2686 | | } |
| | 2687 | | default: |
| | 2688 | | { |
| | 2689 | | // Create the result |
| | 2690 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2691 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 2692 | |
|
| | 2693 | | throw _value.CreateException(clientDiagnostics, response); |
| | 2694 | | } |
| | 2695 | | } |
| | 2696 | | } |
| | 2697 | | #endregion Container.AcquireLeaseAsync |
| | 2698 | |
|
| | 2699 | | #region Container.ReleaseLeaseAsync |
| | 2700 | | /// <summary> |
| | 2701 | | /// [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 1 |
| | 2702 | | /// </summary> |
| | 2703 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2704 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2705 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2706 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 2707 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2708 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2709 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 2710 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 2711 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2712 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2713 | | /// <param name="operationName">Operation name.</param> |
| | 2714 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2715 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobContainerInfo}</returns> |
| | 2716 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobContainer |
| | 2717 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2718 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2719 | | System.Uri resourceUri, |
| | 2720 | | string leaseId, |
| | 2721 | | string version, |
| | 2722 | | int? timeout = default, |
| | 2723 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 2724 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 2725 | | string requestId = default, |
| | 2726 | | bool async = true, |
| | 2727 | | string operationName = "ContainerClient.ReleaseLease", |
| | 2728 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2729 | | { |
| | 2730 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2731 | | try |
| | 2732 | | { |
| | 2733 | | _scope.AddAttribute("url", resourceUri); |
| | 2734 | | _scope.Start(); |
| | 2735 | | using (Azure.Core.HttpMessage _message = ReleaseLeaseAsync_CreateMessage( |
| | 2736 | | pipeline, |
| | 2737 | | resourceUri, |
| | 2738 | | leaseId, |
| | 2739 | | version, |
| | 2740 | | timeout, |
| | 2741 | | ifModifiedSince, |
| | 2742 | | ifUnmodifiedSince, |
| | 2743 | | requestId)) |
| | 2744 | | { |
| | 2745 | | if (async) |
| | 2746 | | { |
| | 2747 | | // Send the request asynchronously if we're being called via an async path |
| | 2748 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2749 | | } |
| | 2750 | | else |
| | 2751 | | { |
| | 2752 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2753 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2754 | | pipeline.Send(_message, cancellationToken); |
| | 2755 | | } |
| | 2756 | | Azure.Response _response = _message.Response; |
| | 2757 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2758 | | return ReleaseLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 2759 | | } |
| | 2760 | | } |
| | 2761 | | catch (System.Exception ex) |
| | 2762 | | { |
| | 2763 | | _scope.Failed(ex); |
| | 2764 | | throw; |
| | 2765 | | } |
| | 2766 | | finally |
| | 2767 | | { |
| | 2768 | | _scope.Dispose(); |
| | 2769 | | } |
| | 2770 | | } |
| | 2771 | |
|
| | 2772 | | /// <summary> |
| | 2773 | | /// Create the Container.ReleaseLeaseAsync request. |
| | 2774 | | /// </summary> |
| | 2775 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2776 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2777 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 2778 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2779 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2780 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 2781 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 2782 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2783 | | /// <returns>The Container.ReleaseLeaseAsync Message.</returns> |
| | 2784 | | internal static Azure.Core.HttpMessage ReleaseLeaseAsync_CreateMessage( |
| | 2785 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2786 | | System.Uri resourceUri, |
| | 2787 | | string leaseId, |
| | 2788 | | string version, |
| | 2789 | | int? timeout = default, |
| | 2790 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 2791 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 2792 | | string requestId = default) |
| | 2793 | | { |
| | 2794 | | // Validation |
| | 2795 | | if (resourceUri == null) |
| | 2796 | | { |
| | 2797 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 2798 | | } |
| | 2799 | | if (leaseId == null) |
| | 2800 | | { |
| | 2801 | | throw new System.ArgumentNullException(nameof(leaseId)); |
| | 2802 | | } |
| | 2803 | | if (version == null) |
| | 2804 | | { |
| | 2805 | | throw new System.ArgumentNullException(nameof(version)); |
| | 2806 | | } |
| | 2807 | |
|
| | 2808 | | // Create the request |
| | 2809 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 2810 | | Azure.Core.Request _request = _message.Request; |
| | 2811 | |
|
| | 2812 | | // Set the endpoint |
| | 2813 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 2814 | | _request.Uri.Reset(resourceUri); |
| | 2815 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 2816 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 2817 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 2818 | |
|
| | 2819 | | // Add request headers |
| | 2820 | | _request.Headers.SetValue("x-ms-lease-action", "release"); |
| | 2821 | | _request.Headers.SetValue("x-ms-lease-id", leaseId); |
| | 2822 | | _request.Headers.SetValue("x-ms-version", version); |
| | 2823 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 2824 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 2825 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 2826 | |
|
| | 2827 | | return _message; |
| | 2828 | | } |
| | 2829 | |
|
| | 2830 | | /// <summary> |
| | 2831 | | /// Create the Container.ReleaseLeaseAsync response or throw a failure exception. |
| | 2832 | | /// </summary> |
| | 2833 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 2834 | | /// <param name="response">The raw Response.</param> |
| | 2835 | | /// <returns>The Container.ReleaseLeaseAsync Azure.Response{Azure.Storage.Blobs.Models.BlobContainerInfo}.</ |
| | 2836 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo> ReleaseLeaseAsync_CreateRespons |
| | 2837 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2838 | | Azure.Response response) |
| | 2839 | | { |
| | 2840 | | // Process the response |
| | 2841 | | switch (response.Status) |
| | 2842 | | { |
| | 2843 | | case 200: |
| | 2844 | | { |
| | 2845 | | // Create the result |
| | 2846 | | Azure.Storage.Blobs.Models.BlobContainerInfo _value = new Azure.Storage.Blobs.Models.BlobContain |
| | 2847 | |
|
| | 2848 | | // Get response headers |
| | 2849 | | string _header; |
| | 2850 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 2851 | | { |
| | 2852 | | _value.ETag = new Azure.ETag(_header); |
| | 2853 | | } |
| | 2854 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 2855 | | { |
| | 2856 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 2857 | | } |
| | 2858 | |
|
| | 2859 | | // Create the response |
| | 2860 | | return Response.FromValue(_value, response); |
| | 2861 | | } |
| | 2862 | | default: |
| | 2863 | | { |
| | 2864 | | // Create the result |
| | 2865 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2866 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 2867 | |
|
| | 2868 | | throw _value.CreateException(clientDiagnostics, response); |
| | 2869 | | } |
| | 2870 | | } |
| | 2871 | | } |
| | 2872 | | #endregion Container.ReleaseLeaseAsync |
| | 2873 | |
|
| | 2874 | | #region Container.RenewLeaseAsync |
| | 2875 | | /// <summary> |
| | 2876 | | /// [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 1 |
| | 2877 | | /// </summary> |
| | 2878 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2879 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2880 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2881 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 2882 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2883 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2884 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 2885 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 2886 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2887 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2888 | | /// <param name="operationName">Operation name.</param> |
| | 2889 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2890 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobLease}</returns> |
| | 2891 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>> R |
| | 2892 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2893 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2894 | | System.Uri resourceUri, |
| | 2895 | | string leaseId, |
| | 2896 | | string version, |
| | 2897 | | int? timeout = default, |
| | 2898 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 2899 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 2900 | | string requestId = default, |
| | 2901 | | bool async = true, |
| | 2902 | | string operationName = "ContainerClient.RenewLease", |
| | 2903 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2904 | | { |
| | 2905 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2906 | | try |
| | 2907 | | { |
| | 2908 | | _scope.AddAttribute("url", resourceUri); |
| | 2909 | | _scope.Start(); |
| | 2910 | | using (Azure.Core.HttpMessage _message = RenewLeaseAsync_CreateMessage( |
| | 2911 | | pipeline, |
| | 2912 | | resourceUri, |
| | 2913 | | leaseId, |
| | 2914 | | version, |
| | 2915 | | timeout, |
| | 2916 | | ifModifiedSince, |
| | 2917 | | ifUnmodifiedSince, |
| | 2918 | | requestId)) |
| | 2919 | | { |
| | 2920 | | if (async) |
| | 2921 | | { |
| | 2922 | | // Send the request asynchronously if we're being called via an async path |
| | 2923 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2924 | | } |
| | 2925 | | else |
| | 2926 | | { |
| | 2927 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2928 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2929 | | pipeline.Send(_message, cancellationToken); |
| | 2930 | | } |
| | 2931 | | Azure.Response _response = _message.Response; |
| | 2932 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2933 | | return RenewLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 2934 | | } |
| | 2935 | | } |
| | 2936 | | catch (System.Exception ex) |
| | 2937 | | { |
| | 2938 | | _scope.Failed(ex); |
| | 2939 | | throw; |
| | 2940 | | } |
| | 2941 | | finally |
| | 2942 | | { |
| | 2943 | | _scope.Dispose(); |
| | 2944 | | } |
| | 2945 | | } |
| | 2946 | |
|
| | 2947 | | /// <summary> |
| | 2948 | | /// Create the Container.RenewLeaseAsync request. |
| | 2949 | | /// </summary> |
| | 2950 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2951 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 2952 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 2953 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2954 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2955 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 2956 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 2957 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2958 | | /// <returns>The Container.RenewLeaseAsync Message.</returns> |
| | 2959 | | internal static Azure.Core.HttpMessage RenewLeaseAsync_CreateMessage( |
| | 2960 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2961 | | System.Uri resourceUri, |
| | 2962 | | string leaseId, |
| | 2963 | | string version, |
| | 2964 | | int? timeout = default, |
| | 2965 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 2966 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 2967 | | string requestId = default) |
| | 2968 | | { |
| | 2969 | | // Validation |
| | 2970 | | if (resourceUri == null) |
| | 2971 | | { |
| | 2972 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 2973 | | } |
| | 2974 | | if (leaseId == null) |
| | 2975 | | { |
| | 2976 | | throw new System.ArgumentNullException(nameof(leaseId)); |
| | 2977 | | } |
| | 2978 | | if (version == null) |
| | 2979 | | { |
| | 2980 | | throw new System.ArgumentNullException(nameof(version)); |
| | 2981 | | } |
| | 2982 | |
|
| | 2983 | | // Create the request |
| | 2984 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 2985 | | Azure.Core.Request _request = _message.Request; |
| | 2986 | |
|
| | 2987 | | // Set the endpoint |
| | 2988 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 2989 | | _request.Uri.Reset(resourceUri); |
| | 2990 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 2991 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 2992 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 2993 | |
|
| | 2994 | | // Add request headers |
| | 2995 | | _request.Headers.SetValue("x-ms-lease-action", "renew"); |
| | 2996 | | _request.Headers.SetValue("x-ms-lease-id", leaseId); |
| | 2997 | | _request.Headers.SetValue("x-ms-version", version); |
| | 2998 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 2999 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 3000 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 3001 | |
|
| | 3002 | | return _message; |
| | 3003 | | } |
| | 3004 | |
|
| | 3005 | | /// <summary> |
| | 3006 | | /// Create the Container.RenewLeaseAsync response or throw a failure exception. |
| | 3007 | | /// </summary> |
| | 3008 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 3009 | | /// <param name="response">The raw Response.</param> |
| | 3010 | | /// <returns>The Container.RenewLeaseAsync Azure.Response{Azure.Storage.Blobs.Models.BlobLease}.</returns> |
| | 3011 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobLease> RenewLeaseAsync_CreateResponse( |
| | 3012 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3013 | | Azure.Response response) |
| | 3014 | | { |
| | 3015 | | // Process the response |
| | 3016 | | switch (response.Status) |
| | 3017 | | { |
| | 3018 | | case 200: |
| | 3019 | | { |
| | 3020 | | // Create the result |
| | 3021 | | Azure.Storage.Blobs.Models.BlobLease _value = new Azure.Storage.Blobs.Models.BlobLease(); |
| | 3022 | |
|
| | 3023 | | // Get response headers |
| | 3024 | | string _header; |
| | 3025 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 3026 | | { |
| | 3027 | | _value.ETag = new Azure.ETag(_header); |
| | 3028 | | } |
| | 3029 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 3030 | | { |
| | 3031 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 3032 | | } |
| | 3033 | | if (response.Headers.TryGetValue("x-ms-lease-id", out _header)) |
| | 3034 | | { |
| | 3035 | | _value.LeaseId = _header; |
| | 3036 | | } |
| | 3037 | |
|
| | 3038 | | // Create the response |
| | 3039 | | return Response.FromValue(_value, response); |
| | 3040 | | } |
| | 3041 | | default: |
| | 3042 | | { |
| | 3043 | | // Create the result |
| | 3044 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3045 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 3046 | |
|
| | 3047 | | throw _value.CreateException(clientDiagnostics, response); |
| | 3048 | | } |
| | 3049 | | } |
| | 3050 | | } |
| | 3051 | | #endregion Container.RenewLeaseAsync |
| | 3052 | |
|
| | 3053 | | #region Container.BreakLeaseAsync |
| | 3054 | | /// <summary> |
| | 3055 | | /// [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 1 |
| | 3056 | | /// </summary> |
| | 3057 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 3058 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3059 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 3060 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3061 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3062 | | /// <param name="breakPeriod">For a break operation, proposed duration the lease should continue before it i |
| | 3063 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 3064 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 3065 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 3066 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 3067 | | /// <param name="operationName">Operation name.</param> |
| | 3068 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 3069 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BrokenLease}</returns> |
| | 3070 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BrokenLease>> |
| | 3071 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3072 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3073 | | System.Uri resourceUri, |
| | 3074 | | string version, |
| | 3075 | | int? timeout = default, |
| | 3076 | | long? breakPeriod = default, |
| | 3077 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 3078 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 3079 | | string requestId = default, |
| | 3080 | | bool async = true, |
| | 3081 | | string operationName = "ContainerClient.BreakLease", |
| | 3082 | | System.Threading.CancellationToken cancellationToken = default) |
| | 3083 | | { |
| | 3084 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 3085 | | try |
| | 3086 | | { |
| | 3087 | | _scope.AddAttribute("url", resourceUri); |
| | 3088 | | _scope.Start(); |
| | 3089 | | using (Azure.Core.HttpMessage _message = BreakLeaseAsync_CreateMessage( |
| | 3090 | | pipeline, |
| | 3091 | | resourceUri, |
| | 3092 | | version, |
| | 3093 | | timeout, |
| | 3094 | | breakPeriod, |
| | 3095 | | ifModifiedSince, |
| | 3096 | | ifUnmodifiedSince, |
| | 3097 | | requestId)) |
| | 3098 | | { |
| | 3099 | | if (async) |
| | 3100 | | { |
| | 3101 | | // Send the request asynchronously if we're being called via an async path |
| | 3102 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 3103 | | } |
| | 3104 | | else |
| | 3105 | | { |
| | 3106 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 3107 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 3108 | | pipeline.Send(_message, cancellationToken); |
| | 3109 | | } |
| | 3110 | | Azure.Response _response = _message.Response; |
| | 3111 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 3112 | | return BreakLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 3113 | | } |
| | 3114 | | } |
| | 3115 | | catch (System.Exception ex) |
| | 3116 | | { |
| | 3117 | | _scope.Failed(ex); |
| | 3118 | | throw; |
| | 3119 | | } |
| | 3120 | | finally |
| | 3121 | | { |
| | 3122 | | _scope.Dispose(); |
| | 3123 | | } |
| | 3124 | | } |
| | 3125 | |
|
| | 3126 | | /// <summary> |
| | 3127 | | /// Create the Container.BreakLeaseAsync request. |
| | 3128 | | /// </summary> |
| | 3129 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3130 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 3131 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3132 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3133 | | /// <param name="breakPeriod">For a break operation, proposed duration the lease should continue before it i |
| | 3134 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 3135 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 3136 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 3137 | | /// <returns>The Container.BreakLeaseAsync Message.</returns> |
| | 3138 | | internal static Azure.Core.HttpMessage BreakLeaseAsync_CreateMessage( |
| | 3139 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3140 | | System.Uri resourceUri, |
| | 3141 | | string version, |
| | 3142 | | int? timeout = default, |
| | 3143 | | long? breakPeriod = default, |
| | 3144 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 3145 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 3146 | | string requestId = default) |
| | 3147 | | { |
| | 3148 | | // Validation |
| | 3149 | | if (resourceUri == null) |
| | 3150 | | { |
| | 3151 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 3152 | | } |
| | 3153 | | if (version == null) |
| | 3154 | | { |
| | 3155 | | throw new System.ArgumentNullException(nameof(version)); |
| | 3156 | | } |
| | 3157 | |
|
| | 3158 | | // Create the request |
| | 3159 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 3160 | | Azure.Core.Request _request = _message.Request; |
| | 3161 | |
|
| | 3162 | | // Set the endpoint |
| | 3163 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 3164 | | _request.Uri.Reset(resourceUri); |
| | 3165 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 3166 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 3167 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 3168 | |
|
| | 3169 | | // Add request headers |
| | 3170 | | _request.Headers.SetValue("x-ms-lease-action", "break"); |
| | 3171 | | _request.Headers.SetValue("x-ms-version", version); |
| | 3172 | | if (breakPeriod != null) { _request.Headers.SetValue("x-ms-lease-break-period", breakPeriod.Value.ToStri |
| | 3173 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 3174 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 3175 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 3176 | |
|
| | 3177 | | return _message; |
| | 3178 | | } |
| | 3179 | |
|
| | 3180 | | /// <summary> |
| | 3181 | | /// Create the Container.BreakLeaseAsync response or throw a failure exception. |
| | 3182 | | /// </summary> |
| | 3183 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 3184 | | /// <param name="response">The raw Response.</param> |
| | 3185 | | /// <returns>The Container.BreakLeaseAsync Azure.Response{Azure.Storage.Blobs.Models.BrokenLease}.</returns> |
| | 3186 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BrokenLease> BreakLeaseAsync_CreateResponse( |
| | 3187 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3188 | | Azure.Response response) |
| | 3189 | | { |
| | 3190 | | // Process the response |
| | 3191 | | switch (response.Status) |
| | 3192 | | { |
| | 3193 | | case 202: |
| | 3194 | | { |
| | 3195 | | // Create the result |
| | 3196 | | Azure.Storage.Blobs.Models.BrokenLease _value = new Azure.Storage.Blobs.Models.BrokenLease(); |
| | 3197 | |
|
| | 3198 | | // Get response headers |
| | 3199 | | string _header; |
| | 3200 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 3201 | | { |
| | 3202 | | _value.ETag = new Azure.ETag(_header); |
| | 3203 | | } |
| | 3204 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 3205 | | { |
| | 3206 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 3207 | | } |
| | 3208 | | if (response.Headers.TryGetValue("x-ms-lease-time", out _header)) |
| | 3209 | | { |
| | 3210 | | _value.LeaseTime = int.Parse(_header, System.Globalization.CultureInfo.InvariantCulture); |
| | 3211 | | } |
| | 3212 | |
|
| | 3213 | | // Create the response |
| | 3214 | | return Response.FromValue(_value, response); |
| | 3215 | | } |
| | 3216 | | default: |
| | 3217 | | { |
| | 3218 | | // Create the result |
| | 3219 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3220 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 3221 | |
|
| | 3222 | | throw _value.CreateException(clientDiagnostics, response); |
| | 3223 | | } |
| | 3224 | | } |
| | 3225 | | } |
| | 3226 | | #endregion Container.BreakLeaseAsync |
| | 3227 | |
|
| | 3228 | | #region Container.ChangeLeaseAsync |
| | 3229 | | /// <summary> |
| | 3230 | | /// [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 1 |
| | 3231 | | /// </summary> |
| | 3232 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 3233 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3234 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 3235 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 3236 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The Blob service returns 400 ( |
| | 3237 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3238 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3239 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 3240 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 3241 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 3242 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 3243 | | /// <param name="operationName">Operation name.</param> |
| | 3244 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 3245 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobLease}</returns> |
| | 3246 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>> C |
| | 3247 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3248 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3249 | | System.Uri resourceUri, |
| | 3250 | | string leaseId, |
| | 3251 | | string proposedLeaseId, |
| | 3252 | | string version, |
| | 3253 | | int? timeout = default, |
| | 3254 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 3255 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 3256 | | string requestId = default, |
| | 3257 | | bool async = true, |
| | 3258 | | string operationName = "ContainerClient.ChangeLease", |
| | 3259 | | System.Threading.CancellationToken cancellationToken = default) |
| | 3260 | | { |
| | 3261 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 3262 | | try |
| | 3263 | | { |
| | 3264 | | _scope.AddAttribute("url", resourceUri); |
| | 3265 | | _scope.Start(); |
| | 3266 | | using (Azure.Core.HttpMessage _message = ChangeLeaseAsync_CreateMessage( |
| | 3267 | | pipeline, |
| | 3268 | | resourceUri, |
| | 3269 | | leaseId, |
| | 3270 | | proposedLeaseId, |
| | 3271 | | version, |
| | 3272 | | timeout, |
| | 3273 | | ifModifiedSince, |
| | 3274 | | ifUnmodifiedSince, |
| | 3275 | | requestId)) |
| | 3276 | | { |
| | 3277 | | if (async) |
| | 3278 | | { |
| | 3279 | | // Send the request asynchronously if we're being called via an async path |
| | 3280 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 3281 | | } |
| | 3282 | | else |
| | 3283 | | { |
| | 3284 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 3285 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 3286 | | pipeline.Send(_message, cancellationToken); |
| | 3287 | | } |
| | 3288 | | Azure.Response _response = _message.Response; |
| | 3289 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 3290 | | return ChangeLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 3291 | | } |
| | 3292 | | } |
| | 3293 | | catch (System.Exception ex) |
| | 3294 | | { |
| | 3295 | | _scope.Failed(ex); |
| | 3296 | | throw; |
| | 3297 | | } |
| | 3298 | | finally |
| | 3299 | | { |
| | 3300 | | _scope.Dispose(); |
| | 3301 | | } |
| | 3302 | | } |
| | 3303 | |
|
| | 3304 | | /// <summary> |
| | 3305 | | /// Create the Container.ChangeLeaseAsync request. |
| | 3306 | | /// </summary> |
| | 3307 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3308 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 3309 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 3310 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The Blob service returns 400 ( |
| | 3311 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3312 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3313 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 3314 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 3315 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 3316 | | /// <returns>The Container.ChangeLeaseAsync Message.</returns> |
| | 3317 | | internal static Azure.Core.HttpMessage ChangeLeaseAsync_CreateMessage( |
| | 3318 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3319 | | System.Uri resourceUri, |
| | 3320 | | string leaseId, |
| | 3321 | | string proposedLeaseId, |
| | 3322 | | string version, |
| | 3323 | | int? timeout = default, |
| | 3324 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 3325 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 3326 | | string requestId = default) |
| | 3327 | | { |
| | 3328 | | // Validation |
| | 3329 | | if (resourceUri == null) |
| | 3330 | | { |
| | 3331 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 3332 | | } |
| | 3333 | | if (leaseId == null) |
| | 3334 | | { |
| | 3335 | | throw new System.ArgumentNullException(nameof(leaseId)); |
| | 3336 | | } |
| | 3337 | | if (proposedLeaseId == null) |
| | 3338 | | { |
| | 3339 | | throw new System.ArgumentNullException(nameof(proposedLeaseId)); |
| | 3340 | | } |
| | 3341 | | if (version == null) |
| | 3342 | | { |
| | 3343 | | throw new System.ArgumentNullException(nameof(version)); |
| | 3344 | | } |
| | 3345 | |
|
| | 3346 | | // Create the request |
| | 3347 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 3348 | | Azure.Core.Request _request = _message.Request; |
| | 3349 | |
|
| | 3350 | | // Set the endpoint |
| | 3351 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 3352 | | _request.Uri.Reset(resourceUri); |
| | 3353 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 3354 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 3355 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 3356 | |
|
| | 3357 | | // Add request headers |
| | 3358 | | _request.Headers.SetValue("x-ms-lease-action", "change"); |
| | 3359 | | _request.Headers.SetValue("x-ms-lease-id", leaseId); |
| | 3360 | | _request.Headers.SetValue("x-ms-proposed-lease-id", proposedLeaseId); |
| | 3361 | | _request.Headers.SetValue("x-ms-version", version); |
| | 3362 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 3363 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 3364 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 3365 | |
|
| | 3366 | | return _message; |
| | 3367 | | } |
| | 3368 | |
|
| | 3369 | | /// <summary> |
| | 3370 | | /// Create the Container.ChangeLeaseAsync response or throw a failure exception. |
| | 3371 | | /// </summary> |
| | 3372 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 3373 | | /// <param name="response">The raw Response.</param> |
| | 3374 | | /// <returns>The Container.ChangeLeaseAsync Azure.Response{Azure.Storage.Blobs.Models.BlobLease}.</returns> |
| | 3375 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobLease> ChangeLeaseAsync_CreateResponse( |
| | 3376 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3377 | | Azure.Response response) |
| | 3378 | | { |
| | 3379 | | // Process the response |
| | 3380 | | switch (response.Status) |
| | 3381 | | { |
| | 3382 | | case 200: |
| | 3383 | | { |
| | 3384 | | // Create the result |
| | 3385 | | Azure.Storage.Blobs.Models.BlobLease _value = new Azure.Storage.Blobs.Models.BlobLease(); |
| | 3386 | |
|
| | 3387 | | // Get response headers |
| | 3388 | | string _header; |
| | 3389 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 3390 | | { |
| | 3391 | | _value.ETag = new Azure.ETag(_header); |
| | 3392 | | } |
| | 3393 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 3394 | | { |
| | 3395 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 3396 | | } |
| | 3397 | | if (response.Headers.TryGetValue("x-ms-lease-id", out _header)) |
| | 3398 | | { |
| | 3399 | | _value.LeaseId = _header; |
| | 3400 | | } |
| | 3401 | |
|
| | 3402 | | // Create the response |
| | 3403 | | return Response.FromValue(_value, response); |
| | 3404 | | } |
| | 3405 | | default: |
| | 3406 | | { |
| | 3407 | | // Create the result |
| | 3408 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3409 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 3410 | |
|
| | 3411 | | throw _value.CreateException(clientDiagnostics, response); |
| | 3412 | | } |
| | 3413 | | } |
| | 3414 | | } |
| | 3415 | | #endregion Container.ChangeLeaseAsync |
| | 3416 | |
|
| | 3417 | | #region Container.ListBlobsFlatSegmentAsync |
| | 3418 | | /// <summary> |
| | 3419 | | /// [Update] The List Blobs operation returns a list of the blobs under the specified container |
| | 3420 | | /// </summary> |
| | 3421 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 3422 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3423 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 3424 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3425 | | /// <param name="prefix">Filters the results to return only containers whose name begins with the specified |
| | 3426 | | /// <param name="marker">A string value that identifies the portion of the list of containers to be returned |
| | 3427 | | /// <param name="maxresults">Specifies the maximum number of containers to return. If the request does not s |
| | 3428 | | /// <param name="include">Include this parameter to specify one or more datasets to include in the response. |
| | 3429 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3430 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 3431 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 3432 | | /// <param name="operationName">Operation name.</param> |
| | 3433 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 3434 | | /// <returns>An enumeration of blobs</returns> |
| | 3435 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobsFlatSegm |
| | 3436 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3437 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3438 | | System.Uri resourceUri, |
| | 3439 | | string version, |
| | 3440 | | string prefix = default, |
| | 3441 | | string marker = default, |
| | 3442 | | int? maxresults = default, |
| | 3443 | | System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.ListBlobsIncludeItem> include = defaul |
| | 3444 | | int? timeout = default, |
| | 3445 | | string requestId = default, |
| | 3446 | | bool async = true, |
| | 3447 | | string operationName = "ContainerClient.ListBlobsFlatSegment", |
| | 3448 | | System.Threading.CancellationToken cancellationToken = default) |
| | 3449 | | { |
| | 3450 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 3451 | | try |
| | 3452 | | { |
| | 3453 | | _scope.AddAttribute("url", resourceUri); |
| | 3454 | | _scope.Start(); |
| | 3455 | | using (Azure.Core.HttpMessage _message = ListBlobsFlatSegmentAsync_CreateMessage( |
| | 3456 | | pipeline, |
| | 3457 | | resourceUri, |
| | 3458 | | version, |
| | 3459 | | prefix, |
| | 3460 | | marker, |
| | 3461 | | maxresults, |
| | 3462 | | include, |
| | 3463 | | timeout, |
| | 3464 | | requestId)) |
| | 3465 | | { |
| | 3466 | | if (async) |
| | 3467 | | { |
| | 3468 | | // Send the request asynchronously if we're being called via an async path |
| | 3469 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 3470 | | } |
| | 3471 | | else |
| | 3472 | | { |
| | 3473 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 3474 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 3475 | | pipeline.Send(_message, cancellationToken); |
| | 3476 | | } |
| | 3477 | | Azure.Response _response = _message.Response; |
| | 3478 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 3479 | | return ListBlobsFlatSegmentAsync_CreateResponse(clientDiagnostics, _response); |
| | 3480 | | } |
| | 3481 | | } |
| | 3482 | | catch (System.Exception ex) |
| | 3483 | | { |
| | 3484 | | _scope.Failed(ex); |
| | 3485 | | throw; |
| | 3486 | | } |
| | 3487 | | finally |
| | 3488 | | { |
| | 3489 | | _scope.Dispose(); |
| | 3490 | | } |
| | 3491 | | } |
| | 3492 | |
|
| | 3493 | | /// <summary> |
| | 3494 | | /// Create the Container.ListBlobsFlatSegmentAsync request. |
| | 3495 | | /// </summary> |
| | 3496 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3497 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 3498 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3499 | | /// <param name="prefix">Filters the results to return only containers whose name begins with the specified |
| | 3500 | | /// <param name="marker">A string value that identifies the portion of the list of containers to be returned |
| | 3501 | | /// <param name="maxresults">Specifies the maximum number of containers to return. If the request does not s |
| | 3502 | | /// <param name="include">Include this parameter to specify one or more datasets to include in the response. |
| | 3503 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3504 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 3505 | | /// <returns>The Container.ListBlobsFlatSegmentAsync Message.</returns> |
| | 3506 | | internal static Azure.Core.HttpMessage ListBlobsFlatSegmentAsync_CreateMessage( |
| | 3507 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3508 | | System.Uri resourceUri, |
| | 3509 | | string version, |
| | 3510 | | string prefix = default, |
| | 3511 | | string marker = default, |
| | 3512 | | int? maxresults = default, |
| | 3513 | | System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.ListBlobsIncludeItem> include = defaul |
| | 3514 | | int? timeout = default, |
| | 3515 | | string requestId = default) |
| | 3516 | | { |
| | 3517 | | // Validation |
| | 3518 | | if (resourceUri == null) |
| | 3519 | | { |
| | 3520 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 3521 | | } |
| | 3522 | | if (version == null) |
| | 3523 | | { |
| | 3524 | | throw new System.ArgumentNullException(nameof(version)); |
| | 3525 | | } |
| | 3526 | |
|
| | 3527 | | // Create the request |
| | 3528 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 3529 | | Azure.Core.Request _request = _message.Request; |
| | 3530 | |
|
| | 3531 | | // Set the endpoint |
| | 3532 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 3533 | | _request.Uri.Reset(resourceUri); |
| | 3534 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 3535 | | _request.Uri.AppendQuery("comp", "list", escapeValue: false); |
| | 3536 | | if (prefix != null) { _request.Uri.AppendQuery("prefix", prefix); } |
| | 3537 | | if (marker != null) { _request.Uri.AppendQuery("marker", marker); } |
| | 3538 | | if (maxresults != null) { _request.Uri.AppendQuery("maxresults", maxresults.Value.ToString(System.Global |
| | 3539 | | if (include != null) { _request.Uri.AppendQuery("include", string.Join(",", System.Linq.Enumerable.Selec |
| | 3540 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 3541 | |
|
| | 3542 | | // Add request headers |
| | 3543 | | _request.Headers.SetValue("x-ms-version", version); |
| | 3544 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 3545 | |
|
| | 3546 | | return _message; |
| | 3547 | | } |
| | 3548 | |
|
| | 3549 | | /// <summary> |
| | 3550 | | /// Create the Container.ListBlobsFlatSegmentAsync response or throw a failure exception. |
| | 3551 | | /// </summary> |
| | 3552 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 3553 | | /// <param name="response">The raw Response.</param> |
| | 3554 | | /// <returns>The Container.ListBlobsFlatSegmentAsync Azure.Response{Azure.Storage.Blobs.Models.BlobsFlatSegm |
| | 3555 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobsFlatSegment> ListBlobsFlatSegmentAsync_Create |
| | 3556 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3557 | | Azure.Response response) |
| | 3558 | | { |
| | 3559 | | // Process the response |
| | 3560 | | switch (response.Status) |
| | 3561 | | { |
| | 3562 | | case 200: |
| | 3563 | | { |
| | 3564 | | // Create the result |
| | 3565 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3566 | | Azure.Storage.Blobs.Models.BlobsFlatSegment _value = Azure.Storage.Blobs.Models.BlobsFlatSegment |
| | 3567 | |
|
| | 3568 | | // Create the response |
| | 3569 | | return Response.FromValue(_value, response); |
| | 3570 | | } |
| | 3571 | | case 304: |
| | 3572 | | { |
| | 3573 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.BlobsFlatSegment>(response); |
| | 3574 | | } |
| | 3575 | | default: |
| | 3576 | | { |
| | 3577 | | // Create the result |
| | 3578 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3579 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 3580 | |
|
| | 3581 | | throw _value.CreateException(clientDiagnostics, response); |
| | 3582 | | } |
| | 3583 | | } |
| | 3584 | | } |
| | 3585 | | #endregion Container.ListBlobsFlatSegmentAsync |
| | 3586 | |
|
| | 3587 | | #region Container.ListBlobsHierarchySegmentAsync |
| | 3588 | | /// <summary> |
| | 3589 | | /// [Update] The List Blobs operation returns a list of the blobs under the specified container |
| | 3590 | | /// </summary> |
| | 3591 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 3592 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3593 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 3594 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3595 | | /// <param name="prefix">Filters the results to return only containers whose name begins with the specified |
| | 3596 | | /// <param name="delimiter">When the request includes this parameter, the operation returns a BlobPrefix ele |
| | 3597 | | /// <param name="marker">A string value that identifies the portion of the list of containers to be returned |
| | 3598 | | /// <param name="maxresults">Specifies the maximum number of containers to return. If the request does not s |
| | 3599 | | /// <param name="include">Include this parameter to specify one or more datasets to include in the response. |
| | 3600 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3601 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 3602 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 3603 | | /// <param name="operationName">Operation name.</param> |
| | 3604 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 3605 | | /// <returns>An enumeration of blobs</returns> |
| | 3606 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobsHierarch |
| | 3607 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3608 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3609 | | System.Uri resourceUri, |
| | 3610 | | string version, |
| | 3611 | | string prefix = default, |
| | 3612 | | string delimiter = default, |
| | 3613 | | string marker = default, |
| | 3614 | | int? maxresults = default, |
| | 3615 | | System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.ListBlobsIncludeItem> include = defaul |
| | 3616 | | int? timeout = default, |
| | 3617 | | string requestId = default, |
| | 3618 | | bool async = true, |
| | 3619 | | string operationName = "ContainerClient.ListBlobsHierarchySegment", |
| | 3620 | | System.Threading.CancellationToken cancellationToken = default) |
| | 3621 | | { |
| | 3622 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 3623 | | try |
| | 3624 | | { |
| | 3625 | | _scope.AddAttribute("url", resourceUri); |
| | 3626 | | _scope.Start(); |
| | 3627 | | using (Azure.Core.HttpMessage _message = ListBlobsHierarchySegmentAsync_CreateMessage( |
| | 3628 | | pipeline, |
| | 3629 | | resourceUri, |
| | 3630 | | version, |
| | 3631 | | prefix, |
| | 3632 | | delimiter, |
| | 3633 | | marker, |
| | 3634 | | maxresults, |
| | 3635 | | include, |
| | 3636 | | timeout, |
| | 3637 | | requestId)) |
| | 3638 | | { |
| | 3639 | | if (async) |
| | 3640 | | { |
| | 3641 | | // Send the request asynchronously if we're being called via an async path |
| | 3642 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 3643 | | } |
| | 3644 | | else |
| | 3645 | | { |
| | 3646 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 3647 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 3648 | | pipeline.Send(_message, cancellationToken); |
| | 3649 | | } |
| | 3650 | | Azure.Response _response = _message.Response; |
| | 3651 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 3652 | | return ListBlobsHierarchySegmentAsync_CreateResponse(clientDiagnostics, _response); |
| | 3653 | | } |
| | 3654 | | } |
| | 3655 | | catch (System.Exception ex) |
| | 3656 | | { |
| | 3657 | | _scope.Failed(ex); |
| | 3658 | | throw; |
| | 3659 | | } |
| | 3660 | | finally |
| | 3661 | | { |
| | 3662 | | _scope.Dispose(); |
| | 3663 | | } |
| | 3664 | | } |
| | 3665 | |
|
| | 3666 | | /// <summary> |
| | 3667 | | /// Create the Container.ListBlobsHierarchySegmentAsync request. |
| | 3668 | | /// </summary> |
| | 3669 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3670 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 3671 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3672 | | /// <param name="prefix">Filters the results to return only containers whose name begins with the specified |
| | 3673 | | /// <param name="delimiter">When the request includes this parameter, the operation returns a BlobPrefix ele |
| | 3674 | | /// <param name="marker">A string value that identifies the portion of the list of containers to be returned |
| | 3675 | | /// <param name="maxresults">Specifies the maximum number of containers to return. If the request does not s |
| | 3676 | | /// <param name="include">Include this parameter to specify one or more datasets to include in the response. |
| | 3677 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3678 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 3679 | | /// <returns>The Container.ListBlobsHierarchySegmentAsync Message.</returns> |
| | 3680 | | internal static Azure.Core.HttpMessage ListBlobsHierarchySegmentAsync_CreateMessage( |
| | 3681 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3682 | | System.Uri resourceUri, |
| | 3683 | | string version, |
| | 3684 | | string prefix = default, |
| | 3685 | | string delimiter = default, |
| | 3686 | | string marker = default, |
| | 3687 | | int? maxresults = default, |
| | 3688 | | System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.ListBlobsIncludeItem> include = defaul |
| | 3689 | | int? timeout = default, |
| | 3690 | | string requestId = default) |
| | 3691 | | { |
| | 3692 | | // Validation |
| | 3693 | | if (resourceUri == null) |
| | 3694 | | { |
| | 3695 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 3696 | | } |
| | 3697 | | if (version == null) |
| | 3698 | | { |
| | 3699 | | throw new System.ArgumentNullException(nameof(version)); |
| | 3700 | | } |
| | 3701 | |
|
| | 3702 | | // Create the request |
| | 3703 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 3704 | | Azure.Core.Request _request = _message.Request; |
| | 3705 | |
|
| | 3706 | | // Set the endpoint |
| | 3707 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 3708 | | _request.Uri.Reset(resourceUri); |
| | 3709 | | _request.Uri.AppendQuery("restype", "container", escapeValue: false); |
| | 3710 | | _request.Uri.AppendQuery("comp", "list", escapeValue: false); |
| | 3711 | | if (prefix != null) { _request.Uri.AppendQuery("prefix", prefix); } |
| | 3712 | | if (delimiter != null) { _request.Uri.AppendQuery("delimiter", delimiter); } |
| | 3713 | | if (marker != null) { _request.Uri.AppendQuery("marker", marker); } |
| | 3714 | | if (maxresults != null) { _request.Uri.AppendQuery("maxresults", maxresults.Value.ToString(System.Global |
| | 3715 | | if (include != null) { _request.Uri.AppendQuery("include", string.Join(",", System.Linq.Enumerable.Selec |
| | 3716 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 3717 | |
|
| | 3718 | | // Add request headers |
| | 3719 | | _request.Headers.SetValue("x-ms-version", version); |
| | 3720 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 3721 | |
|
| | 3722 | | return _message; |
| | 3723 | | } |
| | 3724 | |
|
| | 3725 | | /// <summary> |
| | 3726 | | /// Create the Container.ListBlobsHierarchySegmentAsync response or throw a failure exception. |
| | 3727 | | /// </summary> |
| | 3728 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 3729 | | /// <param name="response">The raw Response.</param> |
| | 3730 | | /// <returns>The Container.ListBlobsHierarchySegmentAsync Azure.Response{Azure.Storage.Blobs.Models.BlobsHie |
| | 3731 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobsHierarchySegment> ListBlobsHierarchySegmentAs |
| | 3732 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3733 | | Azure.Response response) |
| | 3734 | | { |
| | 3735 | | // Process the response |
| | 3736 | | switch (response.Status) |
| | 3737 | | { |
| | 3738 | | case 200: |
| | 3739 | | { |
| | 3740 | | // Create the result |
| | 3741 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3742 | | Azure.Storage.Blobs.Models.BlobsHierarchySegment _value = Azure.Storage.Blobs.Models.BlobsHierar |
| | 3743 | |
|
| | 3744 | | // Create the response |
| | 3745 | | return Response.FromValue(_value, response); |
| | 3746 | | } |
| | 3747 | | case 304: |
| | 3748 | | { |
| | 3749 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.BlobsHierarchySegment>(response); |
| | 3750 | | } |
| | 3751 | | default: |
| | 3752 | | { |
| | 3753 | | // Create the result |
| | 3754 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3755 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 3756 | |
|
| | 3757 | | throw _value.CreateException(clientDiagnostics, response); |
| | 3758 | | } |
| | 3759 | | } |
| | 3760 | | } |
| | 3761 | | #endregion Container.ListBlobsHierarchySegmentAsync |
| | 3762 | | } |
| | 3763 | | #endregion Container operations |
| | 3764 | |
|
| | 3765 | | #region Blob operations |
| | 3766 | | /// <summary> |
| | 3767 | | /// Blob operations for Azure Blob Storage |
| | 3768 | | /// </summary> |
| | 3769 | | public static partial class Blob |
| | 3770 | | { |
| | 3771 | | #region Blob.DownloadAsync |
| | 3772 | | /// <summary> |
| | 3773 | | /// The Download operation reads or downloads a blob from the system, including its metadata and properties. |
| | 3774 | | /// </summary> |
| | 3775 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 3776 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3777 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 3778 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3779 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 3780 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 3781 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3782 | | /// <param name="range">Return only the bytes of the blob in the specified range.</param> |
| | 3783 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 3784 | | /// <param name="rangeGetContentHash">When set to true and specified together with the Range, the service re |
| | 3785 | | /// <param name="rangeGetContentCRC64">When set to true and specified together with the Range, the service r |
| | 3786 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 3787 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 3788 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 3789 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 3790 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 3791 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 3792 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 3793 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 3794 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 3795 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 3796 | | /// <param name="operationName">Operation name.</param> |
| | 3797 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 3798 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.FlattenedDownloadProperties}</returns> |
| | 3799 | | public static async System.Threading.Tasks.ValueTask<(Azure.Response<Azure.Storage.Blobs.Models.FlattenedDow |
| | 3800 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3801 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3802 | | System.Uri resourceUri, |
| | 3803 | | string version, |
| | 3804 | | string snapshot = default, |
| | 3805 | | string versionId = default, |
| | 3806 | | int? timeout = default, |
| | 3807 | | string range = default, |
| | 3808 | | string leaseId = default, |
| | 3809 | | bool? rangeGetContentHash = default, |
| | 3810 | | bool? rangeGetContentCRC64 = default, |
| | 3811 | | string encryptionKey = default, |
| | 3812 | | string encryptionKeySha256 = default, |
| | 3813 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 3814 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 3815 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 3816 | | Azure.ETag? ifMatch = default, |
| | 3817 | | Azure.ETag? ifNoneMatch = default, |
| | 3818 | | string ifTags = default, |
| | 3819 | | string requestId = default, |
| | 3820 | | bool async = true, |
| | 3821 | | string operationName = "BlobClient.Download", |
| | 3822 | | System.Threading.CancellationToken cancellationToken = default) |
| | 3823 | | { |
| | 3824 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 3825 | | try |
| | 3826 | | { |
| | 3827 | | _scope.AddAttribute("url", resourceUri); |
| | 3828 | | _scope.Start(); |
| | 3829 | | using (Azure.Core.HttpMessage _message = DownloadAsync_CreateMessage( |
| | 3830 | | pipeline, |
| | 3831 | | resourceUri, |
| | 3832 | | version, |
| | 3833 | | snapshot, |
| | 3834 | | versionId, |
| | 3835 | | timeout, |
| | 3836 | | range, |
| | 3837 | | leaseId, |
| | 3838 | | rangeGetContentHash, |
| | 3839 | | rangeGetContentCRC64, |
| | 3840 | | encryptionKey, |
| | 3841 | | encryptionKeySha256, |
| | 3842 | | encryptionAlgorithm, |
| | 3843 | | ifModifiedSince, |
| | 3844 | | ifUnmodifiedSince, |
| | 3845 | | ifMatch, |
| | 3846 | | ifNoneMatch, |
| | 3847 | | ifTags, |
| | 3848 | | requestId)) |
| | 3849 | | { |
| | 3850 | | // Avoid buffering if stream is going to be returned to the caller |
| | 3851 | | _message.BufferResponse = false; |
| | 3852 | | if (async) |
| | 3853 | | { |
| | 3854 | | // Send the request asynchronously if we're being called via an async path |
| | 3855 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 3856 | | } |
| | 3857 | | else |
| | 3858 | | { |
| | 3859 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 3860 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 3861 | | pipeline.Send(_message, cancellationToken); |
| | 3862 | | } |
| | 3863 | | Azure.Response _response = _message.Response; |
| | 3864 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 3865 | | return (DownloadAsync_CreateResponse(clientDiagnostics, _response), _message.ExtractResponseCont |
| | 3866 | | } |
| | 3867 | | } |
| | 3868 | | catch (System.Exception ex) |
| | 3869 | | { |
| | 3870 | | _scope.Failed(ex); |
| | 3871 | | throw; |
| | 3872 | | } |
| | 3873 | | finally |
| | 3874 | | { |
| | 3875 | | _scope.Dispose(); |
| | 3876 | | } |
| | 3877 | | } |
| | 3878 | |
|
| | 3879 | | /// <summary> |
| | 3880 | | /// Create the Blob.DownloadAsync request. |
| | 3881 | | /// </summary> |
| | 3882 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3883 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 3884 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3885 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 3886 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 3887 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3888 | | /// <param name="range">Return only the bytes of the blob in the specified range.</param> |
| | 3889 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 3890 | | /// <param name="rangeGetContentHash">When set to true and specified together with the Range, the service re |
| | 3891 | | /// <param name="rangeGetContentCRC64">When set to true and specified together with the Range, the service r |
| | 3892 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 3893 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 3894 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 3895 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 3896 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 3897 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 3898 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 3899 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 3900 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 3901 | | /// <returns>The Blob.DownloadAsync Message.</returns> |
| | 3902 | | internal static Azure.Core.HttpMessage DownloadAsync_CreateMessage( |
| | 3903 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3904 | | System.Uri resourceUri, |
| | 3905 | | string version, |
| | 3906 | | string snapshot = default, |
| | 3907 | | string versionId = default, |
| | 3908 | | int? timeout = default, |
| | 3909 | | string range = default, |
| | 3910 | | string leaseId = default, |
| | 3911 | | bool? rangeGetContentHash = default, |
| | 3912 | | bool? rangeGetContentCRC64 = default, |
| | 3913 | | string encryptionKey = default, |
| | 3914 | | string encryptionKeySha256 = default, |
| | 3915 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 3916 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 3917 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 3918 | | Azure.ETag? ifMatch = default, |
| | 3919 | | Azure.ETag? ifNoneMatch = default, |
| | 3920 | | string ifTags = default, |
| | 3921 | | string requestId = default) |
| | 3922 | | { |
| | 3923 | | // Validation |
| | 3924 | | if (resourceUri == null) |
| | 3925 | | { |
| | 3926 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 3927 | | } |
| | 3928 | | if (version == null) |
| | 3929 | | { |
| | 3930 | | throw new System.ArgumentNullException(nameof(version)); |
| | 3931 | | } |
| | 3932 | |
|
| | 3933 | | // Create the request |
| | 3934 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 3935 | | Azure.Core.Request _request = _message.Request; |
| | 3936 | |
|
| | 3937 | | // Set the endpoint |
| | 3938 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 3939 | | _request.Uri.Reset(resourceUri); |
| | 3940 | | if (snapshot != null) { _request.Uri.AppendQuery("snapshot", snapshot); } |
| | 3941 | | if (versionId != null) { _request.Uri.AppendQuery("versionid", versionId); } |
| | 3942 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 3943 | |
|
| | 3944 | | // Add request headers |
| | 3945 | | _request.Headers.SetValue("x-ms-version", version); |
| | 3946 | | if (range != null) { _request.Headers.SetValue("x-ms-range", range); } |
| | 3947 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 3948 | | if (rangeGetContentHash != null) { |
| | 3949 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 3950 | | _request.Headers.SetValue("x-ms-range-get-content-md5", rangeGetContentHash.Value.ToString(System.Global |
| | 3951 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 3952 | | } |
| | 3953 | | if (rangeGetContentCRC64 != null) { |
| | 3954 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 3955 | | _request.Headers.SetValue("x-ms-range-get-content-crc64", rangeGetContentCRC64.Value.ToString(System.Glo |
| | 3956 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 3957 | | } |
| | 3958 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 3959 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 3960 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 3961 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 3962 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 3963 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 3964 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 3965 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 3966 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 3967 | |
|
| | 3968 | | return _message; |
| | 3969 | | } |
| | 3970 | |
|
| | 3971 | | /// <summary> |
| | 3972 | | /// Create the Blob.DownloadAsync response or throw a failure exception. |
| | 3973 | | /// </summary> |
| | 3974 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 3975 | | /// <param name="response">The raw Response.</param> |
| | 3976 | | /// <returns>The Blob.DownloadAsync Azure.Response{Azure.Storage.Blobs.Models.FlattenedDownloadProperties}.< |
| | 3977 | | internal static Azure.Response<Azure.Storage.Blobs.Models.FlattenedDownloadProperties> DownloadAsync_CreateR |
| | 3978 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3979 | | Azure.Response response) |
| | 3980 | | { |
| | 3981 | | // Process the response |
| | 3982 | | switch (response.Status) |
| | 3983 | | { |
| | 3984 | | case 200: |
| | 3985 | | { |
| | 3986 | | // Create the result |
| | 3987 | | Azure.Storage.Blobs.Models.FlattenedDownloadProperties _value = new Azure.Storage.Blobs.Models.F |
| | 3988 | | _value.Content = response.ContentStream; // You should manually wrap with RetriableStream! |
| | 3989 | |
|
| | 3990 | | // Get response headers |
| | 3991 | | string _header; |
| | 3992 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 3993 | | { |
| | 3994 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 3995 | | } |
| | 3996 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompare |
| | 3997 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 3998 | | { |
| | 3999 | | if (_headerPair.Name.StartsWith("x-ms-meta-", System.StringComparison.InvariantCulture)) |
| | 4000 | | { |
| | 4001 | | _value.Metadata[_headerPair.Name.Substring(10)] = _headerPair.Value; |
| | 4002 | | } |
| | 4003 | | } |
| | 4004 | | if (response.Headers.TryGetValue("x-ms-or-policy-id", out _header)) |
| | 4005 | | { |
| | 4006 | | _value.ObjectReplicationPolicyId = _header; |
| | 4007 | | } |
| | 4008 | | _value.ObjectReplicationRules = new System.Collections.Generic.Dictionary<string, string>(System |
| | 4009 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 4010 | | { |
| | 4011 | | if (_headerPair.Name.StartsWith("x-ms-or-", System.StringComparison.InvariantCulture)) |
| | 4012 | | { |
| | 4013 | | _value.ObjectReplicationRules[_headerPair.Name.Substring(8)] = _headerPair.Value; |
| | 4014 | | } |
| | 4015 | | } |
| | 4016 | | if (response.Headers.TryGetValue("Content-Length", out _header)) |
| | 4017 | | { |
| | 4018 | | _value.ContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture |
| | 4019 | | } |
| | 4020 | | if (response.Headers.TryGetValue("Content-Type", out _header)) |
| | 4021 | | { |
| | 4022 | | _value.ContentType = _header; |
| | 4023 | | } |
| | 4024 | | if (response.Headers.TryGetValue("Content-Range", out _header)) |
| | 4025 | | { |
| | 4026 | | _value.ContentRange = _header; |
| | 4027 | | } |
| | 4028 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 4029 | | { |
| | 4030 | | _value.ETag = new Azure.ETag(_header); |
| | 4031 | | } |
| | 4032 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 4033 | | { |
| | 4034 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 4035 | | } |
| | 4036 | | if (response.Headers.TryGetValue("Content-Encoding", out _header)) |
| | 4037 | | { |
| | 4038 | | _value.ContentEncoding = _header; |
| | 4039 | | } |
| | 4040 | | if (response.Headers.TryGetValue("Cache-Control", out _header)) |
| | 4041 | | { |
| | 4042 | | _value.CacheControl = _header; |
| | 4043 | | } |
| | 4044 | | if (response.Headers.TryGetValue("Content-Disposition", out _header)) |
| | 4045 | | { |
| | 4046 | | _value.ContentDisposition = _header; |
| | 4047 | | } |
| | 4048 | | if (response.Headers.TryGetValue("Content-Language", out _header)) |
| | 4049 | | { |
| | 4050 | | _value.ContentLanguage = _header; |
| | 4051 | | } |
| | 4052 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 4053 | | { |
| | 4054 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 4055 | | } |
| | 4056 | | if (response.Headers.TryGetValue("x-ms-blob-type", out _header)) |
| | 4057 | | { |
| | 4058 | | _value.BlobType = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseBlobType(_header); |
| | 4059 | | } |
| | 4060 | | if (response.Headers.TryGetValue("x-ms-copy-completion-time", out _header)) |
| | 4061 | | { |
| | 4062 | | _value.CopyCompletionTime = System.DateTimeOffset.Parse(_header, System.Globalization.Cultur |
| | 4063 | | } |
| | 4064 | | if (response.Headers.TryGetValue("x-ms-copy-status-description", out _header)) |
| | 4065 | | { |
| | 4066 | | _value.CopyStatusDescription = _header; |
| | 4067 | | } |
| | 4068 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 4069 | | { |
| | 4070 | | _value.CopyId = _header; |
| | 4071 | | } |
| | 4072 | | if (response.Headers.TryGetValue("x-ms-copy-progress", out _header)) |
| | 4073 | | { |
| | 4074 | | _value.CopyProgress = _header; |
| | 4075 | | } |
| | 4076 | | if (response.Headers.TryGetValue("x-ms-copy-source", out _header)) |
| | 4077 | | { |
| | 4078 | | _value.CopySource = new System.Uri(_header); |
| | 4079 | | } |
| | 4080 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 4081 | | { |
| | 4082 | | _value.CopyStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseCopyStatus(_header |
| | 4083 | | } |
| | 4084 | | if (response.Headers.TryGetValue("x-ms-lease-duration", out _header)) |
| | 4085 | | { |
| | 4086 | | _value.LeaseDuration = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseDurationTy |
| | 4087 | | } |
| | 4088 | | if (response.Headers.TryGetValue("x-ms-lease-state", out _header)) |
| | 4089 | | { |
| | 4090 | | _value.LeaseState = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseState(_header |
| | 4091 | | } |
| | 4092 | | if (response.Headers.TryGetValue("x-ms-lease-status", out _header)) |
| | 4093 | | { |
| | 4094 | | _value.LeaseStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseStatus(_head |
| | 4095 | | } |
| | 4096 | | if (response.Headers.TryGetValue("x-ms-version-id", out _header)) |
| | 4097 | | { |
| | 4098 | | _value.VersionId = _header; |
| | 4099 | | } |
| | 4100 | | if (response.Headers.TryGetValue("Accept-Ranges", out _header)) |
| | 4101 | | { |
| | 4102 | | _value.AcceptRanges = _header; |
| | 4103 | | } |
| | 4104 | | if (response.Headers.TryGetValue("x-ms-blob-committed-block-count", out _header)) |
| | 4105 | | { |
| | 4106 | | _value.BlobCommittedBlockCount = int.Parse(_header, System.Globalization.CultureInfo.Invaria |
| | 4107 | | } |
| | 4108 | | if (response.Headers.TryGetValue("x-ms-server-encrypted", out _header)) |
| | 4109 | | { |
| | 4110 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 4111 | | } |
| | 4112 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 4113 | | { |
| | 4114 | | _value.EncryptionKeySha256 = _header; |
| | 4115 | | } |
| | 4116 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 4117 | | { |
| | 4118 | | _value.EncryptionScope = _header; |
| | 4119 | | } |
| | 4120 | | if (response.Headers.TryGetValue("x-ms-blob-content-md5", out _header)) |
| | 4121 | | { |
| | 4122 | | _value.BlobContentHash = System.Convert.FromBase64String(_header); |
| | 4123 | | } |
| | 4124 | | if (response.Headers.TryGetValue("x-ms-tag-count", out _header)) |
| | 4125 | | { |
| | 4126 | | _value.TagCount = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture); |
| | 4127 | | } |
| | 4128 | | if (response.Headers.TryGetValue("x-ms-blob-sealed", out _header)) |
| | 4129 | | { |
| | 4130 | | _value.IsSealed = bool.Parse(_header); |
| | 4131 | | } |
| | 4132 | |
|
| | 4133 | | // Create the response |
| | 4134 | | return Response.FromValue(_value, response); |
| | 4135 | | } |
| | 4136 | | case 206: |
| | 4137 | | { |
| | 4138 | | // Create the result |
| | 4139 | | Azure.Storage.Blobs.Models.FlattenedDownloadProperties _value = new Azure.Storage.Blobs.Models.F |
| | 4140 | | _value.Content = response.ContentStream; // You should manually wrap with RetriableStream! |
| | 4141 | |
|
| | 4142 | | // Get response headers |
| | 4143 | | string _header; |
| | 4144 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 4145 | | { |
| | 4146 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 4147 | | } |
| | 4148 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompare |
| | 4149 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 4150 | | { |
| | 4151 | | if (_headerPair.Name.StartsWith("x-ms-meta-", System.StringComparison.InvariantCulture)) |
| | 4152 | | { |
| | 4153 | | _value.Metadata[_headerPair.Name.Substring(10)] = _headerPair.Value; |
| | 4154 | | } |
| | 4155 | | } |
| | 4156 | | if (response.Headers.TryGetValue("x-ms-or-policy-id", out _header)) |
| | 4157 | | { |
| | 4158 | | _value.ObjectReplicationPolicyId = _header; |
| | 4159 | | } |
| | 4160 | | _value.ObjectReplicationRules = new System.Collections.Generic.Dictionary<string, string>(System |
| | 4161 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 4162 | | { |
| | 4163 | | if (_headerPair.Name.StartsWith("x-ms-or-", System.StringComparison.InvariantCulture)) |
| | 4164 | | { |
| | 4165 | | _value.ObjectReplicationRules[_headerPair.Name.Substring(8)] = _headerPair.Value; |
| | 4166 | | } |
| | 4167 | | } |
| | 4168 | | if (response.Headers.TryGetValue("Content-Length", out _header)) |
| | 4169 | | { |
| | 4170 | | _value.ContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture |
| | 4171 | | } |
| | 4172 | | if (response.Headers.TryGetValue("Content-Type", out _header)) |
| | 4173 | | { |
| | 4174 | | _value.ContentType = _header; |
| | 4175 | | } |
| | 4176 | | if (response.Headers.TryGetValue("Content-Range", out _header)) |
| | 4177 | | { |
| | 4178 | | _value.ContentRange = _header; |
| | 4179 | | } |
| | 4180 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 4181 | | { |
| | 4182 | | _value.ETag = new Azure.ETag(_header); |
| | 4183 | | } |
| | 4184 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 4185 | | { |
| | 4186 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 4187 | | } |
| | 4188 | | if (response.Headers.TryGetValue("Content-Encoding", out _header)) |
| | 4189 | | { |
| | 4190 | | _value.ContentEncoding = _header; |
| | 4191 | | } |
| | 4192 | | if (response.Headers.TryGetValue("Cache-Control", out _header)) |
| | 4193 | | { |
| | 4194 | | _value.CacheControl = _header; |
| | 4195 | | } |
| | 4196 | | if (response.Headers.TryGetValue("Content-Disposition", out _header)) |
| | 4197 | | { |
| | 4198 | | _value.ContentDisposition = _header; |
| | 4199 | | } |
| | 4200 | | if (response.Headers.TryGetValue("Content-Language", out _header)) |
| | 4201 | | { |
| | 4202 | | _value.ContentLanguage = _header; |
| | 4203 | | } |
| | 4204 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 4205 | | { |
| | 4206 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 4207 | | } |
| | 4208 | | if (response.Headers.TryGetValue("x-ms-blob-type", out _header)) |
| | 4209 | | { |
| | 4210 | | _value.BlobType = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseBlobType(_header); |
| | 4211 | | } |
| | 4212 | | if (response.Headers.TryGetValue("x-ms-content-crc64", out _header)) |
| | 4213 | | { |
| | 4214 | | _value.ContentCrc64 = System.Convert.FromBase64String(_header); |
| | 4215 | | } |
| | 4216 | | if (response.Headers.TryGetValue("x-ms-copy-completion-time", out _header)) |
| | 4217 | | { |
| | 4218 | | _value.CopyCompletionTime = System.DateTimeOffset.Parse(_header, System.Globalization.Cultur |
| | 4219 | | } |
| | 4220 | | if (response.Headers.TryGetValue("x-ms-copy-status-description", out _header)) |
| | 4221 | | { |
| | 4222 | | _value.CopyStatusDescription = _header; |
| | 4223 | | } |
| | 4224 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 4225 | | { |
| | 4226 | | _value.CopyId = _header; |
| | 4227 | | } |
| | 4228 | | if (response.Headers.TryGetValue("x-ms-copy-progress", out _header)) |
| | 4229 | | { |
| | 4230 | | _value.CopyProgress = _header; |
| | 4231 | | } |
| | 4232 | | if (response.Headers.TryGetValue("x-ms-copy-source", out _header)) |
| | 4233 | | { |
| | 4234 | | _value.CopySource = new System.Uri(_header); |
| | 4235 | | } |
| | 4236 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 4237 | | { |
| | 4238 | | _value.CopyStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseCopyStatus(_header |
| | 4239 | | } |
| | 4240 | | if (response.Headers.TryGetValue("x-ms-lease-duration", out _header)) |
| | 4241 | | { |
| | 4242 | | _value.LeaseDuration = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseDurationTy |
| | 4243 | | } |
| | 4244 | | if (response.Headers.TryGetValue("x-ms-lease-state", out _header)) |
| | 4245 | | { |
| | 4246 | | _value.LeaseState = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseState(_header |
| | 4247 | | } |
| | 4248 | | if (response.Headers.TryGetValue("x-ms-lease-status", out _header)) |
| | 4249 | | { |
| | 4250 | | _value.LeaseStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseStatus(_head |
| | 4251 | | } |
| | 4252 | | if (response.Headers.TryGetValue("Accept-Ranges", out _header)) |
| | 4253 | | { |
| | 4254 | | _value.AcceptRanges = _header; |
| | 4255 | | } |
| | 4256 | | if (response.Headers.TryGetValue("x-ms-blob-committed-block-count", out _header)) |
| | 4257 | | { |
| | 4258 | | _value.BlobCommittedBlockCount = int.Parse(_header, System.Globalization.CultureInfo.Invaria |
| | 4259 | | } |
| | 4260 | | if (response.Headers.TryGetValue("x-ms-server-encrypted", out _header)) |
| | 4261 | | { |
| | 4262 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 4263 | | } |
| | 4264 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 4265 | | { |
| | 4266 | | _value.EncryptionKeySha256 = _header; |
| | 4267 | | } |
| | 4268 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 4269 | | { |
| | 4270 | | _value.EncryptionScope = _header; |
| | 4271 | | } |
| | 4272 | | if (response.Headers.TryGetValue("x-ms-blob-content-md5", out _header)) |
| | 4273 | | { |
| | 4274 | | _value.BlobContentHash = System.Convert.FromBase64String(_header); |
| | 4275 | | } |
| | 4276 | | if (response.Headers.TryGetValue("x-ms-tag-count", out _header)) |
| | 4277 | | { |
| | 4278 | | _value.TagCount = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture); |
| | 4279 | | } |
| | 4280 | | if (response.Headers.TryGetValue("x-ms-blob-sealed", out _header)) |
| | 4281 | | { |
| | 4282 | | _value.IsSealed = bool.Parse(_header); |
| | 4283 | | } |
| | 4284 | |
|
| | 4285 | | // Create the response |
| | 4286 | | return Response.FromValue(_value, response); |
| | 4287 | | } |
| | 4288 | | case 304: |
| | 4289 | | { |
| | 4290 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.FlattenedDownloadProperties>(response |
| | 4291 | | } |
| | 4292 | | default: |
| | 4293 | | { |
| | 4294 | | // Create the result |
| | 4295 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 4296 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 4297 | |
|
| | 4298 | | throw _value.CreateException(clientDiagnostics, response); |
| | 4299 | | } |
| | 4300 | | } |
| | 4301 | | } |
| | 4302 | | #endregion Blob.DownloadAsync |
| | 4303 | |
|
| | 4304 | | #region Blob.GetPropertiesAsync |
| | 4305 | | /// <summary> |
| | 4306 | | /// The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system pro |
| | 4307 | | /// </summary> |
| | 4308 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 4309 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4310 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 4311 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4312 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 4313 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 4314 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4315 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4316 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 4317 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 4318 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 4319 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 4320 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 4321 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 4322 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 4323 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 4324 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 4325 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 4326 | | /// <param name="operationName">Operation name.</param> |
| | 4327 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 4328 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobPropertiesInternal}</returns> |
| | 4329 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobPropertie |
| | 4330 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4331 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4332 | | System.Uri resourceUri, |
| | 4333 | | string version, |
| | 4334 | | string snapshot = default, |
| | 4335 | | string versionId = default, |
| | 4336 | | int? timeout = default, |
| | 4337 | | string leaseId = default, |
| | 4338 | | string encryptionKey = default, |
| | 4339 | | string encryptionKeySha256 = default, |
| | 4340 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 4341 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 4342 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 4343 | | Azure.ETag? ifMatch = default, |
| | 4344 | | Azure.ETag? ifNoneMatch = default, |
| | 4345 | | string ifTags = default, |
| | 4346 | | string requestId = default, |
| | 4347 | | bool async = true, |
| | 4348 | | string operationName = "BlobClient.GetProperties", |
| | 4349 | | System.Threading.CancellationToken cancellationToken = default) |
| | 4350 | | { |
| | 4351 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 4352 | | try |
| | 4353 | | { |
| | 4354 | | _scope.AddAttribute("url", resourceUri); |
| | 4355 | | _scope.Start(); |
| | 4356 | | using (Azure.Core.HttpMessage _message = GetPropertiesAsync_CreateMessage( |
| | 4357 | | pipeline, |
| | 4358 | | resourceUri, |
| | 4359 | | version, |
| | 4360 | | snapshot, |
| | 4361 | | versionId, |
| | 4362 | | timeout, |
| | 4363 | | leaseId, |
| | 4364 | | encryptionKey, |
| | 4365 | | encryptionKeySha256, |
| | 4366 | | encryptionAlgorithm, |
| | 4367 | | ifModifiedSince, |
| | 4368 | | ifUnmodifiedSince, |
| | 4369 | | ifMatch, |
| | 4370 | | ifNoneMatch, |
| | 4371 | | ifTags, |
| | 4372 | | requestId)) |
| | 4373 | | { |
| | 4374 | | if (async) |
| | 4375 | | { |
| | 4376 | | // Send the request asynchronously if we're being called via an async path |
| | 4377 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 4378 | | } |
| | 4379 | | else |
| | 4380 | | { |
| | 4381 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 4382 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 4383 | | pipeline.Send(_message, cancellationToken); |
| | 4384 | | } |
| | 4385 | | Azure.Response _response = _message.Response; |
| | 4386 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 4387 | | return GetPropertiesAsync_CreateResponse(clientDiagnostics, _response); |
| | 4388 | | } |
| | 4389 | | } |
| | 4390 | | catch (System.Exception ex) |
| | 4391 | | { |
| | 4392 | | _scope.Failed(ex); |
| | 4393 | | throw; |
| | 4394 | | } |
| | 4395 | | finally |
| | 4396 | | { |
| | 4397 | | _scope.Dispose(); |
| | 4398 | | } |
| | 4399 | | } |
| | 4400 | |
|
| | 4401 | | /// <summary> |
| | 4402 | | /// Create the Blob.GetPropertiesAsync request. |
| | 4403 | | /// </summary> |
| | 4404 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4405 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 4406 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4407 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 4408 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 4409 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4410 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4411 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 4412 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 4413 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 4414 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 4415 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 4416 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 4417 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 4418 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 4419 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 4420 | | /// <returns>The Blob.GetPropertiesAsync Message.</returns> |
| | 4421 | | internal static Azure.Core.HttpMessage GetPropertiesAsync_CreateMessage( |
| | 4422 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4423 | | System.Uri resourceUri, |
| | 4424 | | string version, |
| | 4425 | | string snapshot = default, |
| | 4426 | | string versionId = default, |
| | 4427 | | int? timeout = default, |
| | 4428 | | string leaseId = default, |
| | 4429 | | string encryptionKey = default, |
| | 4430 | | string encryptionKeySha256 = default, |
| | 4431 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 4432 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 4433 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 4434 | | Azure.ETag? ifMatch = default, |
| | 4435 | | Azure.ETag? ifNoneMatch = default, |
| | 4436 | | string ifTags = default, |
| | 4437 | | string requestId = default) |
| | 4438 | | { |
| | 4439 | | // Validation |
| | 4440 | | if (resourceUri == null) |
| | 4441 | | { |
| | 4442 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 4443 | | } |
| | 4444 | | if (version == null) |
| | 4445 | | { |
| | 4446 | | throw new System.ArgumentNullException(nameof(version)); |
| | 4447 | | } |
| | 4448 | |
|
| | 4449 | | // Create the request |
| | 4450 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 4451 | | Azure.Core.Request _request = _message.Request; |
| | 4452 | |
|
| | 4453 | | // Set the endpoint |
| | 4454 | | _request.Method = Azure.Core.RequestMethod.Head; |
| | 4455 | | _request.Uri.Reset(resourceUri); |
| | 4456 | | if (snapshot != null) { _request.Uri.AppendQuery("snapshot", snapshot); } |
| | 4457 | | if (versionId != null) { _request.Uri.AppendQuery("versionid", versionId); } |
| | 4458 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 4459 | |
|
| | 4460 | | // Add request headers |
| | 4461 | | _request.Headers.SetValue("x-ms-version", version); |
| | 4462 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 4463 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 4464 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 4465 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 4466 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 4467 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 4468 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 4469 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 4470 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 4471 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 4472 | |
|
| | 4473 | | return _message; |
| | 4474 | | } |
| | 4475 | |
|
| | 4476 | | /// <summary> |
| | 4477 | | /// Create the Blob.GetPropertiesAsync response or throw a failure exception. |
| | 4478 | | /// </summary> |
| | 4479 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 4480 | | /// <param name="response">The raw Response.</param> |
| | 4481 | | /// <returns>The Blob.GetPropertiesAsync Azure.Response{Azure.Storage.Blobs.Models.BlobPropertiesInternal}.< |
| | 4482 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobPropertiesInternal> GetPropertiesAsync_CreateR |
| | 4483 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4484 | | Azure.Response response) |
| | 4485 | | { |
| | 4486 | | // Process the response |
| | 4487 | | switch (response.Status) |
| | 4488 | | { |
| | 4489 | | case 200: |
| | 4490 | | { |
| | 4491 | | // Create the result |
| | 4492 | | Azure.Storage.Blobs.Models.BlobPropertiesInternal _value = new Azure.Storage.Blobs.Models.BlobPr |
| | 4493 | |
|
| | 4494 | | // Get response headers |
| | 4495 | | string _header; |
| | 4496 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 4497 | | { |
| | 4498 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 4499 | | } |
| | 4500 | | if (response.Headers.TryGetValue("x-ms-creation-time", out _header)) |
| | 4501 | | { |
| | 4502 | | _value.CreatedOn = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo.Inv |
| | 4503 | | } |
| | 4504 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompare |
| | 4505 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 4506 | | { |
| | 4507 | | if (_headerPair.Name.StartsWith("x-ms-meta-", System.StringComparison.InvariantCulture)) |
| | 4508 | | { |
| | 4509 | | _value.Metadata[_headerPair.Name.Substring(10)] = _headerPair.Value; |
| | 4510 | | } |
| | 4511 | | } |
| | 4512 | | if (response.Headers.TryGetValue("x-ms-or-policy-id", out _header)) |
| | 4513 | | { |
| | 4514 | | _value.ObjectReplicationPolicyId = _header; |
| | 4515 | | } |
| | 4516 | | _value.ObjectReplicationRules = new System.Collections.Generic.Dictionary<string, string>(System |
| | 4517 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 4518 | | { |
| | 4519 | | if (_headerPair.Name.StartsWith("x-ms-or-", System.StringComparison.InvariantCulture)) |
| | 4520 | | { |
| | 4521 | | _value.ObjectReplicationRules[_headerPair.Name.Substring(8)] = _headerPair.Value; |
| | 4522 | | } |
| | 4523 | | } |
| | 4524 | | if (response.Headers.TryGetValue("x-ms-blob-type", out _header)) |
| | 4525 | | { |
| | 4526 | | _value.BlobType = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseBlobType(_header); |
| | 4527 | | } |
| | 4528 | | if (response.Headers.TryGetValue("x-ms-copy-completion-time", out _header)) |
| | 4529 | | { |
| | 4530 | | _value.CopyCompletedOn = System.DateTimeOffset.Parse(_header, System.Globalization.CultureIn |
| | 4531 | | } |
| | 4532 | | if (response.Headers.TryGetValue("x-ms-copy-status-description", out _header)) |
| | 4533 | | { |
| | 4534 | | _value.CopyStatusDescription = _header; |
| | 4535 | | } |
| | 4536 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 4537 | | { |
| | 4538 | | _value.CopyId = _header; |
| | 4539 | | } |
| | 4540 | | if (response.Headers.TryGetValue("x-ms-copy-progress", out _header)) |
| | 4541 | | { |
| | 4542 | | _value.CopyProgress = _header; |
| | 4543 | | } |
| | 4544 | | if (response.Headers.TryGetValue("x-ms-copy-source", out _header)) |
| | 4545 | | { |
| | 4546 | | _value.CopySource = new System.Uri(_header); |
| | 4547 | | } |
| | 4548 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 4549 | | { |
| | 4550 | | _value.CopyStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseCopyStatus(_header |
| | 4551 | | } |
| | 4552 | | if (response.Headers.TryGetValue("x-ms-incremental-copy", out _header)) |
| | 4553 | | { |
| | 4554 | | _value.IsIncrementalCopy = bool.Parse(_header); |
| | 4555 | | } |
| | 4556 | | if (response.Headers.TryGetValue("x-ms-copy-destination-snapshot", out _header)) |
| | 4557 | | { |
| | 4558 | | _value.DestinationSnapshot = _header; |
| | 4559 | | } |
| | 4560 | | if (response.Headers.TryGetValue("x-ms-lease-duration", out _header)) |
| | 4561 | | { |
| | 4562 | | _value.LeaseDuration = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseDurationTy |
| | 4563 | | } |
| | 4564 | | if (response.Headers.TryGetValue("x-ms-lease-state", out _header)) |
| | 4565 | | { |
| | 4566 | | _value.LeaseState = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseState(_header |
| | 4567 | | } |
| | 4568 | | if (response.Headers.TryGetValue("x-ms-lease-status", out _header)) |
| | 4569 | | { |
| | 4570 | | _value.LeaseStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseStatus(_head |
| | 4571 | | } |
| | 4572 | | if (response.Headers.TryGetValue("Content-Length", out _header)) |
| | 4573 | | { |
| | 4574 | | _value.ContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture |
| | 4575 | | } |
| | 4576 | | if (response.Headers.TryGetValue("Content-Type", out _header)) |
| | 4577 | | { |
| | 4578 | | _value.ContentType = _header; |
| | 4579 | | } |
| | 4580 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 4581 | | { |
| | 4582 | | _value.ETag = new Azure.ETag(_header); |
| | 4583 | | } |
| | 4584 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 4585 | | { |
| | 4586 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 4587 | | } |
| | 4588 | | if (response.Headers.TryGetValue("Content-Encoding", out _header)) |
| | 4589 | | { |
| | 4590 | | _value.ContentEncoding = _header; |
| | 4591 | | } |
| | 4592 | | if (response.Headers.TryGetValue("Content-Disposition", out _header)) |
| | 4593 | | { |
| | 4594 | | _value.ContentDisposition = _header; |
| | 4595 | | } |
| | 4596 | | if (response.Headers.TryGetValue("Content-Language", out _header)) |
| | 4597 | | { |
| | 4598 | | _value.ContentLanguage = _header; |
| | 4599 | | } |
| | 4600 | | if (response.Headers.TryGetValue("Cache-Control", out _header)) |
| | 4601 | | { |
| | 4602 | | _value.CacheControl = _header; |
| | 4603 | | } |
| | 4604 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 4605 | | { |
| | 4606 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 4607 | | } |
| | 4608 | | if (response.Headers.TryGetValue("Accept-Ranges", out _header)) |
| | 4609 | | { |
| | 4610 | | _value.AcceptRanges = _header; |
| | 4611 | | } |
| | 4612 | | if (response.Headers.TryGetValue("x-ms-blob-committed-block-count", out _header)) |
| | 4613 | | { |
| | 4614 | | _value.BlobCommittedBlockCount = int.Parse(_header, System.Globalization.CultureInfo.Invaria |
| | 4615 | | } |
| | 4616 | | if (response.Headers.TryGetValue("x-ms-server-encrypted", out _header)) |
| | 4617 | | { |
| | 4618 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 4619 | | } |
| | 4620 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 4621 | | { |
| | 4622 | | _value.EncryptionKeySha256 = _header; |
| | 4623 | | } |
| | 4624 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 4625 | | { |
| | 4626 | | _value.EncryptionScope = _header; |
| | 4627 | | } |
| | 4628 | | if (response.Headers.TryGetValue("x-ms-access-tier", out _header)) |
| | 4629 | | { |
| | 4630 | | _value.AccessTier = _header; |
| | 4631 | | } |
| | 4632 | | if (response.Headers.TryGetValue("x-ms-access-tier-inferred", out _header)) |
| | 4633 | | { |
| | 4634 | | _value.AccessTierInferred = bool.Parse(_header); |
| | 4635 | | } |
| | 4636 | | if (response.Headers.TryGetValue("x-ms-archive-status", out _header)) |
| | 4637 | | { |
| | 4638 | | _value.ArchiveStatus = _header; |
| | 4639 | | } |
| | 4640 | | if (response.Headers.TryGetValue("x-ms-access-tier-change-time", out _header)) |
| | 4641 | | { |
| | 4642 | | _value.AccessTierChangedOn = System.DateTimeOffset.Parse(_header, System.Globalization.Cultu |
| | 4643 | | } |
| | 4644 | | if (response.Headers.TryGetValue("x-ms-version-id", out _header)) |
| | 4645 | | { |
| | 4646 | | _value.VersionId = _header; |
| | 4647 | | } |
| | 4648 | | if (response.Headers.TryGetValue("x-ms-is-current-version", out _header)) |
| | 4649 | | { |
| | 4650 | | _value.IsCurrentVersion = bool.Parse(_header); |
| | 4651 | | } |
| | 4652 | | if (response.Headers.TryGetValue("x-ms-tag-count", out _header)) |
| | 4653 | | { |
| | 4654 | | _value.TagCount = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture); |
| | 4655 | | } |
| | 4656 | | if (response.Headers.TryGetValue("x-ms-expiry-time", out _header)) |
| | 4657 | | { |
| | 4658 | | _value.ExpiresOn = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo.Inv |
| | 4659 | | } |
| | 4660 | | if (response.Headers.TryGetValue("x-ms-blob-sealed", out _header)) |
| | 4661 | | { |
| | 4662 | | _value.IsSealed = bool.Parse(_header); |
| | 4663 | | } |
| | 4664 | | if (response.Headers.TryGetValue("x-ms-rehydrate-priority", out _header)) |
| | 4665 | | { |
| | 4666 | | _value.RehydratePriority = _header; |
| | 4667 | | } |
| | 4668 | |
|
| | 4669 | | // Create the response |
| | 4670 | | return Response.FromValue(_value, response); |
| | 4671 | | } |
| | 4672 | | case 304: |
| | 4673 | | { |
| | 4674 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.BlobPropertiesInternal>(response); |
| | 4675 | | } |
| | 4676 | | default: |
| | 4677 | | { |
| | 4678 | | // Create the result |
| | 4679 | | Azure.Storage.Blobs.Models.ConditionNotMetError _value = new Azure.Storage.Blobs.Models.Conditio |
| | 4680 | |
|
| | 4681 | | // Get response headers |
| | 4682 | | string _header; |
| | 4683 | | if (response.Headers.TryGetValue("x-ms-error-code", out _header)) |
| | 4684 | | { |
| | 4685 | | _value.ErrorCode = _header; |
| | 4686 | | } |
| | 4687 | |
|
| | 4688 | | throw _value.CreateException(clientDiagnostics, response); |
| | 4689 | | } |
| | 4690 | | } |
| | 4691 | | } |
| | 4692 | | #endregion Blob.GetPropertiesAsync |
| | 4693 | |
|
| | 4694 | | #region Blob.DeleteAsync |
| | 4695 | | /// <summary> |
| | 4696 | | /// If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently |
| | 4697 | | /// </summary> |
| | 4698 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 4699 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4700 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 4701 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4702 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 4703 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 4704 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4705 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4706 | | /// <param name="deleteSnapshots">Required if the blob has associated snapshots. Specify one of the followin |
| | 4707 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 4708 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 4709 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 4710 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 4711 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 4712 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 4713 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 4714 | | /// <param name="operationName">Operation name.</param> |
| | 4715 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 4716 | | /// <returns>Azure.Response</returns> |
| | 4717 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> DeleteAsync( |
| | 4718 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4719 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4720 | | System.Uri resourceUri, |
| | 4721 | | string version, |
| | 4722 | | string snapshot = default, |
| | 4723 | | string versionId = default, |
| | 4724 | | int? timeout = default, |
| | 4725 | | string leaseId = default, |
| | 4726 | | Azure.Storage.Blobs.Models.DeleteSnapshotsOption? deleteSnapshots = default, |
| | 4727 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 4728 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 4729 | | Azure.ETag? ifMatch = default, |
| | 4730 | | Azure.ETag? ifNoneMatch = default, |
| | 4731 | | string ifTags = default, |
| | 4732 | | string requestId = default, |
| | 4733 | | bool async = true, |
| | 4734 | | string operationName = "BlobClient.Delete", |
| | 4735 | | System.Threading.CancellationToken cancellationToken = default) |
| | 4736 | | { |
| | 4737 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 4738 | | try |
| | 4739 | | { |
| | 4740 | | _scope.AddAttribute("url", resourceUri); |
| | 4741 | | _scope.Start(); |
| | 4742 | | using (Azure.Core.HttpMessage _message = DeleteAsync_CreateMessage( |
| | 4743 | | pipeline, |
| | 4744 | | resourceUri, |
| | 4745 | | version, |
| | 4746 | | snapshot, |
| | 4747 | | versionId, |
| | 4748 | | timeout, |
| | 4749 | | leaseId, |
| | 4750 | | deleteSnapshots, |
| | 4751 | | ifModifiedSince, |
| | 4752 | | ifUnmodifiedSince, |
| | 4753 | | ifMatch, |
| | 4754 | | ifNoneMatch, |
| | 4755 | | ifTags, |
| | 4756 | | requestId)) |
| | 4757 | | { |
| | 4758 | | if (async) |
| | 4759 | | { |
| | 4760 | | // Send the request asynchronously if we're being called via an async path |
| | 4761 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 4762 | | } |
| | 4763 | | else |
| | 4764 | | { |
| | 4765 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 4766 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 4767 | | pipeline.Send(_message, cancellationToken); |
| | 4768 | | } |
| | 4769 | | Azure.Response _response = _message.Response; |
| | 4770 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 4771 | | return DeleteAsync_CreateResponse(clientDiagnostics, _response); |
| | 4772 | | } |
| | 4773 | | } |
| | 4774 | | catch (System.Exception ex) |
| | 4775 | | { |
| | 4776 | | _scope.Failed(ex); |
| | 4777 | | throw; |
| | 4778 | | } |
| | 4779 | | finally |
| | 4780 | | { |
| | 4781 | | _scope.Dispose(); |
| | 4782 | | } |
| | 4783 | | } |
| | 4784 | |
|
| | 4785 | | /// <summary> |
| | 4786 | | /// Create the Blob.DeleteAsync request. |
| | 4787 | | /// </summary> |
| | 4788 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4789 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 4790 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4791 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 4792 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 4793 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4794 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4795 | | /// <param name="deleteSnapshots">Required if the blob has associated snapshots. Specify one of the followin |
| | 4796 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 4797 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 4798 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 4799 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 4800 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 4801 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 4802 | | /// <returns>The Blob.DeleteAsync Message.</returns> |
| | 4803 | | internal static Azure.Core.HttpMessage DeleteAsync_CreateMessage( |
| | 4804 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4805 | | System.Uri resourceUri, |
| | 4806 | | string version, |
| | 4807 | | string snapshot = default, |
| | 4808 | | string versionId = default, |
| | 4809 | | int? timeout = default, |
| | 4810 | | string leaseId = default, |
| | 4811 | | Azure.Storage.Blobs.Models.DeleteSnapshotsOption? deleteSnapshots = default, |
| | 4812 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 4813 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 4814 | | Azure.ETag? ifMatch = default, |
| | 4815 | | Azure.ETag? ifNoneMatch = default, |
| | 4816 | | string ifTags = default, |
| | 4817 | | string requestId = default) |
| | 4818 | | { |
| | 4819 | | // Validation |
| | 4820 | | if (resourceUri == null) |
| | 4821 | | { |
| | 4822 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 4823 | | } |
| | 4824 | | if (version == null) |
| | 4825 | | { |
| | 4826 | | throw new System.ArgumentNullException(nameof(version)); |
| | 4827 | | } |
| | 4828 | |
|
| | 4829 | | // Create the request |
| | 4830 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 4831 | | Azure.Core.Request _request = _message.Request; |
| | 4832 | |
|
| | 4833 | | // Set the endpoint |
| | 4834 | | _request.Method = Azure.Core.RequestMethod.Delete; |
| | 4835 | | _request.Uri.Reset(resourceUri); |
| | 4836 | | if (snapshot != null) { _request.Uri.AppendQuery("snapshot", snapshot); } |
| | 4837 | | if (versionId != null) { _request.Uri.AppendQuery("versionid", versionId); } |
| | 4838 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 4839 | |
|
| | 4840 | | // Add request headers |
| | 4841 | | _request.Headers.SetValue("x-ms-version", version); |
| | 4842 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 4843 | | if (deleteSnapshots != null) { _request.Headers.SetValue("x-ms-delete-snapshots", Azure.Storage.Blobs.Bl |
| | 4844 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 4845 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 4846 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 4847 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 4848 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 4849 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 4850 | |
|
| | 4851 | | return _message; |
| | 4852 | | } |
| | 4853 | |
|
| | 4854 | | /// <summary> |
| | 4855 | | /// Create the Blob.DeleteAsync response or throw a failure exception. |
| | 4856 | | /// </summary> |
| | 4857 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 4858 | | /// <param name="response">The raw Response.</param> |
| | 4859 | | /// <returns>The Blob.DeleteAsync Azure.Response.</returns> |
| | 4860 | | internal static Azure.Response DeleteAsync_CreateResponse( |
| | 4861 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4862 | | Azure.Response response) |
| | 4863 | | { |
| | 4864 | | // Process the response |
| | 4865 | | switch (response.Status) |
| | 4866 | | { |
| | 4867 | | case 202: |
| | 4868 | | { |
| | 4869 | | return response; |
| | 4870 | | } |
| | 4871 | | default: |
| | 4872 | | { |
| | 4873 | | // Create the result |
| | 4874 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 4875 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 4876 | |
|
| | 4877 | | throw _value.CreateException(clientDiagnostics, response); |
| | 4878 | | } |
| | 4879 | | } |
| | 4880 | | } |
| | 4881 | | #endregion Blob.DeleteAsync |
| | 4882 | |
|
| | 4883 | | #region Blob.SetAccessControlAsync |
| | 4884 | | /// <summary> |
| | 4885 | | /// Set the owner, group, permissions, or access control list for a blob. |
| | 4886 | | /// </summary> |
| | 4887 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 4888 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4889 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 4890 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4891 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4892 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4893 | | /// <param name="owner">Optional. The owner of the blob or directory.</param> |
| | 4894 | | /// <param name="group">Optional. The owning group of the blob or directory.</param> |
| | 4895 | | /// <param name="posixPermissions">Optional and only valid if Hierarchical Namespace is enabled for the acco |
| | 4896 | | /// <param name="posixAcl">Sets POSIX access control rights on files and directories. The value is a comma-s |
| | 4897 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 4898 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 4899 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 4900 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 4901 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 4902 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 4903 | | /// <param name="operationName">Operation name.</param> |
| | 4904 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 4905 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobSetAccessControlResult}</returns> |
| | 4906 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobSetAccess |
| | 4907 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4908 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4909 | | System.Uri resourceUri, |
| | 4910 | | string version, |
| | 4911 | | int? timeout = default, |
| | 4912 | | string leaseId = default, |
| | 4913 | | string owner = default, |
| | 4914 | | string group = default, |
| | 4915 | | string posixPermissions = default, |
| | 4916 | | string posixAcl = default, |
| | 4917 | | Azure.ETag? ifMatch = default, |
| | 4918 | | Azure.ETag? ifNoneMatch = default, |
| | 4919 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 4920 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 4921 | | string requestId = default, |
| | 4922 | | bool async = true, |
| | 4923 | | string operationName = "BlobClient.SetAccessControl", |
| | 4924 | | System.Threading.CancellationToken cancellationToken = default) |
| | 4925 | | { |
| | 4926 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 4927 | | try |
| | 4928 | | { |
| | 4929 | | _scope.AddAttribute("url", resourceUri); |
| | 4930 | | _scope.Start(); |
| | 4931 | | using (Azure.Core.HttpMessage _message = SetAccessControlAsync_CreateMessage( |
| | 4932 | | pipeline, |
| | 4933 | | resourceUri, |
| | 4934 | | version, |
| | 4935 | | timeout, |
| | 4936 | | leaseId, |
| | 4937 | | owner, |
| | 4938 | | group, |
| | 4939 | | posixPermissions, |
| | 4940 | | posixAcl, |
| | 4941 | | ifMatch, |
| | 4942 | | ifNoneMatch, |
| | 4943 | | ifModifiedSince, |
| | 4944 | | ifUnmodifiedSince, |
| | 4945 | | requestId)) |
| | 4946 | | { |
| | 4947 | | if (async) |
| | 4948 | | { |
| | 4949 | | // Send the request asynchronously if we're being called via an async path |
| | 4950 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 4951 | | } |
| | 4952 | | else |
| | 4953 | | { |
| | 4954 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 4955 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 4956 | | pipeline.Send(_message, cancellationToken); |
| | 4957 | | } |
| | 4958 | | Azure.Response _response = _message.Response; |
| | 4959 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 4960 | | return SetAccessControlAsync_CreateResponse(clientDiagnostics, _response); |
| | 4961 | | } |
| | 4962 | | } |
| | 4963 | | catch (System.Exception ex) |
| | 4964 | | { |
| | 4965 | | _scope.Failed(ex); |
| | 4966 | | throw; |
| | 4967 | | } |
| | 4968 | | finally |
| | 4969 | | { |
| | 4970 | | _scope.Dispose(); |
| | 4971 | | } |
| | 4972 | | } |
| | 4973 | |
|
| | 4974 | | /// <summary> |
| | 4975 | | /// Create the Blob.SetAccessControlAsync request. |
| | 4976 | | /// </summary> |
| | 4977 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4978 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 4979 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4980 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4981 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4982 | | /// <param name="owner">Optional. The owner of the blob or directory.</param> |
| | 4983 | | /// <param name="group">Optional. The owning group of the blob or directory.</param> |
| | 4984 | | /// <param name="posixPermissions">Optional and only valid if Hierarchical Namespace is enabled for the acco |
| | 4985 | | /// <param name="posixAcl">Sets POSIX access control rights on files and directories. The value is a comma-s |
| | 4986 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 4987 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 4988 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 4989 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 4990 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 4991 | | /// <returns>The Blob.SetAccessControlAsync Message.</returns> |
| | 4992 | | internal static Azure.Core.HttpMessage SetAccessControlAsync_CreateMessage( |
| | 4993 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4994 | | System.Uri resourceUri, |
| | 4995 | | string version, |
| | 4996 | | int? timeout = default, |
| | 4997 | | string leaseId = default, |
| | 4998 | | string owner = default, |
| | 4999 | | string group = default, |
| | 5000 | | string posixPermissions = default, |
| | 5001 | | string posixAcl = default, |
| | 5002 | | Azure.ETag? ifMatch = default, |
| | 5003 | | Azure.ETag? ifNoneMatch = default, |
| | 5004 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 5005 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 5006 | | string requestId = default) |
| | 5007 | | { |
| | 5008 | | // Validation |
| | 5009 | | if (resourceUri == null) |
| | 5010 | | { |
| | 5011 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 5012 | | } |
| | 5013 | | if (version == null) |
| | 5014 | | { |
| | 5015 | | throw new System.ArgumentNullException(nameof(version)); |
| | 5016 | | } |
| | 5017 | |
|
| | 5018 | | // Create the request |
| | 5019 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 5020 | | Azure.Core.Request _request = _message.Request; |
| | 5021 | |
|
| | 5022 | | // Set the endpoint |
| | 5023 | | _request.Method = Azure.Core.RequestMethod.Patch; |
| | 5024 | | _request.Uri.Reset(resourceUri); |
| | 5025 | | _request.Uri.AppendQuery("action", "setAccessControl", escapeValue: false); |
| | 5026 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 5027 | |
|
| | 5028 | | // Add request headers |
| | 5029 | | _request.Headers.SetValue("x-ms-version", version); |
| | 5030 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 5031 | | if (owner != null) { _request.Headers.SetValue("x-ms-owner", owner); } |
| | 5032 | | if (group != null) { _request.Headers.SetValue("x-ms-group", group); } |
| | 5033 | | if (posixPermissions != null) { _request.Headers.SetValue("x-ms-permissions", posixPermissions); } |
| | 5034 | | if (posixAcl != null) { _request.Headers.SetValue("x-ms-acl", posixAcl); } |
| | 5035 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 5036 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 5037 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 5038 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 5039 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 5040 | |
|
| | 5041 | | return _message; |
| | 5042 | | } |
| | 5043 | |
|
| | 5044 | | /// <summary> |
| | 5045 | | /// Create the Blob.SetAccessControlAsync response or throw a failure exception. |
| | 5046 | | /// </summary> |
| | 5047 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 5048 | | /// <param name="response">The raw Response.</param> |
| | 5049 | | /// <returns>The Blob.SetAccessControlAsync Azure.Response{Azure.Storage.Blobs.Models.BlobSetAccessControlRe |
| | 5050 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobSetAccessControlResult> SetAccessControlAsync_ |
| | 5051 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5052 | | Azure.Response response) |
| | 5053 | | { |
| | 5054 | | // Process the response |
| | 5055 | | switch (response.Status) |
| | 5056 | | { |
| | 5057 | | case 200: |
| | 5058 | | { |
| | 5059 | | // Create the result |
| | 5060 | | Azure.Storage.Blobs.Models.BlobSetAccessControlResult _value = new Azure.Storage.Blobs.Models.Bl |
| | 5061 | |
|
| | 5062 | | // Get response headers |
| | 5063 | | string _header; |
| | 5064 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 5065 | | { |
| | 5066 | | _value.ETag = new Azure.ETag(_header); |
| | 5067 | | } |
| | 5068 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 5069 | | { |
| | 5070 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 5071 | | } |
| | 5072 | |
|
| | 5073 | | // Create the response |
| | 5074 | | return Response.FromValue(_value, response); |
| | 5075 | | } |
| | 5076 | | default: |
| | 5077 | | { |
| | 5078 | | // Create the result |
| | 5079 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 5080 | | Azure.Storage.Blobs.Models.DataLakeStorageError _value = Azure.Storage.Blobs.Models.DataLakeStor |
| | 5081 | |
|
| | 5082 | | throw _value.CreateException(clientDiagnostics, response); |
| | 5083 | | } |
| | 5084 | | } |
| | 5085 | | } |
| | 5086 | | #endregion Blob.SetAccessControlAsync |
| | 5087 | |
|
| | 5088 | | #region Blob.GetAccessControlAsync |
| | 5089 | | /// <summary> |
| | 5090 | | /// Get the owner, group, permissions, or access control list for a blob. |
| | 5091 | | /// </summary> |
| | 5092 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 5093 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5094 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 5095 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5096 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5097 | | /// <param name="upn">Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true" |
| | 5098 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 5099 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 5100 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 5101 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 5102 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 5103 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5104 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 5105 | | /// <param name="operationName">Operation name.</param> |
| | 5106 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 5107 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobGetAccessControlResult}</returns> |
| | 5108 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobGetAccess |
| | 5109 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5110 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5111 | | System.Uri resourceUri, |
| | 5112 | | string version, |
| | 5113 | | int? timeout = default, |
| | 5114 | | bool? upn = default, |
| | 5115 | | string leaseId = default, |
| | 5116 | | Azure.ETag? ifMatch = default, |
| | 5117 | | Azure.ETag? ifNoneMatch = default, |
| | 5118 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 5119 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 5120 | | string requestId = default, |
| | 5121 | | bool async = true, |
| | 5122 | | string operationName = "BlobClient.GetAccessControl", |
| | 5123 | | System.Threading.CancellationToken cancellationToken = default) |
| | 5124 | | { |
| | 5125 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 5126 | | try |
| | 5127 | | { |
| | 5128 | | _scope.AddAttribute("url", resourceUri); |
| | 5129 | | _scope.Start(); |
| | 5130 | | using (Azure.Core.HttpMessage _message = GetAccessControlAsync_CreateMessage( |
| | 5131 | | pipeline, |
| | 5132 | | resourceUri, |
| | 5133 | | version, |
| | 5134 | | timeout, |
| | 5135 | | upn, |
| | 5136 | | leaseId, |
| | 5137 | | ifMatch, |
| | 5138 | | ifNoneMatch, |
| | 5139 | | ifModifiedSince, |
| | 5140 | | ifUnmodifiedSince, |
| | 5141 | | requestId)) |
| | 5142 | | { |
| | 5143 | | if (async) |
| | 5144 | | { |
| | 5145 | | // Send the request asynchronously if we're being called via an async path |
| | 5146 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 5147 | | } |
| | 5148 | | else |
| | 5149 | | { |
| | 5150 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 5151 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 5152 | | pipeline.Send(_message, cancellationToken); |
| | 5153 | | } |
| | 5154 | | Azure.Response _response = _message.Response; |
| | 5155 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 5156 | | return GetAccessControlAsync_CreateResponse(clientDiagnostics, _response); |
| | 5157 | | } |
| | 5158 | | } |
| | 5159 | | catch (System.Exception ex) |
| | 5160 | | { |
| | 5161 | | _scope.Failed(ex); |
| | 5162 | | throw; |
| | 5163 | | } |
| | 5164 | | finally |
| | 5165 | | { |
| | 5166 | | _scope.Dispose(); |
| | 5167 | | } |
| | 5168 | | } |
| | 5169 | |
|
| | 5170 | | /// <summary> |
| | 5171 | | /// Create the Blob.GetAccessControlAsync request. |
| | 5172 | | /// </summary> |
| | 5173 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5174 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 5175 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5176 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5177 | | /// <param name="upn">Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true" |
| | 5178 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 5179 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 5180 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 5181 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 5182 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 5183 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5184 | | /// <returns>The Blob.GetAccessControlAsync Message.</returns> |
| | 5185 | | internal static Azure.Core.HttpMessage GetAccessControlAsync_CreateMessage( |
| | 5186 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5187 | | System.Uri resourceUri, |
| | 5188 | | string version, |
| | 5189 | | int? timeout = default, |
| | 5190 | | bool? upn = default, |
| | 5191 | | string leaseId = default, |
| | 5192 | | Azure.ETag? ifMatch = default, |
| | 5193 | | Azure.ETag? ifNoneMatch = default, |
| | 5194 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 5195 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 5196 | | string requestId = default) |
| | 5197 | | { |
| | 5198 | | // Validation |
| | 5199 | | if (resourceUri == null) |
| | 5200 | | { |
| | 5201 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 5202 | | } |
| | 5203 | | if (version == null) |
| | 5204 | | { |
| | 5205 | | throw new System.ArgumentNullException(nameof(version)); |
| | 5206 | | } |
| | 5207 | |
|
| | 5208 | | // Create the request |
| | 5209 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 5210 | | Azure.Core.Request _request = _message.Request; |
| | 5211 | |
|
| | 5212 | | // Set the endpoint |
| | 5213 | | _request.Method = Azure.Core.RequestMethod.Head; |
| | 5214 | | _request.Uri.Reset(resourceUri); |
| | 5215 | | _request.Uri.AppendQuery("action", "getAccessControl", escapeValue: false); |
| | 5216 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 5217 | | if (upn != null) { |
| | 5218 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 5219 | | _request.Uri.AppendQuery("upn", upn.Value.ToString(System.Globalization.CultureInfo.InvariantCulture).To |
| | 5220 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 5221 | | } |
| | 5222 | |
|
| | 5223 | | // Add request headers |
| | 5224 | | _request.Headers.SetValue("x-ms-version", version); |
| | 5225 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 5226 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 5227 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 5228 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 5229 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 5230 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 5231 | |
|
| | 5232 | | return _message; |
| | 5233 | | } |
| | 5234 | |
|
| | 5235 | | /// <summary> |
| | 5236 | | /// Create the Blob.GetAccessControlAsync response or throw a failure exception. |
| | 5237 | | /// </summary> |
| | 5238 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 5239 | | /// <param name="response">The raw Response.</param> |
| | 5240 | | /// <returns>The Blob.GetAccessControlAsync Azure.Response{Azure.Storage.Blobs.Models.BlobGetAccessControlRe |
| | 5241 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobGetAccessControlResult> GetAccessControlAsync_ |
| | 5242 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5243 | | Azure.Response response) |
| | 5244 | | { |
| | 5245 | | // Process the response |
| | 5246 | | switch (response.Status) |
| | 5247 | | { |
| | 5248 | | case 200: |
| | 5249 | | { |
| | 5250 | | // Create the result |
| | 5251 | | Azure.Storage.Blobs.Models.BlobGetAccessControlResult _value = new Azure.Storage.Blobs.Models.Bl |
| | 5252 | |
|
| | 5253 | | // Get response headers |
| | 5254 | | string _header; |
| | 5255 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 5256 | | { |
| | 5257 | | _value.ETag = new Azure.ETag(_header); |
| | 5258 | | } |
| | 5259 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 5260 | | { |
| | 5261 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 5262 | | } |
| | 5263 | | if (response.Headers.TryGetValue("x-ms-owner", out _header)) |
| | 5264 | | { |
| | 5265 | | _value.XMSOwner = _header; |
| | 5266 | | } |
| | 5267 | | if (response.Headers.TryGetValue("x-ms-group", out _header)) |
| | 5268 | | { |
| | 5269 | | _value.XMSGroup = _header; |
| | 5270 | | } |
| | 5271 | | if (response.Headers.TryGetValue("x-ms-permissions", out _header)) |
| | 5272 | | { |
| | 5273 | | _value.XMSPermissions = _header; |
| | 5274 | | } |
| | 5275 | | if (response.Headers.TryGetValue("x-ms-acl", out _header)) |
| | 5276 | | { |
| | 5277 | | _value.XMSAcl = _header; |
| | 5278 | | } |
| | 5279 | |
|
| | 5280 | | // Create the response |
| | 5281 | | return Response.FromValue(_value, response); |
| | 5282 | | } |
| | 5283 | | case 304: |
| | 5284 | | { |
| | 5285 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.BlobGetAccessControlResult>(response) |
| | 5286 | | } |
| | 5287 | | default: |
| | 5288 | | { |
| | 5289 | | // Create the result |
| | 5290 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 5291 | | Azure.Storage.Blobs.Models.DataLakeStorageError _value = Azure.Storage.Blobs.Models.DataLakeStor |
| | 5292 | |
|
| | 5293 | | throw _value.CreateException(clientDiagnostics, response); |
| | 5294 | | } |
| | 5295 | | } |
| | 5296 | | } |
| | 5297 | | #endregion Blob.GetAccessControlAsync |
| | 5298 | |
|
| | 5299 | | #region Blob.RenameAsync |
| | 5300 | | /// <summary> |
| | 5301 | | /// Rename a blob/file. By default, the destination is overwritten and if the destination already exists an |
| | 5302 | | /// </summary> |
| | 5303 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 5304 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5305 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 5306 | | /// <param name="renameSource">The file or directory to be renamed. The value must have the following format |
| | 5307 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5308 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5309 | | /// <param name="pathRenameMode">Determines the behavior of the rename operation</param> |
| | 5310 | | /// <param name="directoryProperties">Optional. User-defined properties to be stored with the file or direc |
| | 5311 | | /// <param name="posixPermissions">Optional and only valid if Hierarchical Namespace is enabled for the acco |
| | 5312 | | /// <param name="posixUmask">Only valid if Hierarchical Namespace is enabled for the account. This umask res |
| | 5313 | | /// <param name="cacheControl">Cache control for given resource</param> |
| | 5314 | | /// <param name="contentType">Content type for given resource</param> |
| | 5315 | | /// <param name="contentEncoding">Content encoding for given resource</param> |
| | 5316 | | /// <param name="contentLanguage">Content language for given resource</param> |
| | 5317 | | /// <param name="contentDisposition">Content disposition for given resource</param> |
| | 5318 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 5319 | | /// <param name="sourceLeaseId">A lease ID for the source path. If specified, the source path must have an a |
| | 5320 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 5321 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 5322 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 5323 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 5324 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 5325 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 5326 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 5327 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 5328 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5329 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 5330 | | /// <param name="operationName">Operation name.</param> |
| | 5331 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 5332 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobRenameResult}</returns> |
| | 5333 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobRenameRes |
| | 5334 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5335 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5336 | | System.Uri resourceUri, |
| | 5337 | | string renameSource, |
| | 5338 | | string version, |
| | 5339 | | int? timeout = default, |
| | 5340 | | Azure.Storage.Blobs.Models.PathRenameMode? pathRenameMode = default, |
| | 5341 | | string directoryProperties = default, |
| | 5342 | | string posixPermissions = default, |
| | 5343 | | string posixUmask = default, |
| | 5344 | | string cacheControl = default, |
| | 5345 | | string contentType = default, |
| | 5346 | | string contentEncoding = default, |
| | 5347 | | string contentLanguage = default, |
| | 5348 | | string contentDisposition = default, |
| | 5349 | | string leaseId = default, |
| | 5350 | | string sourceLeaseId = default, |
| | 5351 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 5352 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 5353 | | Azure.ETag? ifMatch = default, |
| | 5354 | | Azure.ETag? ifNoneMatch = default, |
| | 5355 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 5356 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 5357 | | Azure.ETag? sourceIfMatch = default, |
| | 5358 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 5359 | | string requestId = default, |
| | 5360 | | bool async = true, |
| | 5361 | | string operationName = "BlobClient.Rename", |
| | 5362 | | System.Threading.CancellationToken cancellationToken = default) |
| | 5363 | | { |
| | 5364 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 5365 | | try |
| | 5366 | | { |
| | 5367 | | _scope.AddAttribute("url", resourceUri); |
| | 5368 | | _scope.Start(); |
| | 5369 | | using (Azure.Core.HttpMessage _message = RenameAsync_CreateMessage( |
| | 5370 | | pipeline, |
| | 5371 | | resourceUri, |
| | 5372 | | renameSource, |
| | 5373 | | version, |
| | 5374 | | timeout, |
| | 5375 | | pathRenameMode, |
| | 5376 | | directoryProperties, |
| | 5377 | | posixPermissions, |
| | 5378 | | posixUmask, |
| | 5379 | | cacheControl, |
| | 5380 | | contentType, |
| | 5381 | | contentEncoding, |
| | 5382 | | contentLanguage, |
| | 5383 | | contentDisposition, |
| | 5384 | | leaseId, |
| | 5385 | | sourceLeaseId, |
| | 5386 | | ifModifiedSince, |
| | 5387 | | ifUnmodifiedSince, |
| | 5388 | | ifMatch, |
| | 5389 | | ifNoneMatch, |
| | 5390 | | sourceIfModifiedSince, |
| | 5391 | | sourceIfUnmodifiedSince, |
| | 5392 | | sourceIfMatch, |
| | 5393 | | sourceIfNoneMatch, |
| | 5394 | | requestId)) |
| | 5395 | | { |
| | 5396 | | if (async) |
| | 5397 | | { |
| | 5398 | | // Send the request asynchronously if we're being called via an async path |
| | 5399 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 5400 | | } |
| | 5401 | | else |
| | 5402 | | { |
| | 5403 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 5404 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 5405 | | pipeline.Send(_message, cancellationToken); |
| | 5406 | | } |
| | 5407 | | Azure.Response _response = _message.Response; |
| | 5408 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 5409 | | return RenameAsync_CreateResponse(clientDiagnostics, _response); |
| | 5410 | | } |
| | 5411 | | } |
| | 5412 | | catch (System.Exception ex) |
| | 5413 | | { |
| | 5414 | | _scope.Failed(ex); |
| | 5415 | | throw; |
| | 5416 | | } |
| | 5417 | | finally |
| | 5418 | | { |
| | 5419 | | _scope.Dispose(); |
| | 5420 | | } |
| | 5421 | | } |
| | 5422 | |
|
| | 5423 | | /// <summary> |
| | 5424 | | /// Create the Blob.RenameAsync request. |
| | 5425 | | /// </summary> |
| | 5426 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5427 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 5428 | | /// <param name="renameSource">The file or directory to be renamed. The value must have the following format |
| | 5429 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5430 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5431 | | /// <param name="pathRenameMode">Determines the behavior of the rename operation</param> |
| | 5432 | | /// <param name="directoryProperties">Optional. User-defined properties to be stored with the file or direc |
| | 5433 | | /// <param name="posixPermissions">Optional and only valid if Hierarchical Namespace is enabled for the acco |
| | 5434 | | /// <param name="posixUmask">Only valid if Hierarchical Namespace is enabled for the account. This umask res |
| | 5435 | | /// <param name="cacheControl">Cache control for given resource</param> |
| | 5436 | | /// <param name="contentType">Content type for given resource</param> |
| | 5437 | | /// <param name="contentEncoding">Content encoding for given resource</param> |
| | 5438 | | /// <param name="contentLanguage">Content language for given resource</param> |
| | 5439 | | /// <param name="contentDisposition">Content disposition for given resource</param> |
| | 5440 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 5441 | | /// <param name="sourceLeaseId">A lease ID for the source path. If specified, the source path must have an a |
| | 5442 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 5443 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 5444 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 5445 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 5446 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 5447 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 5448 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 5449 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 5450 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5451 | | /// <returns>The Blob.RenameAsync Message.</returns> |
| | 5452 | | internal static Azure.Core.HttpMessage RenameAsync_CreateMessage( |
| | 5453 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5454 | | System.Uri resourceUri, |
| | 5455 | | string renameSource, |
| | 5456 | | string version, |
| | 5457 | | int? timeout = default, |
| | 5458 | | Azure.Storage.Blobs.Models.PathRenameMode? pathRenameMode = default, |
| | 5459 | | string directoryProperties = default, |
| | 5460 | | string posixPermissions = default, |
| | 5461 | | string posixUmask = default, |
| | 5462 | | string cacheControl = default, |
| | 5463 | | string contentType = default, |
| | 5464 | | string contentEncoding = default, |
| | 5465 | | string contentLanguage = default, |
| | 5466 | | string contentDisposition = default, |
| | 5467 | | string leaseId = default, |
| | 5468 | | string sourceLeaseId = default, |
| | 5469 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 5470 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 5471 | | Azure.ETag? ifMatch = default, |
| | 5472 | | Azure.ETag? ifNoneMatch = default, |
| | 5473 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 5474 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 5475 | | Azure.ETag? sourceIfMatch = default, |
| | 5476 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 5477 | | string requestId = default) |
| | 5478 | | { |
| | 5479 | | // Validation |
| | 5480 | | if (resourceUri == null) |
| | 5481 | | { |
| | 5482 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 5483 | | } |
| | 5484 | | if (renameSource == null) |
| | 5485 | | { |
| | 5486 | | throw new System.ArgumentNullException(nameof(renameSource)); |
| | 5487 | | } |
| | 5488 | | if (version == null) |
| | 5489 | | { |
| | 5490 | | throw new System.ArgumentNullException(nameof(version)); |
| | 5491 | | } |
| | 5492 | |
|
| | 5493 | | // Create the request |
| | 5494 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 5495 | | Azure.Core.Request _request = _message.Request; |
| | 5496 | |
|
| | 5497 | | // Set the endpoint |
| | 5498 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 5499 | | _request.Uri.Reset(resourceUri); |
| | 5500 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 5501 | | if (pathRenameMode != null) { _request.Uri.AppendQuery("mode", Azure.Storage.Blobs.BlobRestClient.Serial |
| | 5502 | |
|
| | 5503 | | // Add request headers |
| | 5504 | | _request.Headers.SetValue("x-ms-rename-source", renameSource); |
| | 5505 | | _request.Headers.SetValue("x-ms-version", version); |
| | 5506 | | if (directoryProperties != null) { _request.Headers.SetValue("x-ms-properties", directoryProperties); } |
| | 5507 | | if (posixPermissions != null) { _request.Headers.SetValue("x-ms-permissions", posixPermissions); } |
| | 5508 | | if (posixUmask != null) { _request.Headers.SetValue("x-ms-umask", posixUmask); } |
| | 5509 | | if (cacheControl != null) { _request.Headers.SetValue("x-ms-cache-control", cacheControl); } |
| | 5510 | | if (contentType != null) { _request.Headers.SetValue("x-ms-content-type", contentType); } |
| | 5511 | | if (contentEncoding != null) { _request.Headers.SetValue("x-ms-content-encoding", contentEncoding); } |
| | 5512 | | if (contentLanguage != null) { _request.Headers.SetValue("x-ms-content-language", contentLanguage); } |
| | 5513 | | if (contentDisposition != null) { _request.Headers.SetValue("x-ms-content-disposition", contentDispositi |
| | 5514 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 5515 | | if (sourceLeaseId != null) { _request.Headers.SetValue("x-ms-source-lease-id", sourceLeaseId); } |
| | 5516 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 5517 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 5518 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 5519 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 5520 | | if (sourceIfModifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-modified-since", sourceIf |
| | 5521 | | if (sourceIfUnmodifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-unmodified-since", sour |
| | 5522 | | if (sourceIfMatch != null) { _request.Headers.SetValue("x-ms-source-if-match", sourceIfMatch.Value.ToStr |
| | 5523 | | if (sourceIfNoneMatch != null) { _request.Headers.SetValue("x-ms-source-if-none-match", sourceIfNoneMatc |
| | 5524 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 5525 | |
|
| | 5526 | | return _message; |
| | 5527 | | } |
| | 5528 | |
|
| | 5529 | | /// <summary> |
| | 5530 | | /// Create the Blob.RenameAsync response or throw a failure exception. |
| | 5531 | | /// </summary> |
| | 5532 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 5533 | | /// <param name="response">The raw Response.</param> |
| | 5534 | | /// <returns>The Blob.RenameAsync Azure.Response{Azure.Storage.Blobs.Models.BlobRenameResult}.</returns> |
| | 5535 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobRenameResult> RenameAsync_CreateResponse( |
| | 5536 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5537 | | Azure.Response response) |
| | 5538 | | { |
| | 5539 | | // Process the response |
| | 5540 | | switch (response.Status) |
| | 5541 | | { |
| | 5542 | | case 201: |
| | 5543 | | { |
| | 5544 | | // Create the result |
| | 5545 | | Azure.Storage.Blobs.Models.BlobRenameResult _value = new Azure.Storage.Blobs.Models.BlobRenameRe |
| | 5546 | |
|
| | 5547 | | // Get response headers |
| | 5548 | | string _header; |
| | 5549 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 5550 | | { |
| | 5551 | | _value.ETag = new Azure.ETag(_header); |
| | 5552 | | } |
| | 5553 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 5554 | | { |
| | 5555 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 5556 | | } |
| | 5557 | | if (response.Headers.TryGetValue("Content-Length", out _header)) |
| | 5558 | | { |
| | 5559 | | _value.ContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture |
| | 5560 | | } |
| | 5561 | |
|
| | 5562 | | // Create the response |
| | 5563 | | return Response.FromValue(_value, response); |
| | 5564 | | } |
| | 5565 | | default: |
| | 5566 | | { |
| | 5567 | | // Create the result |
| | 5568 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 5569 | | Azure.Storage.Blobs.Models.DataLakeStorageError _value = Azure.Storage.Blobs.Models.DataLakeStor |
| | 5570 | |
|
| | 5571 | | throw _value.CreateException(clientDiagnostics, response); |
| | 5572 | | } |
| | 5573 | | } |
| | 5574 | | } |
| | 5575 | | #endregion Blob.RenameAsync |
| | 5576 | |
|
| | 5577 | | #region Blob.UndeleteAsync |
| | 5578 | | /// <summary> |
| | 5579 | | /// Undelete a blob that was previously soft deleted |
| | 5580 | | /// </summary> |
| | 5581 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 5582 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5583 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 5584 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5585 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5586 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5587 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 5588 | | /// <param name="operationName">Operation name.</param> |
| | 5589 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 5590 | | /// <returns>Azure.Response</returns> |
| | 5591 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> UndeleteAsync( |
| | 5592 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5593 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5594 | | System.Uri resourceUri, |
| | 5595 | | string version, |
| | 5596 | | int? timeout = default, |
| | 5597 | | string requestId = default, |
| | 5598 | | bool async = true, |
| | 5599 | | string operationName = "BlobClient.Undelete", |
| | 5600 | | System.Threading.CancellationToken cancellationToken = default) |
| | 5601 | | { |
| | 5602 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 5603 | | try |
| | 5604 | | { |
| | 5605 | | _scope.AddAttribute("url", resourceUri); |
| | 5606 | | _scope.Start(); |
| | 5607 | | using (Azure.Core.HttpMessage _message = UndeleteAsync_CreateMessage( |
| | 5608 | | pipeline, |
| | 5609 | | resourceUri, |
| | 5610 | | version, |
| | 5611 | | timeout, |
| | 5612 | | requestId)) |
| | 5613 | | { |
| | 5614 | | if (async) |
| | 5615 | | { |
| | 5616 | | // Send the request asynchronously if we're being called via an async path |
| | 5617 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 5618 | | } |
| | 5619 | | else |
| | 5620 | | { |
| | 5621 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 5622 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 5623 | | pipeline.Send(_message, cancellationToken); |
| | 5624 | | } |
| | 5625 | | Azure.Response _response = _message.Response; |
| | 5626 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 5627 | | return UndeleteAsync_CreateResponse(clientDiagnostics, _response); |
| | 5628 | | } |
| | 5629 | | } |
| | 5630 | | catch (System.Exception ex) |
| | 5631 | | { |
| | 5632 | | _scope.Failed(ex); |
| | 5633 | | throw; |
| | 5634 | | } |
| | 5635 | | finally |
| | 5636 | | { |
| | 5637 | | _scope.Dispose(); |
| | 5638 | | } |
| | 5639 | | } |
| | 5640 | |
|
| | 5641 | | /// <summary> |
| | 5642 | | /// Create the Blob.UndeleteAsync request. |
| | 5643 | | /// </summary> |
| | 5644 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5645 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 5646 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5647 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5648 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5649 | | /// <returns>The Blob.UndeleteAsync Message.</returns> |
| | 5650 | | internal static Azure.Core.HttpMessage UndeleteAsync_CreateMessage( |
| | 5651 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5652 | | System.Uri resourceUri, |
| | 5653 | | string version, |
| | 5654 | | int? timeout = default, |
| | 5655 | | string requestId = default) |
| | 5656 | | { |
| | 5657 | | // Validation |
| | 5658 | | if (resourceUri == null) |
| | 5659 | | { |
| | 5660 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 5661 | | } |
| | 5662 | | if (version == null) |
| | 5663 | | { |
| | 5664 | | throw new System.ArgumentNullException(nameof(version)); |
| | 5665 | | } |
| | 5666 | |
|
| | 5667 | | // Create the request |
| | 5668 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 5669 | | Azure.Core.Request _request = _message.Request; |
| | 5670 | |
|
| | 5671 | | // Set the endpoint |
| | 5672 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 5673 | | _request.Uri.Reset(resourceUri); |
| | 5674 | | _request.Uri.AppendQuery("comp", "undelete", escapeValue: false); |
| | 5675 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 5676 | |
|
| | 5677 | | // Add request headers |
| | 5678 | | _request.Headers.SetValue("x-ms-version", version); |
| | 5679 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 5680 | |
|
| | 5681 | | return _message; |
| | 5682 | | } |
| | 5683 | |
|
| | 5684 | | /// <summary> |
| | 5685 | | /// Create the Blob.UndeleteAsync response or throw a failure exception. |
| | 5686 | | /// </summary> |
| | 5687 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 5688 | | /// <param name="response">The raw Response.</param> |
| | 5689 | | /// <returns>The Blob.UndeleteAsync Azure.Response.</returns> |
| | 5690 | | internal static Azure.Response UndeleteAsync_CreateResponse( |
| | 5691 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5692 | | Azure.Response response) |
| | 5693 | | { |
| | 5694 | | // Process the response |
| | 5695 | | switch (response.Status) |
| | 5696 | | { |
| | 5697 | | case 200: |
| | 5698 | | { |
| | 5699 | | return response; |
| | 5700 | | } |
| | 5701 | | default: |
| | 5702 | | { |
| | 5703 | | // Create the result |
| | 5704 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 5705 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 5706 | |
|
| | 5707 | | throw _value.CreateException(clientDiagnostics, response); |
| | 5708 | | } |
| | 5709 | | } |
| | 5710 | | } |
| | 5711 | | #endregion Blob.UndeleteAsync |
| | 5712 | |
|
| | 5713 | | #region Blob.SetExpiryAsync |
| | 5714 | | /// <summary> |
| | 5715 | | /// Sets the time a blob will expire and be deleted. |
| | 5716 | | /// </summary> |
| | 5717 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 5718 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5719 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 5720 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5721 | | /// <param name="expiryOptions">Required. Indicates mode of the expiry time</param> |
| | 5722 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5723 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5724 | | /// <param name="expiresOn">The time to set the blob to expiry</param> |
| | 5725 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 5726 | | /// <param name="operationName">Operation name.</param> |
| | 5727 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 5728 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobSetExpiryInternal}</returns> |
| | 5729 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobSetExpiry |
| | 5730 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5731 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5732 | | System.Uri resourceUri, |
| | 5733 | | string version, |
| | 5734 | | Azure.Storage.Blobs.Models.BlobExpiryOptions expiryOptions, |
| | 5735 | | int? timeout = default, |
| | 5736 | | string requestId = default, |
| | 5737 | | string expiresOn = default, |
| | 5738 | | bool async = true, |
| | 5739 | | string operationName = "BlobClient.SetExpiry", |
| | 5740 | | System.Threading.CancellationToken cancellationToken = default) |
| | 5741 | | { |
| | 5742 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 5743 | | try |
| | 5744 | | { |
| | 5745 | | _scope.AddAttribute("url", resourceUri); |
| | 5746 | | _scope.Start(); |
| | 5747 | | using (Azure.Core.HttpMessage _message = SetExpiryAsync_CreateMessage( |
| | 5748 | | pipeline, |
| | 5749 | | resourceUri, |
| | 5750 | | version, |
| | 5751 | | expiryOptions, |
| | 5752 | | timeout, |
| | 5753 | | requestId, |
| | 5754 | | expiresOn)) |
| | 5755 | | { |
| | 5756 | | if (async) |
| | 5757 | | { |
| | 5758 | | // Send the request asynchronously if we're being called via an async path |
| | 5759 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 5760 | | } |
| | 5761 | | else |
| | 5762 | | { |
| | 5763 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 5764 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 5765 | | pipeline.Send(_message, cancellationToken); |
| | 5766 | | } |
| | 5767 | | Azure.Response _response = _message.Response; |
| | 5768 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 5769 | | return SetExpiryAsync_CreateResponse(clientDiagnostics, _response); |
| | 5770 | | } |
| | 5771 | | } |
| | 5772 | | catch (System.Exception ex) |
| | 5773 | | { |
| | 5774 | | _scope.Failed(ex); |
| | 5775 | | throw; |
| | 5776 | | } |
| | 5777 | | finally |
| | 5778 | | { |
| | 5779 | | _scope.Dispose(); |
| | 5780 | | } |
| | 5781 | | } |
| | 5782 | |
|
| | 5783 | | /// <summary> |
| | 5784 | | /// Create the Blob.SetExpiryAsync request. |
| | 5785 | | /// </summary> |
| | 5786 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5787 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 5788 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5789 | | /// <param name="expiryOptions">Required. Indicates mode of the expiry time</param> |
| | 5790 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5791 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5792 | | /// <param name="expiresOn">The time to set the blob to expiry</param> |
| | 5793 | | /// <returns>The Blob.SetExpiryAsync Message.</returns> |
| | 5794 | | internal static Azure.Core.HttpMessage SetExpiryAsync_CreateMessage( |
| | 5795 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5796 | | System.Uri resourceUri, |
| | 5797 | | string version, |
| | 5798 | | Azure.Storage.Blobs.Models.BlobExpiryOptions expiryOptions, |
| | 5799 | | int? timeout = default, |
| | 5800 | | string requestId = default, |
| | 5801 | | string expiresOn = default) |
| | 5802 | | { |
| | 5803 | | // Validation |
| | 5804 | | if (resourceUri == null) |
| | 5805 | | { |
| | 5806 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 5807 | | } |
| | 5808 | | if (version == null) |
| | 5809 | | { |
| | 5810 | | throw new System.ArgumentNullException(nameof(version)); |
| | 5811 | | } |
| | 5812 | |
|
| | 5813 | | // Create the request |
| | 5814 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 5815 | | Azure.Core.Request _request = _message.Request; |
| | 5816 | |
|
| | 5817 | | // Set the endpoint |
| | 5818 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 5819 | | _request.Uri.Reset(resourceUri); |
| | 5820 | | _request.Uri.AppendQuery("comp", "expiry", escapeValue: false); |
| | 5821 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 5822 | |
|
| | 5823 | | // Add request headers |
| | 5824 | | _request.Headers.SetValue("x-ms-version", version); |
| | 5825 | | _request.Headers.SetValue("x-ms-expiry-option", expiryOptions.ToString()); |
| | 5826 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 5827 | | if (expiresOn != null) { _request.Headers.SetValue("x-ms-expiry-time", expiresOn); } |
| | 5828 | |
|
| | 5829 | | return _message; |
| | 5830 | | } |
| | 5831 | |
|
| | 5832 | | /// <summary> |
| | 5833 | | /// Create the Blob.SetExpiryAsync response or throw a failure exception. |
| | 5834 | | /// </summary> |
| | 5835 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 5836 | | /// <param name="response">The raw Response.</param> |
| | 5837 | | /// <returns>The Blob.SetExpiryAsync Azure.Response{Azure.Storage.Blobs.Models.BlobSetExpiryInternal}.</retu |
| | 5838 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobSetExpiryInternal> SetExpiryAsync_CreateRespon |
| | 5839 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5840 | | Azure.Response response) |
| | 5841 | | { |
| | 5842 | | // Process the response |
| | 5843 | | switch (response.Status) |
| | 5844 | | { |
| | 5845 | | case 200: |
| | 5846 | | { |
| | 5847 | | // Create the result |
| | 5848 | | Azure.Storage.Blobs.Models.BlobSetExpiryInternal _value = new Azure.Storage.Blobs.Models.BlobSet |
| | 5849 | |
|
| | 5850 | | // Get response headers |
| | 5851 | | string _header; |
| | 5852 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 5853 | | { |
| | 5854 | | _value.ETag = new Azure.ETag(_header); |
| | 5855 | | } |
| | 5856 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 5857 | | { |
| | 5858 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 5859 | | } |
| | 5860 | |
|
| | 5861 | | // Create the response |
| | 5862 | | return Response.FromValue(_value, response); |
| | 5863 | | } |
| | 5864 | | default: |
| | 5865 | | { |
| | 5866 | | // Create the result |
| | 5867 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 5868 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 5869 | |
|
| | 5870 | | throw _value.CreateException(clientDiagnostics, response); |
| | 5871 | | } |
| | 5872 | | } |
| | 5873 | | } |
| | 5874 | | #endregion Blob.SetExpiryAsync |
| | 5875 | |
|
| | 5876 | | #region Blob.SetHttpHeadersAsync |
| | 5877 | | /// <summary> |
| | 5878 | | /// The Set HTTP Headers operation sets system properties on the blob |
| | 5879 | | /// </summary> |
| | 5880 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 5881 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5882 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 5883 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5884 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5885 | | /// <param name="blobCacheControl">Optional. Sets the blob's cache control. If specified, this property is s |
| | 5886 | | /// <param name="blobContentType">Optional. Sets the blob's content type. If specified, this property is sto |
| | 5887 | | /// <param name="blobContentHash">Optional. An MD5 hash of the blob content. Note that this hash is not vali |
| | 5888 | | /// <param name="blobContentEncoding">Optional. Sets the blob's content encoding. If specified, this propert |
| | 5889 | | /// <param name="blobContentLanguage">Optional. Set the blob's content language. If specified, this property |
| | 5890 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 5891 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 5892 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 5893 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 5894 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 5895 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 5896 | | /// <param name="blobContentDisposition">Optional. Sets the blob's Content-Disposition header.</param> |
| | 5897 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5898 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 5899 | | /// <param name="operationName">Operation name.</param> |
| | 5900 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 5901 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.SetHttpHeadersOperation}</returns> |
| | 5902 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.SetHttpHeader |
| | 5903 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5904 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5905 | | System.Uri resourceUri, |
| | 5906 | | string version, |
| | 5907 | | int? timeout = default, |
| | 5908 | | string blobCacheControl = default, |
| | 5909 | | string blobContentType = default, |
| | 5910 | | byte[] blobContentHash = default, |
| | 5911 | | string blobContentEncoding = default, |
| | 5912 | | string blobContentLanguage = default, |
| | 5913 | | string leaseId = default, |
| | 5914 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 5915 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 5916 | | Azure.ETag? ifMatch = default, |
| | 5917 | | Azure.ETag? ifNoneMatch = default, |
| | 5918 | | string ifTags = default, |
| | 5919 | | string blobContentDisposition = default, |
| | 5920 | | string requestId = default, |
| | 5921 | | bool async = true, |
| | 5922 | | string operationName = "BlobClient.SetHttpHeaders", |
| | 5923 | | System.Threading.CancellationToken cancellationToken = default) |
| | 5924 | | { |
| | 5925 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 5926 | | try |
| | 5927 | | { |
| | 5928 | | _scope.AddAttribute("url", resourceUri); |
| | 5929 | | _scope.Start(); |
| | 5930 | | using (Azure.Core.HttpMessage _message = SetHttpHeadersAsync_CreateMessage( |
| | 5931 | | pipeline, |
| | 5932 | | resourceUri, |
| | 5933 | | version, |
| | 5934 | | timeout, |
| | 5935 | | blobCacheControl, |
| | 5936 | | blobContentType, |
| | 5937 | | blobContentHash, |
| | 5938 | | blobContentEncoding, |
| | 5939 | | blobContentLanguage, |
| | 5940 | | leaseId, |
| | 5941 | | ifModifiedSince, |
| | 5942 | | ifUnmodifiedSince, |
| | 5943 | | ifMatch, |
| | 5944 | | ifNoneMatch, |
| | 5945 | | ifTags, |
| | 5946 | | blobContentDisposition, |
| | 5947 | | requestId)) |
| | 5948 | | { |
| | 5949 | | if (async) |
| | 5950 | | { |
| | 5951 | | // Send the request asynchronously if we're being called via an async path |
| | 5952 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 5953 | | } |
| | 5954 | | else |
| | 5955 | | { |
| | 5956 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 5957 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 5958 | | pipeline.Send(_message, cancellationToken); |
| | 5959 | | } |
| | 5960 | | Azure.Response _response = _message.Response; |
| | 5961 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 5962 | | return SetHttpHeadersAsync_CreateResponse(clientDiagnostics, _response); |
| | 5963 | | } |
| | 5964 | | } |
| | 5965 | | catch (System.Exception ex) |
| | 5966 | | { |
| | 5967 | | _scope.Failed(ex); |
| | 5968 | | throw; |
| | 5969 | | } |
| | 5970 | | finally |
| | 5971 | | { |
| | 5972 | | _scope.Dispose(); |
| | 5973 | | } |
| | 5974 | | } |
| | 5975 | |
|
| | 5976 | | /// <summary> |
| | 5977 | | /// Create the Blob.SetHttpHeadersAsync request. |
| | 5978 | | /// </summary> |
| | 5979 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5980 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 5981 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5982 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5983 | | /// <param name="blobCacheControl">Optional. Sets the blob's cache control. If specified, this property is s |
| | 5984 | | /// <param name="blobContentType">Optional. Sets the blob's content type. If specified, this property is sto |
| | 5985 | | /// <param name="blobContentHash">Optional. An MD5 hash of the blob content. Note that this hash is not vali |
| | 5986 | | /// <param name="blobContentEncoding">Optional. Sets the blob's content encoding. If specified, this propert |
| | 5987 | | /// <param name="blobContentLanguage">Optional. Set the blob's content language. If specified, this property |
| | 5988 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 5989 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 5990 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 5991 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 5992 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 5993 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 5994 | | /// <param name="blobContentDisposition">Optional. Sets the blob's Content-Disposition header.</param> |
| | 5995 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5996 | | /// <returns>The Blob.SetHttpHeadersAsync Message.</returns> |
| | 5997 | | internal static Azure.Core.HttpMessage SetHttpHeadersAsync_CreateMessage( |
| | 5998 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5999 | | System.Uri resourceUri, |
| | 6000 | | string version, |
| | 6001 | | int? timeout = default, |
| | 6002 | | string blobCacheControl = default, |
| | 6003 | | string blobContentType = default, |
| | 6004 | | byte[] blobContentHash = default, |
| | 6005 | | string blobContentEncoding = default, |
| | 6006 | | string blobContentLanguage = default, |
| | 6007 | | string leaseId = default, |
| | 6008 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 6009 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 6010 | | Azure.ETag? ifMatch = default, |
| | 6011 | | Azure.ETag? ifNoneMatch = default, |
| | 6012 | | string ifTags = default, |
| | 6013 | | string blobContentDisposition = default, |
| | 6014 | | string requestId = default) |
| | 6015 | | { |
| | 6016 | | // Validation |
| | 6017 | | if (resourceUri == null) |
| | 6018 | | { |
| | 6019 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 6020 | | } |
| | 6021 | | if (version == null) |
| | 6022 | | { |
| | 6023 | | throw new System.ArgumentNullException(nameof(version)); |
| | 6024 | | } |
| | 6025 | |
|
| | 6026 | | // Create the request |
| | 6027 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 6028 | | Azure.Core.Request _request = _message.Request; |
| | 6029 | |
|
| | 6030 | | // Set the endpoint |
| | 6031 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 6032 | | _request.Uri.Reset(resourceUri); |
| | 6033 | | _request.Uri.AppendQuery("comp", "properties", escapeValue: false); |
| | 6034 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 6035 | |
|
| | 6036 | | // Add request headers |
| | 6037 | | _request.Headers.SetValue("x-ms-version", version); |
| | 6038 | | if (blobCacheControl != null) { _request.Headers.SetValue("x-ms-blob-cache-control", blobCacheControl); |
| | 6039 | | if (blobContentType != null) { _request.Headers.SetValue("x-ms-blob-content-type", blobContentType); } |
| | 6040 | | if (blobContentHash != null) { _request.Headers.SetValue("x-ms-blob-content-md5", System.Convert.ToBase6 |
| | 6041 | | if (blobContentEncoding != null) { _request.Headers.SetValue("x-ms-blob-content-encoding", blobContentEn |
| | 6042 | | if (blobContentLanguage != null) { _request.Headers.SetValue("x-ms-blob-content-language", blobContentLa |
| | 6043 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 6044 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 6045 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 6046 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 6047 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 6048 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 6049 | | if (blobContentDisposition != null) { _request.Headers.SetValue("x-ms-blob-content-disposition", blobCon |
| | 6050 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 6051 | |
|
| | 6052 | | return _message; |
| | 6053 | | } |
| | 6054 | |
|
| | 6055 | | /// <summary> |
| | 6056 | | /// Create the Blob.SetHttpHeadersAsync response or throw a failure exception. |
| | 6057 | | /// </summary> |
| | 6058 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 6059 | | /// <param name="response">The raw Response.</param> |
| | 6060 | | /// <returns>The Blob.SetHttpHeadersAsync Azure.Response{Azure.Storage.Blobs.Models.SetHttpHeadersOperation} |
| | 6061 | | internal static Azure.Response<Azure.Storage.Blobs.Models.SetHttpHeadersOperation> SetHttpHeadersAsync_Creat |
| | 6062 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6063 | | Azure.Response response) |
| | 6064 | | { |
| | 6065 | | // Process the response |
| | 6066 | | switch (response.Status) |
| | 6067 | | { |
| | 6068 | | case 200: |
| | 6069 | | { |
| | 6070 | | // Create the result |
| | 6071 | | Azure.Storage.Blobs.Models.SetHttpHeadersOperation _value = new Azure.Storage.Blobs.Models.SetHt |
| | 6072 | |
|
| | 6073 | | // Get response headers |
| | 6074 | | string _header; |
| | 6075 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 6076 | | { |
| | 6077 | | _value.ETag = new Azure.ETag(_header); |
| | 6078 | | } |
| | 6079 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 6080 | | { |
| | 6081 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 6082 | | } |
| | 6083 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 6084 | | { |
| | 6085 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 6086 | | } |
| | 6087 | |
|
| | 6088 | | // Create the response |
| | 6089 | | return Response.FromValue(_value, response); |
| | 6090 | | } |
| | 6091 | | default: |
| | 6092 | | { |
| | 6093 | | // Create the result |
| | 6094 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6095 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 6096 | |
|
| | 6097 | | throw _value.CreateException(clientDiagnostics, response); |
| | 6098 | | } |
| | 6099 | | } |
| | 6100 | | } |
| | 6101 | | #endregion Blob.SetHttpHeadersAsync |
| | 6102 | |
|
| | 6103 | | #region Blob.SetMetadataAsync |
| | 6104 | | /// <summary> |
| | 6105 | | /// The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-va |
| | 6106 | | /// </summary> |
| | 6107 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 6108 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6109 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 6110 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6111 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6112 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 6113 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6114 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 6115 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 6116 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 6117 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 6118 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 6119 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 6120 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 6121 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 6122 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 6123 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 6124 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 6125 | | /// <param name="operationName">Operation name.</param> |
| | 6126 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 6127 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.SetMetadataOperation}</returns> |
| | 6128 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.SetMetadataOp |
| | 6129 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6130 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6131 | | System.Uri resourceUri, |
| | 6132 | | string version, |
| | 6133 | | int? timeout = default, |
| | 6134 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 6135 | | string leaseId = default, |
| | 6136 | | string encryptionKey = default, |
| | 6137 | | string encryptionKeySha256 = default, |
| | 6138 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 6139 | | string encryptionScope = default, |
| | 6140 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 6141 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 6142 | | Azure.ETag? ifMatch = default, |
| | 6143 | | Azure.ETag? ifNoneMatch = default, |
| | 6144 | | string ifTags = default, |
| | 6145 | | string requestId = default, |
| | 6146 | | bool async = true, |
| | 6147 | | string operationName = "BlobClient.SetMetadata", |
| | 6148 | | System.Threading.CancellationToken cancellationToken = default) |
| | 6149 | | { |
| | 6150 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 6151 | | try |
| | 6152 | | { |
| | 6153 | | _scope.AddAttribute("url", resourceUri); |
| | 6154 | | _scope.Start(); |
| | 6155 | | using (Azure.Core.HttpMessage _message = SetMetadataAsync_CreateMessage( |
| | 6156 | | pipeline, |
| | 6157 | | resourceUri, |
| | 6158 | | version, |
| | 6159 | | timeout, |
| | 6160 | | metadata, |
| | 6161 | | leaseId, |
| | 6162 | | encryptionKey, |
| | 6163 | | encryptionKeySha256, |
| | 6164 | | encryptionAlgorithm, |
| | 6165 | | encryptionScope, |
| | 6166 | | ifModifiedSince, |
| | 6167 | | ifUnmodifiedSince, |
| | 6168 | | ifMatch, |
| | 6169 | | ifNoneMatch, |
| | 6170 | | ifTags, |
| | 6171 | | requestId)) |
| | 6172 | | { |
| | 6173 | | if (async) |
| | 6174 | | { |
| | 6175 | | // Send the request asynchronously if we're being called via an async path |
| | 6176 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 6177 | | } |
| | 6178 | | else |
| | 6179 | | { |
| | 6180 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 6181 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 6182 | | pipeline.Send(_message, cancellationToken); |
| | 6183 | | } |
| | 6184 | | Azure.Response _response = _message.Response; |
| | 6185 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 6186 | | return SetMetadataAsync_CreateResponse(clientDiagnostics, _response); |
| | 6187 | | } |
| | 6188 | | } |
| | 6189 | | catch (System.Exception ex) |
| | 6190 | | { |
| | 6191 | | _scope.Failed(ex); |
| | 6192 | | throw; |
| | 6193 | | } |
| | 6194 | | finally |
| | 6195 | | { |
| | 6196 | | _scope.Dispose(); |
| | 6197 | | } |
| | 6198 | | } |
| | 6199 | |
|
| | 6200 | | /// <summary> |
| | 6201 | | /// Create the Blob.SetMetadataAsync request. |
| | 6202 | | /// </summary> |
| | 6203 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6204 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 6205 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6206 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6207 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 6208 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6209 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 6210 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 6211 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 6212 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 6213 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 6214 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 6215 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 6216 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 6217 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 6218 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 6219 | | /// <returns>The Blob.SetMetadataAsync Message.</returns> |
| | 6220 | | internal static Azure.Core.HttpMessage SetMetadataAsync_CreateMessage( |
| | 6221 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6222 | | System.Uri resourceUri, |
| | 6223 | | string version, |
| | 6224 | | int? timeout = default, |
| | 6225 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 6226 | | string leaseId = default, |
| | 6227 | | string encryptionKey = default, |
| | 6228 | | string encryptionKeySha256 = default, |
| | 6229 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 6230 | | string encryptionScope = default, |
| | 6231 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 6232 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 6233 | | Azure.ETag? ifMatch = default, |
| | 6234 | | Azure.ETag? ifNoneMatch = default, |
| | 6235 | | string ifTags = default, |
| | 6236 | | string requestId = default) |
| | 6237 | | { |
| | 6238 | | // Validation |
| | 6239 | | if (resourceUri == null) |
| | 6240 | | { |
| | 6241 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 6242 | | } |
| | 6243 | | if (version == null) |
| | 6244 | | { |
| | 6245 | | throw new System.ArgumentNullException(nameof(version)); |
| | 6246 | | } |
| | 6247 | |
|
| | 6248 | | // Create the request |
| | 6249 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 6250 | | Azure.Core.Request _request = _message.Request; |
| | 6251 | |
|
| | 6252 | | // Set the endpoint |
| | 6253 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 6254 | | _request.Uri.Reset(resourceUri); |
| | 6255 | | _request.Uri.AppendQuery("comp", "metadata", escapeValue: false); |
| | 6256 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 6257 | |
|
| | 6258 | | // Add request headers |
| | 6259 | | _request.Headers.SetValue("x-ms-version", version); |
| | 6260 | | if (metadata != null) { |
| | 6261 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 6262 | | { |
| | 6263 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 6264 | | } |
| | 6265 | | } |
| | 6266 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 6267 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 6268 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 6269 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 6270 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 6271 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 6272 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 6273 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 6274 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 6275 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 6276 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 6277 | |
|
| | 6278 | | return _message; |
| | 6279 | | } |
| | 6280 | |
|
| | 6281 | | /// <summary> |
| | 6282 | | /// Create the Blob.SetMetadataAsync response or throw a failure exception. |
| | 6283 | | /// </summary> |
| | 6284 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 6285 | | /// <param name="response">The raw Response.</param> |
| | 6286 | | /// <returns>The Blob.SetMetadataAsync Azure.Response{Azure.Storage.Blobs.Models.SetMetadataOperation}.</ret |
| | 6287 | | internal static Azure.Response<Azure.Storage.Blobs.Models.SetMetadataOperation> SetMetadataAsync_CreateRespo |
| | 6288 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6289 | | Azure.Response response) |
| | 6290 | | { |
| | 6291 | | // Process the response |
| | 6292 | | switch (response.Status) |
| | 6293 | | { |
| | 6294 | | case 200: |
| | 6295 | | { |
| | 6296 | | // Create the result |
| | 6297 | | Azure.Storage.Blobs.Models.SetMetadataOperation _value = new Azure.Storage.Blobs.Models.SetMetad |
| | 6298 | |
|
| | 6299 | | // Get response headers |
| | 6300 | | string _header; |
| | 6301 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 6302 | | { |
| | 6303 | | _value.ETag = new Azure.ETag(_header); |
| | 6304 | | } |
| | 6305 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 6306 | | { |
| | 6307 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 6308 | | } |
| | 6309 | | if (response.Headers.TryGetValue("x-ms-version-id", out _header)) |
| | 6310 | | { |
| | 6311 | | _value.VersionId = _header; |
| | 6312 | | } |
| | 6313 | | if (response.Headers.TryGetValue("x-ms-request-server-encrypted", out _header)) |
| | 6314 | | { |
| | 6315 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 6316 | | } |
| | 6317 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 6318 | | { |
| | 6319 | | _value.EncryptionKeySha256 = _header; |
| | 6320 | | } |
| | 6321 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 6322 | | { |
| | 6323 | | _value.EncryptionScope = _header; |
| | 6324 | | } |
| | 6325 | |
|
| | 6326 | | // Create the response |
| | 6327 | | return Response.FromValue(_value, response); |
| | 6328 | | } |
| | 6329 | | default: |
| | 6330 | | { |
| | 6331 | | // Create the result |
| | 6332 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6333 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 6334 | |
|
| | 6335 | | throw _value.CreateException(clientDiagnostics, response); |
| | 6336 | | } |
| | 6337 | | } |
| | 6338 | | } |
| | 6339 | | #endregion Blob.SetMetadataAsync |
| | 6340 | |
|
| | 6341 | | #region Blob.AcquireLeaseAsync |
| | 6342 | | /// <summary> |
| | 6343 | | /// [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operatio |
| | 6344 | | /// </summary> |
| | 6345 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 6346 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6347 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 6348 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6349 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6350 | | /// <param name="duration">Specifies the duration of the lease, in seconds, or negative one (-1) for a lease |
| | 6351 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The Blob service returns 400 ( |
| | 6352 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 6353 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 6354 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 6355 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 6356 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 6357 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 6358 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 6359 | | /// <param name="operationName">Operation name.</param> |
| | 6360 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 6361 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobLease}</returns> |
| | 6362 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>> A |
| | 6363 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6364 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6365 | | System.Uri resourceUri, |
| | 6366 | | string version, |
| | 6367 | | int? timeout = default, |
| | 6368 | | long? duration = default, |
| | 6369 | | string proposedLeaseId = default, |
| | 6370 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 6371 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 6372 | | Azure.ETag? ifMatch = default, |
| | 6373 | | Azure.ETag? ifNoneMatch = default, |
| | 6374 | | string ifTags = default, |
| | 6375 | | string requestId = default, |
| | 6376 | | bool async = true, |
| | 6377 | | string operationName = "BlobClient.AcquireLease", |
| | 6378 | | System.Threading.CancellationToken cancellationToken = default) |
| | 6379 | | { |
| | 6380 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 6381 | | try |
| | 6382 | | { |
| | 6383 | | _scope.AddAttribute("url", resourceUri); |
| | 6384 | | _scope.Start(); |
| | 6385 | | using (Azure.Core.HttpMessage _message = AcquireLeaseAsync_CreateMessage( |
| | 6386 | | pipeline, |
| | 6387 | | resourceUri, |
| | 6388 | | version, |
| | 6389 | | timeout, |
| | 6390 | | duration, |
| | 6391 | | proposedLeaseId, |
| | 6392 | | ifModifiedSince, |
| | 6393 | | ifUnmodifiedSince, |
| | 6394 | | ifMatch, |
| | 6395 | | ifNoneMatch, |
| | 6396 | | ifTags, |
| | 6397 | | requestId)) |
| | 6398 | | { |
| | 6399 | | if (async) |
| | 6400 | | { |
| | 6401 | | // Send the request asynchronously if we're being called via an async path |
| | 6402 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 6403 | | } |
| | 6404 | | else |
| | 6405 | | { |
| | 6406 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 6407 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 6408 | | pipeline.Send(_message, cancellationToken); |
| | 6409 | | } |
| | 6410 | | Azure.Response _response = _message.Response; |
| | 6411 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 6412 | | return AcquireLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 6413 | | } |
| | 6414 | | } |
| | 6415 | | catch (System.Exception ex) |
| | 6416 | | { |
| | 6417 | | _scope.Failed(ex); |
| | 6418 | | throw; |
| | 6419 | | } |
| | 6420 | | finally |
| | 6421 | | { |
| | 6422 | | _scope.Dispose(); |
| | 6423 | | } |
| | 6424 | | } |
| | 6425 | |
|
| | 6426 | | /// <summary> |
| | 6427 | | /// Create the Blob.AcquireLeaseAsync request. |
| | 6428 | | /// </summary> |
| | 6429 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6430 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 6431 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6432 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6433 | | /// <param name="duration">Specifies the duration of the lease, in seconds, or negative one (-1) for a lease |
| | 6434 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The Blob service returns 400 ( |
| | 6435 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 6436 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 6437 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 6438 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 6439 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 6440 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 6441 | | /// <returns>The Blob.AcquireLeaseAsync Message.</returns> |
| | 6442 | | internal static Azure.Core.HttpMessage AcquireLeaseAsync_CreateMessage( |
| | 6443 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6444 | | System.Uri resourceUri, |
| | 6445 | | string version, |
| | 6446 | | int? timeout = default, |
| | 6447 | | long? duration = default, |
| | 6448 | | string proposedLeaseId = default, |
| | 6449 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 6450 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 6451 | | Azure.ETag? ifMatch = default, |
| | 6452 | | Azure.ETag? ifNoneMatch = default, |
| | 6453 | | string ifTags = default, |
| | 6454 | | string requestId = default) |
| | 6455 | | { |
| | 6456 | | // Validation |
| | 6457 | | if (resourceUri == null) |
| | 6458 | | { |
| | 6459 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 6460 | | } |
| | 6461 | | if (version == null) |
| | 6462 | | { |
| | 6463 | | throw new System.ArgumentNullException(nameof(version)); |
| | 6464 | | } |
| | 6465 | |
|
| | 6466 | | // Create the request |
| | 6467 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 6468 | | Azure.Core.Request _request = _message.Request; |
| | 6469 | |
|
| | 6470 | | // Set the endpoint |
| | 6471 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 6472 | | _request.Uri.Reset(resourceUri); |
| | 6473 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 6474 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 6475 | |
|
| | 6476 | | // Add request headers |
| | 6477 | | _request.Headers.SetValue("x-ms-lease-action", "acquire"); |
| | 6478 | | _request.Headers.SetValue("x-ms-version", version); |
| | 6479 | | if (duration != null) { _request.Headers.SetValue("x-ms-lease-duration", duration.Value.ToString(System. |
| | 6480 | | if (proposedLeaseId != null) { _request.Headers.SetValue("x-ms-proposed-lease-id", proposedLeaseId); } |
| | 6481 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 6482 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 6483 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 6484 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 6485 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 6486 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 6487 | |
|
| | 6488 | | return _message; |
| | 6489 | | } |
| | 6490 | |
|
| | 6491 | | /// <summary> |
| | 6492 | | /// Create the Blob.AcquireLeaseAsync response or throw a failure exception. |
| | 6493 | | /// </summary> |
| | 6494 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 6495 | | /// <param name="response">The raw Response.</param> |
| | 6496 | | /// <returns>The Blob.AcquireLeaseAsync Azure.Response{Azure.Storage.Blobs.Models.BlobLease}.</returns> |
| | 6497 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobLease> AcquireLeaseAsync_CreateResponse( |
| | 6498 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6499 | | Azure.Response response) |
| | 6500 | | { |
| | 6501 | | // Process the response |
| | 6502 | | switch (response.Status) |
| | 6503 | | { |
| | 6504 | | case 201: |
| | 6505 | | { |
| | 6506 | | // Create the result |
| | 6507 | | Azure.Storage.Blobs.Models.BlobLease _value = new Azure.Storage.Blobs.Models.BlobLease(); |
| | 6508 | |
|
| | 6509 | | // Get response headers |
| | 6510 | | string _header; |
| | 6511 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 6512 | | { |
| | 6513 | | _value.ETag = new Azure.ETag(_header); |
| | 6514 | | } |
| | 6515 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 6516 | | { |
| | 6517 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 6518 | | } |
| | 6519 | | if (response.Headers.TryGetValue("x-ms-lease-id", out _header)) |
| | 6520 | | { |
| | 6521 | | _value.LeaseId = _header; |
| | 6522 | | } |
| | 6523 | |
|
| | 6524 | | // Create the response |
| | 6525 | | return Response.FromValue(_value, response); |
| | 6526 | | } |
| | 6527 | | default: |
| | 6528 | | { |
| | 6529 | | // Create the result |
| | 6530 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6531 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 6532 | |
|
| | 6533 | | throw _value.CreateException(clientDiagnostics, response); |
| | 6534 | | } |
| | 6535 | | } |
| | 6536 | | } |
| | 6537 | | #endregion Blob.AcquireLeaseAsync |
| | 6538 | |
|
| | 6539 | | #region Blob.ReleaseLeaseAsync |
| | 6540 | | /// <summary> |
| | 6541 | | /// [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operatio |
| | 6542 | | /// </summary> |
| | 6543 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 6544 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6545 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 6546 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 6547 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6548 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6549 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 6550 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 6551 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 6552 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 6553 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 6554 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 6555 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 6556 | | /// <param name="operationName">Operation name.</param> |
| | 6557 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 6558 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobInfo}</returns> |
| | 6559 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobInfo>> Re |
| | 6560 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6561 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6562 | | System.Uri resourceUri, |
| | 6563 | | string leaseId, |
| | 6564 | | string version, |
| | 6565 | | int? timeout = default, |
| | 6566 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 6567 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 6568 | | Azure.ETag? ifMatch = default, |
| | 6569 | | Azure.ETag? ifNoneMatch = default, |
| | 6570 | | string ifTags = default, |
| | 6571 | | string requestId = default, |
| | 6572 | | bool async = true, |
| | 6573 | | string operationName = "BlobClient.ReleaseLease", |
| | 6574 | | System.Threading.CancellationToken cancellationToken = default) |
| | 6575 | | { |
| | 6576 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 6577 | | try |
| | 6578 | | { |
| | 6579 | | _scope.AddAttribute("url", resourceUri); |
| | 6580 | | _scope.Start(); |
| | 6581 | | using (Azure.Core.HttpMessage _message = ReleaseLeaseAsync_CreateMessage( |
| | 6582 | | pipeline, |
| | 6583 | | resourceUri, |
| | 6584 | | leaseId, |
| | 6585 | | version, |
| | 6586 | | timeout, |
| | 6587 | | ifModifiedSince, |
| | 6588 | | ifUnmodifiedSince, |
| | 6589 | | ifMatch, |
| | 6590 | | ifNoneMatch, |
| | 6591 | | ifTags, |
| | 6592 | | requestId)) |
| | 6593 | | { |
| | 6594 | | if (async) |
| | 6595 | | { |
| | 6596 | | // Send the request asynchronously if we're being called via an async path |
| | 6597 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 6598 | | } |
| | 6599 | | else |
| | 6600 | | { |
| | 6601 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 6602 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 6603 | | pipeline.Send(_message, cancellationToken); |
| | 6604 | | } |
| | 6605 | | Azure.Response _response = _message.Response; |
| | 6606 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 6607 | | return ReleaseLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 6608 | | } |
| | 6609 | | } |
| | 6610 | | catch (System.Exception ex) |
| | 6611 | | { |
| | 6612 | | _scope.Failed(ex); |
| | 6613 | | throw; |
| | 6614 | | } |
| | 6615 | | finally |
| | 6616 | | { |
| | 6617 | | _scope.Dispose(); |
| | 6618 | | } |
| | 6619 | | } |
| | 6620 | |
|
| | 6621 | | /// <summary> |
| | 6622 | | /// Create the Blob.ReleaseLeaseAsync request. |
| | 6623 | | /// </summary> |
| | 6624 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6625 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 6626 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 6627 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6628 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6629 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 6630 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 6631 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 6632 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 6633 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 6634 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 6635 | | /// <returns>The Blob.ReleaseLeaseAsync Message.</returns> |
| | 6636 | | internal static Azure.Core.HttpMessage ReleaseLeaseAsync_CreateMessage( |
| | 6637 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6638 | | System.Uri resourceUri, |
| | 6639 | | string leaseId, |
| | 6640 | | string version, |
| | 6641 | | int? timeout = default, |
| | 6642 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 6643 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 6644 | | Azure.ETag? ifMatch = default, |
| | 6645 | | Azure.ETag? ifNoneMatch = default, |
| | 6646 | | string ifTags = default, |
| | 6647 | | string requestId = default) |
| | 6648 | | { |
| | 6649 | | // Validation |
| | 6650 | | if (resourceUri == null) |
| | 6651 | | { |
| | 6652 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 6653 | | } |
| | 6654 | | if (leaseId == null) |
| | 6655 | | { |
| | 6656 | | throw new System.ArgumentNullException(nameof(leaseId)); |
| | 6657 | | } |
| | 6658 | | if (version == null) |
| | 6659 | | { |
| | 6660 | | throw new System.ArgumentNullException(nameof(version)); |
| | 6661 | | } |
| | 6662 | |
|
| | 6663 | | // Create the request |
| | 6664 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 6665 | | Azure.Core.Request _request = _message.Request; |
| | 6666 | |
|
| | 6667 | | // Set the endpoint |
| | 6668 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 6669 | | _request.Uri.Reset(resourceUri); |
| | 6670 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 6671 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 6672 | |
|
| | 6673 | | // Add request headers |
| | 6674 | | _request.Headers.SetValue("x-ms-lease-action", "release"); |
| | 6675 | | _request.Headers.SetValue("x-ms-lease-id", leaseId); |
| | 6676 | | _request.Headers.SetValue("x-ms-version", version); |
| | 6677 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 6678 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 6679 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 6680 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 6681 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 6682 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 6683 | |
|
| | 6684 | | return _message; |
| | 6685 | | } |
| | 6686 | |
|
| | 6687 | | /// <summary> |
| | 6688 | | /// Create the Blob.ReleaseLeaseAsync response or throw a failure exception. |
| | 6689 | | /// </summary> |
| | 6690 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 6691 | | /// <param name="response">The raw Response.</param> |
| | 6692 | | /// <returns>The Blob.ReleaseLeaseAsync Azure.Response{Azure.Storage.Blobs.Models.BlobInfo}.</returns> |
| | 6693 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobInfo> ReleaseLeaseAsync_CreateResponse( |
| | 6694 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6695 | | Azure.Response response) |
| | 6696 | | { |
| | 6697 | | // Process the response |
| | 6698 | | switch (response.Status) |
| | 6699 | | { |
| | 6700 | | case 200: |
| | 6701 | | { |
| | 6702 | | // Create the result |
| | 6703 | | Azure.Storage.Blobs.Models.BlobInfo _value = new Azure.Storage.Blobs.Models.BlobInfo(); |
| | 6704 | |
|
| | 6705 | | // Get response headers |
| | 6706 | | string _header; |
| | 6707 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 6708 | | { |
| | 6709 | | _value.ETag = new Azure.ETag(_header); |
| | 6710 | | } |
| | 6711 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 6712 | | { |
| | 6713 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 6714 | | } |
| | 6715 | |
|
| | 6716 | | // Create the response |
| | 6717 | | return Response.FromValue(_value, response); |
| | 6718 | | } |
| | 6719 | | default: |
| | 6720 | | { |
| | 6721 | | // Create the result |
| | 6722 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6723 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 6724 | |
|
| | 6725 | | throw _value.CreateException(clientDiagnostics, response); |
| | 6726 | | } |
| | 6727 | | } |
| | 6728 | | } |
| | 6729 | | #endregion Blob.ReleaseLeaseAsync |
| | 6730 | |
|
| | 6731 | | #region Blob.RenewLeaseAsync |
| | 6732 | | /// <summary> |
| | 6733 | | /// [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operatio |
| | 6734 | | /// </summary> |
| | 6735 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 6736 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6737 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 6738 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 6739 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6740 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6741 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 6742 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 6743 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 6744 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 6745 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 6746 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 6747 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 6748 | | /// <param name="operationName">Operation name.</param> |
| | 6749 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 6750 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobLease}</returns> |
| | 6751 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>> R |
| | 6752 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6753 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6754 | | System.Uri resourceUri, |
| | 6755 | | string leaseId, |
| | 6756 | | string version, |
| | 6757 | | int? timeout = default, |
| | 6758 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 6759 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 6760 | | Azure.ETag? ifMatch = default, |
| | 6761 | | Azure.ETag? ifNoneMatch = default, |
| | 6762 | | string ifTags = default, |
| | 6763 | | string requestId = default, |
| | 6764 | | bool async = true, |
| | 6765 | | string operationName = "BlobClient.RenewLease", |
| | 6766 | | System.Threading.CancellationToken cancellationToken = default) |
| | 6767 | | { |
| | 6768 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 6769 | | try |
| | 6770 | | { |
| | 6771 | | _scope.AddAttribute("url", resourceUri); |
| | 6772 | | _scope.Start(); |
| | 6773 | | using (Azure.Core.HttpMessage _message = RenewLeaseAsync_CreateMessage( |
| | 6774 | | pipeline, |
| | 6775 | | resourceUri, |
| | 6776 | | leaseId, |
| | 6777 | | version, |
| | 6778 | | timeout, |
| | 6779 | | ifModifiedSince, |
| | 6780 | | ifUnmodifiedSince, |
| | 6781 | | ifMatch, |
| | 6782 | | ifNoneMatch, |
| | 6783 | | ifTags, |
| | 6784 | | requestId)) |
| | 6785 | | { |
| | 6786 | | if (async) |
| | 6787 | | { |
| | 6788 | | // Send the request asynchronously if we're being called via an async path |
| | 6789 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 6790 | | } |
| | 6791 | | else |
| | 6792 | | { |
| | 6793 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 6794 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 6795 | | pipeline.Send(_message, cancellationToken); |
| | 6796 | | } |
| | 6797 | | Azure.Response _response = _message.Response; |
| | 6798 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 6799 | | return RenewLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 6800 | | } |
| | 6801 | | } |
| | 6802 | | catch (System.Exception ex) |
| | 6803 | | { |
| | 6804 | | _scope.Failed(ex); |
| | 6805 | | throw; |
| | 6806 | | } |
| | 6807 | | finally |
| | 6808 | | { |
| | 6809 | | _scope.Dispose(); |
| | 6810 | | } |
| | 6811 | | } |
| | 6812 | |
|
| | 6813 | | /// <summary> |
| | 6814 | | /// Create the Blob.RenewLeaseAsync request. |
| | 6815 | | /// </summary> |
| | 6816 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6817 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 6818 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 6819 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6820 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6821 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 6822 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 6823 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 6824 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 6825 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 6826 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 6827 | | /// <returns>The Blob.RenewLeaseAsync Message.</returns> |
| | 6828 | | internal static Azure.Core.HttpMessage RenewLeaseAsync_CreateMessage( |
| | 6829 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6830 | | System.Uri resourceUri, |
| | 6831 | | string leaseId, |
| | 6832 | | string version, |
| | 6833 | | int? timeout = default, |
| | 6834 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 6835 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 6836 | | Azure.ETag? ifMatch = default, |
| | 6837 | | Azure.ETag? ifNoneMatch = default, |
| | 6838 | | string ifTags = default, |
| | 6839 | | string requestId = default) |
| | 6840 | | { |
| | 6841 | | // Validation |
| | 6842 | | if (resourceUri == null) |
| | 6843 | | { |
| | 6844 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 6845 | | } |
| | 6846 | | if (leaseId == null) |
| | 6847 | | { |
| | 6848 | | throw new System.ArgumentNullException(nameof(leaseId)); |
| | 6849 | | } |
| | 6850 | | if (version == null) |
| | 6851 | | { |
| | 6852 | | throw new System.ArgumentNullException(nameof(version)); |
| | 6853 | | } |
| | 6854 | |
|
| | 6855 | | // Create the request |
| | 6856 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 6857 | | Azure.Core.Request _request = _message.Request; |
| | 6858 | |
|
| | 6859 | | // Set the endpoint |
| | 6860 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 6861 | | _request.Uri.Reset(resourceUri); |
| | 6862 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 6863 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 6864 | |
|
| | 6865 | | // Add request headers |
| | 6866 | | _request.Headers.SetValue("x-ms-lease-action", "renew"); |
| | 6867 | | _request.Headers.SetValue("x-ms-lease-id", leaseId); |
| | 6868 | | _request.Headers.SetValue("x-ms-version", version); |
| | 6869 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 6870 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 6871 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 6872 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 6873 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 6874 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 6875 | |
|
| | 6876 | | return _message; |
| | 6877 | | } |
| | 6878 | |
|
| | 6879 | | /// <summary> |
| | 6880 | | /// Create the Blob.RenewLeaseAsync response or throw a failure exception. |
| | 6881 | | /// </summary> |
| | 6882 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 6883 | | /// <param name="response">The raw Response.</param> |
| | 6884 | | /// <returns>The Blob.RenewLeaseAsync Azure.Response{Azure.Storage.Blobs.Models.BlobLease}.</returns> |
| | 6885 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobLease> RenewLeaseAsync_CreateResponse( |
| | 6886 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6887 | | Azure.Response response) |
| | 6888 | | { |
| | 6889 | | // Process the response |
| | 6890 | | switch (response.Status) |
| | 6891 | | { |
| | 6892 | | case 200: |
| | 6893 | | { |
| | 6894 | | // Create the result |
| | 6895 | | Azure.Storage.Blobs.Models.BlobLease _value = new Azure.Storage.Blobs.Models.BlobLease(); |
| | 6896 | |
|
| | 6897 | | // Get response headers |
| | 6898 | | string _header; |
| | 6899 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 6900 | | { |
| | 6901 | | _value.ETag = new Azure.ETag(_header); |
| | 6902 | | } |
| | 6903 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 6904 | | { |
| | 6905 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 6906 | | } |
| | 6907 | | if (response.Headers.TryGetValue("x-ms-lease-id", out _header)) |
| | 6908 | | { |
| | 6909 | | _value.LeaseId = _header; |
| | 6910 | | } |
| | 6911 | |
|
| | 6912 | | // Create the response |
| | 6913 | | return Response.FromValue(_value, response); |
| | 6914 | | } |
| | 6915 | | default: |
| | 6916 | | { |
| | 6917 | | // Create the result |
| | 6918 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6919 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 6920 | |
|
| | 6921 | | throw _value.CreateException(clientDiagnostics, response); |
| | 6922 | | } |
| | 6923 | | } |
| | 6924 | | } |
| | 6925 | | #endregion Blob.RenewLeaseAsync |
| | 6926 | |
|
| | 6927 | | #region Blob.ChangeLeaseAsync |
| | 6928 | | /// <summary> |
| | 6929 | | /// [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operatio |
| | 6930 | | /// </summary> |
| | 6931 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 6932 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6933 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 6934 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 6935 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The Blob service returns 400 ( |
| | 6936 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6937 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6938 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 6939 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 6940 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 6941 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 6942 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 6943 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 6944 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 6945 | | /// <param name="operationName">Operation name.</param> |
| | 6946 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 6947 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobLease}</returns> |
| | 6948 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobLease>> C |
| | 6949 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6950 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6951 | | System.Uri resourceUri, |
| | 6952 | | string leaseId, |
| | 6953 | | string proposedLeaseId, |
| | 6954 | | string version, |
| | 6955 | | int? timeout = default, |
| | 6956 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 6957 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 6958 | | Azure.ETag? ifMatch = default, |
| | 6959 | | Azure.ETag? ifNoneMatch = default, |
| | 6960 | | string ifTags = default, |
| | 6961 | | string requestId = default, |
| | 6962 | | bool async = true, |
| | 6963 | | string operationName = "BlobClient.ChangeLease", |
| | 6964 | | System.Threading.CancellationToken cancellationToken = default) |
| | 6965 | | { |
| | 6966 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 6967 | | try |
| | 6968 | | { |
| | 6969 | | _scope.AddAttribute("url", resourceUri); |
| | 6970 | | _scope.Start(); |
| | 6971 | | using (Azure.Core.HttpMessage _message = ChangeLeaseAsync_CreateMessage( |
| | 6972 | | pipeline, |
| | 6973 | | resourceUri, |
| | 6974 | | leaseId, |
| | 6975 | | proposedLeaseId, |
| | 6976 | | version, |
| | 6977 | | timeout, |
| | 6978 | | ifModifiedSince, |
| | 6979 | | ifUnmodifiedSince, |
| | 6980 | | ifMatch, |
| | 6981 | | ifNoneMatch, |
| | 6982 | | ifTags, |
| | 6983 | | requestId)) |
| | 6984 | | { |
| | 6985 | | if (async) |
| | 6986 | | { |
| | 6987 | | // Send the request asynchronously if we're being called via an async path |
| | 6988 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 6989 | | } |
| | 6990 | | else |
| | 6991 | | { |
| | 6992 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 6993 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 6994 | | pipeline.Send(_message, cancellationToken); |
| | 6995 | | } |
| | 6996 | | Azure.Response _response = _message.Response; |
| | 6997 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 6998 | | return ChangeLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 6999 | | } |
| | 7000 | | } |
| | 7001 | | catch (System.Exception ex) |
| | 7002 | | { |
| | 7003 | | _scope.Failed(ex); |
| | 7004 | | throw; |
| | 7005 | | } |
| | 7006 | | finally |
| | 7007 | | { |
| | 7008 | | _scope.Dispose(); |
| | 7009 | | } |
| | 7010 | | } |
| | 7011 | |
|
| | 7012 | | /// <summary> |
| | 7013 | | /// Create the Blob.ChangeLeaseAsync request. |
| | 7014 | | /// </summary> |
| | 7015 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7016 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 7017 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 7018 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The Blob service returns 400 ( |
| | 7019 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7020 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7021 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 7022 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 7023 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 7024 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 7025 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 7026 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 7027 | | /// <returns>The Blob.ChangeLeaseAsync Message.</returns> |
| | 7028 | | internal static Azure.Core.HttpMessage ChangeLeaseAsync_CreateMessage( |
| | 7029 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7030 | | System.Uri resourceUri, |
| | 7031 | | string leaseId, |
| | 7032 | | string proposedLeaseId, |
| | 7033 | | string version, |
| | 7034 | | int? timeout = default, |
| | 7035 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 7036 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 7037 | | Azure.ETag? ifMatch = default, |
| | 7038 | | Azure.ETag? ifNoneMatch = default, |
| | 7039 | | string ifTags = default, |
| | 7040 | | string requestId = default) |
| | 7041 | | { |
| | 7042 | | // Validation |
| | 7043 | | if (resourceUri == null) |
| | 7044 | | { |
| | 7045 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 7046 | | } |
| | 7047 | | if (leaseId == null) |
| | 7048 | | { |
| | 7049 | | throw new System.ArgumentNullException(nameof(leaseId)); |
| | 7050 | | } |
| | 7051 | | if (proposedLeaseId == null) |
| | 7052 | | { |
| | 7053 | | throw new System.ArgumentNullException(nameof(proposedLeaseId)); |
| | 7054 | | } |
| | 7055 | | if (version == null) |
| | 7056 | | { |
| | 7057 | | throw new System.ArgumentNullException(nameof(version)); |
| | 7058 | | } |
| | 7059 | |
|
| | 7060 | | // Create the request |
| | 7061 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 7062 | | Azure.Core.Request _request = _message.Request; |
| | 7063 | |
|
| | 7064 | | // Set the endpoint |
| | 7065 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 7066 | | _request.Uri.Reset(resourceUri); |
| | 7067 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 7068 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 7069 | |
|
| | 7070 | | // Add request headers |
| | 7071 | | _request.Headers.SetValue("x-ms-lease-action", "change"); |
| | 7072 | | _request.Headers.SetValue("x-ms-lease-id", leaseId); |
| | 7073 | | _request.Headers.SetValue("x-ms-proposed-lease-id", proposedLeaseId); |
| | 7074 | | _request.Headers.SetValue("x-ms-version", version); |
| | 7075 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 7076 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 7077 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 7078 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 7079 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 7080 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 7081 | |
|
| | 7082 | | return _message; |
| | 7083 | | } |
| | 7084 | |
|
| | 7085 | | /// <summary> |
| | 7086 | | /// Create the Blob.ChangeLeaseAsync response or throw a failure exception. |
| | 7087 | | /// </summary> |
| | 7088 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 7089 | | /// <param name="response">The raw Response.</param> |
| | 7090 | | /// <returns>The Blob.ChangeLeaseAsync Azure.Response{Azure.Storage.Blobs.Models.BlobLease}.</returns> |
| | 7091 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobLease> ChangeLeaseAsync_CreateResponse( |
| | 7092 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7093 | | Azure.Response response) |
| | 7094 | | { |
| | 7095 | | // Process the response |
| | 7096 | | switch (response.Status) |
| | 7097 | | { |
| | 7098 | | case 200: |
| | 7099 | | { |
| | 7100 | | // Create the result |
| | 7101 | | Azure.Storage.Blobs.Models.BlobLease _value = new Azure.Storage.Blobs.Models.BlobLease(); |
| | 7102 | |
|
| | 7103 | | // Get response headers |
| | 7104 | | string _header; |
| | 7105 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 7106 | | { |
| | 7107 | | _value.ETag = new Azure.ETag(_header); |
| | 7108 | | } |
| | 7109 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 7110 | | { |
| | 7111 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 7112 | | } |
| | 7113 | | if (response.Headers.TryGetValue("x-ms-lease-id", out _header)) |
| | 7114 | | { |
| | 7115 | | _value.LeaseId = _header; |
| | 7116 | | } |
| | 7117 | |
|
| | 7118 | | // Create the response |
| | 7119 | | return Response.FromValue(_value, response); |
| | 7120 | | } |
| | 7121 | | default: |
| | 7122 | | { |
| | 7123 | | // Create the result |
| | 7124 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 7125 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 7126 | |
|
| | 7127 | | throw _value.CreateException(clientDiagnostics, response); |
| | 7128 | | } |
| | 7129 | | } |
| | 7130 | | } |
| | 7131 | | #endregion Blob.ChangeLeaseAsync |
| | 7132 | |
|
| | 7133 | | #region Blob.BreakLeaseAsync |
| | 7134 | | /// <summary> |
| | 7135 | | /// [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operatio |
| | 7136 | | /// </summary> |
| | 7137 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 7138 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7139 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 7140 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7141 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7142 | | /// <param name="breakPeriod">For a break operation, proposed duration the lease should continue before it i |
| | 7143 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 7144 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 7145 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 7146 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 7147 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 7148 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 7149 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 7150 | | /// <param name="operationName">Operation name.</param> |
| | 7151 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 7152 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BrokenLease}</returns> |
| | 7153 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BrokenLease>> |
| | 7154 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7155 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7156 | | System.Uri resourceUri, |
| | 7157 | | string version, |
| | 7158 | | int? timeout = default, |
| | 7159 | | long? breakPeriod = default, |
| | 7160 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 7161 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 7162 | | Azure.ETag? ifMatch = default, |
| | 7163 | | Azure.ETag? ifNoneMatch = default, |
| | 7164 | | string ifTags = default, |
| | 7165 | | string requestId = default, |
| | 7166 | | bool async = true, |
| | 7167 | | string operationName = "BlobClient.BreakLease", |
| | 7168 | | System.Threading.CancellationToken cancellationToken = default) |
| | 7169 | | { |
| | 7170 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 7171 | | try |
| | 7172 | | { |
| | 7173 | | _scope.AddAttribute("url", resourceUri); |
| | 7174 | | _scope.Start(); |
| | 7175 | | using (Azure.Core.HttpMessage _message = BreakLeaseAsync_CreateMessage( |
| | 7176 | | pipeline, |
| | 7177 | | resourceUri, |
| | 7178 | | version, |
| | 7179 | | timeout, |
| | 7180 | | breakPeriod, |
| | 7181 | | ifModifiedSince, |
| | 7182 | | ifUnmodifiedSince, |
| | 7183 | | ifMatch, |
| | 7184 | | ifNoneMatch, |
| | 7185 | | ifTags, |
| | 7186 | | requestId)) |
| | 7187 | | { |
| | 7188 | | if (async) |
| | 7189 | | { |
| | 7190 | | // Send the request asynchronously if we're being called via an async path |
| | 7191 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 7192 | | } |
| | 7193 | | else |
| | 7194 | | { |
| | 7195 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 7196 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 7197 | | pipeline.Send(_message, cancellationToken); |
| | 7198 | | } |
| | 7199 | | Azure.Response _response = _message.Response; |
| | 7200 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 7201 | | return BreakLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 7202 | | } |
| | 7203 | | } |
| | 7204 | | catch (System.Exception ex) |
| | 7205 | | { |
| | 7206 | | _scope.Failed(ex); |
| | 7207 | | throw; |
| | 7208 | | } |
| | 7209 | | finally |
| | 7210 | | { |
| | 7211 | | _scope.Dispose(); |
| | 7212 | | } |
| | 7213 | | } |
| | 7214 | |
|
| | 7215 | | /// <summary> |
| | 7216 | | /// Create the Blob.BreakLeaseAsync request. |
| | 7217 | | /// </summary> |
| | 7218 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7219 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 7220 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7221 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7222 | | /// <param name="breakPeriod">For a break operation, proposed duration the lease should continue before it i |
| | 7223 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 7224 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 7225 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 7226 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 7227 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 7228 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 7229 | | /// <returns>The Blob.BreakLeaseAsync Message.</returns> |
| | 7230 | | internal static Azure.Core.HttpMessage BreakLeaseAsync_CreateMessage( |
| | 7231 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7232 | | System.Uri resourceUri, |
| | 7233 | | string version, |
| | 7234 | | int? timeout = default, |
| | 7235 | | long? breakPeriod = default, |
| | 7236 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 7237 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 7238 | | Azure.ETag? ifMatch = default, |
| | 7239 | | Azure.ETag? ifNoneMatch = default, |
| | 7240 | | string ifTags = default, |
| | 7241 | | string requestId = default) |
| | 7242 | | { |
| | 7243 | | // Validation |
| | 7244 | | if (resourceUri == null) |
| | 7245 | | { |
| | 7246 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 7247 | | } |
| | 7248 | | if (version == null) |
| | 7249 | | { |
| | 7250 | | throw new System.ArgumentNullException(nameof(version)); |
| | 7251 | | } |
| | 7252 | |
|
| | 7253 | | // Create the request |
| | 7254 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 7255 | | Azure.Core.Request _request = _message.Request; |
| | 7256 | |
|
| | 7257 | | // Set the endpoint |
| | 7258 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 7259 | | _request.Uri.Reset(resourceUri); |
| | 7260 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 7261 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 7262 | |
|
| | 7263 | | // Add request headers |
| | 7264 | | _request.Headers.SetValue("x-ms-lease-action", "break"); |
| | 7265 | | _request.Headers.SetValue("x-ms-version", version); |
| | 7266 | | if (breakPeriod != null) { _request.Headers.SetValue("x-ms-lease-break-period", breakPeriod.Value.ToStri |
| | 7267 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 7268 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 7269 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 7270 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 7271 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 7272 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 7273 | |
|
| | 7274 | | return _message; |
| | 7275 | | } |
| | 7276 | |
|
| | 7277 | | /// <summary> |
| | 7278 | | /// Create the Blob.BreakLeaseAsync response or throw a failure exception. |
| | 7279 | | /// </summary> |
| | 7280 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 7281 | | /// <param name="response">The raw Response.</param> |
| | 7282 | | /// <returns>The Blob.BreakLeaseAsync Azure.Response{Azure.Storage.Blobs.Models.BrokenLease}.</returns> |
| | 7283 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BrokenLease> BreakLeaseAsync_CreateResponse( |
| | 7284 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7285 | | Azure.Response response) |
| | 7286 | | { |
| | 7287 | | // Process the response |
| | 7288 | | switch (response.Status) |
| | 7289 | | { |
| | 7290 | | case 202: |
| | 7291 | | { |
| | 7292 | | // Create the result |
| | 7293 | | Azure.Storage.Blobs.Models.BrokenLease _value = new Azure.Storage.Blobs.Models.BrokenLease(); |
| | 7294 | |
|
| | 7295 | | // Get response headers |
| | 7296 | | string _header; |
| | 7297 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 7298 | | { |
| | 7299 | | _value.ETag = new Azure.ETag(_header); |
| | 7300 | | } |
| | 7301 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 7302 | | { |
| | 7303 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 7304 | | } |
| | 7305 | | if (response.Headers.TryGetValue("x-ms-lease-time", out _header)) |
| | 7306 | | { |
| | 7307 | | _value.LeaseTime = int.Parse(_header, System.Globalization.CultureInfo.InvariantCulture); |
| | 7308 | | } |
| | 7309 | |
|
| | 7310 | | // Create the response |
| | 7311 | | return Response.FromValue(_value, response); |
| | 7312 | | } |
| | 7313 | | default: |
| | 7314 | | { |
| | 7315 | | // Create the result |
| | 7316 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 7317 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 7318 | |
|
| | 7319 | | throw _value.CreateException(clientDiagnostics, response); |
| | 7320 | | } |
| | 7321 | | } |
| | 7322 | | } |
| | 7323 | | #endregion Blob.BreakLeaseAsync |
| | 7324 | |
|
| | 7325 | | #region Blob.CreateSnapshotAsync |
| | 7326 | | /// <summary> |
| | 7327 | | /// The Create Snapshot operation creates a read-only snapshot of a blob |
| | 7328 | | /// </summary> |
| | 7329 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 7330 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7331 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 7332 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7333 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7334 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 7335 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 7336 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 7337 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 7338 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 7339 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 7340 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 7341 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 7342 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 7343 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 7344 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 7345 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 7346 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 7347 | | /// <param name="operationName">Operation name.</param> |
| | 7348 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 7349 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobSnapshotInfo}</returns> |
| | 7350 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobSnapshotI |
| | 7351 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7352 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7353 | | System.Uri resourceUri, |
| | 7354 | | string version, |
| | 7355 | | int? timeout = default, |
| | 7356 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 7357 | | string encryptionKey = default, |
| | 7358 | | string encryptionKeySha256 = default, |
| | 7359 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 7360 | | string encryptionScope = default, |
| | 7361 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 7362 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 7363 | | Azure.ETag? ifMatch = default, |
| | 7364 | | Azure.ETag? ifNoneMatch = default, |
| | 7365 | | string ifTags = default, |
| | 7366 | | string leaseId = default, |
| | 7367 | | string requestId = default, |
| | 7368 | | bool async = true, |
| | 7369 | | string operationName = "BlobClient.CreateSnapshot", |
| | 7370 | | System.Threading.CancellationToken cancellationToken = default) |
| | 7371 | | { |
| | 7372 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 7373 | | try |
| | 7374 | | { |
| | 7375 | | _scope.AddAttribute("url", resourceUri); |
| | 7376 | | _scope.Start(); |
| | 7377 | | using (Azure.Core.HttpMessage _message = CreateSnapshotAsync_CreateMessage( |
| | 7378 | | pipeline, |
| | 7379 | | resourceUri, |
| | 7380 | | version, |
| | 7381 | | timeout, |
| | 7382 | | metadata, |
| | 7383 | | encryptionKey, |
| | 7384 | | encryptionKeySha256, |
| | 7385 | | encryptionAlgorithm, |
| | 7386 | | encryptionScope, |
| | 7387 | | ifModifiedSince, |
| | 7388 | | ifUnmodifiedSince, |
| | 7389 | | ifMatch, |
| | 7390 | | ifNoneMatch, |
| | 7391 | | ifTags, |
| | 7392 | | leaseId, |
| | 7393 | | requestId)) |
| | 7394 | | { |
| | 7395 | | if (async) |
| | 7396 | | { |
| | 7397 | | // Send the request asynchronously if we're being called via an async path |
| | 7398 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 7399 | | } |
| | 7400 | | else |
| | 7401 | | { |
| | 7402 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 7403 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 7404 | | pipeline.Send(_message, cancellationToken); |
| | 7405 | | } |
| | 7406 | | Azure.Response _response = _message.Response; |
| | 7407 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 7408 | | return CreateSnapshotAsync_CreateResponse(clientDiagnostics, _response); |
| | 7409 | | } |
| | 7410 | | } |
| | 7411 | | catch (System.Exception ex) |
| | 7412 | | { |
| | 7413 | | _scope.Failed(ex); |
| | 7414 | | throw; |
| | 7415 | | } |
| | 7416 | | finally |
| | 7417 | | { |
| | 7418 | | _scope.Dispose(); |
| | 7419 | | } |
| | 7420 | | } |
| | 7421 | |
|
| | 7422 | | /// <summary> |
| | 7423 | | /// Create the Blob.CreateSnapshotAsync request. |
| | 7424 | | /// </summary> |
| | 7425 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7426 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 7427 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7428 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7429 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 7430 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 7431 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 7432 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 7433 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 7434 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 7435 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 7436 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 7437 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 7438 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 7439 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 7440 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 7441 | | /// <returns>The Blob.CreateSnapshotAsync Message.</returns> |
| | 7442 | | internal static Azure.Core.HttpMessage CreateSnapshotAsync_CreateMessage( |
| | 7443 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7444 | | System.Uri resourceUri, |
| | 7445 | | string version, |
| | 7446 | | int? timeout = default, |
| | 7447 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 7448 | | string encryptionKey = default, |
| | 7449 | | string encryptionKeySha256 = default, |
| | 7450 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 7451 | | string encryptionScope = default, |
| | 7452 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 7453 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 7454 | | Azure.ETag? ifMatch = default, |
| | 7455 | | Azure.ETag? ifNoneMatch = default, |
| | 7456 | | string ifTags = default, |
| | 7457 | | string leaseId = default, |
| | 7458 | | string requestId = default) |
| | 7459 | | { |
| | 7460 | | // Validation |
| | 7461 | | if (resourceUri == null) |
| | 7462 | | { |
| | 7463 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 7464 | | } |
| | 7465 | | if (version == null) |
| | 7466 | | { |
| | 7467 | | throw new System.ArgumentNullException(nameof(version)); |
| | 7468 | | } |
| | 7469 | |
|
| | 7470 | | // Create the request |
| | 7471 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 7472 | | Azure.Core.Request _request = _message.Request; |
| | 7473 | |
|
| | 7474 | | // Set the endpoint |
| | 7475 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 7476 | | _request.Uri.Reset(resourceUri); |
| | 7477 | | _request.Uri.AppendQuery("comp", "snapshot", escapeValue: false); |
| | 7478 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 7479 | |
|
| | 7480 | | // Add request headers |
| | 7481 | | _request.Headers.SetValue("x-ms-version", version); |
| | 7482 | | if (metadata != null) { |
| | 7483 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 7484 | | { |
| | 7485 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 7486 | | } |
| | 7487 | | } |
| | 7488 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 7489 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 7490 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 7491 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 7492 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 7493 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 7494 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 7495 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 7496 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 7497 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 7498 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 7499 | |
|
| | 7500 | | return _message; |
| | 7501 | | } |
| | 7502 | |
|
| | 7503 | | /// <summary> |
| | 7504 | | /// Create the Blob.CreateSnapshotAsync response or throw a failure exception. |
| | 7505 | | /// </summary> |
| | 7506 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 7507 | | /// <param name="response">The raw Response.</param> |
| | 7508 | | /// <returns>The Blob.CreateSnapshotAsync Azure.Response{Azure.Storage.Blobs.Models.BlobSnapshotInfo}.</retu |
| | 7509 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobSnapshotInfo> CreateSnapshotAsync_CreateRespon |
| | 7510 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7511 | | Azure.Response response) |
| | 7512 | | { |
| | 7513 | | // Process the response |
| | 7514 | | switch (response.Status) |
| | 7515 | | { |
| | 7516 | | case 201: |
| | 7517 | | { |
| | 7518 | | // Create the result |
| | 7519 | | Azure.Storage.Blobs.Models.BlobSnapshotInfo _value = new Azure.Storage.Blobs.Models.BlobSnapshot |
| | 7520 | |
|
| | 7521 | | // Get response headers |
| | 7522 | | string _header; |
| | 7523 | | if (response.Headers.TryGetValue("x-ms-snapshot", out _header)) |
| | 7524 | | { |
| | 7525 | | _value.Snapshot = _header; |
| | 7526 | | } |
| | 7527 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 7528 | | { |
| | 7529 | | _value.ETag = new Azure.ETag(_header); |
| | 7530 | | } |
| | 7531 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 7532 | | { |
| | 7533 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 7534 | | } |
| | 7535 | | if (response.Headers.TryGetValue("x-ms-version-id", out _header)) |
| | 7536 | | { |
| | 7537 | | _value.VersionId = _header; |
| | 7538 | | } |
| | 7539 | | if (response.Headers.TryGetValue("x-ms-request-server-encrypted", out _header)) |
| | 7540 | | { |
| | 7541 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 7542 | | } |
| | 7543 | |
|
| | 7544 | | // Create the response |
| | 7545 | | return Response.FromValue(_value, response); |
| | 7546 | | } |
| | 7547 | | default: |
| | 7548 | | { |
| | 7549 | | // Create the result |
| | 7550 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 7551 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 7552 | |
|
| | 7553 | | throw _value.CreateException(clientDiagnostics, response); |
| | 7554 | | } |
| | 7555 | | } |
| | 7556 | | } |
| | 7557 | | #endregion Blob.CreateSnapshotAsync |
| | 7558 | |
|
| | 7559 | | #region Blob.StartCopyFromUriAsync |
| | 7560 | | /// <summary> |
| | 7561 | | /// The Start Copy From URL operation copies a blob or an internet resource to a new blob. |
| | 7562 | | /// </summary> |
| | 7563 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 7564 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7565 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 7566 | | /// <param name="copySource">Specifies the name of the source page blob snapshot. This value is a URL of up |
| | 7567 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7568 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7569 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 7570 | | /// <param name="tier">Optional. Indicates the tier to be set on the blob.</param> |
| | 7571 | | /// <param name="rehydratePriority">Optional: Indicates the priority with which to rehydrate an archived blo |
| | 7572 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 7573 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 7574 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 7575 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 7576 | | /// <param name="sourceIfTags">Specify a SQL where clause on blob tags to operate only on blobs with a match |
| | 7577 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 7578 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 7579 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 7580 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 7581 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 7582 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 7583 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 7584 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 7585 | | /// <param name="sealBlob">Overrides the sealed state of the destination blob. Service version 2019-12-12 a |
| | 7586 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 7587 | | /// <param name="operationName">Operation name.</param> |
| | 7588 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 7589 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobCopyInfo}</returns> |
| | 7590 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobCopyInfo> |
| | 7591 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7592 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7593 | | System.Uri resourceUri, |
| | 7594 | | System.Uri copySource, |
| | 7595 | | string version, |
| | 7596 | | int? timeout = default, |
| | 7597 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 7598 | | Azure.Storage.Blobs.Models.AccessTier? tier = default, |
| | 7599 | | Azure.Storage.Blobs.Models.RehydratePriority? rehydratePriority = default, |
| | 7600 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 7601 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 7602 | | Azure.ETag? sourceIfMatch = default, |
| | 7603 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 7604 | | string sourceIfTags = default, |
| | 7605 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 7606 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 7607 | | Azure.ETag? ifMatch = default, |
| | 7608 | | Azure.ETag? ifNoneMatch = default, |
| | 7609 | | string ifTags = default, |
| | 7610 | | string leaseId = default, |
| | 7611 | | string requestId = default, |
| | 7612 | | string blobTagsString = default, |
| | 7613 | | bool? sealBlob = default, |
| | 7614 | | bool async = true, |
| | 7615 | | string operationName = "BlobClient.StartCopyFromUri", |
| | 7616 | | System.Threading.CancellationToken cancellationToken = default) |
| | 7617 | | { |
| | 7618 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 7619 | | try |
| | 7620 | | { |
| | 7621 | | _scope.AddAttribute("url", resourceUri); |
| | 7622 | | _scope.Start(); |
| | 7623 | | using (Azure.Core.HttpMessage _message = StartCopyFromUriAsync_CreateMessage( |
| | 7624 | | pipeline, |
| | 7625 | | resourceUri, |
| | 7626 | | copySource, |
| | 7627 | | version, |
| | 7628 | | timeout, |
| | 7629 | | metadata, |
| | 7630 | | tier, |
| | 7631 | | rehydratePriority, |
| | 7632 | | sourceIfModifiedSince, |
| | 7633 | | sourceIfUnmodifiedSince, |
| | 7634 | | sourceIfMatch, |
| | 7635 | | sourceIfNoneMatch, |
| | 7636 | | sourceIfTags, |
| | 7637 | | ifModifiedSince, |
| | 7638 | | ifUnmodifiedSince, |
| | 7639 | | ifMatch, |
| | 7640 | | ifNoneMatch, |
| | 7641 | | ifTags, |
| | 7642 | | leaseId, |
| | 7643 | | requestId, |
| | 7644 | | blobTagsString, |
| | 7645 | | sealBlob)) |
| | 7646 | | { |
| | 7647 | | if (async) |
| | 7648 | | { |
| | 7649 | | // Send the request asynchronously if we're being called via an async path |
| | 7650 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 7651 | | } |
| | 7652 | | else |
| | 7653 | | { |
| | 7654 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 7655 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 7656 | | pipeline.Send(_message, cancellationToken); |
| | 7657 | | } |
| | 7658 | | Azure.Response _response = _message.Response; |
| | 7659 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 7660 | | return StartCopyFromUriAsync_CreateResponse(clientDiagnostics, _response); |
| | 7661 | | } |
| | 7662 | | } |
| | 7663 | | catch (System.Exception ex) |
| | 7664 | | { |
| | 7665 | | _scope.Failed(ex); |
| | 7666 | | throw; |
| | 7667 | | } |
| | 7668 | | finally |
| | 7669 | | { |
| | 7670 | | _scope.Dispose(); |
| | 7671 | | } |
| | 7672 | | } |
| | 7673 | |
|
| | 7674 | | /// <summary> |
| | 7675 | | /// Create the Blob.StartCopyFromUriAsync request. |
| | 7676 | | /// </summary> |
| | 7677 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7678 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 7679 | | /// <param name="copySource">Specifies the name of the source page blob snapshot. This value is a URL of up |
| | 7680 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7681 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7682 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 7683 | | /// <param name="tier">Optional. Indicates the tier to be set on the blob.</param> |
| | 7684 | | /// <param name="rehydratePriority">Optional: Indicates the priority with which to rehydrate an archived blo |
| | 7685 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 7686 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 7687 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 7688 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 7689 | | /// <param name="sourceIfTags">Specify a SQL where clause on blob tags to operate only on blobs with a match |
| | 7690 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 7691 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 7692 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 7693 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 7694 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 7695 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 7696 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 7697 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 7698 | | /// <param name="sealBlob">Overrides the sealed state of the destination blob. Service version 2019-12-12 a |
| | 7699 | | /// <returns>The Blob.StartCopyFromUriAsync Message.</returns> |
| | 7700 | | internal static Azure.Core.HttpMessage StartCopyFromUriAsync_CreateMessage( |
| | 7701 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7702 | | System.Uri resourceUri, |
| | 7703 | | System.Uri copySource, |
| | 7704 | | string version, |
| | 7705 | | int? timeout = default, |
| | 7706 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 7707 | | Azure.Storage.Blobs.Models.AccessTier? tier = default, |
| | 7708 | | Azure.Storage.Blobs.Models.RehydratePriority? rehydratePriority = default, |
| | 7709 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 7710 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 7711 | | Azure.ETag? sourceIfMatch = default, |
| | 7712 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 7713 | | string sourceIfTags = default, |
| | 7714 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 7715 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 7716 | | Azure.ETag? ifMatch = default, |
| | 7717 | | Azure.ETag? ifNoneMatch = default, |
| | 7718 | | string ifTags = default, |
| | 7719 | | string leaseId = default, |
| | 7720 | | string requestId = default, |
| | 7721 | | string blobTagsString = default, |
| | 7722 | | bool? sealBlob = default) |
| | 7723 | | { |
| | 7724 | | // Validation |
| | 7725 | | if (resourceUri == null) |
| | 7726 | | { |
| | 7727 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 7728 | | } |
| | 7729 | | if (copySource == null) |
| | 7730 | | { |
| | 7731 | | throw new System.ArgumentNullException(nameof(copySource)); |
| | 7732 | | } |
| | 7733 | | if (version == null) |
| | 7734 | | { |
| | 7735 | | throw new System.ArgumentNullException(nameof(version)); |
| | 7736 | | } |
| | 7737 | |
|
| | 7738 | | // Create the request |
| | 7739 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 7740 | | Azure.Core.Request _request = _message.Request; |
| | 7741 | |
|
| | 7742 | | // Set the endpoint |
| | 7743 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 7744 | | _request.Uri.Reset(resourceUri); |
| | 7745 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 7746 | |
|
| | 7747 | | // Add request headers |
| | 7748 | | _request.Headers.SetValue("x-ms-copy-source", copySource.AbsoluteUri); |
| | 7749 | | _request.Headers.SetValue("x-ms-version", version); |
| | 7750 | | if (metadata != null) { |
| | 7751 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 7752 | | { |
| | 7753 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 7754 | | } |
| | 7755 | | } |
| | 7756 | | if (tier != null) { _request.Headers.SetValue("x-ms-access-tier", tier.ToString()); } |
| | 7757 | | if (rehydratePriority != null) { _request.Headers.SetValue("x-ms-rehydrate-priority", rehydratePriority. |
| | 7758 | | if (sourceIfModifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-modified-since", sourceIf |
| | 7759 | | if (sourceIfUnmodifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-unmodified-since", sour |
| | 7760 | | if (sourceIfMatch != null) { _request.Headers.SetValue("x-ms-source-if-match", sourceIfMatch.Value.ToStr |
| | 7761 | | if (sourceIfNoneMatch != null) { _request.Headers.SetValue("x-ms-source-if-none-match", sourceIfNoneMatc |
| | 7762 | | if (sourceIfTags != null) { _request.Headers.SetValue("x-ms-source-if-tags", sourceIfTags); } |
| | 7763 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 7764 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 7765 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 7766 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 7767 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 7768 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 7769 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 7770 | | if (blobTagsString != null) { _request.Headers.SetValue("x-ms-tags", blobTagsString); } |
| | 7771 | | if (sealBlob != null) { |
| | 7772 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 7773 | | _request.Headers.SetValue("x-ms-seal-blob", sealBlob.Value.ToString(System.Globalization.CultureInfo.Inv |
| | 7774 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 7775 | | } |
| | 7776 | |
|
| | 7777 | | return _message; |
| | 7778 | | } |
| | 7779 | |
|
| | 7780 | | /// <summary> |
| | 7781 | | /// Create the Blob.StartCopyFromUriAsync response or throw a failure exception. |
| | 7782 | | /// </summary> |
| | 7783 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 7784 | | /// <param name="response">The raw Response.</param> |
| | 7785 | | /// <returns>The Blob.StartCopyFromUriAsync Azure.Response{Azure.Storage.Blobs.Models.BlobCopyInfo}.</return |
| | 7786 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobCopyInfo> StartCopyFromUriAsync_CreateResponse |
| | 7787 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7788 | | Azure.Response response) |
| | 7789 | | { |
| | 7790 | | // Process the response |
| | 7791 | | switch (response.Status) |
| | 7792 | | { |
| | 7793 | | case 202: |
| | 7794 | | { |
| | 7795 | | // Create the result |
| | 7796 | | Azure.Storage.Blobs.Models.BlobCopyInfo _value = new Azure.Storage.Blobs.Models.BlobCopyInfo(); |
| | 7797 | |
|
| | 7798 | | // Get response headers |
| | 7799 | | string _header; |
| | 7800 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 7801 | | { |
| | 7802 | | _value.ETag = new Azure.ETag(_header); |
| | 7803 | | } |
| | 7804 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 7805 | | { |
| | 7806 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 7807 | | } |
| | 7808 | | if (response.Headers.TryGetValue("x-ms-version-id", out _header)) |
| | 7809 | | { |
| | 7810 | | _value.VersionId = _header; |
| | 7811 | | } |
| | 7812 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 7813 | | { |
| | 7814 | | _value.CopyId = _header; |
| | 7815 | | } |
| | 7816 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 7817 | | { |
| | 7818 | | _value.CopyStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseCopyStatus(_header |
| | 7819 | | } |
| | 7820 | |
|
| | 7821 | | // Create the response |
| | 7822 | | return Response.FromValue(_value, response); |
| | 7823 | | } |
| | 7824 | | default: |
| | 7825 | | { |
| | 7826 | | // Create the result |
| | 7827 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 7828 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 7829 | |
|
| | 7830 | | throw _value.CreateException(clientDiagnostics, response); |
| | 7831 | | } |
| | 7832 | | } |
| | 7833 | | } |
| | 7834 | | #endregion Blob.StartCopyFromUriAsync |
| | 7835 | |
|
| | 7836 | | #region Blob.CopyFromUriAsync |
| | 7837 | | /// <summary> |
| | 7838 | | /// The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a re |
| | 7839 | | /// </summary> |
| | 7840 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 7841 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7842 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 7843 | | /// <param name="copySource">Specifies the name of the source page blob snapshot. This value is a URL of up |
| | 7844 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7845 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7846 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 7847 | | /// <param name="tier">Optional. Indicates the tier to be set on the blob.</param> |
| | 7848 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 7849 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 7850 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 7851 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 7852 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 7853 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 7854 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 7855 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 7856 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 7857 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 7858 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 7859 | | /// <param name="sourceContentHash">Specify the md5 calculated for the range of bytes that must be read from |
| | 7860 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 7861 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 7862 | | /// <param name="operationName">Operation name.</param> |
| | 7863 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 7864 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobCopyInfo}</returns> |
| | 7865 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobCopyInfo> |
| | 7866 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7867 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7868 | | System.Uri resourceUri, |
| | 7869 | | System.Uri copySource, |
| | 7870 | | string version, |
| | 7871 | | int? timeout = default, |
| | 7872 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 7873 | | Azure.Storage.Blobs.Models.AccessTier? tier = default, |
| | 7874 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 7875 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 7876 | | Azure.ETag? sourceIfMatch = default, |
| | 7877 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 7878 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 7879 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 7880 | | Azure.ETag? ifMatch = default, |
| | 7881 | | Azure.ETag? ifNoneMatch = default, |
| | 7882 | | string ifTags = default, |
| | 7883 | | string leaseId = default, |
| | 7884 | | string requestId = default, |
| | 7885 | | byte[] sourceContentHash = default, |
| | 7886 | | string blobTagsString = default, |
| | 7887 | | bool async = true, |
| | 7888 | | string operationName = "BlobClient.CopyFromUri", |
| | 7889 | | System.Threading.CancellationToken cancellationToken = default) |
| | 7890 | | { |
| | 7891 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 7892 | | try |
| | 7893 | | { |
| | 7894 | | _scope.AddAttribute("url", resourceUri); |
| | 7895 | | _scope.Start(); |
| | 7896 | | using (Azure.Core.HttpMessage _message = CopyFromUriAsync_CreateMessage( |
| | 7897 | | pipeline, |
| | 7898 | | resourceUri, |
| | 7899 | | copySource, |
| | 7900 | | version, |
| | 7901 | | timeout, |
| | 7902 | | metadata, |
| | 7903 | | tier, |
| | 7904 | | sourceIfModifiedSince, |
| | 7905 | | sourceIfUnmodifiedSince, |
| | 7906 | | sourceIfMatch, |
| | 7907 | | sourceIfNoneMatch, |
| | 7908 | | ifModifiedSince, |
| | 7909 | | ifUnmodifiedSince, |
| | 7910 | | ifMatch, |
| | 7911 | | ifNoneMatch, |
| | 7912 | | ifTags, |
| | 7913 | | leaseId, |
| | 7914 | | requestId, |
| | 7915 | | sourceContentHash, |
| | 7916 | | blobTagsString)) |
| | 7917 | | { |
| | 7918 | | if (async) |
| | 7919 | | { |
| | 7920 | | // Send the request asynchronously if we're being called via an async path |
| | 7921 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 7922 | | } |
| | 7923 | | else |
| | 7924 | | { |
| | 7925 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 7926 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 7927 | | pipeline.Send(_message, cancellationToken); |
| | 7928 | | } |
| | 7929 | | Azure.Response _response = _message.Response; |
| | 7930 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 7931 | | return CopyFromUriAsync_CreateResponse(clientDiagnostics, _response); |
| | 7932 | | } |
| | 7933 | | } |
| | 7934 | | catch (System.Exception ex) |
| | 7935 | | { |
| | 7936 | | _scope.Failed(ex); |
| | 7937 | | throw; |
| | 7938 | | } |
| | 7939 | | finally |
| | 7940 | | { |
| | 7941 | | _scope.Dispose(); |
| | 7942 | | } |
| | 7943 | | } |
| | 7944 | |
|
| | 7945 | | /// <summary> |
| | 7946 | | /// Create the Blob.CopyFromUriAsync request. |
| | 7947 | | /// </summary> |
| | 7948 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7949 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 7950 | | /// <param name="copySource">Specifies the name of the source page blob snapshot. This value is a URL of up |
| | 7951 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7952 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7953 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 7954 | | /// <param name="tier">Optional. Indicates the tier to be set on the blob.</param> |
| | 7955 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 7956 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 7957 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 7958 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 7959 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 7960 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 7961 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 7962 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 7963 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 7964 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 7965 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 7966 | | /// <param name="sourceContentHash">Specify the md5 calculated for the range of bytes that must be read from |
| | 7967 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 7968 | | /// <returns>The Blob.CopyFromUriAsync Message.</returns> |
| | 7969 | | internal static Azure.Core.HttpMessage CopyFromUriAsync_CreateMessage( |
| | 7970 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7971 | | System.Uri resourceUri, |
| | 7972 | | System.Uri copySource, |
| | 7973 | | string version, |
| | 7974 | | int? timeout = default, |
| | 7975 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 7976 | | Azure.Storage.Blobs.Models.AccessTier? tier = default, |
| | 7977 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 7978 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 7979 | | Azure.ETag? sourceIfMatch = default, |
| | 7980 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 7981 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 7982 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 7983 | | Azure.ETag? ifMatch = default, |
| | 7984 | | Azure.ETag? ifNoneMatch = default, |
| | 7985 | | string ifTags = default, |
| | 7986 | | string leaseId = default, |
| | 7987 | | string requestId = default, |
| | 7988 | | byte[] sourceContentHash = default, |
| | 7989 | | string blobTagsString = default) |
| | 7990 | | { |
| | 7991 | | // Validation |
| | 7992 | | if (resourceUri == null) |
| | 7993 | | { |
| | 7994 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 7995 | | } |
| | 7996 | | if (copySource == null) |
| | 7997 | | { |
| | 7998 | | throw new System.ArgumentNullException(nameof(copySource)); |
| | 7999 | | } |
| | 8000 | | if (version == null) |
| | 8001 | | { |
| | 8002 | | throw new System.ArgumentNullException(nameof(version)); |
| | 8003 | | } |
| | 8004 | |
|
| | 8005 | | // Create the request |
| | 8006 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 8007 | | Azure.Core.Request _request = _message.Request; |
| | 8008 | |
|
| | 8009 | | // Set the endpoint |
| | 8010 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 8011 | | _request.Uri.Reset(resourceUri); |
| | 8012 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 8013 | |
|
| | 8014 | | // Add request headers |
| | 8015 | | _request.Headers.SetValue("x-ms-requires-sync", "true"); |
| | 8016 | | _request.Headers.SetValue("x-ms-copy-source", copySource.AbsoluteUri); |
| | 8017 | | _request.Headers.SetValue("x-ms-version", version); |
| | 8018 | | if (metadata != null) { |
| | 8019 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 8020 | | { |
| | 8021 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 8022 | | } |
| | 8023 | | } |
| | 8024 | | if (tier != null) { _request.Headers.SetValue("x-ms-access-tier", tier.ToString()); } |
| | 8025 | | if (sourceIfModifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-modified-since", sourceIf |
| | 8026 | | if (sourceIfUnmodifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-unmodified-since", sour |
| | 8027 | | if (sourceIfMatch != null) { _request.Headers.SetValue("x-ms-source-if-match", sourceIfMatch.Value.ToStr |
| | 8028 | | if (sourceIfNoneMatch != null) { _request.Headers.SetValue("x-ms-source-if-none-match", sourceIfNoneMatc |
| | 8029 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 8030 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 8031 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 8032 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 8033 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 8034 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 8035 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 8036 | | if (sourceContentHash != null) { _request.Headers.SetValue("x-ms-source-content-md5", System.Convert.ToB |
| | 8037 | | if (blobTagsString != null) { _request.Headers.SetValue("x-ms-tags", blobTagsString); } |
| | 8038 | |
|
| | 8039 | | return _message; |
| | 8040 | | } |
| | 8041 | |
|
| | 8042 | | /// <summary> |
| | 8043 | | /// Create the Blob.CopyFromUriAsync response or throw a failure exception. |
| | 8044 | | /// </summary> |
| | 8045 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 8046 | | /// <param name="response">The raw Response.</param> |
| | 8047 | | /// <returns>The Blob.CopyFromUriAsync Azure.Response{Azure.Storage.Blobs.Models.BlobCopyInfo}.</returns> |
| | 8048 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobCopyInfo> CopyFromUriAsync_CreateResponse( |
| | 8049 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 8050 | | Azure.Response response) |
| | 8051 | | { |
| | 8052 | | // Process the response |
| | 8053 | | switch (response.Status) |
| | 8054 | | { |
| | 8055 | | case 202: |
| | 8056 | | { |
| | 8057 | | // Create the result |
| | 8058 | | Azure.Storage.Blobs.Models.BlobCopyInfo _value = new Azure.Storage.Blobs.Models.BlobCopyInfo(); |
| | 8059 | |
|
| | 8060 | | // Get response headers |
| | 8061 | | string _header; |
| | 8062 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 8063 | | { |
| | 8064 | | _value.ETag = new Azure.ETag(_header); |
| | 8065 | | } |
| | 8066 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 8067 | | { |
| | 8068 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 8069 | | } |
| | 8070 | | if (response.Headers.TryGetValue("x-ms-version-id", out _header)) |
| | 8071 | | { |
| | 8072 | | _value.VersionId = _header; |
| | 8073 | | } |
| | 8074 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 8075 | | { |
| | 8076 | | _value.CopyId = _header; |
| | 8077 | | } |
| | 8078 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 8079 | | { |
| | 8080 | | _value.CopyStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseCopyStatus(_header |
| | 8081 | | } |
| | 8082 | |
|
| | 8083 | | // Create the response |
| | 8084 | | return Response.FromValue(_value, response); |
| | 8085 | | } |
| | 8086 | | case 304: |
| | 8087 | | { |
| | 8088 | | // Create the result |
| | 8089 | | Azure.Storage.Blobs.Models.ConditionNotMetError _value = new Azure.Storage.Blobs.Models.Conditio |
| | 8090 | |
|
| | 8091 | | // Get response headers |
| | 8092 | | string _header; |
| | 8093 | | if (response.Headers.TryGetValue("x-ms-error-code", out _header)) |
| | 8094 | | { |
| | 8095 | | _value.ErrorCode = _header; |
| | 8096 | | } |
| | 8097 | |
|
| | 8098 | | throw _value.CreateException(clientDiagnostics, response); |
| | 8099 | | } |
| | 8100 | | default: |
| | 8101 | | { |
| | 8102 | | // Create the result |
| | 8103 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 8104 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 8105 | |
|
| | 8106 | | throw _value.CreateException(clientDiagnostics, response); |
| | 8107 | | } |
| | 8108 | | } |
| | 8109 | | } |
| | 8110 | | #endregion Blob.CopyFromUriAsync |
| | 8111 | |
|
| | 8112 | | #region Blob.AbortCopyFromUriAsync |
| | 8113 | | /// <summary> |
| | 8114 | | /// The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blo |
| | 8115 | | /// </summary> |
| | 8116 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 8117 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 8118 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 8119 | | /// <param name="copyId">The copy identifier provided in the x-ms-copy-id header of the original Copy Blob o |
| | 8120 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 8121 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 8122 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 8123 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 8124 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 8125 | | /// <param name="operationName">Operation name.</param> |
| | 8126 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 8127 | | /// <returns>Azure.Response</returns> |
| | 8128 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> AbortCopyFromUriAsync( |
| | 8129 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 8130 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 8131 | | System.Uri resourceUri, |
| | 8132 | | string copyId, |
| | 8133 | | string version, |
| | 8134 | | int? timeout = default, |
| | 8135 | | string leaseId = default, |
| | 8136 | | string requestId = default, |
| | 8137 | | bool async = true, |
| | 8138 | | string operationName = "BlobClient.AbortCopyFromUri", |
| | 8139 | | System.Threading.CancellationToken cancellationToken = default) |
| | 8140 | | { |
| | 8141 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 8142 | | try |
| | 8143 | | { |
| | 8144 | | _scope.AddAttribute("url", resourceUri); |
| | 8145 | | _scope.Start(); |
| | 8146 | | using (Azure.Core.HttpMessage _message = AbortCopyFromUriAsync_CreateMessage( |
| | 8147 | | pipeline, |
| | 8148 | | resourceUri, |
| | 8149 | | copyId, |
| | 8150 | | version, |
| | 8151 | | timeout, |
| | 8152 | | leaseId, |
| | 8153 | | requestId)) |
| | 8154 | | { |
| | 8155 | | if (async) |
| | 8156 | | { |
| | 8157 | | // Send the request asynchronously if we're being called via an async path |
| | 8158 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 8159 | | } |
| | 8160 | | else |
| | 8161 | | { |
| | 8162 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 8163 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 8164 | | pipeline.Send(_message, cancellationToken); |
| | 8165 | | } |
| | 8166 | | Azure.Response _response = _message.Response; |
| | 8167 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 8168 | | return AbortCopyFromUriAsync_CreateResponse(clientDiagnostics, _response); |
| | 8169 | | } |
| | 8170 | | } |
| | 8171 | | catch (System.Exception ex) |
| | 8172 | | { |
| | 8173 | | _scope.Failed(ex); |
| | 8174 | | throw; |
| | 8175 | | } |
| | 8176 | | finally |
| | 8177 | | { |
| | 8178 | | _scope.Dispose(); |
| | 8179 | | } |
| | 8180 | | } |
| | 8181 | |
|
| | 8182 | | /// <summary> |
| | 8183 | | /// Create the Blob.AbortCopyFromUriAsync request. |
| | 8184 | | /// </summary> |
| | 8185 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 8186 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 8187 | | /// <param name="copyId">The copy identifier provided in the x-ms-copy-id header of the original Copy Blob o |
| | 8188 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 8189 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 8190 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 8191 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 8192 | | /// <returns>The Blob.AbortCopyFromUriAsync Message.</returns> |
| | 8193 | | internal static Azure.Core.HttpMessage AbortCopyFromUriAsync_CreateMessage( |
| | 8194 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 8195 | | System.Uri resourceUri, |
| | 8196 | | string copyId, |
| | 8197 | | string version, |
| | 8198 | | int? timeout = default, |
| | 8199 | | string leaseId = default, |
| | 8200 | | string requestId = default) |
| | 8201 | | { |
| | 8202 | | // Validation |
| | 8203 | | if (resourceUri == null) |
| | 8204 | | { |
| | 8205 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 8206 | | } |
| | 8207 | | if (copyId == null) |
| | 8208 | | { |
| | 8209 | | throw new System.ArgumentNullException(nameof(copyId)); |
| | 8210 | | } |
| | 8211 | | if (version == null) |
| | 8212 | | { |
| | 8213 | | throw new System.ArgumentNullException(nameof(version)); |
| | 8214 | | } |
| | 8215 | |
|
| | 8216 | | // Create the request |
| | 8217 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 8218 | | Azure.Core.Request _request = _message.Request; |
| | 8219 | |
|
| | 8220 | | // Set the endpoint |
| | 8221 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 8222 | | _request.Uri.Reset(resourceUri); |
| | 8223 | | _request.Uri.AppendQuery("comp", "copy", escapeValue: false); |
| | 8224 | | _request.Uri.AppendQuery("copyid", copyId); |
| | 8225 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 8226 | |
|
| | 8227 | | // Add request headers |
| | 8228 | | _request.Headers.SetValue("x-ms-copy-action", "abort"); |
| | 8229 | | _request.Headers.SetValue("x-ms-version", version); |
| | 8230 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 8231 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 8232 | |
|
| | 8233 | | return _message; |
| | 8234 | | } |
| | 8235 | |
|
| | 8236 | | /// <summary> |
| | 8237 | | /// Create the Blob.AbortCopyFromUriAsync response or throw a failure exception. |
| | 8238 | | /// </summary> |
| | 8239 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 8240 | | /// <param name="response">The raw Response.</param> |
| | 8241 | | /// <returns>The Blob.AbortCopyFromUriAsync Azure.Response.</returns> |
| | 8242 | | internal static Azure.Response AbortCopyFromUriAsync_CreateResponse( |
| | 8243 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 8244 | | Azure.Response response) |
| | 8245 | | { |
| | 8246 | | // Process the response |
| | 8247 | | switch (response.Status) |
| | 8248 | | { |
| | 8249 | | case 204: |
| | 8250 | | { |
| | 8251 | | return response; |
| | 8252 | | } |
| | 8253 | | default: |
| | 8254 | | { |
| | 8255 | | // Create the result |
| | 8256 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 8257 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 8258 | |
|
| | 8259 | | throw _value.CreateException(clientDiagnostics, response); |
| | 8260 | | } |
| | 8261 | | } |
| | 8262 | | } |
| | 8263 | | #endregion Blob.AbortCopyFromUriAsync |
| | 8264 | |
|
| | 8265 | | #region Blob.SetAccessTierAsync |
| | 8266 | | /// <summary> |
| | 8267 | | /// The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium sto |
| | 8268 | | /// </summary> |
| | 8269 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 8270 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 8271 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 8272 | | /// <param name="tier">Indicates the tier to be set on the blob.</param> |
| | 8273 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 8274 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 8275 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 8276 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 8277 | | /// <param name="rehydratePriority">Optional: Indicates the priority with which to rehydrate an archived blo |
| | 8278 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 8279 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 8280 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 8281 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 8282 | | /// <param name="operationName">Operation name.</param> |
| | 8283 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 8284 | | /// <returns>Azure.Response</returns> |
| | 8285 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> SetAccessTierAsync( |
| | 8286 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 8287 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 8288 | | System.Uri resourceUri, |
| | 8289 | | Azure.Storage.Blobs.Models.AccessTier tier, |
| | 8290 | | string version, |
| | 8291 | | string snapshot = default, |
| | 8292 | | string versionId = default, |
| | 8293 | | int? timeout = default, |
| | 8294 | | Azure.Storage.Blobs.Models.RehydratePriority? rehydratePriority = default, |
| | 8295 | | string requestId = default, |
| | 8296 | | string leaseId = default, |
| | 8297 | | string ifTags = default, |
| | 8298 | | bool async = true, |
| | 8299 | | string operationName = "BlobClient.SetAccessTier", |
| | 8300 | | System.Threading.CancellationToken cancellationToken = default) |
| | 8301 | | { |
| | 8302 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 8303 | | try |
| | 8304 | | { |
| | 8305 | | _scope.AddAttribute("url", resourceUri); |
| | 8306 | | _scope.Start(); |
| | 8307 | | using (Azure.Core.HttpMessage _message = SetAccessTierAsync_CreateMessage( |
| | 8308 | | pipeline, |
| | 8309 | | resourceUri, |
| | 8310 | | tier, |
| | 8311 | | version, |
| | 8312 | | snapshot, |
| | 8313 | | versionId, |
| | 8314 | | timeout, |
| | 8315 | | rehydratePriority, |
| | 8316 | | requestId, |
| | 8317 | | leaseId, |
| | 8318 | | ifTags)) |
| | 8319 | | { |
| | 8320 | | if (async) |
| | 8321 | | { |
| | 8322 | | // Send the request asynchronously if we're being called via an async path |
| | 8323 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 8324 | | } |
| | 8325 | | else |
| | 8326 | | { |
| | 8327 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 8328 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 8329 | | pipeline.Send(_message, cancellationToken); |
| | 8330 | | } |
| | 8331 | | Azure.Response _response = _message.Response; |
| | 8332 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 8333 | | return SetAccessTierAsync_CreateResponse(clientDiagnostics, _response); |
| | 8334 | | } |
| | 8335 | | } |
| | 8336 | | catch (System.Exception ex) |
| | 8337 | | { |
| | 8338 | | _scope.Failed(ex); |
| | 8339 | | throw; |
| | 8340 | | } |
| | 8341 | | finally |
| | 8342 | | { |
| | 8343 | | _scope.Dispose(); |
| | 8344 | | } |
| | 8345 | | } |
| | 8346 | |
|
| | 8347 | | /// <summary> |
| | 8348 | | /// Create the Blob.SetAccessTierAsync request. |
| | 8349 | | /// </summary> |
| | 8350 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 8351 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 8352 | | /// <param name="tier">Indicates the tier to be set on the blob.</param> |
| | 8353 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 8354 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 8355 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 8356 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 8357 | | /// <param name="rehydratePriority">Optional: Indicates the priority with which to rehydrate an archived blo |
| | 8358 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 8359 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 8360 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 8361 | | /// <returns>The Blob.SetAccessTierAsync Message.</returns> |
| | 8362 | | internal static Azure.Core.HttpMessage SetAccessTierAsync_CreateMessage( |
| | 8363 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 8364 | | System.Uri resourceUri, |
| | 8365 | | Azure.Storage.Blobs.Models.AccessTier tier, |
| | 8366 | | string version, |
| | 8367 | | string snapshot = default, |
| | 8368 | | string versionId = default, |
| | 8369 | | int? timeout = default, |
| | 8370 | | Azure.Storage.Blobs.Models.RehydratePriority? rehydratePriority = default, |
| | 8371 | | string requestId = default, |
| | 8372 | | string leaseId = default, |
| | 8373 | | string ifTags = default) |
| | 8374 | | { |
| | 8375 | | // Validation |
| | 8376 | | if (resourceUri == null) |
| | 8377 | | { |
| | 8378 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 8379 | | } |
| | 8380 | | if (version == null) |
| | 8381 | | { |
| | 8382 | | throw new System.ArgumentNullException(nameof(version)); |
| | 8383 | | } |
| | 8384 | |
|
| | 8385 | | // Create the request |
| | 8386 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 8387 | | Azure.Core.Request _request = _message.Request; |
| | 8388 | |
|
| | 8389 | | // Set the endpoint |
| | 8390 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 8391 | | _request.Uri.Reset(resourceUri); |
| | 8392 | | _request.Uri.AppendQuery("comp", "tier", escapeValue: false); |
| | 8393 | | if (snapshot != null) { _request.Uri.AppendQuery("snapshot", snapshot); } |
| | 8394 | | if (versionId != null) { _request.Uri.AppendQuery("versionid", versionId); } |
| | 8395 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 8396 | |
|
| | 8397 | | // Add request headers |
| | 8398 | | _request.Headers.SetValue("x-ms-access-tier", tier.ToString()); |
| | 8399 | | _request.Headers.SetValue("x-ms-version", version); |
| | 8400 | | if (rehydratePriority != null) { _request.Headers.SetValue("x-ms-rehydrate-priority", rehydratePriority. |
| | 8401 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 8402 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 8403 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 8404 | |
|
| | 8405 | | return _message; |
| | 8406 | | } |
| | 8407 | |
|
| | 8408 | | /// <summary> |
| | 8409 | | /// Create the Blob.SetAccessTierAsync response or throw a failure exception. |
| | 8410 | | /// </summary> |
| | 8411 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 8412 | | /// <param name="response">The raw Response.</param> |
| | 8413 | | /// <returns>The Blob.SetAccessTierAsync Azure.Response.</returns> |
| | 8414 | | internal static Azure.Response SetAccessTierAsync_CreateResponse( |
| | 8415 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 8416 | | Azure.Response response) |
| | 8417 | | { |
| | 8418 | | // Process the response |
| | 8419 | | switch (response.Status) |
| | 8420 | | { |
| | 8421 | | case 200: |
| | 8422 | | { |
| | 8423 | | return response; |
| | 8424 | | } |
| | 8425 | | case 202: |
| | 8426 | | { |
| | 8427 | | return response; |
| | 8428 | | } |
| | 8429 | | default: |
| | 8430 | | { |
| | 8431 | | // Create the result |
| | 8432 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 8433 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 8434 | |
|
| | 8435 | | throw _value.CreateException(clientDiagnostics, response); |
| | 8436 | | } |
| | 8437 | | } |
| | 8438 | | } |
| | 8439 | | #endregion Blob.SetAccessTierAsync |
| | 8440 | |
|
| | 8441 | | #region Blob.QueryAsync |
| | 8442 | | /// <summary> |
| | 8443 | | /// The Query operation enables users to select/project on blob data by providing simple query expressions. |
| | 8444 | | /// </summary> |
| | 8445 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 8446 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 8447 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 8448 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 8449 | | /// <param name="queryRequest">the query request</param> |
| | 8450 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 8451 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 8452 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 8453 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 8454 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 8455 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 8456 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 8457 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 8458 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 8459 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 8460 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 8461 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 8462 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 8463 | | /// <param name="operationName">Operation name.</param> |
| | 8464 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 8465 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobQueryResult}</returns> |
| | 8466 | | public static async System.Threading.Tasks.ValueTask<(Azure.Response<Azure.Storage.Blobs.Models.BlobQueryRes |
| | 8467 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 8468 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 8469 | | System.Uri resourceUri, |
| | 8470 | | string version, |
| | 8471 | | Azure.Storage.Blobs.Models.QueryRequest queryRequest = default, |
| | 8472 | | string snapshot = default, |
| | 8473 | | int? timeout = default, |
| | 8474 | | string leaseId = default, |
| | 8475 | | string encryptionKey = default, |
| | 8476 | | string encryptionKeySha256 = default, |
| | 8477 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 8478 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 8479 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 8480 | | Azure.ETag? ifMatch = default, |
| | 8481 | | Azure.ETag? ifNoneMatch = default, |
| | 8482 | | string ifTags = default, |
| | 8483 | | string requestId = default, |
| | 8484 | | bool async = true, |
| | 8485 | | string operationName = "BlobClient.Query", |
| | 8486 | | System.Threading.CancellationToken cancellationToken = default) |
| | 8487 | | { |
| | 8488 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 8489 | | try |
| | 8490 | | { |
| | 8491 | | _scope.AddAttribute("url", resourceUri); |
| | 8492 | | _scope.Start(); |
| | 8493 | | using (Azure.Core.HttpMessage _message = QueryAsync_CreateMessage( |
| | 8494 | | pipeline, |
| | 8495 | | resourceUri, |
| | 8496 | | version, |
| | 8497 | | queryRequest, |
| | 8498 | | snapshot, |
| | 8499 | | timeout, |
| | 8500 | | leaseId, |
| | 8501 | | encryptionKey, |
| | 8502 | | encryptionKeySha256, |
| | 8503 | | encryptionAlgorithm, |
| | 8504 | | ifModifiedSince, |
| | 8505 | | ifUnmodifiedSince, |
| | 8506 | | ifMatch, |
| | 8507 | | ifNoneMatch, |
| | 8508 | | ifTags, |
| | 8509 | | requestId)) |
| | 8510 | | { |
| | 8511 | | // Avoid buffering if stream is going to be returned to the caller |
| | 8512 | | _message.BufferResponse = false; |
| | 8513 | | if (async) |
| | 8514 | | { |
| | 8515 | | // Send the request asynchronously if we're being called via an async path |
| | 8516 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 8517 | | } |
| | 8518 | | else |
| | 8519 | | { |
| | 8520 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 8521 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 8522 | | pipeline.Send(_message, cancellationToken); |
| | 8523 | | } |
| | 8524 | | Azure.Response _response = _message.Response; |
| | 8525 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 8526 | | return (QueryAsync_CreateResponse(clientDiagnostics, _response), _message.ExtractResponseContent |
| | 8527 | | } |
| | 8528 | | } |
| | 8529 | | catch (System.Exception ex) |
| | 8530 | | { |
| | 8531 | | _scope.Failed(ex); |
| | 8532 | | throw; |
| | 8533 | | } |
| | 8534 | | finally |
| | 8535 | | { |
| | 8536 | | _scope.Dispose(); |
| | 8537 | | } |
| | 8538 | | } |
| | 8539 | |
|
| | 8540 | | /// <summary> |
| | 8541 | | /// Create the Blob.QueryAsync request. |
| | 8542 | | /// </summary> |
| | 8543 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 8544 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 8545 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 8546 | | /// <param name="queryRequest">the query request</param> |
| | 8547 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 8548 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 8549 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 8550 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 8551 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 8552 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 8553 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 8554 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 8555 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 8556 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 8557 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 8558 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 8559 | | /// <returns>The Blob.QueryAsync Message.</returns> |
| | 8560 | | internal static Azure.Core.HttpMessage QueryAsync_CreateMessage( |
| | 8561 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 8562 | | System.Uri resourceUri, |
| | 8563 | | string version, |
| | 8564 | | Azure.Storage.Blobs.Models.QueryRequest queryRequest = default, |
| | 8565 | | string snapshot = default, |
| | 8566 | | int? timeout = default, |
| | 8567 | | string leaseId = default, |
| | 8568 | | string encryptionKey = default, |
| | 8569 | | string encryptionKeySha256 = default, |
| | 8570 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 8571 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 8572 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 8573 | | Azure.ETag? ifMatch = default, |
| | 8574 | | Azure.ETag? ifNoneMatch = default, |
| | 8575 | | string ifTags = default, |
| | 8576 | | string requestId = default) |
| | 8577 | | { |
| | 8578 | | // Validation |
| | 8579 | | if (resourceUri == null) |
| | 8580 | | { |
| | 8581 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 8582 | | } |
| | 8583 | | if (version == null) |
| | 8584 | | { |
| | 8585 | | throw new System.ArgumentNullException(nameof(version)); |
| | 8586 | | } |
| | 8587 | |
|
| | 8588 | | // Create the request |
| | 8589 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 8590 | | Azure.Core.Request _request = _message.Request; |
| | 8591 | |
|
| | 8592 | | // Set the endpoint |
| | 8593 | | _request.Method = Azure.Core.RequestMethod.Post; |
| | 8594 | | _request.Uri.Reset(resourceUri); |
| | 8595 | | _request.Uri.AppendQuery("comp", "query", escapeValue: false); |
| | 8596 | | if (snapshot != null) { _request.Uri.AppendQuery("snapshot", snapshot); } |
| | 8597 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 8598 | |
|
| | 8599 | | // Add request headers |
| | 8600 | | _request.Headers.SetValue("x-ms-version", version); |
| | 8601 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 8602 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 8603 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 8604 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 8605 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 8606 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 8607 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 8608 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 8609 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 8610 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 8611 | |
|
| | 8612 | | // Create the body |
| | 8613 | | if (queryRequest != null) |
| | 8614 | | { |
| | 8615 | | System.Xml.Linq.XElement _body = Azure.Storage.Blobs.Models.QueryRequest.ToXml(queryRequest, "QueryR |
| | 8616 | | string _text = _body.ToString(System.Xml.Linq.SaveOptions.DisableFormatting); |
| | 8617 | | _request.Headers.SetValue("Content-Type", "application/xml"); |
| | 8618 | | _request.Headers.SetValue("Content-Length", _text.Length.ToString(System.Globalization.CultureInfo.I |
| | 8619 | | _request.Content = Azure.Core.RequestContent.Create(System.Text.Encoding.UTF8.GetBytes(_text)); |
| | 8620 | | } |
| | 8621 | |
|
| | 8622 | | return _message; |
| | 8623 | | } |
| | 8624 | |
|
| | 8625 | | /// <summary> |
| | 8626 | | /// Create the Blob.QueryAsync response or throw a failure exception. |
| | 8627 | | /// </summary> |
| | 8628 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 8629 | | /// <param name="response">The raw Response.</param> |
| | 8630 | | /// <returns>The Blob.QueryAsync Azure.Response{Azure.Storage.Blobs.Models.BlobQueryResult}.</returns> |
| | 8631 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobQueryResult> QueryAsync_CreateResponse( |
| | 8632 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 8633 | | Azure.Response response) |
| | 8634 | | { |
| | 8635 | | // Process the response |
| | 8636 | | switch (response.Status) |
| | 8637 | | { |
| | 8638 | | case 200: |
| | 8639 | | { |
| | 8640 | | // Create the result |
| | 8641 | | Azure.Storage.Blobs.Models.BlobQueryResult _value = new Azure.Storage.Blobs.Models.BlobQueryResu |
| | 8642 | | _value.Body = response.ContentStream; // You should manually wrap with RetriableStream! |
| | 8643 | |
|
| | 8644 | | // Get response headers |
| | 8645 | | string _header; |
| | 8646 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 8647 | | { |
| | 8648 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 8649 | | } |
| | 8650 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompare |
| | 8651 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 8652 | | { |
| | 8653 | | if (_headerPair.Name.StartsWith("x-ms-meta-", System.StringComparison.InvariantCulture)) |
| | 8654 | | { |
| | 8655 | | _value.Metadata[_headerPair.Name.Substring(10)] = _headerPair.Value; |
| | 8656 | | } |
| | 8657 | | } |
| | 8658 | | if (response.Headers.TryGetValue("Content-Length", out _header)) |
| | 8659 | | { |
| | 8660 | | _value.ContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture |
| | 8661 | | } |
| | 8662 | | if (response.Headers.TryGetValue("Content-Type", out _header)) |
| | 8663 | | { |
| | 8664 | | _value.ContentType = _header; |
| | 8665 | | } |
| | 8666 | | if (response.Headers.TryGetValue("Content-Range", out _header)) |
| | 8667 | | { |
| | 8668 | | _value.ContentRange = _header; |
| | 8669 | | } |
| | 8670 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 8671 | | { |
| | 8672 | | _value.ETag = new Azure.ETag(_header); |
| | 8673 | | } |
| | 8674 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 8675 | | { |
| | 8676 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 8677 | | } |
| | 8678 | | if (response.Headers.TryGetValue("Content-Encoding", out _header)) |
| | 8679 | | { |
| | 8680 | | _value.ContentEncoding = _header; |
| | 8681 | | } |
| | 8682 | | if (response.Headers.TryGetValue("Cache-Control", out _header)) |
| | 8683 | | { |
| | 8684 | | _value.CacheControl = _header; |
| | 8685 | | } |
| | 8686 | | if (response.Headers.TryGetValue("Content-Disposition", out _header)) |
| | 8687 | | { |
| | 8688 | | _value.ContentDisposition = _header; |
| | 8689 | | } |
| | 8690 | | if (response.Headers.TryGetValue("Content-Language", out _header)) |
| | 8691 | | { |
| | 8692 | | _value.ContentLanguage = _header; |
| | 8693 | | } |
| | 8694 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 8695 | | { |
| | 8696 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 8697 | | } |
| | 8698 | | if (response.Headers.TryGetValue("x-ms-blob-type", out _header)) |
| | 8699 | | { |
| | 8700 | | _value.BlobType = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseBlobType(_header); |
| | 8701 | | } |
| | 8702 | | if (response.Headers.TryGetValue("x-ms-copy-completion-time", out _header)) |
| | 8703 | | { |
| | 8704 | | _value.CopyCompletionTime = System.DateTimeOffset.Parse(_header, System.Globalization.Cultur |
| | 8705 | | } |
| | 8706 | | if (response.Headers.TryGetValue("x-ms-copy-status-description", out _header)) |
| | 8707 | | { |
| | 8708 | | _value.CopyStatusDescription = _header; |
| | 8709 | | } |
| | 8710 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 8711 | | { |
| | 8712 | | _value.CopyId = _header; |
| | 8713 | | } |
| | 8714 | | if (response.Headers.TryGetValue("x-ms-copy-progress", out _header)) |
| | 8715 | | { |
| | 8716 | | _value.CopyProgress = _header; |
| | 8717 | | } |
| | 8718 | | if (response.Headers.TryGetValue("x-ms-copy-source", out _header)) |
| | 8719 | | { |
| | 8720 | | _value.CopySource = _header; |
| | 8721 | | } |
| | 8722 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 8723 | | { |
| | 8724 | | _value.CopyStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseCopyStatus(_header |
| | 8725 | | } |
| | 8726 | | if (response.Headers.TryGetValue("x-ms-lease-duration", out _header)) |
| | 8727 | | { |
| | 8728 | | _value.LeaseDuration = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseDurationTy |
| | 8729 | | } |
| | 8730 | | if (response.Headers.TryGetValue("x-ms-lease-state", out _header)) |
| | 8731 | | { |
| | 8732 | | _value.LeaseState = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseState(_header |
| | 8733 | | } |
| | 8734 | | if (response.Headers.TryGetValue("x-ms-lease-status", out _header)) |
| | 8735 | | { |
| | 8736 | | _value.LeaseStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseStatus(_head |
| | 8737 | | } |
| | 8738 | | if (response.Headers.TryGetValue("Accept-Ranges", out _header)) |
| | 8739 | | { |
| | 8740 | | _value.AcceptRanges = _header; |
| | 8741 | | } |
| | 8742 | | if (response.Headers.TryGetValue("x-ms-blob-committed-block-count", out _header)) |
| | 8743 | | { |
| | 8744 | | _value.BlobCommittedBlockCount = int.Parse(_header, System.Globalization.CultureInfo.Invaria |
| | 8745 | | } |
| | 8746 | | if (response.Headers.TryGetValue("x-ms-server-encrypted", out _header)) |
| | 8747 | | { |
| | 8748 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 8749 | | } |
| | 8750 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 8751 | | { |
| | 8752 | | _value.EncryptionKeySha256 = _header; |
| | 8753 | | } |
| | 8754 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 8755 | | { |
| | 8756 | | _value.EncryptionScope = _header; |
| | 8757 | | } |
| | 8758 | | if (response.Headers.TryGetValue("x-ms-blob-content-md5", out _header)) |
| | 8759 | | { |
| | 8760 | | _value.BlobContentMD5 = System.Convert.FromBase64String(_header); |
| | 8761 | | } |
| | 8762 | |
|
| | 8763 | | // Create the response |
| | 8764 | | return Response.FromValue(_value, response); |
| | 8765 | | } |
| | 8766 | | case 206: |
| | 8767 | | { |
| | 8768 | | // Create the result |
| | 8769 | | Azure.Storage.Blobs.Models.BlobQueryResult _value = new Azure.Storage.Blobs.Models.BlobQueryResu |
| | 8770 | | _value.Body = response.ContentStream; // You should manually wrap with RetriableStream! |
| | 8771 | |
|
| | 8772 | | // Get response headers |
| | 8773 | | string _header; |
| | 8774 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 8775 | | { |
| | 8776 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 8777 | | } |
| | 8778 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompare |
| | 8779 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 8780 | | { |
| | 8781 | | if (_headerPair.Name.StartsWith("x-ms-meta-", System.StringComparison.InvariantCulture)) |
| | 8782 | | { |
| | 8783 | | _value.Metadata[_headerPair.Name.Substring(10)] = _headerPair.Value; |
| | 8784 | | } |
| | 8785 | | } |
| | 8786 | | if (response.Headers.TryGetValue("Content-Length", out _header)) |
| | 8787 | | { |
| | 8788 | | _value.ContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture |
| | 8789 | | } |
| | 8790 | | if (response.Headers.TryGetValue("Content-Type", out _header)) |
| | 8791 | | { |
| | 8792 | | _value.ContentType = _header; |
| | 8793 | | } |
| | 8794 | | if (response.Headers.TryGetValue("Content-Range", out _header)) |
| | 8795 | | { |
| | 8796 | | _value.ContentRange = _header; |
| | 8797 | | } |
| | 8798 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 8799 | | { |
| | 8800 | | _value.ETag = new Azure.ETag(_header); |
| | 8801 | | } |
| | 8802 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 8803 | | { |
| | 8804 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 8805 | | } |
| | 8806 | | if (response.Headers.TryGetValue("Content-Encoding", out _header)) |
| | 8807 | | { |
| | 8808 | | _value.ContentEncoding = _header; |
| | 8809 | | } |
| | 8810 | | if (response.Headers.TryGetValue("Cache-Control", out _header)) |
| | 8811 | | { |
| | 8812 | | _value.CacheControl = _header; |
| | 8813 | | } |
| | 8814 | | if (response.Headers.TryGetValue("Content-Disposition", out _header)) |
| | 8815 | | { |
| | 8816 | | _value.ContentDisposition = _header; |
| | 8817 | | } |
| | 8818 | | if (response.Headers.TryGetValue("Content-Language", out _header)) |
| | 8819 | | { |
| | 8820 | | _value.ContentLanguage = _header; |
| | 8821 | | } |
| | 8822 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 8823 | | { |
| | 8824 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 8825 | | } |
| | 8826 | | if (response.Headers.TryGetValue("x-ms-blob-type", out _header)) |
| | 8827 | | { |
| | 8828 | | _value.BlobType = (Azure.Storage.Blobs.Models.BlobType)System.Enum.Parse(typeof(Azure.Storag |
| | 8829 | | } |
| | 8830 | | if (response.Headers.TryGetValue("x-ms-content-crc64", out _header)) |
| | 8831 | | { |
| | 8832 | | _value.ContentCrc64 = System.Convert.FromBase64String(_header); |
| | 8833 | | } |
| | 8834 | | if (response.Headers.TryGetValue("x-ms-copy-completion-time", out _header)) |
| | 8835 | | { |
| | 8836 | | _value.CopyCompletionTime = System.DateTimeOffset.Parse(_header, System.Globalization.Cultur |
| | 8837 | | } |
| | 8838 | | if (response.Headers.TryGetValue("x-ms-copy-status-description", out _header)) |
| | 8839 | | { |
| | 8840 | | _value.CopyStatusDescription = _header; |
| | 8841 | | } |
| | 8842 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 8843 | | { |
| | 8844 | | _value.CopyId = _header; |
| | 8845 | | } |
| | 8846 | | if (response.Headers.TryGetValue("x-ms-copy-progress", out _header)) |
| | 8847 | | { |
| | 8848 | | _value.CopyProgress = _header; |
| | 8849 | | } |
| | 8850 | | if (response.Headers.TryGetValue("x-ms-copy-source", out _header)) |
| | 8851 | | { |
| | 8852 | | _value.CopySource = _header; |
| | 8853 | | } |
| | 8854 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 8855 | | { |
| | 8856 | | _value.CopyStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseCopyStatus(_header |
| | 8857 | | } |
| | 8858 | | if (response.Headers.TryGetValue("x-ms-lease-duration", out _header)) |
| | 8859 | | { |
| | 8860 | | _value.LeaseDuration = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseDurationTy |
| | 8861 | | } |
| | 8862 | | if (response.Headers.TryGetValue("x-ms-lease-state", out _header)) |
| | 8863 | | { |
| | 8864 | | _value.LeaseState = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseState(_header |
| | 8865 | | } |
| | 8866 | | if (response.Headers.TryGetValue("x-ms-lease-status", out _header)) |
| | 8867 | | { |
| | 8868 | | _value.LeaseStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseStatus(_head |
| | 8869 | | } |
| | 8870 | | if (response.Headers.TryGetValue("Accept-Ranges", out _header)) |
| | 8871 | | { |
| | 8872 | | _value.AcceptRanges = _header; |
| | 8873 | | } |
| | 8874 | | if (response.Headers.TryGetValue("x-ms-blob-committed-block-count", out _header)) |
| | 8875 | | { |
| | 8876 | | _value.BlobCommittedBlockCount = int.Parse(_header, System.Globalization.CultureInfo.Invaria |
| | 8877 | | } |
| | 8878 | | if (response.Headers.TryGetValue("x-ms-server-encrypted", out _header)) |
| | 8879 | | { |
| | 8880 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 8881 | | } |
| | 8882 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 8883 | | { |
| | 8884 | | _value.EncryptionKeySha256 = _header; |
| | 8885 | | } |
| | 8886 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 8887 | | { |
| | 8888 | | _value.EncryptionScope = _header; |
| | 8889 | | } |
| | 8890 | | if (response.Headers.TryGetValue("x-ms-blob-content-md5", out _header)) |
| | 8891 | | { |
| | 8892 | | _value.BlobContentMD5 = System.Convert.FromBase64String(_header); |
| | 8893 | | } |
| | 8894 | |
|
| | 8895 | | // Create the response |
| | 8896 | | return Response.FromValue(_value, response); |
| | 8897 | | } |
| | 8898 | | default: |
| | 8899 | | { |
| | 8900 | | // Create the result |
| | 8901 | | Azure.Storage.Blobs.Models.FailureNoContent _value = new Azure.Storage.Blobs.Models.FailureNoCon |
| | 8902 | |
|
| | 8903 | | // Get response headers |
| | 8904 | | string _header; |
| | 8905 | | if (response.Headers.TryGetValue("x-ms-error-code", out _header)) |
| | 8906 | | { |
| | 8907 | | _value.ErrorCode = _header; |
| | 8908 | | } |
| | 8909 | |
|
| | 8910 | | throw _value.CreateException(clientDiagnostics, response); |
| | 8911 | | } |
| | 8912 | | } |
| | 8913 | | } |
| | 8914 | | #endregion Blob.QueryAsync |
| | 8915 | |
|
| | 8916 | | #region Blob.GetTagsAsync |
| | 8917 | | /// <summary> |
| | 8918 | | /// The Get Tags operation enables users to get the tags associated with a blob. |
| | 8919 | | /// </summary> |
| | 8920 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 8921 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 8922 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 8923 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 8924 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 8925 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 8926 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 8927 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 8928 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 8929 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 8930 | | /// <param name="operationName">Operation name.</param> |
| | 8931 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 8932 | | /// <returns>Blob tags</returns> |
| | 8933 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobTags>> Ge |
| | 8934 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 8935 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 8936 | | System.Uri resourceUri, |
| | 8937 | | string version, |
| | 8938 | | int? timeout = default, |
| | 8939 | | string requestId = default, |
| | 8940 | | string snapshot = default, |
| | 8941 | | string versionId = default, |
| | 8942 | | string ifTags = default, |
| | 8943 | | bool async = true, |
| | 8944 | | string operationName = "BlobClient.GetTags", |
| | 8945 | | System.Threading.CancellationToken cancellationToken = default) |
| | 8946 | | { |
| | 8947 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 8948 | | try |
| | 8949 | | { |
| | 8950 | | _scope.AddAttribute("url", resourceUri); |
| | 8951 | | _scope.Start(); |
| | 8952 | | using (Azure.Core.HttpMessage _message = GetTagsAsync_CreateMessage( |
| | 8953 | | pipeline, |
| | 8954 | | resourceUri, |
| | 8955 | | version, |
| | 8956 | | timeout, |
| | 8957 | | requestId, |
| | 8958 | | snapshot, |
| | 8959 | | versionId, |
| | 8960 | | ifTags)) |
| | 8961 | | { |
| | 8962 | | if (async) |
| | 8963 | | { |
| | 8964 | | // Send the request asynchronously if we're being called via an async path |
| | 8965 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 8966 | | } |
| | 8967 | | else |
| | 8968 | | { |
| | 8969 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 8970 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 8971 | | pipeline.Send(_message, cancellationToken); |
| | 8972 | | } |
| | 8973 | | Azure.Response _response = _message.Response; |
| | 8974 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 8975 | | return GetTagsAsync_CreateResponse(clientDiagnostics, _response); |
| | 8976 | | } |
| | 8977 | | } |
| | 8978 | | catch (System.Exception ex) |
| | 8979 | | { |
| | 8980 | | _scope.Failed(ex); |
| | 8981 | | throw; |
| | 8982 | | } |
| | 8983 | | finally |
| | 8984 | | { |
| | 8985 | | _scope.Dispose(); |
| | 8986 | | } |
| | 8987 | | } |
| | 8988 | |
|
| | 8989 | | /// <summary> |
| | 8990 | | /// Create the Blob.GetTagsAsync request. |
| | 8991 | | /// </summary> |
| | 8992 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 8993 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 8994 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 8995 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 8996 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 8997 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 8998 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 8999 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 9000 | | /// <returns>The Blob.GetTagsAsync Message.</returns> |
| | 9001 | | internal static Azure.Core.HttpMessage GetTagsAsync_CreateMessage( |
| | 9002 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 9003 | | System.Uri resourceUri, |
| | 9004 | | string version, |
| | 9005 | | int? timeout = default, |
| | 9006 | | string requestId = default, |
| | 9007 | | string snapshot = default, |
| | 9008 | | string versionId = default, |
| | 9009 | | string ifTags = default) |
| | 9010 | | { |
| | 9011 | | // Validation |
| | 9012 | | if (resourceUri == null) |
| | 9013 | | { |
| | 9014 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 9015 | | } |
| | 9016 | | if (version == null) |
| | 9017 | | { |
| | 9018 | | throw new System.ArgumentNullException(nameof(version)); |
| | 9019 | | } |
| | 9020 | |
|
| | 9021 | | // Create the request |
| | 9022 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 9023 | | Azure.Core.Request _request = _message.Request; |
| | 9024 | |
|
| | 9025 | | // Set the endpoint |
| | 9026 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 9027 | | _request.Uri.Reset(resourceUri); |
| | 9028 | | _request.Uri.AppendQuery("comp", "tags", escapeValue: false); |
| | 9029 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 9030 | | if (snapshot != null) { _request.Uri.AppendQuery("snapshot", snapshot); } |
| | 9031 | | if (versionId != null) { _request.Uri.AppendQuery("versionid", versionId); } |
| | 9032 | |
|
| | 9033 | | // Add request headers |
| | 9034 | | _request.Headers.SetValue("x-ms-version", version); |
| | 9035 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 9036 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 9037 | |
|
| | 9038 | | return _message; |
| | 9039 | | } |
| | 9040 | |
|
| | 9041 | | /// <summary> |
| | 9042 | | /// Create the Blob.GetTagsAsync response or throw a failure exception. |
| | 9043 | | /// </summary> |
| | 9044 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 9045 | | /// <param name="response">The raw Response.</param> |
| | 9046 | | /// <returns>The Blob.GetTagsAsync Azure.Response{Azure.Storage.Blobs.Models.BlobTags}.</returns> |
| | 9047 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobTags> GetTagsAsync_CreateResponse( |
| | 9048 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 9049 | | Azure.Response response) |
| | 9050 | | { |
| | 9051 | | // Process the response |
| | 9052 | | switch (response.Status) |
| | 9053 | | { |
| | 9054 | | case 200: |
| | 9055 | | { |
| | 9056 | | // Create the result |
| | 9057 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 9058 | | Azure.Storage.Blobs.Models.BlobTags _value = Azure.Storage.Blobs.Models.BlobTags.FromXml(_xml.Ro |
| | 9059 | |
|
| | 9060 | | // Create the response |
| | 9061 | | return Response.FromValue(_value, response); |
| | 9062 | | } |
| | 9063 | | case 304: |
| | 9064 | | { |
| | 9065 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.BlobTags>(response); |
| | 9066 | | } |
| | 9067 | | default: |
| | 9068 | | { |
| | 9069 | | // Create the result |
| | 9070 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 9071 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 9072 | |
|
| | 9073 | | throw _value.CreateException(clientDiagnostics, response); |
| | 9074 | | } |
| | 9075 | | } |
| | 9076 | | } |
| | 9077 | | #endregion Blob.GetTagsAsync |
| | 9078 | |
|
| | 9079 | | #region Blob.SetTagsAsync |
| | 9080 | | /// <summary> |
| | 9081 | | /// The Set Tags operation enables users to set tags on a blob. |
| | 9082 | | /// </summary> |
| | 9083 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 9084 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 9085 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 9086 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 9087 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 9088 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 9089 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 9090 | | /// <param name="transactionalContentCrc64">Specify the transactional crc64 for the body, to be validated by |
| | 9091 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 9092 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 9093 | | /// <param name="tags">Blob tags</param> |
| | 9094 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 9095 | | /// <param name="operationName">Operation name.</param> |
| | 9096 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 9097 | | /// <returns>Azure.Response</returns> |
| | 9098 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> SetTagsAsync( |
| | 9099 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 9100 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 9101 | | System.Uri resourceUri, |
| | 9102 | | string version, |
| | 9103 | | int? timeout = default, |
| | 9104 | | string versionId = default, |
| | 9105 | | byte[] transactionalContentHash = default, |
| | 9106 | | byte[] transactionalContentCrc64 = default, |
| | 9107 | | string requestId = default, |
| | 9108 | | string ifTags = default, |
| | 9109 | | Azure.Storage.Blobs.Models.BlobTags tags = default, |
| | 9110 | | bool async = true, |
| | 9111 | | string operationName = "BlobClient.SetTags", |
| | 9112 | | System.Threading.CancellationToken cancellationToken = default) |
| | 9113 | | { |
| | 9114 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 9115 | | try |
| | 9116 | | { |
| | 9117 | | _scope.AddAttribute("url", resourceUri); |
| | 9118 | | _scope.Start(); |
| | 9119 | | using (Azure.Core.HttpMessage _message = SetTagsAsync_CreateMessage( |
| | 9120 | | pipeline, |
| | 9121 | | resourceUri, |
| | 9122 | | version, |
| | 9123 | | timeout, |
| | 9124 | | versionId, |
| | 9125 | | transactionalContentHash, |
| | 9126 | | transactionalContentCrc64, |
| | 9127 | | requestId, |
| | 9128 | | ifTags, |
| | 9129 | | tags)) |
| | 9130 | | { |
| | 9131 | | if (async) |
| | 9132 | | { |
| | 9133 | | // Send the request asynchronously if we're being called via an async path |
| | 9134 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 9135 | | } |
| | 9136 | | else |
| | 9137 | | { |
| | 9138 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 9139 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 9140 | | pipeline.Send(_message, cancellationToken); |
| | 9141 | | } |
| | 9142 | | Azure.Response _response = _message.Response; |
| | 9143 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 9144 | | return SetTagsAsync_CreateResponse(clientDiagnostics, _response); |
| | 9145 | | } |
| | 9146 | | } |
| | 9147 | | catch (System.Exception ex) |
| | 9148 | | { |
| | 9149 | | _scope.Failed(ex); |
| | 9150 | | throw; |
| | 9151 | | } |
| | 9152 | | finally |
| | 9153 | | { |
| | 9154 | | _scope.Dispose(); |
| | 9155 | | } |
| | 9156 | | } |
| | 9157 | |
|
| | 9158 | | /// <summary> |
| | 9159 | | /// Create the Blob.SetTagsAsync request. |
| | 9160 | | /// </summary> |
| | 9161 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 9162 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 9163 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 9164 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 9165 | | /// <param name="versionId">The version id parameter is an opaque DateTime value that, when present, specifi |
| | 9166 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 9167 | | /// <param name="transactionalContentCrc64">Specify the transactional crc64 for the body, to be validated by |
| | 9168 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 9169 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 9170 | | /// <param name="tags">Blob tags</param> |
| | 9171 | | /// <returns>The Blob.SetTagsAsync Message.</returns> |
| | 9172 | | internal static Azure.Core.HttpMessage SetTagsAsync_CreateMessage( |
| | 9173 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 9174 | | System.Uri resourceUri, |
| | 9175 | | string version, |
| | 9176 | | int? timeout = default, |
| | 9177 | | string versionId = default, |
| | 9178 | | byte[] transactionalContentHash = default, |
| | 9179 | | byte[] transactionalContentCrc64 = default, |
| | 9180 | | string requestId = default, |
| | 9181 | | string ifTags = default, |
| | 9182 | | Azure.Storage.Blobs.Models.BlobTags tags = default) |
| | 9183 | | { |
| | 9184 | | // Validation |
| | 9185 | | if (resourceUri == null) |
| | 9186 | | { |
| | 9187 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 9188 | | } |
| | 9189 | | if (version == null) |
| | 9190 | | { |
| | 9191 | | throw new System.ArgumentNullException(nameof(version)); |
| | 9192 | | } |
| | 9193 | |
|
| | 9194 | | // Create the request |
| | 9195 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 9196 | | Azure.Core.Request _request = _message.Request; |
| | 9197 | |
|
| | 9198 | | // Set the endpoint |
| | 9199 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 9200 | | _request.Uri.Reset(resourceUri); |
| | 9201 | | _request.Uri.AppendQuery("comp", "tags", escapeValue: false); |
| | 9202 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 9203 | | if (versionId != null) { _request.Uri.AppendQuery("versionid", versionId); } |
| | 9204 | |
|
| | 9205 | | // Add request headers |
| | 9206 | | _request.Headers.SetValue("x-ms-version", version); |
| | 9207 | | if (transactionalContentHash != null) { _request.Headers.SetValue("Content-MD5", System.Convert.ToBase64 |
| | 9208 | | if (transactionalContentCrc64 != null) { _request.Headers.SetValue("x-ms-content-crc64", System.Convert. |
| | 9209 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 9210 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 9211 | |
|
| | 9212 | | // Create the body |
| | 9213 | | if (tags != null) |
| | 9214 | | { |
| | 9215 | | System.Xml.Linq.XElement _body = Azure.Storage.Blobs.Models.BlobTags.ToXml(tags, "Tags", ""); |
| | 9216 | | string _text = _body.ToString(System.Xml.Linq.SaveOptions.DisableFormatting); |
| | 9217 | | _request.Headers.SetValue("Content-Type", "application/xml"); |
| | 9218 | | _request.Headers.SetValue("Content-Length", _text.Length.ToString(System.Globalization.CultureInfo.I |
| | 9219 | | _request.Content = Azure.Core.RequestContent.Create(System.Text.Encoding.UTF8.GetBytes(_text)); |
| | 9220 | | } |
| | 9221 | |
|
| | 9222 | | return _message; |
| | 9223 | | } |
| | 9224 | |
|
| | 9225 | | /// <summary> |
| | 9226 | | /// Create the Blob.SetTagsAsync response or throw a failure exception. |
| | 9227 | | /// </summary> |
| | 9228 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 9229 | | /// <param name="response">The raw Response.</param> |
| | 9230 | | /// <returns>The Blob.SetTagsAsync Azure.Response.</returns> |
| | 9231 | | internal static Azure.Response SetTagsAsync_CreateResponse( |
| | 9232 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 9233 | | Azure.Response response) |
| | 9234 | | { |
| | 9235 | | // Process the response |
| | 9236 | | switch (response.Status) |
| | 9237 | | { |
| | 9238 | | case 204: |
| | 9239 | | { |
| | 9240 | | return response; |
| | 9241 | | } |
| | 9242 | | default: |
| | 9243 | | { |
| | 9244 | | // Create the result |
| | 9245 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 9246 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 9247 | |
|
| | 9248 | | throw _value.CreateException(clientDiagnostics, response); |
| | 9249 | | } |
| | 9250 | | } |
| | 9251 | | } |
| | 9252 | | #endregion Blob.SetTagsAsync |
| | 9253 | | } |
| | 9254 | | #endregion Blob operations |
| | 9255 | |
|
| | 9256 | | #region PageBlob operations |
| | 9257 | | /// <summary> |
| | 9258 | | /// PageBlob operations for Azure Blob Storage |
| | 9259 | | /// </summary> |
| | 9260 | | public static partial class PageBlob |
| | 9261 | | { |
| | 9262 | | #region PageBlob.CreateAsync |
| | 9263 | | /// <summary> |
| | 9264 | | /// The Create operation creates a new page blob. |
| | 9265 | | /// </summary> |
| | 9266 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 9267 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 9268 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 9269 | | /// <param name="contentLength">The length of the request.</param> |
| | 9270 | | /// <param name="blobContentLength">This header specifies the maximum size for the page blob, up to 1 TB. Th |
| | 9271 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 9272 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 9273 | | /// <param name="tier">Optional. Indicates the tier to be set on the page blob.</param> |
| | 9274 | | /// <param name="blobContentType">Optional. Sets the blob's content type. If specified, this property is sto |
| | 9275 | | /// <param name="blobContentEncoding">Optional. Sets the blob's content encoding. If specified, this propert |
| | 9276 | | /// <param name="blobContentLanguage">Optional. Set the blob's content language. If specified, this property |
| | 9277 | | /// <param name="blobContentHash">Optional. An MD5 hash of the blob content. Note that this hash is not vali |
| | 9278 | | /// <param name="blobCacheControl">Optional. Sets the blob's cache control. If specified, this property is s |
| | 9279 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 9280 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 9281 | | /// <param name="blobContentDisposition">Optional. Sets the blob's Content-Disposition header.</param> |
| | 9282 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 9283 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 9284 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 9285 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 9286 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 9287 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 9288 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 9289 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 9290 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 9291 | | /// <param name="blobSequenceNumber">Set for page blobs only. The sequence number is a user-controlled value |
| | 9292 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 9293 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 9294 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 9295 | | /// <param name="operationName">Operation name.</param> |
| | 9296 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 9297 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobContentInfo}</returns> |
| | 9298 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobContentIn |
| | 9299 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 9300 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 9301 | | System.Uri resourceUri, |
| | 9302 | | long contentLength, |
| | 9303 | | long blobContentLength, |
| | 9304 | | string version, |
| | 9305 | | int? timeout = default, |
| | 9306 | | Azure.Storage.Blobs.Models.AccessTier? tier = default, |
| | 9307 | | string blobContentType = default, |
| | 9308 | | string blobContentEncoding = default, |
| | 9309 | | string blobContentLanguage = default, |
| | 9310 | | byte[] blobContentHash = default, |
| | 9311 | | string blobCacheControl = default, |
| | 9312 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 9313 | | string leaseId = default, |
| | 9314 | | string blobContentDisposition = default, |
| | 9315 | | string encryptionKey = default, |
| | 9316 | | string encryptionKeySha256 = default, |
| | 9317 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 9318 | | string encryptionScope = default, |
| | 9319 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 9320 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 9321 | | Azure.ETag? ifMatch = default, |
| | 9322 | | Azure.ETag? ifNoneMatch = default, |
| | 9323 | | string ifTags = default, |
| | 9324 | | long? blobSequenceNumber = default, |
| | 9325 | | string requestId = default, |
| | 9326 | | string blobTagsString = default, |
| | 9327 | | bool async = true, |
| | 9328 | | string operationName = "PageBlobClient.Create", |
| | 9329 | | System.Threading.CancellationToken cancellationToken = default) |
| | 9330 | | { |
| | 9331 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 9332 | | try |
| | 9333 | | { |
| | 9334 | | _scope.AddAttribute("url", resourceUri); |
| | 9335 | | _scope.Start(); |
| | 9336 | | using (Azure.Core.HttpMessage _message = CreateAsync_CreateMessage( |
| | 9337 | | pipeline, |
| | 9338 | | resourceUri, |
| | 9339 | | contentLength, |
| | 9340 | | blobContentLength, |
| | 9341 | | version, |
| | 9342 | | timeout, |
| | 9343 | | tier, |
| | 9344 | | blobContentType, |
| | 9345 | | blobContentEncoding, |
| | 9346 | | blobContentLanguage, |
| | 9347 | | blobContentHash, |
| | 9348 | | blobCacheControl, |
| | 9349 | | metadata, |
| | 9350 | | leaseId, |
| | 9351 | | blobContentDisposition, |
| | 9352 | | encryptionKey, |
| | 9353 | | encryptionKeySha256, |
| | 9354 | | encryptionAlgorithm, |
| | 9355 | | encryptionScope, |
| | 9356 | | ifModifiedSince, |
| | 9357 | | ifUnmodifiedSince, |
| | 9358 | | ifMatch, |
| | 9359 | | ifNoneMatch, |
| | 9360 | | ifTags, |
| | 9361 | | blobSequenceNumber, |
| | 9362 | | requestId, |
| | 9363 | | blobTagsString)) |
| | 9364 | | { |
| | 9365 | | if (async) |
| | 9366 | | { |
| | 9367 | | // Send the request asynchronously if we're being called via an async path |
| | 9368 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 9369 | | } |
| | 9370 | | else |
| | 9371 | | { |
| | 9372 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 9373 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 9374 | | pipeline.Send(_message, cancellationToken); |
| | 9375 | | } |
| | 9376 | | Azure.Response _response = _message.Response; |
| | 9377 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 9378 | | return CreateAsync_CreateResponse(clientDiagnostics, _response); |
| | 9379 | | } |
| | 9380 | | } |
| | 9381 | | catch (System.Exception ex) |
| | 9382 | | { |
| | 9383 | | _scope.Failed(ex); |
| | 9384 | | throw; |
| | 9385 | | } |
| | 9386 | | finally |
| | 9387 | | { |
| | 9388 | | _scope.Dispose(); |
| | 9389 | | } |
| | 9390 | | } |
| | 9391 | |
|
| | 9392 | | /// <summary> |
| | 9393 | | /// Create the PageBlob.CreateAsync request. |
| | 9394 | | /// </summary> |
| | 9395 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 9396 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 9397 | | /// <param name="contentLength">The length of the request.</param> |
| | 9398 | | /// <param name="blobContentLength">This header specifies the maximum size for the page blob, up to 1 TB. Th |
| | 9399 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 9400 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 9401 | | /// <param name="tier">Optional. Indicates the tier to be set on the page blob.</param> |
| | 9402 | | /// <param name="blobContentType">Optional. Sets the blob's content type. If specified, this property is sto |
| | 9403 | | /// <param name="blobContentEncoding">Optional. Sets the blob's content encoding. If specified, this propert |
| | 9404 | | /// <param name="blobContentLanguage">Optional. Set the blob's content language. If specified, this property |
| | 9405 | | /// <param name="blobContentHash">Optional. An MD5 hash of the blob content. Note that this hash is not vali |
| | 9406 | | /// <param name="blobCacheControl">Optional. Sets the blob's cache control. If specified, this property is s |
| | 9407 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 9408 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 9409 | | /// <param name="blobContentDisposition">Optional. Sets the blob's Content-Disposition header.</param> |
| | 9410 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 9411 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 9412 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 9413 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 9414 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 9415 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 9416 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 9417 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 9418 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 9419 | | /// <param name="blobSequenceNumber">Set for page blobs only. The sequence number is a user-controlled value |
| | 9420 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 9421 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 9422 | | /// <returns>The PageBlob.CreateAsync Message.</returns> |
| | 9423 | | internal static Azure.Core.HttpMessage CreateAsync_CreateMessage( |
| | 9424 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 9425 | | System.Uri resourceUri, |
| | 9426 | | long contentLength, |
| | 9427 | | long blobContentLength, |
| | 9428 | | string version, |
| | 9429 | | int? timeout = default, |
| | 9430 | | Azure.Storage.Blobs.Models.AccessTier? tier = default, |
| | 9431 | | string blobContentType = default, |
| | 9432 | | string blobContentEncoding = default, |
| | 9433 | | string blobContentLanguage = default, |
| | 9434 | | byte[] blobContentHash = default, |
| | 9435 | | string blobCacheControl = default, |
| | 9436 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 9437 | | string leaseId = default, |
| | 9438 | | string blobContentDisposition = default, |
| | 9439 | | string encryptionKey = default, |
| | 9440 | | string encryptionKeySha256 = default, |
| | 9441 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 9442 | | string encryptionScope = default, |
| | 9443 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 9444 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 9445 | | Azure.ETag? ifMatch = default, |
| | 9446 | | Azure.ETag? ifNoneMatch = default, |
| | 9447 | | string ifTags = default, |
| | 9448 | | long? blobSequenceNumber = default, |
| | 9449 | | string requestId = default, |
| | 9450 | | string blobTagsString = default) |
| | 9451 | | { |
| | 9452 | | // Validation |
| | 9453 | | if (resourceUri == null) |
| | 9454 | | { |
| | 9455 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 9456 | | } |
| | 9457 | | if (version == null) |
| | 9458 | | { |
| | 9459 | | throw new System.ArgumentNullException(nameof(version)); |
| | 9460 | | } |
| | 9461 | |
|
| | 9462 | | // Create the request |
| | 9463 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 9464 | | Azure.Core.Request _request = _message.Request; |
| | 9465 | |
|
| | 9466 | | // Set the endpoint |
| | 9467 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 9468 | | _request.Uri.Reset(resourceUri); |
| | 9469 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 9470 | |
|
| | 9471 | | // Add request headers |
| | 9472 | | _request.Headers.SetValue("x-ms-blob-type", "PageBlob"); |
| | 9473 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 9474 | | _request.Headers.SetValue("x-ms-blob-content-length", blobContentLength.ToString(System.Globalization.Cu |
| | 9475 | | _request.Headers.SetValue("x-ms-version", version); |
| | 9476 | | if (tier != null) { _request.Headers.SetValue("x-ms-access-tier", tier.ToString()); } |
| | 9477 | | if (blobContentType != null) { _request.Headers.SetValue("x-ms-blob-content-type", blobContentType); } |
| | 9478 | | if (blobContentEncoding != null) { _request.Headers.SetValue("x-ms-blob-content-encoding", blobContentEn |
| | 9479 | | if (blobContentLanguage != null) { _request.Headers.SetValue("x-ms-blob-content-language", blobContentLa |
| | 9480 | | if (blobContentHash != null) { _request.Headers.SetValue("x-ms-blob-content-md5", System.Convert.ToBase6 |
| | 9481 | | if (blobCacheControl != null) { _request.Headers.SetValue("x-ms-blob-cache-control", blobCacheControl); |
| | 9482 | | if (metadata != null) { |
| | 9483 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 9484 | | { |
| | 9485 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 9486 | | } |
| | 9487 | | } |
| | 9488 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 9489 | | if (blobContentDisposition != null) { _request.Headers.SetValue("x-ms-blob-content-disposition", blobCon |
| | 9490 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 9491 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 9492 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 9493 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 9494 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 9495 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 9496 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 9497 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 9498 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 9499 | | if (blobSequenceNumber != null) { _request.Headers.SetValue("x-ms-blob-sequence-number", blobSequenceNum |
| | 9500 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 9501 | | if (blobTagsString != null) { _request.Headers.SetValue("x-ms-tags", blobTagsString); } |
| | 9502 | |
|
| | 9503 | | return _message; |
| | 9504 | | } |
| | 9505 | |
|
| | 9506 | | /// <summary> |
| | 9507 | | /// Create the PageBlob.CreateAsync response or throw a failure exception. |
| | 9508 | | /// </summary> |
| | 9509 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 9510 | | /// <param name="response">The raw Response.</param> |
| | 9511 | | /// <returns>The PageBlob.CreateAsync Azure.Response{Azure.Storage.Blobs.Models.BlobContentInfo}.</returns> |
| | 9512 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> CreateAsync_CreateResponse( |
| | 9513 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 9514 | | Azure.Response response) |
| | 9515 | | { |
| | 9516 | | // Process the response |
| | 9517 | | switch (response.Status) |
| | 9518 | | { |
| | 9519 | | case 201: |
| | 9520 | | { |
| | 9521 | | // Create the result |
| | 9522 | | Azure.Storage.Blobs.Models.BlobContentInfo _value = new Azure.Storage.Blobs.Models.BlobContentIn |
| | 9523 | |
|
| | 9524 | | // Get response headers |
| | 9525 | | string _header; |
| | 9526 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 9527 | | { |
| | 9528 | | _value.ETag = new Azure.ETag(_header); |
| | 9529 | | } |
| | 9530 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 9531 | | { |
| | 9532 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 9533 | | } |
| | 9534 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 9535 | | { |
| | 9536 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 9537 | | } |
| | 9538 | | if (response.Headers.TryGetValue("x-ms-version-id", out _header)) |
| | 9539 | | { |
| | 9540 | | _value.VersionId = _header; |
| | 9541 | | } |
| | 9542 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 9543 | | { |
| | 9544 | | _value.EncryptionKeySha256 = _header; |
| | 9545 | | } |
| | 9546 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 9547 | | { |
| | 9548 | | _value.EncryptionScope = _header; |
| | 9549 | | } |
| | 9550 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 9551 | | { |
| | 9552 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 9553 | | } |
| | 9554 | |
|
| | 9555 | | // Create the response |
| | 9556 | | return Response.FromValue(_value, response); |
| | 9557 | | } |
| | 9558 | | default: |
| | 9559 | | { |
| | 9560 | | // Create the result |
| | 9561 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 9562 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 9563 | |
|
| | 9564 | | throw _value.CreateException(clientDiagnostics, response); |
| | 9565 | | } |
| | 9566 | | } |
| | 9567 | | } |
| | 9568 | | #endregion PageBlob.CreateAsync |
| | 9569 | |
|
| | 9570 | | #region PageBlob.UploadPagesAsync |
| | 9571 | | /// <summary> |
| | 9572 | | /// The Upload Pages operation writes a range of pages to a page blob |
| | 9573 | | /// </summary> |
| | 9574 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 9575 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 9576 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 9577 | | /// <param name="body">Initial data</param> |
| | 9578 | | /// <param name="contentLength">The length of the request.</param> |
| | 9579 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 9580 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 9581 | | /// <param name="transactionalContentCrc64">Specify the transactional crc64 for the body, to be validated by |
| | 9582 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 9583 | | /// <param name="range">Return only the bytes of the blob in the specified range.</param> |
| | 9584 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 9585 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 9586 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 9587 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 9588 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 9589 | | /// <param name="ifSequenceNumberLessThanOrEqualTo">Specify this header value to operate only on a blob if i |
| | 9590 | | /// <param name="ifSequenceNumberLessThan">Specify this header value to operate only on a blob if it has a s |
| | 9591 | | /// <param name="ifSequenceNumberEqualTo">Specify this header value to operate only on a blob if it has the |
| | 9592 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 9593 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 9594 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 9595 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 9596 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 9597 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 9598 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 9599 | | /// <param name="operationName">Operation name.</param> |
| | 9600 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 9601 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.PageInfo}</returns> |
| | 9602 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.PageInfo>> Up |
| | 9603 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 9604 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 9605 | | System.Uri resourceUri, |
| | 9606 | | System.IO.Stream body, |
| | 9607 | | long contentLength, |
| | 9608 | | string version, |
| | 9609 | | byte[] transactionalContentHash = default, |
| | 9610 | | byte[] transactionalContentCrc64 = default, |
| | 9611 | | int? timeout = default, |
| | 9612 | | string range = default, |
| | 9613 | | string leaseId = default, |
| | 9614 | | string encryptionKey = default, |
| | 9615 | | string encryptionKeySha256 = default, |
| | 9616 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 9617 | | string encryptionScope = default, |
| | 9618 | | long? ifSequenceNumberLessThanOrEqualTo = default, |
| | 9619 | | long? ifSequenceNumberLessThan = default, |
| | 9620 | | long? ifSequenceNumberEqualTo = default, |
| | 9621 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 9622 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 9623 | | Azure.ETag? ifMatch = default, |
| | 9624 | | Azure.ETag? ifNoneMatch = default, |
| | 9625 | | string ifTags = default, |
| | 9626 | | string requestId = default, |
| | 9627 | | bool async = true, |
| | 9628 | | string operationName = "PageBlobClient.UploadPages", |
| | 9629 | | System.Threading.CancellationToken cancellationToken = default) |
| | 9630 | | { |
| | 9631 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 9632 | | try |
| | 9633 | | { |
| | 9634 | | _scope.AddAttribute("url", resourceUri); |
| | 9635 | | _scope.Start(); |
| | 9636 | | using (Azure.Core.HttpMessage _message = UploadPagesAsync_CreateMessage( |
| | 9637 | | pipeline, |
| | 9638 | | resourceUri, |
| | 9639 | | body, |
| | 9640 | | contentLength, |
| | 9641 | | version, |
| | 9642 | | transactionalContentHash, |
| | 9643 | | transactionalContentCrc64, |
| | 9644 | | timeout, |
| | 9645 | | range, |
| | 9646 | | leaseId, |
| | 9647 | | encryptionKey, |
| | 9648 | | encryptionKeySha256, |
| | 9649 | | encryptionAlgorithm, |
| | 9650 | | encryptionScope, |
| | 9651 | | ifSequenceNumberLessThanOrEqualTo, |
| | 9652 | | ifSequenceNumberLessThan, |
| | 9653 | | ifSequenceNumberEqualTo, |
| | 9654 | | ifModifiedSince, |
| | 9655 | | ifUnmodifiedSince, |
| | 9656 | | ifMatch, |
| | 9657 | | ifNoneMatch, |
| | 9658 | | ifTags, |
| | 9659 | | requestId)) |
| | 9660 | | { |
| | 9661 | | if (async) |
| | 9662 | | { |
| | 9663 | | // Send the request asynchronously if we're being called via an async path |
| | 9664 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 9665 | | } |
| | 9666 | | else |
| | 9667 | | { |
| | 9668 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 9669 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 9670 | | pipeline.Send(_message, cancellationToken); |
| | 9671 | | } |
| | 9672 | | Azure.Response _response = _message.Response; |
| | 9673 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 9674 | | return UploadPagesAsync_CreateResponse(clientDiagnostics, _response); |
| | 9675 | | } |
| | 9676 | | } |
| | 9677 | | catch (System.Exception ex) |
| | 9678 | | { |
| | 9679 | | _scope.Failed(ex); |
| | 9680 | | throw; |
| | 9681 | | } |
| | 9682 | | finally |
| | 9683 | | { |
| | 9684 | | _scope.Dispose(); |
| | 9685 | | } |
| | 9686 | | } |
| | 9687 | |
|
| | 9688 | | /// <summary> |
| | 9689 | | /// Create the PageBlob.UploadPagesAsync request. |
| | 9690 | | /// </summary> |
| | 9691 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 9692 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 9693 | | /// <param name="body">Initial data</param> |
| | 9694 | | /// <param name="contentLength">The length of the request.</param> |
| | 9695 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 9696 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 9697 | | /// <param name="transactionalContentCrc64">Specify the transactional crc64 for the body, to be validated by |
| | 9698 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 9699 | | /// <param name="range">Return only the bytes of the blob in the specified range.</param> |
| | 9700 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 9701 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 9702 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 9703 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 9704 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 9705 | | /// <param name="ifSequenceNumberLessThanOrEqualTo">Specify this header value to operate only on a blob if i |
| | 9706 | | /// <param name="ifSequenceNumberLessThan">Specify this header value to operate only on a blob if it has a s |
| | 9707 | | /// <param name="ifSequenceNumberEqualTo">Specify this header value to operate only on a blob if it has the |
| | 9708 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 9709 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 9710 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 9711 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 9712 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 9713 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 9714 | | /// <returns>The PageBlob.UploadPagesAsync Message.</returns> |
| | 9715 | | internal static Azure.Core.HttpMessage UploadPagesAsync_CreateMessage( |
| | 9716 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 9717 | | System.Uri resourceUri, |
| | 9718 | | System.IO.Stream body, |
| | 9719 | | long contentLength, |
| | 9720 | | string version, |
| | 9721 | | byte[] transactionalContentHash = default, |
| | 9722 | | byte[] transactionalContentCrc64 = default, |
| | 9723 | | int? timeout = default, |
| | 9724 | | string range = default, |
| | 9725 | | string leaseId = default, |
| | 9726 | | string encryptionKey = default, |
| | 9727 | | string encryptionKeySha256 = default, |
| | 9728 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 9729 | | string encryptionScope = default, |
| | 9730 | | long? ifSequenceNumberLessThanOrEqualTo = default, |
| | 9731 | | long? ifSequenceNumberLessThan = default, |
| | 9732 | | long? ifSequenceNumberEqualTo = default, |
| | 9733 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 9734 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 9735 | | Azure.ETag? ifMatch = default, |
| | 9736 | | Azure.ETag? ifNoneMatch = default, |
| | 9737 | | string ifTags = default, |
| | 9738 | | string requestId = default) |
| | 9739 | | { |
| | 9740 | | // Validation |
| | 9741 | | if (resourceUri == null) |
| | 9742 | | { |
| | 9743 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 9744 | | } |
| | 9745 | | if (body == null) |
| | 9746 | | { |
| | 9747 | | throw new System.ArgumentNullException(nameof(body)); |
| | 9748 | | } |
| | 9749 | | if (version == null) |
| | 9750 | | { |
| | 9751 | | throw new System.ArgumentNullException(nameof(version)); |
| | 9752 | | } |
| | 9753 | |
|
| | 9754 | | // Create the request |
| | 9755 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 9756 | | Azure.Core.Request _request = _message.Request; |
| | 9757 | |
|
| | 9758 | | // Set the endpoint |
| | 9759 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 9760 | | _request.Uri.Reset(resourceUri); |
| | 9761 | | _request.Uri.AppendQuery("comp", "page", escapeValue: false); |
| | 9762 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 9763 | |
|
| | 9764 | | // Add request headers |
| | 9765 | | _request.Headers.SetValue("x-ms-page-write", "update"); |
| | 9766 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 9767 | | _request.Headers.SetValue("x-ms-version", version); |
| | 9768 | | if (transactionalContentHash != null) { _request.Headers.SetValue("Content-MD5", System.Convert.ToBase64 |
| | 9769 | | if (transactionalContentCrc64 != null) { _request.Headers.SetValue("x-ms-content-crc64", System.Convert. |
| | 9770 | | if (range != null) { _request.Headers.SetValue("x-ms-range", range); } |
| | 9771 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 9772 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 9773 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 9774 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 9775 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 9776 | | if (ifSequenceNumberLessThanOrEqualTo != null) { _request.Headers.SetValue("x-ms-if-sequence-number-le", |
| | 9777 | | if (ifSequenceNumberLessThan != null) { _request.Headers.SetValue("x-ms-if-sequence-number-lt", ifSequen |
| | 9778 | | if (ifSequenceNumberEqualTo != null) { _request.Headers.SetValue("x-ms-if-sequence-number-eq", ifSequenc |
| | 9779 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 9780 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 9781 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 9782 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 9783 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 9784 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 9785 | |
|
| | 9786 | | // Create the body |
| | 9787 | | _request.Content = Azure.Core.RequestContent.Create(body); |
| | 9788 | |
|
| | 9789 | | return _message; |
| | 9790 | | } |
| | 9791 | |
|
| | 9792 | | /// <summary> |
| | 9793 | | /// Create the PageBlob.UploadPagesAsync response or throw a failure exception. |
| | 9794 | | /// </summary> |
| | 9795 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 9796 | | /// <param name="response">The raw Response.</param> |
| | 9797 | | /// <returns>The PageBlob.UploadPagesAsync Azure.Response{Azure.Storage.Blobs.Models.PageInfo}.</returns> |
| | 9798 | | internal static Azure.Response<Azure.Storage.Blobs.Models.PageInfo> UploadPagesAsync_CreateResponse( |
| | 9799 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 9800 | | Azure.Response response) |
| | 9801 | | { |
| | 9802 | | // Process the response |
| | 9803 | | switch (response.Status) |
| | 9804 | | { |
| | 9805 | | case 201: |
| | 9806 | | { |
| | 9807 | | // Create the result |
| | 9808 | | Azure.Storage.Blobs.Models.PageInfo _value = new Azure.Storage.Blobs.Models.PageInfo(); |
| | 9809 | |
|
| | 9810 | | // Get response headers |
| | 9811 | | string _header; |
| | 9812 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 9813 | | { |
| | 9814 | | _value.ETag = new Azure.ETag(_header); |
| | 9815 | | } |
| | 9816 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 9817 | | { |
| | 9818 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 9819 | | } |
| | 9820 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 9821 | | { |
| | 9822 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 9823 | | } |
| | 9824 | | if (response.Headers.TryGetValue("x-ms-content-crc64", out _header)) |
| | 9825 | | { |
| | 9826 | | _value.ContentCrc64 = System.Convert.FromBase64String(_header); |
| | 9827 | | } |
| | 9828 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 9829 | | { |
| | 9830 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 9831 | | } |
| | 9832 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 9833 | | { |
| | 9834 | | _value.EncryptionKeySha256 = _header; |
| | 9835 | | } |
| | 9836 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 9837 | | { |
| | 9838 | | _value.EncryptionScope = _header; |
| | 9839 | | } |
| | 9840 | |
|
| | 9841 | | // Create the response |
| | 9842 | | return Response.FromValue(_value, response); |
| | 9843 | | } |
| | 9844 | | default: |
| | 9845 | | { |
| | 9846 | | // Create the result |
| | 9847 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 9848 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 9849 | |
|
| | 9850 | | throw _value.CreateException(clientDiagnostics, response); |
| | 9851 | | } |
| | 9852 | | } |
| | 9853 | | } |
| | 9854 | | #endregion PageBlob.UploadPagesAsync |
| | 9855 | |
|
| | 9856 | | #region PageBlob.ClearPagesAsync |
| | 9857 | | /// <summary> |
| | 9858 | | /// The Clear Pages operation clears a set of pages from a page blob |
| | 9859 | | /// </summary> |
| | 9860 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 9861 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 9862 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 9863 | | /// <param name="contentLength">The length of the request.</param> |
| | 9864 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 9865 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 9866 | | /// <param name="range">Return only the bytes of the blob in the specified range.</param> |
| | 9867 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 9868 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 9869 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 9870 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 9871 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 9872 | | /// <param name="ifSequenceNumberLessThanOrEqualTo">Specify this header value to operate only on a blob if i |
| | 9873 | | /// <param name="ifSequenceNumberLessThan">Specify this header value to operate only on a blob if it has a s |
| | 9874 | | /// <param name="ifSequenceNumberEqualTo">Specify this header value to operate only on a blob if it has the |
| | 9875 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 9876 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 9877 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 9878 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 9879 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 9880 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 9881 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 9882 | | /// <param name="operationName">Operation name.</param> |
| | 9883 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 9884 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.PageInfo}</returns> |
| | 9885 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.PageInfo>> Cl |
| | 9886 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 9887 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 9888 | | System.Uri resourceUri, |
| | 9889 | | long contentLength, |
| | 9890 | | string version, |
| | 9891 | | int? timeout = default, |
| | 9892 | | string range = default, |
| | 9893 | | string leaseId = default, |
| | 9894 | | string encryptionKey = default, |
| | 9895 | | string encryptionKeySha256 = default, |
| | 9896 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 9897 | | string encryptionScope = default, |
| | 9898 | | long? ifSequenceNumberLessThanOrEqualTo = default, |
| | 9899 | | long? ifSequenceNumberLessThan = default, |
| | 9900 | | long? ifSequenceNumberEqualTo = default, |
| | 9901 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 9902 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 9903 | | Azure.ETag? ifMatch = default, |
| | 9904 | | Azure.ETag? ifNoneMatch = default, |
| | 9905 | | string ifTags = default, |
| | 9906 | | string requestId = default, |
| | 9907 | | bool async = true, |
| | 9908 | | string operationName = "PageBlobClient.ClearPages", |
| | 9909 | | System.Threading.CancellationToken cancellationToken = default) |
| | 9910 | | { |
| | 9911 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 9912 | | try |
| | 9913 | | { |
| | 9914 | | _scope.AddAttribute("url", resourceUri); |
| | 9915 | | _scope.Start(); |
| | 9916 | | using (Azure.Core.HttpMessage _message = ClearPagesAsync_CreateMessage( |
| | 9917 | | pipeline, |
| | 9918 | | resourceUri, |
| | 9919 | | contentLength, |
| | 9920 | | version, |
| | 9921 | | timeout, |
| | 9922 | | range, |
| | 9923 | | leaseId, |
| | 9924 | | encryptionKey, |
| | 9925 | | encryptionKeySha256, |
| | 9926 | | encryptionAlgorithm, |
| | 9927 | | encryptionScope, |
| | 9928 | | ifSequenceNumberLessThanOrEqualTo, |
| | 9929 | | ifSequenceNumberLessThan, |
| | 9930 | | ifSequenceNumberEqualTo, |
| | 9931 | | ifModifiedSince, |
| | 9932 | | ifUnmodifiedSince, |
| | 9933 | | ifMatch, |
| | 9934 | | ifNoneMatch, |
| | 9935 | | ifTags, |
| | 9936 | | requestId)) |
| | 9937 | | { |
| | 9938 | | if (async) |
| | 9939 | | { |
| | 9940 | | // Send the request asynchronously if we're being called via an async path |
| | 9941 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 9942 | | } |
| | 9943 | | else |
| | 9944 | | { |
| | 9945 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 9946 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 9947 | | pipeline.Send(_message, cancellationToken); |
| | 9948 | | } |
| | 9949 | | Azure.Response _response = _message.Response; |
| | 9950 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 9951 | | return ClearPagesAsync_CreateResponse(clientDiagnostics, _response); |
| | 9952 | | } |
| | 9953 | | } |
| | 9954 | | catch (System.Exception ex) |
| | 9955 | | { |
| | 9956 | | _scope.Failed(ex); |
| | 9957 | | throw; |
| | 9958 | | } |
| | 9959 | | finally |
| | 9960 | | { |
| | 9961 | | _scope.Dispose(); |
| | 9962 | | } |
| | 9963 | | } |
| | 9964 | |
|
| | 9965 | | /// <summary> |
| | 9966 | | /// Create the PageBlob.ClearPagesAsync request. |
| | 9967 | | /// </summary> |
| | 9968 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 9969 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 9970 | | /// <param name="contentLength">The length of the request.</param> |
| | 9971 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 9972 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 9973 | | /// <param name="range">Return only the bytes of the blob in the specified range.</param> |
| | 9974 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 9975 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 9976 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 9977 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 9978 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 9979 | | /// <param name="ifSequenceNumberLessThanOrEqualTo">Specify this header value to operate only on a blob if i |
| | 9980 | | /// <param name="ifSequenceNumberLessThan">Specify this header value to operate only on a blob if it has a s |
| | 9981 | | /// <param name="ifSequenceNumberEqualTo">Specify this header value to operate only on a blob if it has the |
| | 9982 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 9983 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 9984 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 9985 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 9986 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 9987 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 9988 | | /// <returns>The PageBlob.ClearPagesAsync Message.</returns> |
| | 9989 | | internal static Azure.Core.HttpMessage ClearPagesAsync_CreateMessage( |
| | 9990 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 9991 | | System.Uri resourceUri, |
| | 9992 | | long contentLength, |
| | 9993 | | string version, |
| | 9994 | | int? timeout = default, |
| | 9995 | | string range = default, |
| | 9996 | | string leaseId = default, |
| | 9997 | | string encryptionKey = default, |
| | 9998 | | string encryptionKeySha256 = default, |
| | 9999 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 10000 | | string encryptionScope = default, |
| | 10001 | | long? ifSequenceNumberLessThanOrEqualTo = default, |
| | 10002 | | long? ifSequenceNumberLessThan = default, |
| | 10003 | | long? ifSequenceNumberEqualTo = default, |
| | 10004 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 10005 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 10006 | | Azure.ETag? ifMatch = default, |
| | 10007 | | Azure.ETag? ifNoneMatch = default, |
| | 10008 | | string ifTags = default, |
| | 10009 | | string requestId = default) |
| | 10010 | | { |
| | 10011 | | // Validation |
| | 10012 | | if (resourceUri == null) |
| | 10013 | | { |
| | 10014 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 10015 | | } |
| | 10016 | | if (version == null) |
| | 10017 | | { |
| | 10018 | | throw new System.ArgumentNullException(nameof(version)); |
| | 10019 | | } |
| | 10020 | |
|
| | 10021 | | // Create the request |
| | 10022 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 10023 | | Azure.Core.Request _request = _message.Request; |
| | 10024 | |
|
| | 10025 | | // Set the endpoint |
| | 10026 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 10027 | | _request.Uri.Reset(resourceUri); |
| | 10028 | | _request.Uri.AppendQuery("comp", "page", escapeValue: false); |
| | 10029 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 10030 | |
|
| | 10031 | | // Add request headers |
| | 10032 | | _request.Headers.SetValue("x-ms-page-write", "clear"); |
| | 10033 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 10034 | | _request.Headers.SetValue("x-ms-version", version); |
| | 10035 | | if (range != null) { _request.Headers.SetValue("x-ms-range", range); } |
| | 10036 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 10037 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 10038 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 10039 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 10040 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 10041 | | if (ifSequenceNumberLessThanOrEqualTo != null) { _request.Headers.SetValue("x-ms-if-sequence-number-le", |
| | 10042 | | if (ifSequenceNumberLessThan != null) { _request.Headers.SetValue("x-ms-if-sequence-number-lt", ifSequen |
| | 10043 | | if (ifSequenceNumberEqualTo != null) { _request.Headers.SetValue("x-ms-if-sequence-number-eq", ifSequenc |
| | 10044 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 10045 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 10046 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 10047 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 10048 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 10049 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 10050 | |
|
| | 10051 | | return _message; |
| | 10052 | | } |
| | 10053 | |
|
| | 10054 | | /// <summary> |
| | 10055 | | /// Create the PageBlob.ClearPagesAsync response or throw a failure exception. |
| | 10056 | | /// </summary> |
| | 10057 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 10058 | | /// <param name="response">The raw Response.</param> |
| | 10059 | | /// <returns>The PageBlob.ClearPagesAsync Azure.Response{Azure.Storage.Blobs.Models.PageInfo}.</returns> |
| | 10060 | | internal static Azure.Response<Azure.Storage.Blobs.Models.PageInfo> ClearPagesAsync_CreateResponse( |
| | 10061 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 10062 | | Azure.Response response) |
| | 10063 | | { |
| | 10064 | | // Process the response |
| | 10065 | | switch (response.Status) |
| | 10066 | | { |
| | 10067 | | case 201: |
| | 10068 | | { |
| | 10069 | | // Create the result |
| | 10070 | | Azure.Storage.Blobs.Models.PageInfo _value = new Azure.Storage.Blobs.Models.PageInfo(); |
| | 10071 | |
|
| | 10072 | | // Get response headers |
| | 10073 | | string _header; |
| | 10074 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 10075 | | { |
| | 10076 | | _value.ETag = new Azure.ETag(_header); |
| | 10077 | | } |
| | 10078 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 10079 | | { |
| | 10080 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 10081 | | } |
| | 10082 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 10083 | | { |
| | 10084 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 10085 | | } |
| | 10086 | | if (response.Headers.TryGetValue("x-ms-content-crc64", out _header)) |
| | 10087 | | { |
| | 10088 | | _value.ContentCrc64 = System.Convert.FromBase64String(_header); |
| | 10089 | | } |
| | 10090 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 10091 | | { |
| | 10092 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 10093 | | } |
| | 10094 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 10095 | | { |
| | 10096 | | _value.EncryptionKeySha256 = _header; |
| | 10097 | | } |
| | 10098 | |
|
| | 10099 | | // Create the response |
| | 10100 | | return Response.FromValue(_value, response); |
| | 10101 | | } |
| | 10102 | | default: |
| | 10103 | | { |
| | 10104 | | // Create the result |
| | 10105 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 10106 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 10107 | |
|
| | 10108 | | throw _value.CreateException(clientDiagnostics, response); |
| | 10109 | | } |
| | 10110 | | } |
| | 10111 | | } |
| | 10112 | | #endregion PageBlob.ClearPagesAsync |
| | 10113 | |
|
| | 10114 | | #region PageBlob.UploadPagesFromUriAsync |
| | 10115 | | /// <summary> |
| | 10116 | | /// The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL |
| | 10117 | | /// </summary> |
| | 10118 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 10119 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 10120 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 10121 | | /// <param name="sourceUri">Specify a URL to the copy source.</param> |
| | 10122 | | /// <param name="sourceRange">Bytes of source data in the specified range. The length of this range should m |
| | 10123 | | /// <param name="contentLength">The length of the request.</param> |
| | 10124 | | /// <param name="range">The range of bytes to which the source range would be written. The range should be 5 |
| | 10125 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 10126 | | /// <param name="sourceContentHash">Specify the md5 calculated for the range of bytes that must be read from |
| | 10127 | | /// <param name="sourceContentcrc64">Specify the crc64 calculated for the range of bytes that must be read f |
| | 10128 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 10129 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 10130 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 10131 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 10132 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 10133 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 10134 | | /// <param name="ifSequenceNumberLessThanOrEqualTo">Specify this header value to operate only on a blob if i |
| | 10135 | | /// <param name="ifSequenceNumberLessThan">Specify this header value to operate only on a blob if it has a s |
| | 10136 | | /// <param name="ifSequenceNumberEqualTo">Specify this header value to operate only on a blob if it has the |
| | 10137 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 10138 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 10139 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 10140 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 10141 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 10142 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 10143 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 10144 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 10145 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 10146 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 10147 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 10148 | | /// <param name="operationName">Operation name.</param> |
| | 10149 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 10150 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.PageInfo}</returns> |
| | 10151 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.PageInfo>> Up |
| | 10152 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 10153 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 10154 | | System.Uri resourceUri, |
| | 10155 | | System.Uri sourceUri, |
| | 10156 | | string sourceRange, |
| | 10157 | | long contentLength, |
| | 10158 | | string range, |
| | 10159 | | string version, |
| | 10160 | | byte[] sourceContentHash = default, |
| | 10161 | | byte[] sourceContentcrc64 = default, |
| | 10162 | | int? timeout = default, |
| | 10163 | | string encryptionKey = default, |
| | 10164 | | string encryptionKeySha256 = default, |
| | 10165 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 10166 | | string encryptionScope = default, |
| | 10167 | | string leaseId = default, |
| | 10168 | | long? ifSequenceNumberLessThanOrEqualTo = default, |
| | 10169 | | long? ifSequenceNumberLessThan = default, |
| | 10170 | | long? ifSequenceNumberEqualTo = default, |
| | 10171 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 10172 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 10173 | | Azure.ETag? ifMatch = default, |
| | 10174 | | Azure.ETag? ifNoneMatch = default, |
| | 10175 | | string ifTags = default, |
| | 10176 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 10177 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 10178 | | Azure.ETag? sourceIfMatch = default, |
| | 10179 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 10180 | | string requestId = default, |
| | 10181 | | bool async = true, |
| | 10182 | | string operationName = "PageBlobClient.UploadPagesFromUri", |
| | 10183 | | System.Threading.CancellationToken cancellationToken = default) |
| | 10184 | | { |
| | 10185 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 10186 | | try |
| | 10187 | | { |
| | 10188 | | _scope.AddAttribute("url", resourceUri); |
| | 10189 | | _scope.Start(); |
| | 10190 | | using (Azure.Core.HttpMessage _message = UploadPagesFromUriAsync_CreateMessage( |
| | 10191 | | pipeline, |
| | 10192 | | resourceUri, |
| | 10193 | | sourceUri, |
| | 10194 | | sourceRange, |
| | 10195 | | contentLength, |
| | 10196 | | range, |
| | 10197 | | version, |
| | 10198 | | sourceContentHash, |
| | 10199 | | sourceContentcrc64, |
| | 10200 | | timeout, |
| | 10201 | | encryptionKey, |
| | 10202 | | encryptionKeySha256, |
| | 10203 | | encryptionAlgorithm, |
| | 10204 | | encryptionScope, |
| | 10205 | | leaseId, |
| | 10206 | | ifSequenceNumberLessThanOrEqualTo, |
| | 10207 | | ifSequenceNumberLessThan, |
| | 10208 | | ifSequenceNumberEqualTo, |
| | 10209 | | ifModifiedSince, |
| | 10210 | | ifUnmodifiedSince, |
| | 10211 | | ifMatch, |
| | 10212 | | ifNoneMatch, |
| | 10213 | | ifTags, |
| | 10214 | | sourceIfModifiedSince, |
| | 10215 | | sourceIfUnmodifiedSince, |
| | 10216 | | sourceIfMatch, |
| | 10217 | | sourceIfNoneMatch, |
| | 10218 | | requestId)) |
| | 10219 | | { |
| | 10220 | | if (async) |
| | 10221 | | { |
| | 10222 | | // Send the request asynchronously if we're being called via an async path |
| | 10223 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 10224 | | } |
| | 10225 | | else |
| | 10226 | | { |
| | 10227 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 10228 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 10229 | | pipeline.Send(_message, cancellationToken); |
| | 10230 | | } |
| | 10231 | | Azure.Response _response = _message.Response; |
| | 10232 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 10233 | | return UploadPagesFromUriAsync_CreateResponse(clientDiagnostics, _response); |
| | 10234 | | } |
| | 10235 | | } |
| | 10236 | | catch (System.Exception ex) |
| | 10237 | | { |
| | 10238 | | _scope.Failed(ex); |
| | 10239 | | throw; |
| | 10240 | | } |
| | 10241 | | finally |
| | 10242 | | { |
| | 10243 | | _scope.Dispose(); |
| | 10244 | | } |
| | 10245 | | } |
| | 10246 | |
|
| | 10247 | | /// <summary> |
| | 10248 | | /// Create the PageBlob.UploadPagesFromUriAsync request. |
| | 10249 | | /// </summary> |
| | 10250 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 10251 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 10252 | | /// <param name="sourceUri">Specify a URL to the copy source.</param> |
| | 10253 | | /// <param name="sourceRange">Bytes of source data in the specified range. The length of this range should m |
| | 10254 | | /// <param name="contentLength">The length of the request.</param> |
| | 10255 | | /// <param name="range">The range of bytes to which the source range would be written. The range should be 5 |
| | 10256 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 10257 | | /// <param name="sourceContentHash">Specify the md5 calculated for the range of bytes that must be read from |
| | 10258 | | /// <param name="sourceContentcrc64">Specify the crc64 calculated for the range of bytes that must be read f |
| | 10259 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 10260 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 10261 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 10262 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 10263 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 10264 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 10265 | | /// <param name="ifSequenceNumberLessThanOrEqualTo">Specify this header value to operate only on a blob if i |
| | 10266 | | /// <param name="ifSequenceNumberLessThan">Specify this header value to operate only on a blob if it has a s |
| | 10267 | | /// <param name="ifSequenceNumberEqualTo">Specify this header value to operate only on a blob if it has the |
| | 10268 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 10269 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 10270 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 10271 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 10272 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 10273 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 10274 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 10275 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 10276 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 10277 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 10278 | | /// <returns>The PageBlob.UploadPagesFromUriAsync Message.</returns> |
| | 10279 | | internal static Azure.Core.HttpMessage UploadPagesFromUriAsync_CreateMessage( |
| | 10280 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 10281 | | System.Uri resourceUri, |
| | 10282 | | System.Uri sourceUri, |
| | 10283 | | string sourceRange, |
| | 10284 | | long contentLength, |
| | 10285 | | string range, |
| | 10286 | | string version, |
| | 10287 | | byte[] sourceContentHash = default, |
| | 10288 | | byte[] sourceContentcrc64 = default, |
| | 10289 | | int? timeout = default, |
| | 10290 | | string encryptionKey = default, |
| | 10291 | | string encryptionKeySha256 = default, |
| | 10292 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 10293 | | string encryptionScope = default, |
| | 10294 | | string leaseId = default, |
| | 10295 | | long? ifSequenceNumberLessThanOrEqualTo = default, |
| | 10296 | | long? ifSequenceNumberLessThan = default, |
| | 10297 | | long? ifSequenceNumberEqualTo = default, |
| | 10298 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 10299 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 10300 | | Azure.ETag? ifMatch = default, |
| | 10301 | | Azure.ETag? ifNoneMatch = default, |
| | 10302 | | string ifTags = default, |
| | 10303 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 10304 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 10305 | | Azure.ETag? sourceIfMatch = default, |
| | 10306 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 10307 | | string requestId = default) |
| | 10308 | | { |
| | 10309 | | // Validation |
| | 10310 | | if (resourceUri == null) |
| | 10311 | | { |
| | 10312 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 10313 | | } |
| | 10314 | | if (sourceUri == null) |
| | 10315 | | { |
| | 10316 | | throw new System.ArgumentNullException(nameof(sourceUri)); |
| | 10317 | | } |
| | 10318 | | if (sourceRange == null) |
| | 10319 | | { |
| | 10320 | | throw new System.ArgumentNullException(nameof(sourceRange)); |
| | 10321 | | } |
| | 10322 | | if (range == null) |
| | 10323 | | { |
| | 10324 | | throw new System.ArgumentNullException(nameof(range)); |
| | 10325 | | } |
| | 10326 | | if (version == null) |
| | 10327 | | { |
| | 10328 | | throw new System.ArgumentNullException(nameof(version)); |
| | 10329 | | } |
| | 10330 | |
|
| | 10331 | | // Create the request |
| | 10332 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 10333 | | Azure.Core.Request _request = _message.Request; |
| | 10334 | |
|
| | 10335 | | // Set the endpoint |
| | 10336 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 10337 | | _request.Uri.Reset(resourceUri); |
| | 10338 | | _request.Uri.AppendQuery("comp", "page", escapeValue: false); |
| | 10339 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 10340 | |
|
| | 10341 | | // Add request headers |
| | 10342 | | _request.Headers.SetValue("x-ms-page-write", "update"); |
| | 10343 | | _request.Headers.SetValue("x-ms-copy-source", sourceUri.AbsoluteUri); |
| | 10344 | | _request.Headers.SetValue("x-ms-source-range", sourceRange); |
| | 10345 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 10346 | | _request.Headers.SetValue("x-ms-range", range); |
| | 10347 | | _request.Headers.SetValue("x-ms-version", version); |
| | 10348 | | if (sourceContentHash != null) { _request.Headers.SetValue("x-ms-source-content-md5", System.Convert.ToB |
| | 10349 | | if (sourceContentcrc64 != null) { _request.Headers.SetValue("x-ms-source-content-crc64", System.Convert. |
| | 10350 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 10351 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 10352 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 10353 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 10354 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 10355 | | if (ifSequenceNumberLessThanOrEqualTo != null) { _request.Headers.SetValue("x-ms-if-sequence-number-le", |
| | 10356 | | if (ifSequenceNumberLessThan != null) { _request.Headers.SetValue("x-ms-if-sequence-number-lt", ifSequen |
| | 10357 | | if (ifSequenceNumberEqualTo != null) { _request.Headers.SetValue("x-ms-if-sequence-number-eq", ifSequenc |
| | 10358 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 10359 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 10360 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 10361 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 10362 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 10363 | | if (sourceIfModifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-modified-since", sourceIf |
| | 10364 | | if (sourceIfUnmodifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-unmodified-since", sour |
| | 10365 | | if (sourceIfMatch != null) { _request.Headers.SetValue("x-ms-source-if-match", sourceIfMatch.Value.ToStr |
| | 10366 | | if (sourceIfNoneMatch != null) { _request.Headers.SetValue("x-ms-source-if-none-match", sourceIfNoneMatc |
| | 10367 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 10368 | |
|
| | 10369 | | return _message; |
| | 10370 | | } |
| | 10371 | |
|
| | 10372 | | /// <summary> |
| | 10373 | | /// Create the PageBlob.UploadPagesFromUriAsync response or throw a failure exception. |
| | 10374 | | /// </summary> |
| | 10375 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 10376 | | /// <param name="response">The raw Response.</param> |
| | 10377 | | /// <returns>The PageBlob.UploadPagesFromUriAsync Azure.Response{Azure.Storage.Blobs.Models.PageInfo}.</retu |
| | 10378 | | internal static Azure.Response<Azure.Storage.Blobs.Models.PageInfo> UploadPagesFromUriAsync_CreateResponse( |
| | 10379 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 10380 | | Azure.Response response) |
| | 10381 | | { |
| | 10382 | | // Process the response |
| | 10383 | | switch (response.Status) |
| | 10384 | | { |
| | 10385 | | case 201: |
| | 10386 | | { |
| | 10387 | | // Create the result |
| | 10388 | | Azure.Storage.Blobs.Models.PageInfo _value = new Azure.Storage.Blobs.Models.PageInfo(); |
| | 10389 | |
|
| | 10390 | | // Get response headers |
| | 10391 | | string _header; |
| | 10392 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 10393 | | { |
| | 10394 | | _value.ETag = new Azure.ETag(_header); |
| | 10395 | | } |
| | 10396 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 10397 | | { |
| | 10398 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 10399 | | } |
| | 10400 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 10401 | | { |
| | 10402 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 10403 | | } |
| | 10404 | | if (response.Headers.TryGetValue("x-ms-content-crc64", out _header)) |
| | 10405 | | { |
| | 10406 | | _value.ContentCrc64 = System.Convert.FromBase64String(_header); |
| | 10407 | | } |
| | 10408 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 10409 | | { |
| | 10410 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 10411 | | } |
| | 10412 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 10413 | | { |
| | 10414 | | _value.EncryptionKeySha256 = _header; |
| | 10415 | | } |
| | 10416 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 10417 | | { |
| | 10418 | | _value.EncryptionScope = _header; |
| | 10419 | | } |
| | 10420 | |
|
| | 10421 | | // Create the response |
| | 10422 | | return Response.FromValue(_value, response); |
| | 10423 | | } |
| | 10424 | | case 304: |
| | 10425 | | { |
| | 10426 | | // Create the result |
| | 10427 | | Azure.Storage.Blobs.Models.ConditionNotMetError _value = new Azure.Storage.Blobs.Models.Conditio |
| | 10428 | |
|
| | 10429 | | // Get response headers |
| | 10430 | | string _header; |
| | 10431 | | if (response.Headers.TryGetValue("x-ms-error-code", out _header)) |
| | 10432 | | { |
| | 10433 | | _value.ErrorCode = _header; |
| | 10434 | | } |
| | 10435 | |
|
| | 10436 | | throw _value.CreateException(clientDiagnostics, response); |
| | 10437 | | } |
| | 10438 | | default: |
| | 10439 | | { |
| | 10440 | | // Create the result |
| | 10441 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 10442 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 10443 | |
|
| | 10444 | | throw _value.CreateException(clientDiagnostics, response); |
| | 10445 | | } |
| | 10446 | | } |
| | 10447 | | } |
| | 10448 | | #endregion PageBlob.UploadPagesFromUriAsync |
| | 10449 | |
|
| | 10450 | | #region PageBlob.GetPageRangesAsync |
| | 10451 | | /// <summary> |
| | 10452 | | /// The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a pag |
| | 10453 | | /// </summary> |
| | 10454 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 10455 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 10456 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 10457 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 10458 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 10459 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 10460 | | /// <param name="range">Return only the bytes of the blob in the specified range.</param> |
| | 10461 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 10462 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 10463 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 10464 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 10465 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 10466 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 10467 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 10468 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 10469 | | /// <param name="operationName">Operation name.</param> |
| | 10470 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 10471 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.PageRangesInfoInternal}</returns> |
| | 10472 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.PageRangesInf |
| | 10473 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 10474 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 10475 | | System.Uri resourceUri, |
| | 10476 | | string version, |
| | 10477 | | string snapshot = default, |
| | 10478 | | int? timeout = default, |
| | 10479 | | string range = default, |
| | 10480 | | string leaseId = default, |
| | 10481 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 10482 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 10483 | | Azure.ETag? ifMatch = default, |
| | 10484 | | Azure.ETag? ifNoneMatch = default, |
| | 10485 | | string ifTags = default, |
| | 10486 | | string requestId = default, |
| | 10487 | | bool async = true, |
| | 10488 | | string operationName = "PageBlobClient.GetPageRanges", |
| | 10489 | | System.Threading.CancellationToken cancellationToken = default) |
| | 10490 | | { |
| | 10491 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 10492 | | try |
| | 10493 | | { |
| | 10494 | | _scope.AddAttribute("url", resourceUri); |
| | 10495 | | _scope.Start(); |
| | 10496 | | using (Azure.Core.HttpMessage _message = GetPageRangesAsync_CreateMessage( |
| | 10497 | | pipeline, |
| | 10498 | | resourceUri, |
| | 10499 | | version, |
| | 10500 | | snapshot, |
| | 10501 | | timeout, |
| | 10502 | | range, |
| | 10503 | | leaseId, |
| | 10504 | | ifModifiedSince, |
| | 10505 | | ifUnmodifiedSince, |
| | 10506 | | ifMatch, |
| | 10507 | | ifNoneMatch, |
| | 10508 | | ifTags, |
| | 10509 | | requestId)) |
| | 10510 | | { |
| | 10511 | | if (async) |
| | 10512 | | { |
| | 10513 | | // Send the request asynchronously if we're being called via an async path |
| | 10514 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 10515 | | } |
| | 10516 | | else |
| | 10517 | | { |
| | 10518 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 10519 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 10520 | | pipeline.Send(_message, cancellationToken); |
| | 10521 | | } |
| | 10522 | | Azure.Response _response = _message.Response; |
| | 10523 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 10524 | | return GetPageRangesAsync_CreateResponse(clientDiagnostics, _response); |
| | 10525 | | } |
| | 10526 | | } |
| | 10527 | | catch (System.Exception ex) |
| | 10528 | | { |
| | 10529 | | _scope.Failed(ex); |
| | 10530 | | throw; |
| | 10531 | | } |
| | 10532 | | finally |
| | 10533 | | { |
| | 10534 | | _scope.Dispose(); |
| | 10535 | | } |
| | 10536 | | } |
| | 10537 | |
|
| | 10538 | | /// <summary> |
| | 10539 | | /// Create the PageBlob.GetPageRangesAsync request. |
| | 10540 | | /// </summary> |
| | 10541 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 10542 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 10543 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 10544 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 10545 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 10546 | | /// <param name="range">Return only the bytes of the blob in the specified range.</param> |
| | 10547 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 10548 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 10549 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 10550 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 10551 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 10552 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 10553 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 10554 | | /// <returns>The PageBlob.GetPageRangesAsync Message.</returns> |
| | 10555 | | internal static Azure.Core.HttpMessage GetPageRangesAsync_CreateMessage( |
| | 10556 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 10557 | | System.Uri resourceUri, |
| | 10558 | | string version, |
| | 10559 | | string snapshot = default, |
| | 10560 | | int? timeout = default, |
| | 10561 | | string range = default, |
| | 10562 | | string leaseId = default, |
| | 10563 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 10564 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 10565 | | Azure.ETag? ifMatch = default, |
| | 10566 | | Azure.ETag? ifNoneMatch = default, |
| | 10567 | | string ifTags = default, |
| | 10568 | | string requestId = default) |
| | 10569 | | { |
| | 10570 | | // Validation |
| | 10571 | | if (resourceUri == null) |
| | 10572 | | { |
| | 10573 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 10574 | | } |
| | 10575 | | if (version == null) |
| | 10576 | | { |
| | 10577 | | throw new System.ArgumentNullException(nameof(version)); |
| | 10578 | | } |
| | 10579 | |
|
| | 10580 | | // Create the request |
| | 10581 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 10582 | | Azure.Core.Request _request = _message.Request; |
| | 10583 | |
|
| | 10584 | | // Set the endpoint |
| | 10585 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 10586 | | _request.Uri.Reset(resourceUri); |
| | 10587 | | _request.Uri.AppendQuery("comp", "pagelist", escapeValue: false); |
| | 10588 | | if (snapshot != null) { _request.Uri.AppendQuery("snapshot", snapshot); } |
| | 10589 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 10590 | |
|
| | 10591 | | // Add request headers |
| | 10592 | | _request.Headers.SetValue("x-ms-version", version); |
| | 10593 | | if (range != null) { _request.Headers.SetValue("x-ms-range", range); } |
| | 10594 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 10595 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 10596 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 10597 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 10598 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 10599 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 10600 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 10601 | |
|
| | 10602 | | return _message; |
| | 10603 | | } |
| | 10604 | |
|
| | 10605 | | /// <summary> |
| | 10606 | | /// Create the PageBlob.GetPageRangesAsync response or throw a failure exception. |
| | 10607 | | /// </summary> |
| | 10608 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 10609 | | /// <param name="response">The raw Response.</param> |
| | 10610 | | /// <returns>The PageBlob.GetPageRangesAsync Azure.Response{Azure.Storage.Blobs.Models.PageRangesInfoInterna |
| | 10611 | | internal static Azure.Response<Azure.Storage.Blobs.Models.PageRangesInfoInternal> GetPageRangesAsync_CreateR |
| | 10612 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 10613 | | Azure.Response response) |
| | 10614 | | { |
| | 10615 | | // Process the response |
| | 10616 | | switch (response.Status) |
| | 10617 | | { |
| | 10618 | | case 200: |
| | 10619 | | { |
| | 10620 | | // Create the result |
| | 10621 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 10622 | | Azure.Storage.Blobs.Models.PageRangesInfoInternal _value = new Azure.Storage.Blobs.Models.PageRa |
| | 10623 | | _value.Body = Azure.Storage.Blobs.Models.PageList.FromXml(_xml.Root); |
| | 10624 | |
|
| | 10625 | | // Get response headers |
| | 10626 | | string _header; |
| | 10627 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 10628 | | { |
| | 10629 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 10630 | | } |
| | 10631 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 10632 | | { |
| | 10633 | | _value.ETag = new Azure.ETag(_header); |
| | 10634 | | } |
| | 10635 | | if (response.Headers.TryGetValue("x-ms-blob-content-length", out _header)) |
| | 10636 | | { |
| | 10637 | | _value.BlobContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCul |
| | 10638 | | } |
| | 10639 | |
|
| | 10640 | | // Create the response |
| | 10641 | | return Response.FromValue(_value, response); |
| | 10642 | | } |
| | 10643 | | case 304: |
| | 10644 | | { |
| | 10645 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.PageRangesInfoInternal>(response); |
| | 10646 | | } |
| | 10647 | | default: |
| | 10648 | | { |
| | 10649 | | // Create the result |
| | 10650 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 10651 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 10652 | |
|
| | 10653 | | throw _value.CreateException(clientDiagnostics, response); |
| | 10654 | | } |
| | 10655 | | } |
| | 10656 | | } |
| | 10657 | | #endregion PageBlob.GetPageRangesAsync |
| | 10658 | |
|
| | 10659 | | #region PageBlob.GetPageRangesDiffAsync |
| | 10660 | | /// <summary> |
| | 10661 | | /// The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were chang |
| | 10662 | | /// </summary> |
| | 10663 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 10664 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 10665 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 10666 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 10667 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 10668 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 10669 | | /// <param name="prevsnapshot">Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a Dat |
| | 10670 | | /// <param name="prevSnapshotUrl">Optional. This header is only supported in service versions 2019-04-19 and |
| | 10671 | | /// <param name="range">Return only the bytes of the blob in the specified range.</param> |
| | 10672 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 10673 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 10674 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 10675 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 10676 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 10677 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 10678 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 10679 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 10680 | | /// <param name="operationName">Operation name.</param> |
| | 10681 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 10682 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.PageRangesInfoInternal}</returns> |
| | 10683 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.PageRangesInf |
| | 10684 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 10685 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 10686 | | System.Uri resourceUri, |
| | 10687 | | string version, |
| | 10688 | | string snapshot = default, |
| | 10689 | | int? timeout = default, |
| | 10690 | | string prevsnapshot = default, |
| | 10691 | | System.Uri prevSnapshotUrl = default, |
| | 10692 | | string range = default, |
| | 10693 | | string leaseId = default, |
| | 10694 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 10695 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 10696 | | Azure.ETag? ifMatch = default, |
| | 10697 | | Azure.ETag? ifNoneMatch = default, |
| | 10698 | | string ifTags = default, |
| | 10699 | | string requestId = default, |
| | 10700 | | bool async = true, |
| | 10701 | | string operationName = "PageBlobClient.GetPageRangesDiff", |
| | 10702 | | System.Threading.CancellationToken cancellationToken = default) |
| | 10703 | | { |
| | 10704 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 10705 | | try |
| | 10706 | | { |
| | 10707 | | _scope.AddAttribute("url", resourceUri); |
| | 10708 | | _scope.Start(); |
| | 10709 | | using (Azure.Core.HttpMessage _message = GetPageRangesDiffAsync_CreateMessage( |
| | 10710 | | pipeline, |
| | 10711 | | resourceUri, |
| | 10712 | | version, |
| | 10713 | | snapshot, |
| | 10714 | | timeout, |
| | 10715 | | prevsnapshot, |
| | 10716 | | prevSnapshotUrl, |
| | 10717 | | range, |
| | 10718 | | leaseId, |
| | 10719 | | ifModifiedSince, |
| | 10720 | | ifUnmodifiedSince, |
| | 10721 | | ifMatch, |
| | 10722 | | ifNoneMatch, |
| | 10723 | | ifTags, |
| | 10724 | | requestId)) |
| | 10725 | | { |
| | 10726 | | if (async) |
| | 10727 | | { |
| | 10728 | | // Send the request asynchronously if we're being called via an async path |
| | 10729 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 10730 | | } |
| | 10731 | | else |
| | 10732 | | { |
| | 10733 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 10734 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 10735 | | pipeline.Send(_message, cancellationToken); |
| | 10736 | | } |
| | 10737 | | Azure.Response _response = _message.Response; |
| | 10738 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 10739 | | return GetPageRangesDiffAsync_CreateResponse(clientDiagnostics, _response); |
| | 10740 | | } |
| | 10741 | | } |
| | 10742 | | catch (System.Exception ex) |
| | 10743 | | { |
| | 10744 | | _scope.Failed(ex); |
| | 10745 | | throw; |
| | 10746 | | } |
| | 10747 | | finally |
| | 10748 | | { |
| | 10749 | | _scope.Dispose(); |
| | 10750 | | } |
| | 10751 | | } |
| | 10752 | |
|
| | 10753 | | /// <summary> |
| | 10754 | | /// Create the PageBlob.GetPageRangesDiffAsync request. |
| | 10755 | | /// </summary> |
| | 10756 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 10757 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 10758 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 10759 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 10760 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 10761 | | /// <param name="prevsnapshot">Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a Dat |
| | 10762 | | /// <param name="prevSnapshotUrl">Optional. This header is only supported in service versions 2019-04-19 and |
| | 10763 | | /// <param name="range">Return only the bytes of the blob in the specified range.</param> |
| | 10764 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 10765 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 10766 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 10767 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 10768 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 10769 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 10770 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 10771 | | /// <returns>The PageBlob.GetPageRangesDiffAsync Message.</returns> |
| | 10772 | | internal static Azure.Core.HttpMessage GetPageRangesDiffAsync_CreateMessage( |
| | 10773 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 10774 | | System.Uri resourceUri, |
| | 10775 | | string version, |
| | 10776 | | string snapshot = default, |
| | 10777 | | int? timeout = default, |
| | 10778 | | string prevsnapshot = default, |
| | 10779 | | System.Uri prevSnapshotUrl = default, |
| | 10780 | | string range = default, |
| | 10781 | | string leaseId = default, |
| | 10782 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 10783 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 10784 | | Azure.ETag? ifMatch = default, |
| | 10785 | | Azure.ETag? ifNoneMatch = default, |
| | 10786 | | string ifTags = default, |
| | 10787 | | string requestId = default) |
| | 10788 | | { |
| | 10789 | | // Validation |
| | 10790 | | if (resourceUri == null) |
| | 10791 | | { |
| | 10792 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 10793 | | } |
| | 10794 | | if (version == null) |
| | 10795 | | { |
| | 10796 | | throw new System.ArgumentNullException(nameof(version)); |
| | 10797 | | } |
| | 10798 | |
|
| | 10799 | | // Create the request |
| | 10800 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 10801 | | Azure.Core.Request _request = _message.Request; |
| | 10802 | |
|
| | 10803 | | // Set the endpoint |
| | 10804 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 10805 | | _request.Uri.Reset(resourceUri); |
| | 10806 | | _request.Uri.AppendQuery("comp", "pagelist", escapeValue: false); |
| | 10807 | | if (snapshot != null) { _request.Uri.AppendQuery("snapshot", snapshot); } |
| | 10808 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 10809 | | if (prevsnapshot != null) { _request.Uri.AppendQuery("prevsnapshot", prevsnapshot); } |
| | 10810 | |
|
| | 10811 | | // Add request headers |
| | 10812 | | _request.Headers.SetValue("x-ms-version", version); |
| | 10813 | | if (prevSnapshotUrl != null) { _request.Headers.SetValue("x-ms-previous-snapshot-url", prevSnapshotUrl.A |
| | 10814 | | if (range != null) { _request.Headers.SetValue("x-ms-range", range); } |
| | 10815 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 10816 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 10817 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 10818 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 10819 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 10820 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 10821 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 10822 | |
|
| | 10823 | | return _message; |
| | 10824 | | } |
| | 10825 | |
|
| | 10826 | | /// <summary> |
| | 10827 | | /// Create the PageBlob.GetPageRangesDiffAsync response or throw a failure exception. |
| | 10828 | | /// </summary> |
| | 10829 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 10830 | | /// <param name="response">The raw Response.</param> |
| | 10831 | | /// <returns>The PageBlob.GetPageRangesDiffAsync Azure.Response{Azure.Storage.Blobs.Models.PageRangesInfoInt |
| | 10832 | | internal static Azure.Response<Azure.Storage.Blobs.Models.PageRangesInfoInternal> GetPageRangesDiffAsync_Cre |
| | 10833 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 10834 | | Azure.Response response) |
| | 10835 | | { |
| | 10836 | | // Process the response |
| | 10837 | | switch (response.Status) |
| | 10838 | | { |
| | 10839 | | case 200: |
| | 10840 | | { |
| | 10841 | | // Create the result |
| | 10842 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 10843 | | Azure.Storage.Blobs.Models.PageRangesInfoInternal _value = new Azure.Storage.Blobs.Models.PageRa |
| | 10844 | | _value.Body = Azure.Storage.Blobs.Models.PageList.FromXml(_xml.Root); |
| | 10845 | |
|
| | 10846 | | // Get response headers |
| | 10847 | | string _header; |
| | 10848 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 10849 | | { |
| | 10850 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 10851 | | } |
| | 10852 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 10853 | | { |
| | 10854 | | _value.ETag = new Azure.ETag(_header); |
| | 10855 | | } |
| | 10856 | | if (response.Headers.TryGetValue("x-ms-blob-content-length", out _header)) |
| | 10857 | | { |
| | 10858 | | _value.BlobContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCul |
| | 10859 | | } |
| | 10860 | |
|
| | 10861 | | // Create the response |
| | 10862 | | return Response.FromValue(_value, response); |
| | 10863 | | } |
| | 10864 | | case 304: |
| | 10865 | | { |
| | 10866 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.PageRangesInfoInternal>(response); |
| | 10867 | | } |
| | 10868 | | default: |
| | 10869 | | { |
| | 10870 | | // Create the result |
| | 10871 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 10872 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 10873 | |
|
| | 10874 | | throw _value.CreateException(clientDiagnostics, response); |
| | 10875 | | } |
| | 10876 | | } |
| | 10877 | | } |
| | 10878 | | #endregion PageBlob.GetPageRangesDiffAsync |
| | 10879 | |
|
| | 10880 | | #region PageBlob.ResizeAsync |
| | 10881 | | /// <summary> |
| | 10882 | | /// Resize the Blob |
| | 10883 | | /// </summary> |
| | 10884 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 10885 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 10886 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 10887 | | /// <param name="blobContentLength">This header specifies the maximum size for the page blob, up to 1 TB. Th |
| | 10888 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 10889 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 10890 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 10891 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 10892 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 10893 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 10894 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 10895 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 10896 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 10897 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 10898 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 10899 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 10900 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 10901 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 10902 | | /// <param name="operationName">Operation name.</param> |
| | 10903 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 10904 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.PageBlobInfo}</returns> |
| | 10905 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.PageBlobInfo> |
| | 10906 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 10907 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 10908 | | System.Uri resourceUri, |
| | 10909 | | long blobContentLength, |
| | 10910 | | string version, |
| | 10911 | | int? timeout = default, |
| | 10912 | | string leaseId = default, |
| | 10913 | | string encryptionKey = default, |
| | 10914 | | string encryptionKeySha256 = default, |
| | 10915 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 10916 | | string encryptionScope = default, |
| | 10917 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 10918 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 10919 | | Azure.ETag? ifMatch = default, |
| | 10920 | | Azure.ETag? ifNoneMatch = default, |
| | 10921 | | string ifTags = default, |
| | 10922 | | string requestId = default, |
| | 10923 | | bool async = true, |
| | 10924 | | string operationName = "PageBlobClient.Resize", |
| | 10925 | | System.Threading.CancellationToken cancellationToken = default) |
| | 10926 | | { |
| | 10927 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 10928 | | try |
| | 10929 | | { |
| | 10930 | | _scope.AddAttribute("url", resourceUri); |
| | 10931 | | _scope.Start(); |
| | 10932 | | using (Azure.Core.HttpMessage _message = ResizeAsync_CreateMessage( |
| | 10933 | | pipeline, |
| | 10934 | | resourceUri, |
| | 10935 | | blobContentLength, |
| | 10936 | | version, |
| | 10937 | | timeout, |
| | 10938 | | leaseId, |
| | 10939 | | encryptionKey, |
| | 10940 | | encryptionKeySha256, |
| | 10941 | | encryptionAlgorithm, |
| | 10942 | | encryptionScope, |
| | 10943 | | ifModifiedSince, |
| | 10944 | | ifUnmodifiedSince, |
| | 10945 | | ifMatch, |
| | 10946 | | ifNoneMatch, |
| | 10947 | | ifTags, |
| | 10948 | | requestId)) |
| | 10949 | | { |
| | 10950 | | if (async) |
| | 10951 | | { |
| | 10952 | | // Send the request asynchronously if we're being called via an async path |
| | 10953 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 10954 | | } |
| | 10955 | | else |
| | 10956 | | { |
| | 10957 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 10958 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 10959 | | pipeline.Send(_message, cancellationToken); |
| | 10960 | | } |
| | 10961 | | Azure.Response _response = _message.Response; |
| | 10962 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 10963 | | return ResizeAsync_CreateResponse(clientDiagnostics, _response); |
| | 10964 | | } |
| | 10965 | | } |
| | 10966 | | catch (System.Exception ex) |
| | 10967 | | { |
| | 10968 | | _scope.Failed(ex); |
| | 10969 | | throw; |
| | 10970 | | } |
| | 10971 | | finally |
| | 10972 | | { |
| | 10973 | | _scope.Dispose(); |
| | 10974 | | } |
| | 10975 | | } |
| | 10976 | |
|
| | 10977 | | /// <summary> |
| | 10978 | | /// Create the PageBlob.ResizeAsync request. |
| | 10979 | | /// </summary> |
| | 10980 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 10981 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 10982 | | /// <param name="blobContentLength">This header specifies the maximum size for the page blob, up to 1 TB. Th |
| | 10983 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 10984 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 10985 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 10986 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 10987 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 10988 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 10989 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 10990 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 10991 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 10992 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 10993 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 10994 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 10995 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 10996 | | /// <returns>The PageBlob.ResizeAsync Message.</returns> |
| | 10997 | | internal static Azure.Core.HttpMessage ResizeAsync_CreateMessage( |
| | 10998 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 10999 | | System.Uri resourceUri, |
| | 11000 | | long blobContentLength, |
| | 11001 | | string version, |
| | 11002 | | int? timeout = default, |
| | 11003 | | string leaseId = default, |
| | 11004 | | string encryptionKey = default, |
| | 11005 | | string encryptionKeySha256 = default, |
| | 11006 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 11007 | | string encryptionScope = default, |
| | 11008 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 11009 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 11010 | | Azure.ETag? ifMatch = default, |
| | 11011 | | Azure.ETag? ifNoneMatch = default, |
| | 11012 | | string ifTags = default, |
| | 11013 | | string requestId = default) |
| | 11014 | | { |
| | 11015 | | // Validation |
| | 11016 | | if (resourceUri == null) |
| | 11017 | | { |
| | 11018 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 11019 | | } |
| | 11020 | | if (version == null) |
| | 11021 | | { |
| | 11022 | | throw new System.ArgumentNullException(nameof(version)); |
| | 11023 | | } |
| | 11024 | |
|
| | 11025 | | // Create the request |
| | 11026 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 11027 | | Azure.Core.Request _request = _message.Request; |
| | 11028 | |
|
| | 11029 | | // Set the endpoint |
| | 11030 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 11031 | | _request.Uri.Reset(resourceUri); |
| | 11032 | | _request.Uri.AppendQuery("comp", "properties", escapeValue: false); |
| | 11033 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 11034 | |
|
| | 11035 | | // Add request headers |
| | 11036 | | _request.Headers.SetValue("x-ms-blob-content-length", blobContentLength.ToString(System.Globalization.Cu |
| | 11037 | | _request.Headers.SetValue("x-ms-version", version); |
| | 11038 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 11039 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 11040 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 11041 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 11042 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 11043 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 11044 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 11045 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 11046 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 11047 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 11048 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 11049 | |
|
| | 11050 | | return _message; |
| | 11051 | | } |
| | 11052 | |
|
| | 11053 | | /// <summary> |
| | 11054 | | /// Create the PageBlob.ResizeAsync response or throw a failure exception. |
| | 11055 | | /// </summary> |
| | 11056 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 11057 | | /// <param name="response">The raw Response.</param> |
| | 11058 | | /// <returns>The PageBlob.ResizeAsync Azure.Response{Azure.Storage.Blobs.Models.PageBlobInfo}.</returns> |
| | 11059 | | internal static Azure.Response<Azure.Storage.Blobs.Models.PageBlobInfo> ResizeAsync_CreateResponse( |
| | 11060 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 11061 | | Azure.Response response) |
| | 11062 | | { |
| | 11063 | | // Process the response |
| | 11064 | | switch (response.Status) |
| | 11065 | | { |
| | 11066 | | case 200: |
| | 11067 | | { |
| | 11068 | | // Create the result |
| | 11069 | | Azure.Storage.Blobs.Models.PageBlobInfo _value = new Azure.Storage.Blobs.Models.PageBlobInfo(); |
| | 11070 | |
|
| | 11071 | | // Get response headers |
| | 11072 | | string _header; |
| | 11073 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 11074 | | { |
| | 11075 | | _value.ETag = new Azure.ETag(_header); |
| | 11076 | | } |
| | 11077 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 11078 | | { |
| | 11079 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 11080 | | } |
| | 11081 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 11082 | | { |
| | 11083 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 11084 | | } |
| | 11085 | |
|
| | 11086 | | // Create the response |
| | 11087 | | return Response.FromValue(_value, response); |
| | 11088 | | } |
| | 11089 | | default: |
| | 11090 | | { |
| | 11091 | | // Create the result |
| | 11092 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 11093 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 11094 | |
|
| | 11095 | | throw _value.CreateException(clientDiagnostics, response); |
| | 11096 | | } |
| | 11097 | | } |
| | 11098 | | } |
| | 11099 | | #endregion PageBlob.ResizeAsync |
| | 11100 | |
|
| | 11101 | | #region PageBlob.UpdateSequenceNumberAsync |
| | 11102 | | /// <summary> |
| | 11103 | | /// Update the sequence number of the blob |
| | 11104 | | /// </summary> |
| | 11105 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 11106 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 11107 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 11108 | | /// <param name="sequenceNumberAction">Required if the x-ms-blob-sequence-number header is set for the reque |
| | 11109 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 11110 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 11111 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 11112 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 11113 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 11114 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 11115 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 11116 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 11117 | | /// <param name="blobSequenceNumber">Set for page blobs only. The sequence number is a user-controlled value |
| | 11118 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 11119 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 11120 | | /// <param name="operationName">Operation name.</param> |
| | 11121 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 11122 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.PageBlobInfo}</returns> |
| | 11123 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.PageBlobInfo> |
| | 11124 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 11125 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 11126 | | System.Uri resourceUri, |
| | 11127 | | Azure.Storage.Blobs.Models.SequenceNumberAction sequenceNumberAction, |
| | 11128 | | string version, |
| | 11129 | | int? timeout = default, |
| | 11130 | | string leaseId = default, |
| | 11131 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 11132 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 11133 | | Azure.ETag? ifMatch = default, |
| | 11134 | | Azure.ETag? ifNoneMatch = default, |
| | 11135 | | string ifTags = default, |
| | 11136 | | long? blobSequenceNumber = default, |
| | 11137 | | string requestId = default, |
| | 11138 | | bool async = true, |
| | 11139 | | string operationName = "PageBlobClient.UpdateSequenceNumber", |
| | 11140 | | System.Threading.CancellationToken cancellationToken = default) |
| | 11141 | | { |
| | 11142 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 11143 | | try |
| | 11144 | | { |
| | 11145 | | _scope.AddAttribute("url", resourceUri); |
| | 11146 | | _scope.Start(); |
| | 11147 | | using (Azure.Core.HttpMessage _message = UpdateSequenceNumberAsync_CreateMessage( |
| | 11148 | | pipeline, |
| | 11149 | | resourceUri, |
| | 11150 | | sequenceNumberAction, |
| | 11151 | | version, |
| | 11152 | | timeout, |
| | 11153 | | leaseId, |
| | 11154 | | ifModifiedSince, |
| | 11155 | | ifUnmodifiedSince, |
| | 11156 | | ifMatch, |
| | 11157 | | ifNoneMatch, |
| | 11158 | | ifTags, |
| | 11159 | | blobSequenceNumber, |
| | 11160 | | requestId)) |
| | 11161 | | { |
| | 11162 | | if (async) |
| | 11163 | | { |
| | 11164 | | // Send the request asynchronously if we're being called via an async path |
| | 11165 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 11166 | | } |
| | 11167 | | else |
| | 11168 | | { |
| | 11169 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 11170 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 11171 | | pipeline.Send(_message, cancellationToken); |
| | 11172 | | } |
| | 11173 | | Azure.Response _response = _message.Response; |
| | 11174 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 11175 | | return UpdateSequenceNumberAsync_CreateResponse(clientDiagnostics, _response); |
| | 11176 | | } |
| | 11177 | | } |
| | 11178 | | catch (System.Exception ex) |
| | 11179 | | { |
| | 11180 | | _scope.Failed(ex); |
| | 11181 | | throw; |
| | 11182 | | } |
| | 11183 | | finally |
| | 11184 | | { |
| | 11185 | | _scope.Dispose(); |
| | 11186 | | } |
| | 11187 | | } |
| | 11188 | |
|
| | 11189 | | /// <summary> |
| | 11190 | | /// Create the PageBlob.UpdateSequenceNumberAsync request. |
| | 11191 | | /// </summary> |
| | 11192 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 11193 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 11194 | | /// <param name="sequenceNumberAction">Required if the x-ms-blob-sequence-number header is set for the reque |
| | 11195 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 11196 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 11197 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 11198 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 11199 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 11200 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 11201 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 11202 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 11203 | | /// <param name="blobSequenceNumber">Set for page blobs only. The sequence number is a user-controlled value |
| | 11204 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 11205 | | /// <returns>The PageBlob.UpdateSequenceNumberAsync Message.</returns> |
| | 11206 | | internal static Azure.Core.HttpMessage UpdateSequenceNumberAsync_CreateMessage( |
| | 11207 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 11208 | | System.Uri resourceUri, |
| | 11209 | | Azure.Storage.Blobs.Models.SequenceNumberAction sequenceNumberAction, |
| | 11210 | | string version, |
| | 11211 | | int? timeout = default, |
| | 11212 | | string leaseId = default, |
| | 11213 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 11214 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 11215 | | Azure.ETag? ifMatch = default, |
| | 11216 | | Azure.ETag? ifNoneMatch = default, |
| | 11217 | | string ifTags = default, |
| | 11218 | | long? blobSequenceNumber = default, |
| | 11219 | | string requestId = default) |
| | 11220 | | { |
| | 11221 | | // Validation |
| | 11222 | | if (resourceUri == null) |
| | 11223 | | { |
| | 11224 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 11225 | | } |
| | 11226 | | if (version == null) |
| | 11227 | | { |
| | 11228 | | throw new System.ArgumentNullException(nameof(version)); |
| | 11229 | | } |
| | 11230 | |
|
| | 11231 | | // Create the request |
| | 11232 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 11233 | | Azure.Core.Request _request = _message.Request; |
| | 11234 | |
|
| | 11235 | | // Set the endpoint |
| | 11236 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 11237 | | _request.Uri.Reset(resourceUri); |
| | 11238 | | _request.Uri.AppendQuery("comp", "properties", escapeValue: false); |
| | 11239 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 11240 | |
|
| | 11241 | | // Add request headers |
| | 11242 | | _request.Headers.SetValue("x-ms-sequence-number-action", Azure.Storage.Blobs.BlobRestClient.Serializatio |
| | 11243 | | _request.Headers.SetValue("x-ms-version", version); |
| | 11244 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 11245 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 11246 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 11247 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 11248 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 11249 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 11250 | | if (blobSequenceNumber != null) { _request.Headers.SetValue("x-ms-blob-sequence-number", blobSequenceNum |
| | 11251 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 11252 | |
|
| | 11253 | | return _message; |
| | 11254 | | } |
| | 11255 | |
|
| | 11256 | | /// <summary> |
| | 11257 | | /// Create the PageBlob.UpdateSequenceNumberAsync response or throw a failure exception. |
| | 11258 | | /// </summary> |
| | 11259 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 11260 | | /// <param name="response">The raw Response.</param> |
| | 11261 | | /// <returns>The PageBlob.UpdateSequenceNumberAsync Azure.Response{Azure.Storage.Blobs.Models.PageBlobInfo}. |
| | 11262 | | internal static Azure.Response<Azure.Storage.Blobs.Models.PageBlobInfo> UpdateSequenceNumberAsync_CreateResp |
| | 11263 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 11264 | | Azure.Response response) |
| | 11265 | | { |
| | 11266 | | // Process the response |
| | 11267 | | switch (response.Status) |
| | 11268 | | { |
| | 11269 | | case 200: |
| | 11270 | | { |
| | 11271 | | // Create the result |
| | 11272 | | Azure.Storage.Blobs.Models.PageBlobInfo _value = new Azure.Storage.Blobs.Models.PageBlobInfo(); |
| | 11273 | |
|
| | 11274 | | // Get response headers |
| | 11275 | | string _header; |
| | 11276 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 11277 | | { |
| | 11278 | | _value.ETag = new Azure.ETag(_header); |
| | 11279 | | } |
| | 11280 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 11281 | | { |
| | 11282 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 11283 | | } |
| | 11284 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 11285 | | { |
| | 11286 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 11287 | | } |
| | 11288 | |
|
| | 11289 | | // Create the response |
| | 11290 | | return Response.FromValue(_value, response); |
| | 11291 | | } |
| | 11292 | | default: |
| | 11293 | | { |
| | 11294 | | // Create the result |
| | 11295 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 11296 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 11297 | |
|
| | 11298 | | throw _value.CreateException(clientDiagnostics, response); |
| | 11299 | | } |
| | 11300 | | } |
| | 11301 | | } |
| | 11302 | | #endregion PageBlob.UpdateSequenceNumberAsync |
| | 11303 | |
|
| | 11304 | | #region PageBlob.CopyIncrementalAsync |
| | 11305 | | /// <summary> |
| | 11306 | | /// The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The |
| | 11307 | | /// </summary> |
| | 11308 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 11309 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 11310 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 11311 | | /// <param name="copySource">Specifies the name of the source page blob snapshot. This value is a URL of up |
| | 11312 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 11313 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 11314 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 11315 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 11316 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 11317 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 11318 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 11319 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 11320 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 11321 | | /// <param name="operationName">Operation name.</param> |
| | 11322 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 11323 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobCopyInfo}</returns> |
| | 11324 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobCopyInfo> |
| | 11325 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 11326 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 11327 | | System.Uri resourceUri, |
| | 11328 | | System.Uri copySource, |
| | 11329 | | string version, |
| | 11330 | | int? timeout = default, |
| | 11331 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 11332 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 11333 | | Azure.ETag? ifMatch = default, |
| | 11334 | | Azure.ETag? ifNoneMatch = default, |
| | 11335 | | string ifTags = default, |
| | 11336 | | string requestId = default, |
| | 11337 | | bool async = true, |
| | 11338 | | string operationName = "PageBlobClient.CopyIncremental", |
| | 11339 | | System.Threading.CancellationToken cancellationToken = default) |
| | 11340 | | { |
| | 11341 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 11342 | | try |
| | 11343 | | { |
| | 11344 | | _scope.AddAttribute("url", resourceUri); |
| | 11345 | | _scope.Start(); |
| | 11346 | | using (Azure.Core.HttpMessage _message = CopyIncrementalAsync_CreateMessage( |
| | 11347 | | pipeline, |
| | 11348 | | resourceUri, |
| | 11349 | | copySource, |
| | 11350 | | version, |
| | 11351 | | timeout, |
| | 11352 | | ifModifiedSince, |
| | 11353 | | ifUnmodifiedSince, |
| | 11354 | | ifMatch, |
| | 11355 | | ifNoneMatch, |
| | 11356 | | ifTags, |
| | 11357 | | requestId)) |
| | 11358 | | { |
| | 11359 | | if (async) |
| | 11360 | | { |
| | 11361 | | // Send the request asynchronously if we're being called via an async path |
| | 11362 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 11363 | | } |
| | 11364 | | else |
| | 11365 | | { |
| | 11366 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 11367 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 11368 | | pipeline.Send(_message, cancellationToken); |
| | 11369 | | } |
| | 11370 | | Azure.Response _response = _message.Response; |
| | 11371 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 11372 | | return CopyIncrementalAsync_CreateResponse(clientDiagnostics, _response); |
| | 11373 | | } |
| | 11374 | | } |
| | 11375 | | catch (System.Exception ex) |
| | 11376 | | { |
| | 11377 | | _scope.Failed(ex); |
| | 11378 | | throw; |
| | 11379 | | } |
| | 11380 | | finally |
| | 11381 | | { |
| | 11382 | | _scope.Dispose(); |
| | 11383 | | } |
| | 11384 | | } |
| | 11385 | |
|
| | 11386 | | /// <summary> |
| | 11387 | | /// Create the PageBlob.CopyIncrementalAsync request. |
| | 11388 | | /// </summary> |
| | 11389 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 11390 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 11391 | | /// <param name="copySource">Specifies the name of the source page blob snapshot. This value is a URL of up |
| | 11392 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 11393 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 11394 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 11395 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 11396 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 11397 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 11398 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 11399 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 11400 | | /// <returns>The PageBlob.CopyIncrementalAsync Message.</returns> |
| | 11401 | | internal static Azure.Core.HttpMessage CopyIncrementalAsync_CreateMessage( |
| | 11402 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 11403 | | System.Uri resourceUri, |
| | 11404 | | System.Uri copySource, |
| | 11405 | | string version, |
| | 11406 | | int? timeout = default, |
| | 11407 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 11408 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 11409 | | Azure.ETag? ifMatch = default, |
| | 11410 | | Azure.ETag? ifNoneMatch = default, |
| | 11411 | | string ifTags = default, |
| | 11412 | | string requestId = default) |
| | 11413 | | { |
| | 11414 | | // Validation |
| | 11415 | | if (resourceUri == null) |
| | 11416 | | { |
| | 11417 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 11418 | | } |
| | 11419 | | if (copySource == null) |
| | 11420 | | { |
| | 11421 | | throw new System.ArgumentNullException(nameof(copySource)); |
| | 11422 | | } |
| | 11423 | | if (version == null) |
| | 11424 | | { |
| | 11425 | | throw new System.ArgumentNullException(nameof(version)); |
| | 11426 | | } |
| | 11427 | |
|
| | 11428 | | // Create the request |
| | 11429 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 11430 | | Azure.Core.Request _request = _message.Request; |
| | 11431 | |
|
| | 11432 | | // Set the endpoint |
| | 11433 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 11434 | | _request.Uri.Reset(resourceUri); |
| | 11435 | | _request.Uri.AppendQuery("comp", "incrementalcopy", escapeValue: false); |
| | 11436 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 11437 | |
|
| | 11438 | | // Add request headers |
| | 11439 | | _request.Headers.SetValue("x-ms-copy-source", copySource.AbsoluteUri); |
| | 11440 | | _request.Headers.SetValue("x-ms-version", version); |
| | 11441 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 11442 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 11443 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 11444 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 11445 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 11446 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 11447 | |
|
| | 11448 | | return _message; |
| | 11449 | | } |
| | 11450 | |
|
| | 11451 | | /// <summary> |
| | 11452 | | /// Create the PageBlob.CopyIncrementalAsync response or throw a failure exception. |
| | 11453 | | /// </summary> |
| | 11454 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 11455 | | /// <param name="response">The raw Response.</param> |
| | 11456 | | /// <returns>The PageBlob.CopyIncrementalAsync Azure.Response{Azure.Storage.Blobs.Models.BlobCopyInfo}.</ret |
| | 11457 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobCopyInfo> CopyIncrementalAsync_CreateResponse( |
| | 11458 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 11459 | | Azure.Response response) |
| | 11460 | | { |
| | 11461 | | // Process the response |
| | 11462 | | switch (response.Status) |
| | 11463 | | { |
| | 11464 | | case 202: |
| | 11465 | | { |
| | 11466 | | // Create the result |
| | 11467 | | Azure.Storage.Blobs.Models.BlobCopyInfo _value = new Azure.Storage.Blobs.Models.BlobCopyInfo(); |
| | 11468 | |
|
| | 11469 | | // Get response headers |
| | 11470 | | string _header; |
| | 11471 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 11472 | | { |
| | 11473 | | _value.ETag = new Azure.ETag(_header); |
| | 11474 | | } |
| | 11475 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 11476 | | { |
| | 11477 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 11478 | | } |
| | 11479 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 11480 | | { |
| | 11481 | | _value.CopyId = _header; |
| | 11482 | | } |
| | 11483 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 11484 | | { |
| | 11485 | | _value.CopyStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseCopyStatus(_header |
| | 11486 | | } |
| | 11487 | |
|
| | 11488 | | // Create the response |
| | 11489 | | return Response.FromValue(_value, response); |
| | 11490 | | } |
| | 11491 | | default: |
| | 11492 | | { |
| | 11493 | | // Create the result |
| | 11494 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 11495 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 11496 | |
|
| | 11497 | | throw _value.CreateException(clientDiagnostics, response); |
| | 11498 | | } |
| | 11499 | | } |
| | 11500 | | } |
| | 11501 | | #endregion PageBlob.CopyIncrementalAsync |
| | 11502 | | } |
| | 11503 | | #endregion PageBlob operations |
| | 11504 | |
|
| | 11505 | | #region AppendBlob operations |
| | 11506 | | /// <summary> |
| | 11507 | | /// AppendBlob operations for Azure Blob Storage |
| | 11508 | | /// </summary> |
| | 11509 | | public static partial class AppendBlob |
| | 11510 | | { |
| | 11511 | | #region AppendBlob.CreateAsync |
| | 11512 | | /// <summary> |
| | 11513 | | /// The Create Append Blob operation creates a new append blob. |
| | 11514 | | /// </summary> |
| | 11515 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 11516 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 11517 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 11518 | | /// <param name="contentLength">The length of the request.</param> |
| | 11519 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 11520 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 11521 | | /// <param name="blobContentType">Optional. Sets the blob's content type. If specified, this property is sto |
| | 11522 | | /// <param name="blobContentEncoding">Optional. Sets the blob's content encoding. If specified, this propert |
| | 11523 | | /// <param name="blobContentLanguage">Optional. Set the blob's content language. If specified, this property |
| | 11524 | | /// <param name="blobContentHash">Optional. An MD5 hash of the blob content. Note that this hash is not vali |
| | 11525 | | /// <param name="blobCacheControl">Optional. Sets the blob's cache control. If specified, this property is s |
| | 11526 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 11527 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 11528 | | /// <param name="blobContentDisposition">Optional. Sets the blob's Content-Disposition header.</param> |
| | 11529 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 11530 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 11531 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 11532 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 11533 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 11534 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 11535 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 11536 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 11537 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 11538 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 11539 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 11540 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 11541 | | /// <param name="operationName">Operation name.</param> |
| | 11542 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 11543 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobContentInfo}</returns> |
| | 11544 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobContentIn |
| | 11545 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 11546 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 11547 | | System.Uri resourceUri, |
| | 11548 | | long contentLength, |
| | 11549 | | string version, |
| | 11550 | | int? timeout = default, |
| | 11551 | | string blobContentType = default, |
| | 11552 | | string blobContentEncoding = default, |
| | 11553 | | string blobContentLanguage = default, |
| | 11554 | | byte[] blobContentHash = default, |
| | 11555 | | string blobCacheControl = default, |
| | 11556 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 11557 | | string leaseId = default, |
| | 11558 | | string blobContentDisposition = default, |
| | 11559 | | string encryptionKey = default, |
| | 11560 | | string encryptionKeySha256 = default, |
| | 11561 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 11562 | | string encryptionScope = default, |
| | 11563 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 11564 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 11565 | | Azure.ETag? ifMatch = default, |
| | 11566 | | Azure.ETag? ifNoneMatch = default, |
| | 11567 | | string ifTags = default, |
| | 11568 | | string requestId = default, |
| | 11569 | | string blobTagsString = default, |
| | 11570 | | bool async = true, |
| | 11571 | | string operationName = "AppendBlobClient.Create", |
| | 11572 | | System.Threading.CancellationToken cancellationToken = default) |
| | 11573 | | { |
| | 11574 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 11575 | | try |
| | 11576 | | { |
| | 11577 | | _scope.AddAttribute("url", resourceUri); |
| | 11578 | | _scope.Start(); |
| | 11579 | | using (Azure.Core.HttpMessage _message = CreateAsync_CreateMessage( |
| | 11580 | | pipeline, |
| | 11581 | | resourceUri, |
| | 11582 | | contentLength, |
| | 11583 | | version, |
| | 11584 | | timeout, |
| | 11585 | | blobContentType, |
| | 11586 | | blobContentEncoding, |
| | 11587 | | blobContentLanguage, |
| | 11588 | | blobContentHash, |
| | 11589 | | blobCacheControl, |
| | 11590 | | metadata, |
| | 11591 | | leaseId, |
| | 11592 | | blobContentDisposition, |
| | 11593 | | encryptionKey, |
| | 11594 | | encryptionKeySha256, |
| | 11595 | | encryptionAlgorithm, |
| | 11596 | | encryptionScope, |
| | 11597 | | ifModifiedSince, |
| | 11598 | | ifUnmodifiedSince, |
| | 11599 | | ifMatch, |
| | 11600 | | ifNoneMatch, |
| | 11601 | | ifTags, |
| | 11602 | | requestId, |
| | 11603 | | blobTagsString)) |
| | 11604 | | { |
| | 11605 | | if (async) |
| | 11606 | | { |
| | 11607 | | // Send the request asynchronously if we're being called via an async path |
| | 11608 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 11609 | | } |
| | 11610 | | else |
| | 11611 | | { |
| | 11612 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 11613 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 11614 | | pipeline.Send(_message, cancellationToken); |
| | 11615 | | } |
| | 11616 | | Azure.Response _response = _message.Response; |
| | 11617 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 11618 | | return CreateAsync_CreateResponse(clientDiagnostics, _response); |
| | 11619 | | } |
| | 11620 | | } |
| | 11621 | | catch (System.Exception ex) |
| | 11622 | | { |
| | 11623 | | _scope.Failed(ex); |
| | 11624 | | throw; |
| | 11625 | | } |
| | 11626 | | finally |
| | 11627 | | { |
| | 11628 | | _scope.Dispose(); |
| | 11629 | | } |
| | 11630 | | } |
| | 11631 | |
|
| | 11632 | | /// <summary> |
| | 11633 | | /// Create the AppendBlob.CreateAsync request. |
| | 11634 | | /// </summary> |
| | 11635 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 11636 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 11637 | | /// <param name="contentLength">The length of the request.</param> |
| | 11638 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 11639 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 11640 | | /// <param name="blobContentType">Optional. Sets the blob's content type. If specified, this property is sto |
| | 11641 | | /// <param name="blobContentEncoding">Optional. Sets the blob's content encoding. If specified, this propert |
| | 11642 | | /// <param name="blobContentLanguage">Optional. Set the blob's content language. If specified, this property |
| | 11643 | | /// <param name="blobContentHash">Optional. An MD5 hash of the blob content. Note that this hash is not vali |
| | 11644 | | /// <param name="blobCacheControl">Optional. Sets the blob's cache control. If specified, this property is s |
| | 11645 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 11646 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 11647 | | /// <param name="blobContentDisposition">Optional. Sets the blob's Content-Disposition header.</param> |
| | 11648 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 11649 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 11650 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 11651 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 11652 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 11653 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 11654 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 11655 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 11656 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 11657 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 11658 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 11659 | | /// <returns>The AppendBlob.CreateAsync Message.</returns> |
| | 11660 | | internal static Azure.Core.HttpMessage CreateAsync_CreateMessage( |
| | 11661 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 11662 | | System.Uri resourceUri, |
| | 11663 | | long contentLength, |
| | 11664 | | string version, |
| | 11665 | | int? timeout = default, |
| | 11666 | | string blobContentType = default, |
| | 11667 | | string blobContentEncoding = default, |
| | 11668 | | string blobContentLanguage = default, |
| | 11669 | | byte[] blobContentHash = default, |
| | 11670 | | string blobCacheControl = default, |
| | 11671 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 11672 | | string leaseId = default, |
| | 11673 | | string blobContentDisposition = default, |
| | 11674 | | string encryptionKey = default, |
| | 11675 | | string encryptionKeySha256 = default, |
| | 11676 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 11677 | | string encryptionScope = default, |
| | 11678 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 11679 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 11680 | | Azure.ETag? ifMatch = default, |
| | 11681 | | Azure.ETag? ifNoneMatch = default, |
| | 11682 | | string ifTags = default, |
| | 11683 | | string requestId = default, |
| | 11684 | | string blobTagsString = default) |
| | 11685 | | { |
| | 11686 | | // Validation |
| | 11687 | | if (resourceUri == null) |
| | 11688 | | { |
| | 11689 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 11690 | | } |
| | 11691 | | if (version == null) |
| | 11692 | | { |
| | 11693 | | throw new System.ArgumentNullException(nameof(version)); |
| | 11694 | | } |
| | 11695 | |
|
| | 11696 | | // Create the request |
| | 11697 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 11698 | | Azure.Core.Request _request = _message.Request; |
| | 11699 | |
|
| | 11700 | | // Set the endpoint |
| | 11701 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 11702 | | _request.Uri.Reset(resourceUri); |
| | 11703 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 11704 | |
|
| | 11705 | | // Add request headers |
| | 11706 | | _request.Headers.SetValue("x-ms-blob-type", "AppendBlob"); |
| | 11707 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 11708 | | _request.Headers.SetValue("x-ms-version", version); |
| | 11709 | | if (blobContentType != null) { _request.Headers.SetValue("x-ms-blob-content-type", blobContentType); } |
| | 11710 | | if (blobContentEncoding != null) { _request.Headers.SetValue("x-ms-blob-content-encoding", blobContentEn |
| | 11711 | | if (blobContentLanguage != null) { _request.Headers.SetValue("x-ms-blob-content-language", blobContentLa |
| | 11712 | | if (blobContentHash != null) { _request.Headers.SetValue("x-ms-blob-content-md5", System.Convert.ToBase6 |
| | 11713 | | if (blobCacheControl != null) { _request.Headers.SetValue("x-ms-blob-cache-control", blobCacheControl); |
| | 11714 | | if (metadata != null) { |
| | 11715 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 11716 | | { |
| | 11717 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 11718 | | } |
| | 11719 | | } |
| | 11720 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 11721 | | if (blobContentDisposition != null) { _request.Headers.SetValue("x-ms-blob-content-disposition", blobCon |
| | 11722 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 11723 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 11724 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 11725 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 11726 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 11727 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 11728 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 11729 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 11730 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 11731 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 11732 | | if (blobTagsString != null) { _request.Headers.SetValue("x-ms-tags", blobTagsString); } |
| | 11733 | |
|
| | 11734 | | return _message; |
| | 11735 | | } |
| | 11736 | |
|
| | 11737 | | /// <summary> |
| | 11738 | | /// Create the AppendBlob.CreateAsync response or throw a failure exception. |
| | 11739 | | /// </summary> |
| | 11740 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 11741 | | /// <param name="response">The raw Response.</param> |
| | 11742 | | /// <returns>The AppendBlob.CreateAsync Azure.Response{Azure.Storage.Blobs.Models.BlobContentInfo}.</returns |
| | 11743 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> CreateAsync_CreateResponse( |
| | 11744 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 11745 | | Azure.Response response) |
| | 11746 | | { |
| | 11747 | | // Process the response |
| | 11748 | | switch (response.Status) |
| | 11749 | | { |
| | 11750 | | case 201: |
| | 11751 | | { |
| | 11752 | | // Create the result |
| | 11753 | | Azure.Storage.Blobs.Models.BlobContentInfo _value = new Azure.Storage.Blobs.Models.BlobContentIn |
| | 11754 | |
|
| | 11755 | | // Get response headers |
| | 11756 | | string _header; |
| | 11757 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 11758 | | { |
| | 11759 | | _value.ETag = new Azure.ETag(_header); |
| | 11760 | | } |
| | 11761 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 11762 | | { |
| | 11763 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 11764 | | } |
| | 11765 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 11766 | | { |
| | 11767 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 11768 | | } |
| | 11769 | | if (response.Headers.TryGetValue("x-ms-version-id", out _header)) |
| | 11770 | | { |
| | 11771 | | _value.VersionId = _header; |
| | 11772 | | } |
| | 11773 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 11774 | | { |
| | 11775 | | _value.EncryptionKeySha256 = _header; |
| | 11776 | | } |
| | 11777 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 11778 | | { |
| | 11779 | | _value.EncryptionScope = _header; |
| | 11780 | | } |
| | 11781 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 11782 | | { |
| | 11783 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 11784 | | } |
| | 11785 | |
|
| | 11786 | | // Create the response |
| | 11787 | | return Response.FromValue(_value, response); |
| | 11788 | | } |
| | 11789 | | default: |
| | 11790 | | { |
| | 11791 | | // Create the result |
| | 11792 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 11793 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 11794 | |
|
| | 11795 | | throw _value.CreateException(clientDiagnostics, response); |
| | 11796 | | } |
| | 11797 | | } |
| | 11798 | | } |
| | 11799 | | #endregion AppendBlob.CreateAsync |
| | 11800 | |
|
| | 11801 | | #region AppendBlob.AppendBlockAsync |
| | 11802 | | /// <summary> |
| | 11803 | | /// The Append Block operation commits a new block of data to the end of an existing append blob. The Append |
| | 11804 | | /// </summary> |
| | 11805 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 11806 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 11807 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 11808 | | /// <param name="body">Initial data</param> |
| | 11809 | | /// <param name="contentLength">The length of the request.</param> |
| | 11810 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 11811 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 11812 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 11813 | | /// <param name="transactionalContentCrc64">Specify the transactional crc64 for the body, to be validated by |
| | 11814 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 11815 | | /// <param name="maxSize">Optional conditional header. The max length in bytes permitted for the append blob |
| | 11816 | | /// <param name="appendPosition">Optional conditional header, used only for the Append Block operation. A nu |
| | 11817 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 11818 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 11819 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 11820 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 11821 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 11822 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 11823 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 11824 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 11825 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 11826 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 11827 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 11828 | | /// <param name="operationName">Operation name.</param> |
| | 11829 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 11830 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobAppendInfo}</returns> |
| | 11831 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobAppendInf |
| | 11832 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 11833 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 11834 | | System.Uri resourceUri, |
| | 11835 | | System.IO.Stream body, |
| | 11836 | | long contentLength, |
| | 11837 | | string version, |
| | 11838 | | int? timeout = default, |
| | 11839 | | byte[] transactionalContentHash = default, |
| | 11840 | | byte[] transactionalContentCrc64 = default, |
| | 11841 | | string leaseId = default, |
| | 11842 | | long? maxSize = default, |
| | 11843 | | long? appendPosition = default, |
| | 11844 | | string encryptionKey = default, |
| | 11845 | | string encryptionKeySha256 = default, |
| | 11846 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 11847 | | string encryptionScope = default, |
| | 11848 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 11849 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 11850 | | Azure.ETag? ifMatch = default, |
| | 11851 | | Azure.ETag? ifNoneMatch = default, |
| | 11852 | | string ifTags = default, |
| | 11853 | | string requestId = default, |
| | 11854 | | bool async = true, |
| | 11855 | | string operationName = "AppendBlobClient.AppendBlock", |
| | 11856 | | System.Threading.CancellationToken cancellationToken = default) |
| | 11857 | | { |
| | 11858 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 11859 | | try |
| | 11860 | | { |
| | 11861 | | _scope.AddAttribute("url", resourceUri); |
| | 11862 | | _scope.Start(); |
| | 11863 | | using (Azure.Core.HttpMessage _message = AppendBlockAsync_CreateMessage( |
| | 11864 | | pipeline, |
| | 11865 | | resourceUri, |
| | 11866 | | body, |
| | 11867 | | contentLength, |
| | 11868 | | version, |
| | 11869 | | timeout, |
| | 11870 | | transactionalContentHash, |
| | 11871 | | transactionalContentCrc64, |
| | 11872 | | leaseId, |
| | 11873 | | maxSize, |
| | 11874 | | appendPosition, |
| | 11875 | | encryptionKey, |
| | 11876 | | encryptionKeySha256, |
| | 11877 | | encryptionAlgorithm, |
| | 11878 | | encryptionScope, |
| | 11879 | | ifModifiedSince, |
| | 11880 | | ifUnmodifiedSince, |
| | 11881 | | ifMatch, |
| | 11882 | | ifNoneMatch, |
| | 11883 | | ifTags, |
| | 11884 | | requestId)) |
| | 11885 | | { |
| | 11886 | | if (async) |
| | 11887 | | { |
| | 11888 | | // Send the request asynchronously if we're being called via an async path |
| | 11889 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 11890 | | } |
| | 11891 | | else |
| | 11892 | | { |
| | 11893 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 11894 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 11895 | | pipeline.Send(_message, cancellationToken); |
| | 11896 | | } |
| | 11897 | | Azure.Response _response = _message.Response; |
| | 11898 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 11899 | | return AppendBlockAsync_CreateResponse(clientDiagnostics, _response); |
| | 11900 | | } |
| | 11901 | | } |
| | 11902 | | catch (System.Exception ex) |
| | 11903 | | { |
| | 11904 | | _scope.Failed(ex); |
| | 11905 | | throw; |
| | 11906 | | } |
| | 11907 | | finally |
| | 11908 | | { |
| | 11909 | | _scope.Dispose(); |
| | 11910 | | } |
| | 11911 | | } |
| | 11912 | |
|
| | 11913 | | /// <summary> |
| | 11914 | | /// Create the AppendBlob.AppendBlockAsync request. |
| | 11915 | | /// </summary> |
| | 11916 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 11917 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 11918 | | /// <param name="body">Initial data</param> |
| | 11919 | | /// <param name="contentLength">The length of the request.</param> |
| | 11920 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 11921 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 11922 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 11923 | | /// <param name="transactionalContentCrc64">Specify the transactional crc64 for the body, to be validated by |
| | 11924 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 11925 | | /// <param name="maxSize">Optional conditional header. The max length in bytes permitted for the append blob |
| | 11926 | | /// <param name="appendPosition">Optional conditional header, used only for the Append Block operation. A nu |
| | 11927 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 11928 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 11929 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 11930 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 11931 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 11932 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 11933 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 11934 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 11935 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 11936 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 11937 | | /// <returns>The AppendBlob.AppendBlockAsync Message.</returns> |
| | 11938 | | internal static Azure.Core.HttpMessage AppendBlockAsync_CreateMessage( |
| | 11939 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 11940 | | System.Uri resourceUri, |
| | 11941 | | System.IO.Stream body, |
| | 11942 | | long contentLength, |
| | 11943 | | string version, |
| | 11944 | | int? timeout = default, |
| | 11945 | | byte[] transactionalContentHash = default, |
| | 11946 | | byte[] transactionalContentCrc64 = default, |
| | 11947 | | string leaseId = default, |
| | 11948 | | long? maxSize = default, |
| | 11949 | | long? appendPosition = default, |
| | 11950 | | string encryptionKey = default, |
| | 11951 | | string encryptionKeySha256 = default, |
| | 11952 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 11953 | | string encryptionScope = default, |
| | 11954 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 11955 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 11956 | | Azure.ETag? ifMatch = default, |
| | 11957 | | Azure.ETag? ifNoneMatch = default, |
| | 11958 | | string ifTags = default, |
| | 11959 | | string requestId = default) |
| | 11960 | | { |
| | 11961 | | // Validation |
| | 11962 | | if (resourceUri == null) |
| | 11963 | | { |
| | 11964 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 11965 | | } |
| | 11966 | | if (body == null) |
| | 11967 | | { |
| | 11968 | | throw new System.ArgumentNullException(nameof(body)); |
| | 11969 | | } |
| | 11970 | | if (version == null) |
| | 11971 | | { |
| | 11972 | | throw new System.ArgumentNullException(nameof(version)); |
| | 11973 | | } |
| | 11974 | |
|
| | 11975 | | // Create the request |
| | 11976 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 11977 | | Azure.Core.Request _request = _message.Request; |
| | 11978 | |
|
| | 11979 | | // Set the endpoint |
| | 11980 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 11981 | | _request.Uri.Reset(resourceUri); |
| | 11982 | | _request.Uri.AppendQuery("comp", "appendblock", escapeValue: false); |
| | 11983 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 11984 | |
|
| | 11985 | | // Add request headers |
| | 11986 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 11987 | | _request.Headers.SetValue("x-ms-version", version); |
| | 11988 | | if (transactionalContentHash != null) { _request.Headers.SetValue("Content-MD5", System.Convert.ToBase64 |
| | 11989 | | if (transactionalContentCrc64 != null) { _request.Headers.SetValue("x-ms-content-crc64", System.Convert. |
| | 11990 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 11991 | | if (maxSize != null) { _request.Headers.SetValue("x-ms-blob-condition-maxsize", maxSize.Value.ToString(S |
| | 11992 | | if (appendPosition != null) { _request.Headers.SetValue("x-ms-blob-condition-appendpos", appendPosition. |
| | 11993 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 11994 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 11995 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 11996 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 11997 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 11998 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 11999 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 12000 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 12001 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 12002 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 12003 | |
|
| | 12004 | | // Create the body |
| | 12005 | | _request.Content = Azure.Core.RequestContent.Create(body); |
| | 12006 | |
|
| | 12007 | | return _message; |
| | 12008 | | } |
| | 12009 | |
|
| | 12010 | | /// <summary> |
| | 12011 | | /// Create the AppendBlob.AppendBlockAsync response or throw a failure exception. |
| | 12012 | | /// </summary> |
| | 12013 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 12014 | | /// <param name="response">The raw Response.</param> |
| | 12015 | | /// <returns>The AppendBlob.AppendBlockAsync Azure.Response{Azure.Storage.Blobs.Models.BlobAppendInfo}.</ret |
| | 12016 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobAppendInfo> AppendBlockAsync_CreateResponse( |
| | 12017 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 12018 | | Azure.Response response) |
| | 12019 | | { |
| | 12020 | | // Process the response |
| | 12021 | | switch (response.Status) |
| | 12022 | | { |
| | 12023 | | case 201: |
| | 12024 | | { |
| | 12025 | | // Create the result |
| | 12026 | | Azure.Storage.Blobs.Models.BlobAppendInfo _value = new Azure.Storage.Blobs.Models.BlobAppendInfo |
| | 12027 | |
|
| | 12028 | | // Get response headers |
| | 12029 | | string _header; |
| | 12030 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 12031 | | { |
| | 12032 | | _value.ETag = new Azure.ETag(_header); |
| | 12033 | | } |
| | 12034 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 12035 | | { |
| | 12036 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 12037 | | } |
| | 12038 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 12039 | | { |
| | 12040 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 12041 | | } |
| | 12042 | | if (response.Headers.TryGetValue("x-ms-content-crc64", out _header)) |
| | 12043 | | { |
| | 12044 | | _value.ContentCrc64 = System.Convert.FromBase64String(_header); |
| | 12045 | | } |
| | 12046 | | if (response.Headers.TryGetValue("x-ms-blob-append-offset", out _header)) |
| | 12047 | | { |
| | 12048 | | _value.BlobAppendOffset = _header; |
| | 12049 | | } |
| | 12050 | | if (response.Headers.TryGetValue("x-ms-blob-committed-block-count", out _header)) |
| | 12051 | | { |
| | 12052 | | _value.BlobCommittedBlockCount = int.Parse(_header, System.Globalization.CultureInfo.Invaria |
| | 12053 | | } |
| | 12054 | | if (response.Headers.TryGetValue("x-ms-request-server-encrypted", out _header)) |
| | 12055 | | { |
| | 12056 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 12057 | | } |
| | 12058 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 12059 | | { |
| | 12060 | | _value.EncryptionKeySha256 = _header; |
| | 12061 | | } |
| | 12062 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 12063 | | { |
| | 12064 | | _value.EncryptionScope = _header; |
| | 12065 | | } |
| | 12066 | |
|
| | 12067 | | // Create the response |
| | 12068 | | return Response.FromValue(_value, response); |
| | 12069 | | } |
| | 12070 | | default: |
| | 12071 | | { |
| | 12072 | | // Create the result |
| | 12073 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 12074 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 12075 | |
|
| | 12076 | | throw _value.CreateException(clientDiagnostics, response); |
| | 12077 | | } |
| | 12078 | | } |
| | 12079 | | } |
| | 12080 | | #endregion AppendBlob.AppendBlockAsync |
| | 12081 | |
|
| | 12082 | | #region AppendBlob.AppendBlockFromUriAsync |
| | 12083 | | /// <summary> |
| | 12084 | | /// The Append Block operation commits a new block of data to the end of an existing append blob where the c |
| | 12085 | | /// </summary> |
| | 12086 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 12087 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 12088 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 12089 | | /// <param name="sourceUri">Specify a URL to the copy source.</param> |
| | 12090 | | /// <param name="contentLength">The length of the request.</param> |
| | 12091 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 12092 | | /// <param name="sourceRange">Bytes of source data in the specified range.</param> |
| | 12093 | | /// <param name="sourceContentHash">Specify the md5 calculated for the range of bytes that must be read from |
| | 12094 | | /// <param name="sourceContentcrc64">Specify the crc64 calculated for the range of bytes that must be read f |
| | 12095 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 12096 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 12097 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 12098 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 12099 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 12100 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 12101 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 12102 | | /// <param name="maxSize">Optional conditional header. The max length in bytes permitted for the append blob |
| | 12103 | | /// <param name="appendPosition">Optional conditional header, used only for the Append Block operation. A nu |
| | 12104 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 12105 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 12106 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 12107 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 12108 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 12109 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 12110 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 12111 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 12112 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 12113 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 12114 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 12115 | | /// <param name="operationName">Operation name.</param> |
| | 12116 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 12117 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobAppendInfo}</returns> |
| | 12118 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobAppendInf |
| | 12119 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 12120 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 12121 | | System.Uri resourceUri, |
| | 12122 | | System.Uri sourceUri, |
| | 12123 | | long contentLength, |
| | 12124 | | string version, |
| | 12125 | | string sourceRange = default, |
| | 12126 | | byte[] sourceContentHash = default, |
| | 12127 | | byte[] sourceContentcrc64 = default, |
| | 12128 | | int? timeout = default, |
| | 12129 | | byte[] transactionalContentHash = default, |
| | 12130 | | string encryptionKey = default, |
| | 12131 | | string encryptionKeySha256 = default, |
| | 12132 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 12133 | | string encryptionScope = default, |
| | 12134 | | string leaseId = default, |
| | 12135 | | long? maxSize = default, |
| | 12136 | | long? appendPosition = default, |
| | 12137 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 12138 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 12139 | | Azure.ETag? ifMatch = default, |
| | 12140 | | Azure.ETag? ifNoneMatch = default, |
| | 12141 | | string ifTags = default, |
| | 12142 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 12143 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 12144 | | Azure.ETag? sourceIfMatch = default, |
| | 12145 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 12146 | | string requestId = default, |
| | 12147 | | bool async = true, |
| | 12148 | | string operationName = "AppendBlobClient.AppendBlockFromUri", |
| | 12149 | | System.Threading.CancellationToken cancellationToken = default) |
| | 12150 | | { |
| | 12151 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 12152 | | try |
| | 12153 | | { |
| | 12154 | | _scope.AddAttribute("url", resourceUri); |
| | 12155 | | _scope.Start(); |
| | 12156 | | using (Azure.Core.HttpMessage _message = AppendBlockFromUriAsync_CreateMessage( |
| | 12157 | | pipeline, |
| | 12158 | | resourceUri, |
| | 12159 | | sourceUri, |
| | 12160 | | contentLength, |
| | 12161 | | version, |
| | 12162 | | sourceRange, |
| | 12163 | | sourceContentHash, |
| | 12164 | | sourceContentcrc64, |
| | 12165 | | timeout, |
| | 12166 | | transactionalContentHash, |
| | 12167 | | encryptionKey, |
| | 12168 | | encryptionKeySha256, |
| | 12169 | | encryptionAlgorithm, |
| | 12170 | | encryptionScope, |
| | 12171 | | leaseId, |
| | 12172 | | maxSize, |
| | 12173 | | appendPosition, |
| | 12174 | | ifModifiedSince, |
| | 12175 | | ifUnmodifiedSince, |
| | 12176 | | ifMatch, |
| | 12177 | | ifNoneMatch, |
| | 12178 | | ifTags, |
| | 12179 | | sourceIfModifiedSince, |
| | 12180 | | sourceIfUnmodifiedSince, |
| | 12181 | | sourceIfMatch, |
| | 12182 | | sourceIfNoneMatch, |
| | 12183 | | requestId)) |
| | 12184 | | { |
| | 12185 | | if (async) |
| | 12186 | | { |
| | 12187 | | // Send the request asynchronously if we're being called via an async path |
| | 12188 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 12189 | | } |
| | 12190 | | else |
| | 12191 | | { |
| | 12192 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 12193 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 12194 | | pipeline.Send(_message, cancellationToken); |
| | 12195 | | } |
| | 12196 | | Azure.Response _response = _message.Response; |
| | 12197 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 12198 | | return AppendBlockFromUriAsync_CreateResponse(clientDiagnostics, _response); |
| | 12199 | | } |
| | 12200 | | } |
| | 12201 | | catch (System.Exception ex) |
| | 12202 | | { |
| | 12203 | | _scope.Failed(ex); |
| | 12204 | | throw; |
| | 12205 | | } |
| | 12206 | | finally |
| | 12207 | | { |
| | 12208 | | _scope.Dispose(); |
| | 12209 | | } |
| | 12210 | | } |
| | 12211 | |
|
| | 12212 | | /// <summary> |
| | 12213 | | /// Create the AppendBlob.AppendBlockFromUriAsync request. |
| | 12214 | | /// </summary> |
| | 12215 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 12216 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 12217 | | /// <param name="sourceUri">Specify a URL to the copy source.</param> |
| | 12218 | | /// <param name="contentLength">The length of the request.</param> |
| | 12219 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 12220 | | /// <param name="sourceRange">Bytes of source data in the specified range.</param> |
| | 12221 | | /// <param name="sourceContentHash">Specify the md5 calculated for the range of bytes that must be read from |
| | 12222 | | /// <param name="sourceContentcrc64">Specify the crc64 calculated for the range of bytes that must be read f |
| | 12223 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 12224 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 12225 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 12226 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 12227 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 12228 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 12229 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 12230 | | /// <param name="maxSize">Optional conditional header. The max length in bytes permitted for the append blob |
| | 12231 | | /// <param name="appendPosition">Optional conditional header, used only for the Append Block operation. A nu |
| | 12232 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 12233 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 12234 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 12235 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 12236 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 12237 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 12238 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 12239 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 12240 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 12241 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 12242 | | /// <returns>The AppendBlob.AppendBlockFromUriAsync Message.</returns> |
| | 12243 | | internal static Azure.Core.HttpMessage AppendBlockFromUriAsync_CreateMessage( |
| | 12244 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 12245 | | System.Uri resourceUri, |
| | 12246 | | System.Uri sourceUri, |
| | 12247 | | long contentLength, |
| | 12248 | | string version, |
| | 12249 | | string sourceRange = default, |
| | 12250 | | byte[] sourceContentHash = default, |
| | 12251 | | byte[] sourceContentcrc64 = default, |
| | 12252 | | int? timeout = default, |
| | 12253 | | byte[] transactionalContentHash = default, |
| | 12254 | | string encryptionKey = default, |
| | 12255 | | string encryptionKeySha256 = default, |
| | 12256 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 12257 | | string encryptionScope = default, |
| | 12258 | | string leaseId = default, |
| | 12259 | | long? maxSize = default, |
| | 12260 | | long? appendPosition = default, |
| | 12261 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 12262 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 12263 | | Azure.ETag? ifMatch = default, |
| | 12264 | | Azure.ETag? ifNoneMatch = default, |
| | 12265 | | string ifTags = default, |
| | 12266 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 12267 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 12268 | | Azure.ETag? sourceIfMatch = default, |
| | 12269 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 12270 | | string requestId = default) |
| | 12271 | | { |
| | 12272 | | // Validation |
| | 12273 | | if (resourceUri == null) |
| | 12274 | | { |
| | 12275 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 12276 | | } |
| | 12277 | | if (sourceUri == null) |
| | 12278 | | { |
| | 12279 | | throw new System.ArgumentNullException(nameof(sourceUri)); |
| | 12280 | | } |
| | 12281 | | if (version == null) |
| | 12282 | | { |
| | 12283 | | throw new System.ArgumentNullException(nameof(version)); |
| | 12284 | | } |
| | 12285 | |
|
| | 12286 | | // Create the request |
| | 12287 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 12288 | | Azure.Core.Request _request = _message.Request; |
| | 12289 | |
|
| | 12290 | | // Set the endpoint |
| | 12291 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 12292 | | _request.Uri.Reset(resourceUri); |
| | 12293 | | _request.Uri.AppendQuery("comp", "appendblock", escapeValue: false); |
| | 12294 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 12295 | |
|
| | 12296 | | // Add request headers |
| | 12297 | | _request.Headers.SetValue("x-ms-copy-source", sourceUri.AbsoluteUri); |
| | 12298 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 12299 | | _request.Headers.SetValue("x-ms-version", version); |
| | 12300 | | if (sourceRange != null) { _request.Headers.SetValue("x-ms-source-range", sourceRange); } |
| | 12301 | | if (sourceContentHash != null) { _request.Headers.SetValue("x-ms-source-content-md5", System.Convert.ToB |
| | 12302 | | if (sourceContentcrc64 != null) { _request.Headers.SetValue("x-ms-source-content-crc64", System.Convert. |
| | 12303 | | if (transactionalContentHash != null) { _request.Headers.SetValue("Content-MD5", System.Convert.ToBase64 |
| | 12304 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 12305 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 12306 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 12307 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 12308 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 12309 | | if (maxSize != null) { _request.Headers.SetValue("x-ms-blob-condition-maxsize", maxSize.Value.ToString(S |
| | 12310 | | if (appendPosition != null) { _request.Headers.SetValue("x-ms-blob-condition-appendpos", appendPosition. |
| | 12311 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 12312 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 12313 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 12314 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 12315 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 12316 | | if (sourceIfModifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-modified-since", sourceIf |
| | 12317 | | if (sourceIfUnmodifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-unmodified-since", sour |
| | 12318 | | if (sourceIfMatch != null) { _request.Headers.SetValue("x-ms-source-if-match", sourceIfMatch.Value.ToStr |
| | 12319 | | if (sourceIfNoneMatch != null) { _request.Headers.SetValue("x-ms-source-if-none-match", sourceIfNoneMatc |
| | 12320 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 12321 | |
|
| | 12322 | | return _message; |
| | 12323 | | } |
| | 12324 | |
|
| | 12325 | | /// <summary> |
| | 12326 | | /// Create the AppendBlob.AppendBlockFromUriAsync response or throw a failure exception. |
| | 12327 | | /// </summary> |
| | 12328 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 12329 | | /// <param name="response">The raw Response.</param> |
| | 12330 | | /// <returns>The AppendBlob.AppendBlockFromUriAsync Azure.Response{Azure.Storage.Blobs.Models.BlobAppendInfo |
| | 12331 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobAppendInfo> AppendBlockFromUriAsync_CreateResp |
| | 12332 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 12333 | | Azure.Response response) |
| | 12334 | | { |
| | 12335 | | // Process the response |
| | 12336 | | switch (response.Status) |
| | 12337 | | { |
| | 12338 | | case 201: |
| | 12339 | | { |
| | 12340 | | // Create the result |
| | 12341 | | Azure.Storage.Blobs.Models.BlobAppendInfo _value = new Azure.Storage.Blobs.Models.BlobAppendInfo |
| | 12342 | |
|
| | 12343 | | // Get response headers |
| | 12344 | | string _header; |
| | 12345 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 12346 | | { |
| | 12347 | | _value.ETag = new Azure.ETag(_header); |
| | 12348 | | } |
| | 12349 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 12350 | | { |
| | 12351 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 12352 | | } |
| | 12353 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 12354 | | { |
| | 12355 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 12356 | | } |
| | 12357 | | if (response.Headers.TryGetValue("x-ms-content-crc64", out _header)) |
| | 12358 | | { |
| | 12359 | | _value.ContentCrc64 = System.Convert.FromBase64String(_header); |
| | 12360 | | } |
| | 12361 | | if (response.Headers.TryGetValue("x-ms-blob-append-offset", out _header)) |
| | 12362 | | { |
| | 12363 | | _value.BlobAppendOffset = _header; |
| | 12364 | | } |
| | 12365 | | if (response.Headers.TryGetValue("x-ms-blob-committed-block-count", out _header)) |
| | 12366 | | { |
| | 12367 | | _value.BlobCommittedBlockCount = int.Parse(_header, System.Globalization.CultureInfo.Invaria |
| | 12368 | | } |
| | 12369 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 12370 | | { |
| | 12371 | | _value.EncryptionKeySha256 = _header; |
| | 12372 | | } |
| | 12373 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 12374 | | { |
| | 12375 | | _value.EncryptionScope = _header; |
| | 12376 | | } |
| | 12377 | | if (response.Headers.TryGetValue("x-ms-request-server-encrypted", out _header)) |
| | 12378 | | { |
| | 12379 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 12380 | | } |
| | 12381 | |
|
| | 12382 | | // Create the response |
| | 12383 | | return Response.FromValue(_value, response); |
| | 12384 | | } |
| | 12385 | | case 304: |
| | 12386 | | { |
| | 12387 | | // Create the result |
| | 12388 | | Azure.Storage.Blobs.Models.ConditionNotMetError _value = new Azure.Storage.Blobs.Models.Conditio |
| | 12389 | |
|
| | 12390 | | // Get response headers |
| | 12391 | | string _header; |
| | 12392 | | if (response.Headers.TryGetValue("x-ms-error-code", out _header)) |
| | 12393 | | { |
| | 12394 | | _value.ErrorCode = _header; |
| | 12395 | | } |
| | 12396 | |
|
| | 12397 | | throw _value.CreateException(clientDiagnostics, response); |
| | 12398 | | } |
| | 12399 | | default: |
| | 12400 | | { |
| | 12401 | | // Create the result |
| | 12402 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 12403 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 12404 | |
|
| | 12405 | | throw _value.CreateException(clientDiagnostics, response); |
| | 12406 | | } |
| | 12407 | | } |
| | 12408 | | } |
| | 12409 | | #endregion AppendBlob.AppendBlockFromUriAsync |
| | 12410 | |
|
| | 12411 | | #region AppendBlob.SealAsync |
| | 12412 | | /// <summary> |
| | 12413 | | /// The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12 |
| | 12414 | | /// </summary> |
| | 12415 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 12416 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 12417 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 12418 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 12419 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 12420 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 12421 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 12422 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 12423 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 12424 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 12425 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 12426 | | /// <param name="appendPosition">Optional conditional header, used only for the Append Block operation. A nu |
| | 12427 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 12428 | | /// <param name="operationName">Operation name.</param> |
| | 12429 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 12430 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.AppendBlobSealInternal}</returns> |
| | 12431 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.AppendBlobSea |
| | 12432 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 12433 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 12434 | | System.Uri resourceUri, |
| | 12435 | | string version, |
| | 12436 | | int? timeout = default, |
| | 12437 | | string requestId = default, |
| | 12438 | | string leaseId = default, |
| | 12439 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 12440 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 12441 | | Azure.ETag? ifMatch = default, |
| | 12442 | | Azure.ETag? ifNoneMatch = default, |
| | 12443 | | long? appendPosition = default, |
| | 12444 | | bool async = true, |
| | 12445 | | string operationName = "AppendBlobClient.Seal", |
| | 12446 | | System.Threading.CancellationToken cancellationToken = default) |
| | 12447 | | { |
| | 12448 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 12449 | | try |
| | 12450 | | { |
| | 12451 | | _scope.AddAttribute("url", resourceUri); |
| | 12452 | | _scope.Start(); |
| | 12453 | | using (Azure.Core.HttpMessage _message = SealAsync_CreateMessage( |
| | 12454 | | pipeline, |
| | 12455 | | resourceUri, |
| | 12456 | | version, |
| | 12457 | | timeout, |
| | 12458 | | requestId, |
| | 12459 | | leaseId, |
| | 12460 | | ifModifiedSince, |
| | 12461 | | ifUnmodifiedSince, |
| | 12462 | | ifMatch, |
| | 12463 | | ifNoneMatch, |
| | 12464 | | appendPosition)) |
| | 12465 | | { |
| | 12466 | | if (async) |
| | 12467 | | { |
| | 12468 | | // Send the request asynchronously if we're being called via an async path |
| | 12469 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 12470 | | } |
| | 12471 | | else |
| | 12472 | | { |
| | 12473 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 12474 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 12475 | | pipeline.Send(_message, cancellationToken); |
| | 12476 | | } |
| | 12477 | | Azure.Response _response = _message.Response; |
| | 12478 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 12479 | | return SealAsync_CreateResponse(clientDiagnostics, _response); |
| | 12480 | | } |
| | 12481 | | } |
| | 12482 | | catch (System.Exception ex) |
| | 12483 | | { |
| | 12484 | | _scope.Failed(ex); |
| | 12485 | | throw; |
| | 12486 | | } |
| | 12487 | | finally |
| | 12488 | | { |
| | 12489 | | _scope.Dispose(); |
| | 12490 | | } |
| | 12491 | | } |
| | 12492 | |
|
| | 12493 | | /// <summary> |
| | 12494 | | /// Create the AppendBlob.SealAsync request. |
| | 12495 | | /// </summary> |
| | 12496 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 12497 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 12498 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 12499 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 12500 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 12501 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 12502 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 12503 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 12504 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 12505 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 12506 | | /// <param name="appendPosition">Optional conditional header, used only for the Append Block operation. A nu |
| | 12507 | | /// <returns>The AppendBlob.SealAsync Message.</returns> |
| | 12508 | | internal static Azure.Core.HttpMessage SealAsync_CreateMessage( |
| | 12509 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 12510 | | System.Uri resourceUri, |
| | 12511 | | string version, |
| | 12512 | | int? timeout = default, |
| | 12513 | | string requestId = default, |
| | 12514 | | string leaseId = default, |
| | 12515 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 12516 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 12517 | | Azure.ETag? ifMatch = default, |
| | 12518 | | Azure.ETag? ifNoneMatch = default, |
| | 12519 | | long? appendPosition = default) |
| | 12520 | | { |
| | 12521 | | // Validation |
| | 12522 | | if (resourceUri == null) |
| | 12523 | | { |
| | 12524 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 12525 | | } |
| | 12526 | | if (version == null) |
| | 12527 | | { |
| | 12528 | | throw new System.ArgumentNullException(nameof(version)); |
| | 12529 | | } |
| | 12530 | |
|
| | 12531 | | // Create the request |
| | 12532 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 12533 | | Azure.Core.Request _request = _message.Request; |
| | 12534 | |
|
| | 12535 | | // Set the endpoint |
| | 12536 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 12537 | | _request.Uri.Reset(resourceUri); |
| | 12538 | | _request.Uri.AppendQuery("comp", "seal", escapeValue: false); |
| | 12539 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 12540 | |
|
| | 12541 | | // Add request headers |
| | 12542 | | _request.Headers.SetValue("x-ms-version", version); |
| | 12543 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 12544 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 12545 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 12546 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 12547 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 12548 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 12549 | | if (appendPosition != null) { _request.Headers.SetValue("x-ms-blob-condition-appendpos", appendPosition. |
| | 12550 | |
|
| | 12551 | | return _message; |
| | 12552 | | } |
| | 12553 | |
|
| | 12554 | | /// <summary> |
| | 12555 | | /// Create the AppendBlob.SealAsync response or throw a failure exception. |
| | 12556 | | /// </summary> |
| | 12557 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 12558 | | /// <param name="response">The raw Response.</param> |
| | 12559 | | /// <returns>The AppendBlob.SealAsync Azure.Response{Azure.Storage.Blobs.Models.AppendBlobSealInternal}.</re |
| | 12560 | | internal static Azure.Response<Azure.Storage.Blobs.Models.AppendBlobSealInternal> SealAsync_CreateResponse( |
| | 12561 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 12562 | | Azure.Response response) |
| | 12563 | | { |
| | 12564 | | // Process the response |
| | 12565 | | switch (response.Status) |
| | 12566 | | { |
| | 12567 | | case 200: |
| | 12568 | | { |
| | 12569 | | // Create the result |
| | 12570 | | Azure.Storage.Blobs.Models.AppendBlobSealInternal _value = new Azure.Storage.Blobs.Models.Append |
| | 12571 | |
|
| | 12572 | | // Get response headers |
| | 12573 | | string _header; |
| | 12574 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 12575 | | { |
| | 12576 | | _value.ETag = new Azure.ETag(_header); |
| | 12577 | | } |
| | 12578 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 12579 | | { |
| | 12580 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 12581 | | } |
| | 12582 | | if (response.Headers.TryGetValue("x-ms-blob-sealed", out _header)) |
| | 12583 | | { |
| | 12584 | | _value.IsSealed = bool.Parse(_header); |
| | 12585 | | } |
| | 12586 | |
|
| | 12587 | | // Create the response |
| | 12588 | | return Response.FromValue(_value, response); |
| | 12589 | | } |
| | 12590 | | default: |
| | 12591 | | { |
| | 12592 | | // Create the result |
| | 12593 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 12594 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 12595 | |
|
| | 12596 | | throw _value.CreateException(clientDiagnostics, response); |
| | 12597 | | } |
| | 12598 | | } |
| | 12599 | | } |
| | 12600 | | #endregion AppendBlob.SealAsync |
| | 12601 | | } |
| | 12602 | | #endregion AppendBlob operations |
| | 12603 | |
|
| | 12604 | | #region BlockBlob operations |
| | 12605 | | /// <summary> |
| | 12606 | | /// BlockBlob operations for Azure Blob Storage |
| | 12607 | | /// </summary> |
| | 12608 | | public static partial class BlockBlob |
| | 12609 | | { |
| | 12610 | | #region BlockBlob.UploadAsync |
| | 12611 | | /// <summary> |
| | 12612 | | /// The Upload Block Blob operation updates the content of an existing block blob. Updating an existing bloc |
| | 12613 | | /// </summary> |
| | 12614 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 12615 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 12616 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 12617 | | /// <param name="body">Initial data</param> |
| | 12618 | | /// <param name="contentLength">The length of the request.</param> |
| | 12619 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 12620 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 12621 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 12622 | | /// <param name="blobContentType">Optional. Sets the blob's content type. If specified, this property is sto |
| | 12623 | | /// <param name="blobContentEncoding">Optional. Sets the blob's content encoding. If specified, this propert |
| | 12624 | | /// <param name="blobContentLanguage">Optional. Set the blob's content language. If specified, this property |
| | 12625 | | /// <param name="blobContentHash">Optional. An MD5 hash of the blob content. Note that this hash is not vali |
| | 12626 | | /// <param name="blobCacheControl">Optional. Sets the blob's cache control. If specified, this property is s |
| | 12627 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 12628 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 12629 | | /// <param name="blobContentDisposition">Optional. Sets the blob's Content-Disposition header.</param> |
| | 12630 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 12631 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 12632 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 12633 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 12634 | | /// <param name="tier">Optional. Indicates the tier to be set on the blob.</param> |
| | 12635 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 12636 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 12637 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 12638 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 12639 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 12640 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 12641 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 12642 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 12643 | | /// <param name="operationName">Operation name.</param> |
| | 12644 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 12645 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobContentInfo}</returns> |
| | 12646 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobContentIn |
| | 12647 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 12648 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 12649 | | System.Uri resourceUri, |
| | 12650 | | System.IO.Stream body, |
| | 12651 | | long contentLength, |
| | 12652 | | string version, |
| | 12653 | | int? timeout = default, |
| | 12654 | | byte[] transactionalContentHash = default, |
| | 12655 | | string blobContentType = default, |
| | 12656 | | string blobContentEncoding = default, |
| | 12657 | | string blobContentLanguage = default, |
| | 12658 | | byte[] blobContentHash = default, |
| | 12659 | | string blobCacheControl = default, |
| | 12660 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 12661 | | string leaseId = default, |
| | 12662 | | string blobContentDisposition = default, |
| | 12663 | | string encryptionKey = default, |
| | 12664 | | string encryptionKeySha256 = default, |
| | 12665 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 12666 | | string encryptionScope = default, |
| | 12667 | | Azure.Storage.Blobs.Models.AccessTier? tier = default, |
| | 12668 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 12669 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 12670 | | Azure.ETag? ifMatch = default, |
| | 12671 | | Azure.ETag? ifNoneMatch = default, |
| | 12672 | | string ifTags = default, |
| | 12673 | | string requestId = default, |
| | 12674 | | string blobTagsString = default, |
| | 12675 | | bool async = true, |
| | 12676 | | string operationName = "BlockBlobClient.Upload", |
| | 12677 | | System.Threading.CancellationToken cancellationToken = default) |
| | 12678 | | { |
| | 12679 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 12680 | | try |
| | 12681 | | { |
| | 12682 | | _scope.AddAttribute("url", resourceUri); |
| | 12683 | | _scope.Start(); |
| | 12684 | | using (Azure.Core.HttpMessage _message = UploadAsync_CreateMessage( |
| | 12685 | | pipeline, |
| | 12686 | | resourceUri, |
| | 12687 | | body, |
| | 12688 | | contentLength, |
| | 12689 | | version, |
| | 12690 | | timeout, |
| | 12691 | | transactionalContentHash, |
| | 12692 | | blobContentType, |
| | 12693 | | blobContentEncoding, |
| | 12694 | | blobContentLanguage, |
| | 12695 | | blobContentHash, |
| | 12696 | | blobCacheControl, |
| | 12697 | | metadata, |
| | 12698 | | leaseId, |
| | 12699 | | blobContentDisposition, |
| | 12700 | | encryptionKey, |
| | 12701 | | encryptionKeySha256, |
| | 12702 | | encryptionAlgorithm, |
| | 12703 | | encryptionScope, |
| | 12704 | | tier, |
| | 12705 | | ifModifiedSince, |
| | 12706 | | ifUnmodifiedSince, |
| | 12707 | | ifMatch, |
| | 12708 | | ifNoneMatch, |
| | 12709 | | ifTags, |
| | 12710 | | requestId, |
| | 12711 | | blobTagsString)) |
| | 12712 | | { |
| | 12713 | | if (async) |
| | 12714 | | { |
| | 12715 | | // Send the request asynchronously if we're being called via an async path |
| | 12716 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 12717 | | } |
| | 12718 | | else |
| | 12719 | | { |
| | 12720 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 12721 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 12722 | | pipeline.Send(_message, cancellationToken); |
| | 12723 | | } |
| | 12724 | | Azure.Response _response = _message.Response; |
| | 12725 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 12726 | | return UploadAsync_CreateResponse(clientDiagnostics, _response); |
| | 12727 | | } |
| | 12728 | | } |
| | 12729 | | catch (System.Exception ex) |
| | 12730 | | { |
| | 12731 | | _scope.Failed(ex); |
| | 12732 | | throw; |
| | 12733 | | } |
| | 12734 | | finally |
| | 12735 | | { |
| | 12736 | | _scope.Dispose(); |
| | 12737 | | } |
| | 12738 | | } |
| | 12739 | |
|
| | 12740 | | /// <summary> |
| | 12741 | | /// Create the BlockBlob.UploadAsync request. |
| | 12742 | | /// </summary> |
| | 12743 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 12744 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 12745 | | /// <param name="body">Initial data</param> |
| | 12746 | | /// <param name="contentLength">The length of the request.</param> |
| | 12747 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 12748 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 12749 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 12750 | | /// <param name="blobContentType">Optional. Sets the blob's content type. If specified, this property is sto |
| | 12751 | | /// <param name="blobContentEncoding">Optional. Sets the blob's content encoding. If specified, this propert |
| | 12752 | | /// <param name="blobContentLanguage">Optional. Set the blob's content language. If specified, this property |
| | 12753 | | /// <param name="blobContentHash">Optional. An MD5 hash of the blob content. Note that this hash is not vali |
| | 12754 | | /// <param name="blobCacheControl">Optional. Sets the blob's cache control. If specified, this property is s |
| | 12755 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 12756 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 12757 | | /// <param name="blobContentDisposition">Optional. Sets the blob's Content-Disposition header.</param> |
| | 12758 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 12759 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 12760 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 12761 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 12762 | | /// <param name="tier">Optional. Indicates the tier to be set on the blob.</param> |
| | 12763 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 12764 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 12765 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 12766 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 12767 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 12768 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 12769 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 12770 | | /// <returns>The BlockBlob.UploadAsync Message.</returns> |
| | 12771 | | internal static Azure.Core.HttpMessage UploadAsync_CreateMessage( |
| | 12772 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 12773 | | System.Uri resourceUri, |
| | 12774 | | System.IO.Stream body, |
| | 12775 | | long contentLength, |
| | 12776 | | string version, |
| | 12777 | | int? timeout = default, |
| | 12778 | | byte[] transactionalContentHash = default, |
| | 12779 | | string blobContentType = default, |
| | 12780 | | string blobContentEncoding = default, |
| | 12781 | | string blobContentLanguage = default, |
| | 12782 | | byte[] blobContentHash = default, |
| | 12783 | | string blobCacheControl = default, |
| | 12784 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 12785 | | string leaseId = default, |
| | 12786 | | string blobContentDisposition = default, |
| | 12787 | | string encryptionKey = default, |
| | 12788 | | string encryptionKeySha256 = default, |
| | 12789 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 12790 | | string encryptionScope = default, |
| | 12791 | | Azure.Storage.Blobs.Models.AccessTier? tier = default, |
| | 12792 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 12793 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 12794 | | Azure.ETag? ifMatch = default, |
| | 12795 | | Azure.ETag? ifNoneMatch = default, |
| | 12796 | | string ifTags = default, |
| | 12797 | | string requestId = default, |
| | 12798 | | string blobTagsString = default) |
| | 12799 | | { |
| | 12800 | | // Validation |
| | 12801 | | if (resourceUri == null) |
| | 12802 | | { |
| | 12803 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 12804 | | } |
| | 12805 | | if (body == null) |
| | 12806 | | { |
| | 12807 | | throw new System.ArgumentNullException(nameof(body)); |
| | 12808 | | } |
| | 12809 | | if (version == null) |
| | 12810 | | { |
| | 12811 | | throw new System.ArgumentNullException(nameof(version)); |
| | 12812 | | } |
| | 12813 | |
|
| | 12814 | | // Create the request |
| | 12815 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 12816 | | Azure.Core.Request _request = _message.Request; |
| | 12817 | |
|
| | 12818 | | // Set the endpoint |
| | 12819 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 12820 | | _request.Uri.Reset(resourceUri); |
| | 12821 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 12822 | |
|
| | 12823 | | // Add request headers |
| | 12824 | | _request.Headers.SetValue("x-ms-blob-type", "BlockBlob"); |
| | 12825 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 12826 | | _request.Headers.SetValue("x-ms-version", version); |
| | 12827 | | if (transactionalContentHash != null) { _request.Headers.SetValue("Content-MD5", System.Convert.ToBase64 |
| | 12828 | | if (blobContentType != null) { _request.Headers.SetValue("x-ms-blob-content-type", blobContentType); } |
| | 12829 | | if (blobContentEncoding != null) { _request.Headers.SetValue("x-ms-blob-content-encoding", blobContentEn |
| | 12830 | | if (blobContentLanguage != null) { _request.Headers.SetValue("x-ms-blob-content-language", blobContentLa |
| | 12831 | | if (blobContentHash != null) { _request.Headers.SetValue("x-ms-blob-content-md5", System.Convert.ToBase6 |
| | 12832 | | if (blobCacheControl != null) { _request.Headers.SetValue("x-ms-blob-cache-control", blobCacheControl); |
| | 12833 | | if (metadata != null) { |
| | 12834 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 12835 | | { |
| | 12836 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 12837 | | } |
| | 12838 | | } |
| | 12839 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 12840 | | if (blobContentDisposition != null) { _request.Headers.SetValue("x-ms-blob-content-disposition", blobCon |
| | 12841 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 12842 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 12843 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 12844 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 12845 | | if (tier != null) { _request.Headers.SetValue("x-ms-access-tier", tier.ToString()); } |
| | 12846 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 12847 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 12848 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 12849 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 12850 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 12851 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 12852 | | if (blobTagsString != null) { _request.Headers.SetValue("x-ms-tags", blobTagsString); } |
| | 12853 | |
|
| | 12854 | | // Create the body |
| | 12855 | | _request.Content = Azure.Core.RequestContent.Create(body); |
| | 12856 | |
|
| | 12857 | | return _message; |
| | 12858 | | } |
| | 12859 | |
|
| | 12860 | | /// <summary> |
| | 12861 | | /// Create the BlockBlob.UploadAsync response or throw a failure exception. |
| | 12862 | | /// </summary> |
| | 12863 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 12864 | | /// <param name="response">The raw Response.</param> |
| | 12865 | | /// <returns>The BlockBlob.UploadAsync Azure.Response{Azure.Storage.Blobs.Models.BlobContentInfo}.</returns> |
| | 12866 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> UploadAsync_CreateResponse( |
| | 12867 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 12868 | | Azure.Response response) |
| | 12869 | | { |
| | 12870 | | // Process the response |
| | 12871 | | switch (response.Status) |
| | 12872 | | { |
| | 12873 | | case 201: |
| | 12874 | | { |
| | 12875 | | // Create the result |
| | 12876 | | Azure.Storage.Blobs.Models.BlobContentInfo _value = new Azure.Storage.Blobs.Models.BlobContentIn |
| | 12877 | |
|
| | 12878 | | // Get response headers |
| | 12879 | | string _header; |
| | 12880 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 12881 | | { |
| | 12882 | | _value.ETag = new Azure.ETag(_header); |
| | 12883 | | } |
| | 12884 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 12885 | | { |
| | 12886 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 12887 | | } |
| | 12888 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 12889 | | { |
| | 12890 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 12891 | | } |
| | 12892 | | if (response.Headers.TryGetValue("x-ms-version-id", out _header)) |
| | 12893 | | { |
| | 12894 | | _value.VersionId = _header; |
| | 12895 | | } |
| | 12896 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 12897 | | { |
| | 12898 | | _value.EncryptionKeySha256 = _header; |
| | 12899 | | } |
| | 12900 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 12901 | | { |
| | 12902 | | _value.EncryptionScope = _header; |
| | 12903 | | } |
| | 12904 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 12905 | | { |
| | 12906 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 12907 | | } |
| | 12908 | |
|
| | 12909 | | // Create the response |
| | 12910 | | return Response.FromValue(_value, response); |
| | 12911 | | } |
| | 12912 | | default: |
| | 12913 | | { |
| | 12914 | | // Create the result |
| | 12915 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 12916 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 12917 | |
|
| | 12918 | | throw _value.CreateException(clientDiagnostics, response); |
| | 12919 | | } |
| | 12920 | | } |
| | 12921 | | } |
| | 12922 | | #endregion BlockBlob.UploadAsync |
| | 12923 | |
|
| | 12924 | | #region BlockBlob.StageBlockAsync |
| | 12925 | | /// <summary> |
| | 12926 | | /// The Stage Block operation creates a new block to be committed as part of a blob |
| | 12927 | | /// </summary> |
| | 12928 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 12929 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 12930 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 12931 | | /// <param name="blockId">A valid Base64 string value that identifies the block. Prior to encoding, the stri |
| | 12932 | | /// <param name="contentLength">The length of the request.</param> |
| | 12933 | | /// <param name="body">Initial data</param> |
| | 12934 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 12935 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 12936 | | /// <param name="transactionalContentCrc64">Specify the transactional crc64 for the body, to be validated by |
| | 12937 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 12938 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 12939 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 12940 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 12941 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 12942 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 12943 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 12944 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 12945 | | /// <param name="operationName">Operation name.</param> |
| | 12946 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 12947 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlockInfo}</returns> |
| | 12948 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlockInfo>> S |
| | 12949 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 12950 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 12951 | | System.Uri resourceUri, |
| | 12952 | | string blockId, |
| | 12953 | | long contentLength, |
| | 12954 | | System.IO.Stream body, |
| | 12955 | | string version, |
| | 12956 | | byte[] transactionalContentHash = default, |
| | 12957 | | byte[] transactionalContentCrc64 = default, |
| | 12958 | | int? timeout = default, |
| | 12959 | | string leaseId = default, |
| | 12960 | | string encryptionKey = default, |
| | 12961 | | string encryptionKeySha256 = default, |
| | 12962 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 12963 | | string encryptionScope = default, |
| | 12964 | | string requestId = default, |
| | 12965 | | bool async = true, |
| | 12966 | | string operationName = "BlockBlobClient.StageBlock", |
| | 12967 | | System.Threading.CancellationToken cancellationToken = default) |
| | 12968 | | { |
| | 12969 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 12970 | | try |
| | 12971 | | { |
| | 12972 | | _scope.AddAttribute("url", resourceUri); |
| | 12973 | | _scope.Start(); |
| | 12974 | | using (Azure.Core.HttpMessage _message = StageBlockAsync_CreateMessage( |
| | 12975 | | pipeline, |
| | 12976 | | resourceUri, |
| | 12977 | | blockId, |
| | 12978 | | contentLength, |
| | 12979 | | body, |
| | 12980 | | version, |
| | 12981 | | transactionalContentHash, |
| | 12982 | | transactionalContentCrc64, |
| | 12983 | | timeout, |
| | 12984 | | leaseId, |
| | 12985 | | encryptionKey, |
| | 12986 | | encryptionKeySha256, |
| | 12987 | | encryptionAlgorithm, |
| | 12988 | | encryptionScope, |
| | 12989 | | requestId)) |
| | 12990 | | { |
| | 12991 | | if (async) |
| | 12992 | | { |
| | 12993 | | // Send the request asynchronously if we're being called via an async path |
| | 12994 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 12995 | | } |
| | 12996 | | else |
| | 12997 | | { |
| | 12998 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 12999 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 13000 | | pipeline.Send(_message, cancellationToken); |
| | 13001 | | } |
| | 13002 | | Azure.Response _response = _message.Response; |
| | 13003 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 13004 | | return StageBlockAsync_CreateResponse(clientDiagnostics, _response); |
| | 13005 | | } |
| | 13006 | | } |
| | 13007 | | catch (System.Exception ex) |
| | 13008 | | { |
| | 13009 | | _scope.Failed(ex); |
| | 13010 | | throw; |
| | 13011 | | } |
| | 13012 | | finally |
| | 13013 | | { |
| | 13014 | | _scope.Dispose(); |
| | 13015 | | } |
| | 13016 | | } |
| | 13017 | |
|
| | 13018 | | /// <summary> |
| | 13019 | | /// Create the BlockBlob.StageBlockAsync request. |
| | 13020 | | /// </summary> |
| | 13021 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 13022 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 13023 | | /// <param name="blockId">A valid Base64 string value that identifies the block. Prior to encoding, the stri |
| | 13024 | | /// <param name="contentLength">The length of the request.</param> |
| | 13025 | | /// <param name="body">Initial data</param> |
| | 13026 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 13027 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 13028 | | /// <param name="transactionalContentCrc64">Specify the transactional crc64 for the body, to be validated by |
| | 13029 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 13030 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 13031 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 13032 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 13033 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 13034 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 13035 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 13036 | | /// <returns>The BlockBlob.StageBlockAsync Message.</returns> |
| | 13037 | | internal static Azure.Core.HttpMessage StageBlockAsync_CreateMessage( |
| | 13038 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 13039 | | System.Uri resourceUri, |
| | 13040 | | string blockId, |
| | 13041 | | long contentLength, |
| | 13042 | | System.IO.Stream body, |
| | 13043 | | string version, |
| | 13044 | | byte[] transactionalContentHash = default, |
| | 13045 | | byte[] transactionalContentCrc64 = default, |
| | 13046 | | int? timeout = default, |
| | 13047 | | string leaseId = default, |
| | 13048 | | string encryptionKey = default, |
| | 13049 | | string encryptionKeySha256 = default, |
| | 13050 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 13051 | | string encryptionScope = default, |
| | 13052 | | string requestId = default) |
| | 13053 | | { |
| | 13054 | | // Validation |
| | 13055 | | if (resourceUri == null) |
| | 13056 | | { |
| | 13057 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 13058 | | } |
| | 13059 | | if (blockId == null) |
| | 13060 | | { |
| | 13061 | | throw new System.ArgumentNullException(nameof(blockId)); |
| | 13062 | | } |
| | 13063 | | if (body == null) |
| | 13064 | | { |
| | 13065 | | throw new System.ArgumentNullException(nameof(body)); |
| | 13066 | | } |
| | 13067 | | if (version == null) |
| | 13068 | | { |
| | 13069 | | throw new System.ArgumentNullException(nameof(version)); |
| | 13070 | | } |
| | 13071 | |
|
| | 13072 | | // Create the request |
| | 13073 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 13074 | | Azure.Core.Request _request = _message.Request; |
| | 13075 | |
|
| | 13076 | | // Set the endpoint |
| | 13077 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 13078 | | _request.Uri.Reset(resourceUri); |
| | 13079 | | _request.Uri.AppendQuery("comp", "block", escapeValue: false); |
| | 13080 | | _request.Uri.AppendQuery("blockid", blockId); |
| | 13081 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 13082 | |
|
| | 13083 | | // Add request headers |
| | 13084 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 13085 | | _request.Headers.SetValue("x-ms-version", version); |
| | 13086 | | if (transactionalContentHash != null) { _request.Headers.SetValue("Content-MD5", System.Convert.ToBase64 |
| | 13087 | | if (transactionalContentCrc64 != null) { _request.Headers.SetValue("x-ms-content-crc64", System.Convert. |
| | 13088 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 13089 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 13090 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 13091 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 13092 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 13093 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 13094 | |
|
| | 13095 | | // Create the body |
| | 13096 | | _request.Content = Azure.Core.RequestContent.Create(body); |
| | 13097 | |
|
| | 13098 | | return _message; |
| | 13099 | | } |
| | 13100 | |
|
| | 13101 | | /// <summary> |
| | 13102 | | /// Create the BlockBlob.StageBlockAsync response or throw a failure exception. |
| | 13103 | | /// </summary> |
| | 13104 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 13105 | | /// <param name="response">The raw Response.</param> |
| | 13106 | | /// <returns>The BlockBlob.StageBlockAsync Azure.Response{Azure.Storage.Blobs.Models.BlockInfo}.</returns> |
| | 13107 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlockInfo> StageBlockAsync_CreateResponse( |
| | 13108 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 13109 | | Azure.Response response) |
| | 13110 | | { |
| | 13111 | | // Process the response |
| | 13112 | | switch (response.Status) |
| | 13113 | | { |
| | 13114 | | case 201: |
| | 13115 | | { |
| | 13116 | | // Create the result |
| | 13117 | | Azure.Storage.Blobs.Models.BlockInfo _value = new Azure.Storage.Blobs.Models.BlockInfo(); |
| | 13118 | |
|
| | 13119 | | // Get response headers |
| | 13120 | | string _header; |
| | 13121 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 13122 | | { |
| | 13123 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 13124 | | } |
| | 13125 | | if (response.Headers.TryGetValue("x-ms-content-crc64", out _header)) |
| | 13126 | | { |
| | 13127 | | _value.ContentCrc64 = System.Convert.FromBase64String(_header); |
| | 13128 | | } |
| | 13129 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 13130 | | { |
| | 13131 | | _value.EncryptionKeySha256 = _header; |
| | 13132 | | } |
| | 13133 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 13134 | | { |
| | 13135 | | _value.EncryptionScope = _header; |
| | 13136 | | } |
| | 13137 | |
|
| | 13138 | | // Create the response |
| | 13139 | | return Response.FromValue(_value, response); |
| | 13140 | | } |
| | 13141 | | default: |
| | 13142 | | { |
| | 13143 | | // Create the result |
| | 13144 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 13145 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 13146 | |
|
| | 13147 | | throw _value.CreateException(clientDiagnostics, response); |
| | 13148 | | } |
| | 13149 | | } |
| | 13150 | | } |
| | 13151 | | #endregion BlockBlob.StageBlockAsync |
| | 13152 | |
|
| | 13153 | | #region BlockBlob.StageBlockFromUriAsync |
| | 13154 | | /// <summary> |
| | 13155 | | /// The Stage Block operation creates a new block to be committed as part of a blob where the contents are r |
| | 13156 | | /// </summary> |
| | 13157 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 13158 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 13159 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 13160 | | /// <param name="blockId">A valid Base64 string value that identifies the block. Prior to encoding, the stri |
| | 13161 | | /// <param name="contentLength">The length of the request.</param> |
| | 13162 | | /// <param name="sourceUri">Specify a URL to the copy source.</param> |
| | 13163 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 13164 | | /// <param name="sourceRange">Bytes of source data in the specified range.</param> |
| | 13165 | | /// <param name="sourceContentHash">Specify the md5 calculated for the range of bytes that must be read from |
| | 13166 | | /// <param name="sourceContentcrc64">Specify the crc64 calculated for the range of bytes that must be read f |
| | 13167 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 13168 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 13169 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 13170 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 13171 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 13172 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 13173 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 13174 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 13175 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 13176 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 13177 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 13178 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 13179 | | /// <param name="operationName">Operation name.</param> |
| | 13180 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 13181 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlockInfo}</returns> |
| | 13182 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlockInfo>> S |
| | 13183 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 13184 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 13185 | | System.Uri resourceUri, |
| | 13186 | | string blockId, |
| | 13187 | | long contentLength, |
| | 13188 | | System.Uri sourceUri, |
| | 13189 | | string version, |
| | 13190 | | string sourceRange = default, |
| | 13191 | | byte[] sourceContentHash = default, |
| | 13192 | | byte[] sourceContentcrc64 = default, |
| | 13193 | | int? timeout = default, |
| | 13194 | | string encryptionKey = default, |
| | 13195 | | string encryptionKeySha256 = default, |
| | 13196 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 13197 | | string encryptionScope = default, |
| | 13198 | | string leaseId = default, |
| | 13199 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 13200 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 13201 | | Azure.ETag? sourceIfMatch = default, |
| | 13202 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 13203 | | string requestId = default, |
| | 13204 | | bool async = true, |
| | 13205 | | string operationName = "BlockBlobClient.StageBlockFromUri", |
| | 13206 | | System.Threading.CancellationToken cancellationToken = default) |
| | 13207 | | { |
| | 13208 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 13209 | | try |
| | 13210 | | { |
| | 13211 | | _scope.AddAttribute("url", resourceUri); |
| | 13212 | | _scope.Start(); |
| | 13213 | | using (Azure.Core.HttpMessage _message = StageBlockFromUriAsync_CreateMessage( |
| | 13214 | | pipeline, |
| | 13215 | | resourceUri, |
| | 13216 | | blockId, |
| | 13217 | | contentLength, |
| | 13218 | | sourceUri, |
| | 13219 | | version, |
| | 13220 | | sourceRange, |
| | 13221 | | sourceContentHash, |
| | 13222 | | sourceContentcrc64, |
| | 13223 | | timeout, |
| | 13224 | | encryptionKey, |
| | 13225 | | encryptionKeySha256, |
| | 13226 | | encryptionAlgorithm, |
| | 13227 | | encryptionScope, |
| | 13228 | | leaseId, |
| | 13229 | | sourceIfModifiedSince, |
| | 13230 | | sourceIfUnmodifiedSince, |
| | 13231 | | sourceIfMatch, |
| | 13232 | | sourceIfNoneMatch, |
| | 13233 | | requestId)) |
| | 13234 | | { |
| | 13235 | | if (async) |
| | 13236 | | { |
| | 13237 | | // Send the request asynchronously if we're being called via an async path |
| | 13238 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 13239 | | } |
| | 13240 | | else |
| | 13241 | | { |
| | 13242 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 13243 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 13244 | | pipeline.Send(_message, cancellationToken); |
| | 13245 | | } |
| | 13246 | | Azure.Response _response = _message.Response; |
| | 13247 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 13248 | | return StageBlockFromUriAsync_CreateResponse(clientDiagnostics, _response); |
| | 13249 | | } |
| | 13250 | | } |
| | 13251 | | catch (System.Exception ex) |
| | 13252 | | { |
| | 13253 | | _scope.Failed(ex); |
| | 13254 | | throw; |
| | 13255 | | } |
| | 13256 | | finally |
| | 13257 | | { |
| | 13258 | | _scope.Dispose(); |
| | 13259 | | } |
| | 13260 | | } |
| | 13261 | |
|
| | 13262 | | /// <summary> |
| | 13263 | | /// Create the BlockBlob.StageBlockFromUriAsync request. |
| | 13264 | | /// </summary> |
| | 13265 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 13266 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 13267 | | /// <param name="blockId">A valid Base64 string value that identifies the block. Prior to encoding, the stri |
| | 13268 | | /// <param name="contentLength">The length of the request.</param> |
| | 13269 | | /// <param name="sourceUri">Specify a URL to the copy source.</param> |
| | 13270 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 13271 | | /// <param name="sourceRange">Bytes of source data in the specified range.</param> |
| | 13272 | | /// <param name="sourceContentHash">Specify the md5 calculated for the range of bytes that must be read from |
| | 13273 | | /// <param name="sourceContentcrc64">Specify the crc64 calculated for the range of bytes that must be read f |
| | 13274 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 13275 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 13276 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 13277 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 13278 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 13279 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 13280 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 13281 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 13282 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 13283 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 13284 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 13285 | | /// <returns>The BlockBlob.StageBlockFromUriAsync Message.</returns> |
| | 13286 | | internal static Azure.Core.HttpMessage StageBlockFromUriAsync_CreateMessage( |
| | 13287 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 13288 | | System.Uri resourceUri, |
| | 13289 | | string blockId, |
| | 13290 | | long contentLength, |
| | 13291 | | System.Uri sourceUri, |
| | 13292 | | string version, |
| | 13293 | | string sourceRange = default, |
| | 13294 | | byte[] sourceContentHash = default, |
| | 13295 | | byte[] sourceContentcrc64 = default, |
| | 13296 | | int? timeout = default, |
| | 13297 | | string encryptionKey = default, |
| | 13298 | | string encryptionKeySha256 = default, |
| | 13299 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 13300 | | string encryptionScope = default, |
| | 13301 | | string leaseId = default, |
| | 13302 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 13303 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 13304 | | Azure.ETag? sourceIfMatch = default, |
| | 13305 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 13306 | | string requestId = default) |
| | 13307 | | { |
| | 13308 | | // Validation |
| | 13309 | | if (resourceUri == null) |
| | 13310 | | { |
| | 13311 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 13312 | | } |
| | 13313 | | if (blockId == null) |
| | 13314 | | { |
| | 13315 | | throw new System.ArgumentNullException(nameof(blockId)); |
| | 13316 | | } |
| | 13317 | | if (sourceUri == null) |
| | 13318 | | { |
| | 13319 | | throw new System.ArgumentNullException(nameof(sourceUri)); |
| | 13320 | | } |
| | 13321 | | if (version == null) |
| | 13322 | | { |
| | 13323 | | throw new System.ArgumentNullException(nameof(version)); |
| | 13324 | | } |
| | 13325 | |
|
| | 13326 | | // Create the request |
| | 13327 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 13328 | | Azure.Core.Request _request = _message.Request; |
| | 13329 | |
|
| | 13330 | | // Set the endpoint |
| | 13331 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 13332 | | _request.Uri.Reset(resourceUri); |
| | 13333 | | _request.Uri.AppendQuery("comp", "block", escapeValue: false); |
| | 13334 | | _request.Uri.AppendQuery("blockid", blockId); |
| | 13335 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 13336 | |
|
| | 13337 | | // Add request headers |
| | 13338 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 13339 | | _request.Headers.SetValue("x-ms-copy-source", sourceUri.AbsoluteUri); |
| | 13340 | | _request.Headers.SetValue("x-ms-version", version); |
| | 13341 | | if (sourceRange != null) { _request.Headers.SetValue("x-ms-source-range", sourceRange); } |
| | 13342 | | if (sourceContentHash != null) { _request.Headers.SetValue("x-ms-source-content-md5", System.Convert.ToB |
| | 13343 | | if (sourceContentcrc64 != null) { _request.Headers.SetValue("x-ms-source-content-crc64", System.Convert. |
| | 13344 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 13345 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 13346 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 13347 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 13348 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 13349 | | if (sourceIfModifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-modified-since", sourceIf |
| | 13350 | | if (sourceIfUnmodifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-unmodified-since", sour |
| | 13351 | | if (sourceIfMatch != null) { _request.Headers.SetValue("x-ms-source-if-match", sourceIfMatch.Value.ToStr |
| | 13352 | | if (sourceIfNoneMatch != null) { _request.Headers.SetValue("x-ms-source-if-none-match", sourceIfNoneMatc |
| | 13353 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 13354 | |
|
| | 13355 | | return _message; |
| | 13356 | | } |
| | 13357 | |
|
| | 13358 | | /// <summary> |
| | 13359 | | /// Create the BlockBlob.StageBlockFromUriAsync response or throw a failure exception. |
| | 13360 | | /// </summary> |
| | 13361 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 13362 | | /// <param name="response">The raw Response.</param> |
| | 13363 | | /// <returns>The BlockBlob.StageBlockFromUriAsync Azure.Response{Azure.Storage.Blobs.Models.BlockInfo}.</ret |
| | 13364 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlockInfo> StageBlockFromUriAsync_CreateResponse( |
| | 13365 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 13366 | | Azure.Response response) |
| | 13367 | | { |
| | 13368 | | // Process the response |
| | 13369 | | switch (response.Status) |
| | 13370 | | { |
| | 13371 | | case 201: |
| | 13372 | | { |
| | 13373 | | // Create the result |
| | 13374 | | Azure.Storage.Blobs.Models.BlockInfo _value = new Azure.Storage.Blobs.Models.BlockInfo(); |
| | 13375 | |
|
| | 13376 | | // Get response headers |
| | 13377 | | string _header; |
| | 13378 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 13379 | | { |
| | 13380 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 13381 | | } |
| | 13382 | | if (response.Headers.TryGetValue("x-ms-content-crc64", out _header)) |
| | 13383 | | { |
| | 13384 | | _value.ContentCrc64 = System.Convert.FromBase64String(_header); |
| | 13385 | | } |
| | 13386 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 13387 | | { |
| | 13388 | | _value.EncryptionKeySha256 = _header; |
| | 13389 | | } |
| | 13390 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 13391 | | { |
| | 13392 | | _value.EncryptionScope = _header; |
| | 13393 | | } |
| | 13394 | |
|
| | 13395 | | // Create the response |
| | 13396 | | return Response.FromValue(_value, response); |
| | 13397 | | } |
| | 13398 | | case 304: |
| | 13399 | | { |
| | 13400 | | // Create the result |
| | 13401 | | Azure.Storage.Blobs.Models.ConditionNotMetError _value = new Azure.Storage.Blobs.Models.Conditio |
| | 13402 | |
|
| | 13403 | | // Get response headers |
| | 13404 | | string _header; |
| | 13405 | | if (response.Headers.TryGetValue("x-ms-error-code", out _header)) |
| | 13406 | | { |
| | 13407 | | _value.ErrorCode = _header; |
| | 13408 | | } |
| | 13409 | |
|
| | 13410 | | throw _value.CreateException(clientDiagnostics, response); |
| | 13411 | | } |
| | 13412 | | default: |
| | 13413 | | { |
| | 13414 | | // Create the result |
| | 13415 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 13416 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 13417 | |
|
| | 13418 | | throw _value.CreateException(clientDiagnostics, response); |
| | 13419 | | } |
| | 13420 | | } |
| | 13421 | | } |
| | 13422 | | #endregion BlockBlob.StageBlockFromUriAsync |
| | 13423 | |
|
| | 13424 | | #region BlockBlob.CommitBlockListAsync |
| | 13425 | | /// <summary> |
| | 13426 | | /// The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. |
| | 13427 | | /// </summary> |
| | 13428 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 13429 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 13430 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 13431 | | /// <param name="blocks">A list of block IDs split between the committed block list, in the uncommitted bloc |
| | 13432 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 13433 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 13434 | | /// <param name="blobCacheControl">Optional. Sets the blob's cache control. If specified, this property is s |
| | 13435 | | /// <param name="blobContentType">Optional. Sets the blob's content type. If specified, this property is sto |
| | 13436 | | /// <param name="blobContentEncoding">Optional. Sets the blob's content encoding. If specified, this propert |
| | 13437 | | /// <param name="blobContentLanguage">Optional. Set the blob's content language. If specified, this property |
| | 13438 | | /// <param name="blobContentHash">Optional. An MD5 hash of the blob content. Note that this hash is not vali |
| | 13439 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 13440 | | /// <param name="transactionalContentCrc64">Specify the transactional crc64 for the body, to be validated by |
| | 13441 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 13442 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 13443 | | /// <param name="blobContentDisposition">Optional. Sets the blob's Content-Disposition header.</param> |
| | 13444 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 13445 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 13446 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 13447 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 13448 | | /// <param name="tier">Optional. Indicates the tier to be set on the blob.</param> |
| | 13449 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 13450 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 13451 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 13452 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 13453 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 13454 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 13455 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 13456 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 13457 | | /// <param name="operationName">Operation name.</param> |
| | 13458 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 13459 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.BlobContentInfo}</returns> |
| | 13460 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.BlobContentIn |
| | 13461 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 13462 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 13463 | | System.Uri resourceUri, |
| | 13464 | | Azure.Storage.Blobs.Models.BlockLookupList blocks, |
| | 13465 | | string version, |
| | 13466 | | int? timeout = default, |
| | 13467 | | string blobCacheControl = default, |
| | 13468 | | string blobContentType = default, |
| | 13469 | | string blobContentEncoding = default, |
| | 13470 | | string blobContentLanguage = default, |
| | 13471 | | byte[] blobContentHash = default, |
| | 13472 | | byte[] transactionalContentHash = default, |
| | 13473 | | byte[] transactionalContentCrc64 = default, |
| | 13474 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 13475 | | string leaseId = default, |
| | 13476 | | string blobContentDisposition = default, |
| | 13477 | | string encryptionKey = default, |
| | 13478 | | string encryptionKeySha256 = default, |
| | 13479 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 13480 | | string encryptionScope = default, |
| | 13481 | | Azure.Storage.Blobs.Models.AccessTier? tier = default, |
| | 13482 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 13483 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 13484 | | Azure.ETag? ifMatch = default, |
| | 13485 | | Azure.ETag? ifNoneMatch = default, |
| | 13486 | | string ifTags = default, |
| | 13487 | | string requestId = default, |
| | 13488 | | string blobTagsString = default, |
| | 13489 | | bool async = true, |
| | 13490 | | string operationName = "BlockBlobClient.CommitBlockList", |
| | 13491 | | System.Threading.CancellationToken cancellationToken = default) |
| | 13492 | | { |
| | 13493 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 13494 | | try |
| | 13495 | | { |
| | 13496 | | _scope.AddAttribute("url", resourceUri); |
| | 13497 | | _scope.Start(); |
| | 13498 | | using (Azure.Core.HttpMessage _message = CommitBlockListAsync_CreateMessage( |
| | 13499 | | pipeline, |
| | 13500 | | resourceUri, |
| | 13501 | | blocks, |
| | 13502 | | version, |
| | 13503 | | timeout, |
| | 13504 | | blobCacheControl, |
| | 13505 | | blobContentType, |
| | 13506 | | blobContentEncoding, |
| | 13507 | | blobContentLanguage, |
| | 13508 | | blobContentHash, |
| | 13509 | | transactionalContentHash, |
| | 13510 | | transactionalContentCrc64, |
| | 13511 | | metadata, |
| | 13512 | | leaseId, |
| | 13513 | | blobContentDisposition, |
| | 13514 | | encryptionKey, |
| | 13515 | | encryptionKeySha256, |
| | 13516 | | encryptionAlgorithm, |
| | 13517 | | encryptionScope, |
| | 13518 | | tier, |
| | 13519 | | ifModifiedSince, |
| | 13520 | | ifUnmodifiedSince, |
| | 13521 | | ifMatch, |
| | 13522 | | ifNoneMatch, |
| | 13523 | | ifTags, |
| | 13524 | | requestId, |
| | 13525 | | blobTagsString)) |
| | 13526 | | { |
| | 13527 | | if (async) |
| | 13528 | | { |
| | 13529 | | // Send the request asynchronously if we're being called via an async path |
| | 13530 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 13531 | | } |
| | 13532 | | else |
| | 13533 | | { |
| | 13534 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 13535 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 13536 | | pipeline.Send(_message, cancellationToken); |
| | 13537 | | } |
| | 13538 | | Azure.Response _response = _message.Response; |
| | 13539 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 13540 | | return CommitBlockListAsync_CreateResponse(clientDiagnostics, _response); |
| | 13541 | | } |
| | 13542 | | } |
| | 13543 | | catch (System.Exception ex) |
| | 13544 | | { |
| | 13545 | | _scope.Failed(ex); |
| | 13546 | | throw; |
| | 13547 | | } |
| | 13548 | | finally |
| | 13549 | | { |
| | 13550 | | _scope.Dispose(); |
| | 13551 | | } |
| | 13552 | | } |
| | 13553 | |
|
| | 13554 | | /// <summary> |
| | 13555 | | /// Create the BlockBlob.CommitBlockListAsync request. |
| | 13556 | | /// </summary> |
| | 13557 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 13558 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 13559 | | /// <param name="blocks">A list of block IDs split between the committed block list, in the uncommitted bloc |
| | 13560 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 13561 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 13562 | | /// <param name="blobCacheControl">Optional. Sets the blob's cache control. If specified, this property is s |
| | 13563 | | /// <param name="blobContentType">Optional. Sets the blob's content type. If specified, this property is sto |
| | 13564 | | /// <param name="blobContentEncoding">Optional. Sets the blob's content encoding. If specified, this propert |
| | 13565 | | /// <param name="blobContentLanguage">Optional. Set the blob's content language. If specified, this property |
| | 13566 | | /// <param name="blobContentHash">Optional. An MD5 hash of the blob content. Note that this hash is not vali |
| | 13567 | | /// <param name="transactionalContentHash">Specify the transactional md5 for the body, to be validated by th |
| | 13568 | | /// <param name="transactionalContentCrc64">Specify the transactional crc64 for the body, to be validated by |
| | 13569 | | /// <param name="metadata">Optional. Specifies a user-defined name-value pair associated with the blob. If n |
| | 13570 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 13571 | | /// <param name="blobContentDisposition">Optional. Sets the blob's Content-Disposition header.</param> |
| | 13572 | | /// <param name="encryptionKey">Optional. Specifies the encryption key to use to encrypt the data provided i |
| | 13573 | | /// <param name="encryptionKeySha256">The SHA-256 hash of the provided encryption key. Must be provided if t |
| | 13574 | | /// <param name="encryptionAlgorithm">The algorithm used to produce the encryption key hash. Currently, the |
| | 13575 | | /// <param name="encryptionScope">Optional. Version 2019-07-07 and later. Specifies the name of the encrypt |
| | 13576 | | /// <param name="tier">Optional. Indicates the tier to be set on the blob.</param> |
| | 13577 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 13578 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 13579 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 13580 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 13581 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 13582 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 13583 | | /// <param name="blobTagsString">Optional. A URL encoded query param string which specifies the tags to be c |
| | 13584 | | /// <returns>The BlockBlob.CommitBlockListAsync Message.</returns> |
| | 13585 | | internal static Azure.Core.HttpMessage CommitBlockListAsync_CreateMessage( |
| | 13586 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 13587 | | System.Uri resourceUri, |
| | 13588 | | Azure.Storage.Blobs.Models.BlockLookupList blocks, |
| | 13589 | | string version, |
| | 13590 | | int? timeout = default, |
| | 13591 | | string blobCacheControl = default, |
| | 13592 | | string blobContentType = default, |
| | 13593 | | string blobContentEncoding = default, |
| | 13594 | | string blobContentLanguage = default, |
| | 13595 | | byte[] blobContentHash = default, |
| | 13596 | | byte[] transactionalContentHash = default, |
| | 13597 | | byte[] transactionalContentCrc64 = default, |
| | 13598 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 13599 | | string leaseId = default, |
| | 13600 | | string blobContentDisposition = default, |
| | 13601 | | string encryptionKey = default, |
| | 13602 | | string encryptionKeySha256 = default, |
| | 13603 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType? encryptionAlgorithm = default, |
| | 13604 | | string encryptionScope = default, |
| | 13605 | | Azure.Storage.Blobs.Models.AccessTier? tier = default, |
| | 13606 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 13607 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 13608 | | Azure.ETag? ifMatch = default, |
| | 13609 | | Azure.ETag? ifNoneMatch = default, |
| | 13610 | | string ifTags = default, |
| | 13611 | | string requestId = default, |
| | 13612 | | string blobTagsString = default) |
| | 13613 | | { |
| | 13614 | | // Validation |
| | 13615 | | if (resourceUri == null) |
| | 13616 | | { |
| | 13617 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 13618 | | } |
| | 13619 | | if (blocks == null) |
| | 13620 | | { |
| | 13621 | | throw new System.ArgumentNullException(nameof(blocks)); |
| | 13622 | | } |
| | 13623 | | if (version == null) |
| | 13624 | | { |
| | 13625 | | throw new System.ArgumentNullException(nameof(version)); |
| | 13626 | | } |
| | 13627 | |
|
| | 13628 | | // Create the request |
| | 13629 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 13630 | | Azure.Core.Request _request = _message.Request; |
| | 13631 | |
|
| | 13632 | | // Set the endpoint |
| | 13633 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 13634 | | _request.Uri.Reset(resourceUri); |
| | 13635 | | _request.Uri.AppendQuery("comp", "blocklist", escapeValue: false); |
| | 13636 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 13637 | |
|
| | 13638 | | // Add request headers |
| | 13639 | | _request.Headers.SetValue("x-ms-version", version); |
| | 13640 | | if (blobCacheControl != null) { _request.Headers.SetValue("x-ms-blob-cache-control", blobCacheControl); |
| | 13641 | | if (blobContentType != null) { _request.Headers.SetValue("x-ms-blob-content-type", blobContentType); } |
| | 13642 | | if (blobContentEncoding != null) { _request.Headers.SetValue("x-ms-blob-content-encoding", blobContentEn |
| | 13643 | | if (blobContentLanguage != null) { _request.Headers.SetValue("x-ms-blob-content-language", blobContentLa |
| | 13644 | | if (blobContentHash != null) { _request.Headers.SetValue("x-ms-blob-content-md5", System.Convert.ToBase6 |
| | 13645 | | if (transactionalContentHash != null) { _request.Headers.SetValue("Content-MD5", System.Convert.ToBase64 |
| | 13646 | | if (transactionalContentCrc64 != null) { _request.Headers.SetValue("x-ms-content-crc64", System.Convert. |
| | 13647 | | if (metadata != null) { |
| | 13648 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 13649 | | { |
| | 13650 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 13651 | | } |
| | 13652 | | } |
| | 13653 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 13654 | | if (blobContentDisposition != null) { _request.Headers.SetValue("x-ms-blob-content-disposition", blobCon |
| | 13655 | | if (encryptionKey != null) { _request.Headers.SetValue("x-ms-encryption-key", encryptionKey); } |
| | 13656 | | if (encryptionKeySha256 != null) { _request.Headers.SetValue("x-ms-encryption-key-sha256", encryptionKey |
| | 13657 | | if (encryptionAlgorithm != null) { _request.Headers.SetValue("x-ms-encryption-algorithm", Azure.Storage. |
| | 13658 | | if (encryptionScope != null) { _request.Headers.SetValue("x-ms-encryption-scope", encryptionScope); } |
| | 13659 | | if (tier != null) { _request.Headers.SetValue("x-ms-access-tier", tier.ToString()); } |
| | 13660 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 13661 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 13662 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 13663 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 13664 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 13665 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 13666 | | if (blobTagsString != null) { _request.Headers.SetValue("x-ms-tags", blobTagsString); } |
| | 13667 | |
|
| | 13668 | | // Create the body |
| | 13669 | | System.Xml.Linq.XElement _body = Azure.Storage.Blobs.Models.BlockLookupList.ToXml(blocks, "BlockList", " |
| | 13670 | | string _text = _body.ToString(System.Xml.Linq.SaveOptions.DisableFormatting); |
| | 13671 | | _request.Headers.SetValue("Content-Type", "application/xml"); |
| | 13672 | | _request.Headers.SetValue("Content-Length", _text.Length.ToString(System.Globalization.CultureInfo.Invar |
| | 13673 | | _request.Content = Azure.Core.RequestContent.Create(System.Text.Encoding.UTF8.GetBytes(_text)); |
| | 13674 | |
|
| | 13675 | | return _message; |
| | 13676 | | } |
| | 13677 | |
|
| | 13678 | | /// <summary> |
| | 13679 | | /// Create the BlockBlob.CommitBlockListAsync response or throw a failure exception. |
| | 13680 | | /// </summary> |
| | 13681 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 13682 | | /// <param name="response">The raw Response.</param> |
| | 13683 | | /// <returns>The BlockBlob.CommitBlockListAsync Azure.Response{Azure.Storage.Blobs.Models.BlobContentInfo}.< |
| | 13684 | | internal static Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> CommitBlockListAsync_CreateRespon |
| | 13685 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 13686 | | Azure.Response response) |
| | 13687 | | { |
| | 13688 | | // Process the response |
| | 13689 | | switch (response.Status) |
| | 13690 | | { |
| | 13691 | | case 201: |
| | 13692 | | { |
| | 13693 | | // Create the result |
| | 13694 | | Azure.Storage.Blobs.Models.BlobContentInfo _value = new Azure.Storage.Blobs.Models.BlobContentIn |
| | 13695 | |
|
| | 13696 | | // Get response headers |
| | 13697 | | string _header; |
| | 13698 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 13699 | | { |
| | 13700 | | _value.ETag = new Azure.ETag(_header); |
| | 13701 | | } |
| | 13702 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 13703 | | { |
| | 13704 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 13705 | | } |
| | 13706 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 13707 | | { |
| | 13708 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 13709 | | } |
| | 13710 | | if (response.Headers.TryGetValue("x-ms-version-id", out _header)) |
| | 13711 | | { |
| | 13712 | | _value.VersionId = _header; |
| | 13713 | | } |
| | 13714 | | if (response.Headers.TryGetValue("x-ms-encryption-key-sha256", out _header)) |
| | 13715 | | { |
| | 13716 | | _value.EncryptionKeySha256 = _header; |
| | 13717 | | } |
| | 13718 | | if (response.Headers.TryGetValue("x-ms-encryption-scope", out _header)) |
| | 13719 | | { |
| | 13720 | | _value.EncryptionScope = _header; |
| | 13721 | | } |
| | 13722 | | if (response.Headers.TryGetValue("x-ms-blob-sequence-number", out _header)) |
| | 13723 | | { |
| | 13724 | | _value.BlobSequenceNumber = long.Parse(_header, System.Globalization.CultureInfo.InvariantCu |
| | 13725 | | } |
| | 13726 | |
|
| | 13727 | | // Create the response |
| | 13728 | | return Response.FromValue(_value, response); |
| | 13729 | | } |
| | 13730 | | default: |
| | 13731 | | { |
| | 13732 | | // Create the result |
| | 13733 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 13734 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 13735 | |
|
| | 13736 | | throw _value.CreateException(clientDiagnostics, response); |
| | 13737 | | } |
| | 13738 | | } |
| | 13739 | | } |
| | 13740 | | #endregion BlockBlob.CommitBlockListAsync |
| | 13741 | |
|
| | 13742 | | #region BlockBlob.GetBlockListAsync |
| | 13743 | | /// <summary> |
| | 13744 | | /// The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blo |
| | 13745 | | /// </summary> |
| | 13746 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 13747 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 13748 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 13749 | | /// <param name="listType">Specifies whether to return the list of committed blocks, the list of uncommitted |
| | 13750 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 13751 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 13752 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 13753 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 13754 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 13755 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 13756 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 13757 | | /// <param name="operationName">Operation name.</param> |
| | 13758 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 13759 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.GetBlockListOperation}</returns> |
| | 13760 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.GetBlockListO |
| | 13761 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 13762 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 13763 | | System.Uri resourceUri, |
| | 13764 | | Azure.Storage.Blobs.Models.BlockListType listType, |
| | 13765 | | string version, |
| | 13766 | | string snapshot = default, |
| | 13767 | | int? timeout = default, |
| | 13768 | | string leaseId = default, |
| | 13769 | | string ifTags = default, |
| | 13770 | | string requestId = default, |
| | 13771 | | bool async = true, |
| | 13772 | | string operationName = "BlockBlobClient.GetBlockList", |
| | 13773 | | System.Threading.CancellationToken cancellationToken = default) |
| | 13774 | | { |
| | 13775 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 13776 | | try |
| | 13777 | | { |
| | 13778 | | _scope.AddAttribute("url", resourceUri); |
| | 13779 | | _scope.Start(); |
| | 13780 | | using (Azure.Core.HttpMessage _message = GetBlockListAsync_CreateMessage( |
| | 13781 | | pipeline, |
| | 13782 | | resourceUri, |
| | 13783 | | listType, |
| | 13784 | | version, |
| | 13785 | | snapshot, |
| | 13786 | | timeout, |
| | 13787 | | leaseId, |
| | 13788 | | ifTags, |
| | 13789 | | requestId)) |
| | 13790 | | { |
| | 13791 | | if (async) |
| | 13792 | | { |
| | 13793 | | // Send the request asynchronously if we're being called via an async path |
| | 13794 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 13795 | | } |
| | 13796 | | else |
| | 13797 | | { |
| | 13798 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 13799 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 13800 | | pipeline.Send(_message, cancellationToken); |
| | 13801 | | } |
| | 13802 | | Azure.Response _response = _message.Response; |
| | 13803 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 13804 | | return GetBlockListAsync_CreateResponse(clientDiagnostics, _response); |
| | 13805 | | } |
| | 13806 | | } |
| | 13807 | | catch (System.Exception ex) |
| | 13808 | | { |
| | 13809 | | _scope.Failed(ex); |
| | 13810 | | throw; |
| | 13811 | | } |
| | 13812 | | finally |
| | 13813 | | { |
| | 13814 | | _scope.Dispose(); |
| | 13815 | | } |
| | 13816 | | } |
| | 13817 | |
|
| | 13818 | | /// <summary> |
| | 13819 | | /// Create the BlockBlob.GetBlockListAsync request. |
| | 13820 | | /// </summary> |
| | 13821 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 13822 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 13823 | | /// <param name="listType">Specifies whether to return the list of committed blocks, the list of uncommitted |
| | 13824 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 13825 | | /// <param name="snapshot">The snapshot parameter is an opaque DateTime value that, when present, specifies |
| | 13826 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 13827 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 13828 | | /// <param name="ifTags">Specify a SQL where clause on blob tags to operate only on blobs with a matching va |
| | 13829 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 13830 | | /// <returns>The BlockBlob.GetBlockListAsync Message.</returns> |
| | 13831 | | internal static Azure.Core.HttpMessage GetBlockListAsync_CreateMessage( |
| | 13832 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 13833 | | System.Uri resourceUri, |
| | 13834 | | Azure.Storage.Blobs.Models.BlockListType listType, |
| | 13835 | | string version, |
| | 13836 | | string snapshot = default, |
| | 13837 | | int? timeout = default, |
| | 13838 | | string leaseId = default, |
| | 13839 | | string ifTags = default, |
| | 13840 | | string requestId = default) |
| | 13841 | | { |
| | 13842 | | // Validation |
| | 13843 | | if (resourceUri == null) |
| | 13844 | | { |
| | 13845 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 13846 | | } |
| | 13847 | | if (version == null) |
| | 13848 | | { |
| | 13849 | | throw new System.ArgumentNullException(nameof(version)); |
| | 13850 | | } |
| | 13851 | |
|
| | 13852 | | // Create the request |
| | 13853 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 13854 | | Azure.Core.Request _request = _message.Request; |
| | 13855 | |
|
| | 13856 | | // Set the endpoint |
| | 13857 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 13858 | | _request.Uri.Reset(resourceUri); |
| | 13859 | | _request.Uri.AppendQuery("comp", "blocklist", escapeValue: false); |
| | 13860 | | _request.Uri.AppendQuery("blocklisttype", Azure.Storage.Blobs.BlobRestClient.Serialization.ToString(list |
| | 13861 | | if (snapshot != null) { _request.Uri.AppendQuery("snapshot", snapshot); } |
| | 13862 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 13863 | |
|
| | 13864 | | // Add request headers |
| | 13865 | | _request.Headers.SetValue("x-ms-version", version); |
| | 13866 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 13867 | | if (ifTags != null) { _request.Headers.SetValue("x-ms-if-tags", ifTags); } |
| | 13868 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 13869 | |
|
| | 13870 | | return _message; |
| | 13871 | | } |
| | 13872 | |
|
| | 13873 | | /// <summary> |
| | 13874 | | /// Create the BlockBlob.GetBlockListAsync response or throw a failure exception. |
| | 13875 | | /// </summary> |
| | 13876 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 13877 | | /// <param name="response">The raw Response.</param> |
| | 13878 | | /// <returns>The BlockBlob.GetBlockListAsync Azure.Response{Azure.Storage.Blobs.Models.GetBlockListOperation |
| | 13879 | | internal static Azure.Response<Azure.Storage.Blobs.Models.GetBlockListOperation> GetBlockListAsync_CreateRes |
| | 13880 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 13881 | | Azure.Response response) |
| | 13882 | | { |
| | 13883 | | // Process the response |
| | 13884 | | switch (response.Status) |
| | 13885 | | { |
| | 13886 | | case 200: |
| | 13887 | | { |
| | 13888 | | // Create the result |
| | 13889 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 13890 | | Azure.Storage.Blobs.Models.GetBlockListOperation _value = new Azure.Storage.Blobs.Models.GetBloc |
| | 13891 | | _value.Body = Azure.Storage.Blobs.Models.BlockList.FromXml(_xml.Root); |
| | 13892 | |
|
| | 13893 | | // Get response headers |
| | 13894 | | string _header; |
| | 13895 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 13896 | | { |
| | 13897 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 13898 | | } |
| | 13899 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 13900 | | { |
| | 13901 | | _value.ETag = new Azure.ETag(_header); |
| | 13902 | | } |
| | 13903 | | if (response.Headers.TryGetValue("Content-Type", out _header)) |
| | 13904 | | { |
| | 13905 | | _value.ContentType = _header; |
| | 13906 | | } |
| | 13907 | | if (response.Headers.TryGetValue("x-ms-blob-content-length", out _header)) |
| | 13908 | | { |
| | 13909 | | _value.BlobContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCul |
| | 13910 | | } |
| | 13911 | |
|
| | 13912 | | // Create the response |
| | 13913 | | return Response.FromValue(_value, response); |
| | 13914 | | } |
| | 13915 | | case 304: |
| | 13916 | | { |
| | 13917 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.GetBlockListOperation>(response); |
| | 13918 | | } |
| | 13919 | | default: |
| | 13920 | | { |
| | 13921 | | // Create the result |
| | 13922 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 13923 | | Azure.Storage.Blobs.Models.StorageError _value = Azure.Storage.Blobs.Models.StorageError.FromXml |
| | 13924 | |
|
| | 13925 | | throw _value.CreateException(clientDiagnostics, response); |
| | 13926 | | } |
| | 13927 | | } |
| | 13928 | | } |
| | 13929 | | #endregion BlockBlob.GetBlockListAsync |
| | 13930 | | } |
| | 13931 | | #endregion BlockBlob operations |
| | 13932 | |
|
| | 13933 | | #region Directory operations |
| | 13934 | | /// <summary> |
| | 13935 | | /// Directory operations for Azure Blob Storage |
| | 13936 | | /// </summary> |
| | 13937 | | public static partial class Directory |
| | 13938 | | { |
| | 13939 | | #region Directory.CreateAsync |
| | 13940 | | /// <summary> |
| | 13941 | | /// Create a directory. By default, the destination is overwritten and if the destination already exists and |
| | 13942 | | /// </summary> |
| | 13943 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 13944 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 13945 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 13946 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 13947 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 13948 | | /// <param name="directoryProperties">Optional. User-defined properties to be stored with the file or direc |
| | 13949 | | /// <param name="posixPermissions">Optional and only valid if Hierarchical Namespace is enabled for the acco |
| | 13950 | | /// <param name="posixUmask">Only valid if Hierarchical Namespace is enabled for the account. This umask res |
| | 13951 | | /// <param name="cacheControl">Cache control for given resource</param> |
| | 13952 | | /// <param name="contentType">Content type for given resource</param> |
| | 13953 | | /// <param name="contentEncoding">Content encoding for given resource</param> |
| | 13954 | | /// <param name="contentLanguage">Content language for given resource</param> |
| | 13955 | | /// <param name="contentDisposition">Content disposition for given resource</param> |
| | 13956 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 13957 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 13958 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 13959 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 13960 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 13961 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 13962 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 13963 | | /// <param name="operationName">Operation name.</param> |
| | 13964 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 13965 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.DirectoryCreateResult}</returns> |
| | 13966 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.DirectoryCrea |
| | 13967 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 13968 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 13969 | | System.Uri resourceUri, |
| | 13970 | | string version, |
| | 13971 | | int? timeout = default, |
| | 13972 | | string directoryProperties = default, |
| | 13973 | | string posixPermissions = default, |
| | 13974 | | string posixUmask = default, |
| | 13975 | | string cacheControl = default, |
| | 13976 | | string contentType = default, |
| | 13977 | | string contentEncoding = default, |
| | 13978 | | string contentLanguage = default, |
| | 13979 | | string contentDisposition = default, |
| | 13980 | | string leaseId = default, |
| | 13981 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 13982 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 13983 | | Azure.ETag? ifMatch = default, |
| | 13984 | | Azure.ETag? ifNoneMatch = default, |
| | 13985 | | string requestId = default, |
| | 13986 | | bool async = true, |
| | 13987 | | string operationName = "DirectoryClient.Create", |
| | 13988 | | System.Threading.CancellationToken cancellationToken = default) |
| | 13989 | | { |
| | 13990 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 13991 | | try |
| | 13992 | | { |
| | 13993 | | _scope.AddAttribute("url", resourceUri); |
| | 13994 | | _scope.Start(); |
| | 13995 | | using (Azure.Core.HttpMessage _message = CreateAsync_CreateMessage( |
| | 13996 | | pipeline, |
| | 13997 | | resourceUri, |
| | 13998 | | version, |
| | 13999 | | timeout, |
| | 14000 | | directoryProperties, |
| | 14001 | | posixPermissions, |
| | 14002 | | posixUmask, |
| | 14003 | | cacheControl, |
| | 14004 | | contentType, |
| | 14005 | | contentEncoding, |
| | 14006 | | contentLanguage, |
| | 14007 | | contentDisposition, |
| | 14008 | | leaseId, |
| | 14009 | | ifModifiedSince, |
| | 14010 | | ifUnmodifiedSince, |
| | 14011 | | ifMatch, |
| | 14012 | | ifNoneMatch, |
| | 14013 | | requestId)) |
| | 14014 | | { |
| | 14015 | | if (async) |
| | 14016 | | { |
| | 14017 | | // Send the request asynchronously if we're being called via an async path |
| | 14018 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 14019 | | } |
| | 14020 | | else |
| | 14021 | | { |
| | 14022 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 14023 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 14024 | | pipeline.Send(_message, cancellationToken); |
| | 14025 | | } |
| | 14026 | | Azure.Response _response = _message.Response; |
| | 14027 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 14028 | | return CreateAsync_CreateResponse(clientDiagnostics, _response); |
| | 14029 | | } |
| | 14030 | | } |
| | 14031 | | catch (System.Exception ex) |
| | 14032 | | { |
| | 14033 | | _scope.Failed(ex); |
| | 14034 | | throw; |
| | 14035 | | } |
| | 14036 | | finally |
| | 14037 | | { |
| | 14038 | | _scope.Dispose(); |
| | 14039 | | } |
| | 14040 | | } |
| | 14041 | |
|
| | 14042 | | /// <summary> |
| | 14043 | | /// Create the Directory.CreateAsync request. |
| | 14044 | | /// </summary> |
| | 14045 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 14046 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 14047 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 14048 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 14049 | | /// <param name="directoryProperties">Optional. User-defined properties to be stored with the file or direc |
| | 14050 | | /// <param name="posixPermissions">Optional and only valid if Hierarchical Namespace is enabled for the acco |
| | 14051 | | /// <param name="posixUmask">Only valid if Hierarchical Namespace is enabled for the account. This umask res |
| | 14052 | | /// <param name="cacheControl">Cache control for given resource</param> |
| | 14053 | | /// <param name="contentType">Content type for given resource</param> |
| | 14054 | | /// <param name="contentEncoding">Content encoding for given resource</param> |
| | 14055 | | /// <param name="contentLanguage">Content language for given resource</param> |
| | 14056 | | /// <param name="contentDisposition">Content disposition for given resource</param> |
| | 14057 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 14058 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 14059 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 14060 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 14061 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 14062 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 14063 | | /// <returns>The Directory.CreateAsync Message.</returns> |
| | 14064 | | internal static Azure.Core.HttpMessage CreateAsync_CreateMessage( |
| | 14065 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 14066 | | System.Uri resourceUri, |
| | 14067 | | string version, |
| | 14068 | | int? timeout = default, |
| | 14069 | | string directoryProperties = default, |
| | 14070 | | string posixPermissions = default, |
| | 14071 | | string posixUmask = default, |
| | 14072 | | string cacheControl = default, |
| | 14073 | | string contentType = default, |
| | 14074 | | string contentEncoding = default, |
| | 14075 | | string contentLanguage = default, |
| | 14076 | | string contentDisposition = default, |
| | 14077 | | string leaseId = default, |
| | 14078 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 14079 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 14080 | | Azure.ETag? ifMatch = default, |
| | 14081 | | Azure.ETag? ifNoneMatch = default, |
| | 14082 | | string requestId = default) |
| | 14083 | | { |
| | 14084 | | // Validation |
| | 14085 | | if (resourceUri == null) |
| | 14086 | | { |
| | 14087 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 14088 | | } |
| | 14089 | | if (version == null) |
| | 14090 | | { |
| | 14091 | | throw new System.ArgumentNullException(nameof(version)); |
| | 14092 | | } |
| | 14093 | |
|
| | 14094 | | // Create the request |
| | 14095 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 14096 | | Azure.Core.Request _request = _message.Request; |
| | 14097 | |
|
| | 14098 | | // Set the endpoint |
| | 14099 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 14100 | | _request.Uri.Reset(resourceUri); |
| | 14101 | | _request.Uri.AppendQuery("resource", "directory", escapeValue: false); |
| | 14102 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 14103 | |
|
| | 14104 | | // Add request headers |
| | 14105 | | _request.Headers.SetValue("x-ms-version", version); |
| | 14106 | | if (directoryProperties != null) { _request.Headers.SetValue("x-ms-properties", directoryProperties); } |
| | 14107 | | if (posixPermissions != null) { _request.Headers.SetValue("x-ms-permissions", posixPermissions); } |
| | 14108 | | if (posixUmask != null) { _request.Headers.SetValue("x-ms-umask", posixUmask); } |
| | 14109 | | if (cacheControl != null) { _request.Headers.SetValue("x-ms-cache-control", cacheControl); } |
| | 14110 | | if (contentType != null) { _request.Headers.SetValue("x-ms-content-type", contentType); } |
| | 14111 | | if (contentEncoding != null) { _request.Headers.SetValue("x-ms-content-encoding", contentEncoding); } |
| | 14112 | | if (contentLanguage != null) { _request.Headers.SetValue("x-ms-content-language", contentLanguage); } |
| | 14113 | | if (contentDisposition != null) { _request.Headers.SetValue("x-ms-content-disposition", contentDispositi |
| | 14114 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 14115 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 14116 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 14117 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 14118 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 14119 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 14120 | |
|
| | 14121 | | return _message; |
| | 14122 | | } |
| | 14123 | |
|
| | 14124 | | /// <summary> |
| | 14125 | | /// Create the Directory.CreateAsync response or throw a failure exception. |
| | 14126 | | /// </summary> |
| | 14127 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 14128 | | /// <param name="response">The raw Response.</param> |
| | 14129 | | /// <returns>The Directory.CreateAsync Azure.Response{Azure.Storage.Blobs.Models.DirectoryCreateResult}.</re |
| | 14130 | | internal static Azure.Response<Azure.Storage.Blobs.Models.DirectoryCreateResult> CreateAsync_CreateResponse( |
| | 14131 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 14132 | | Azure.Response response) |
| | 14133 | | { |
| | 14134 | | // Process the response |
| | 14135 | | switch (response.Status) |
| | 14136 | | { |
| | 14137 | | case 201: |
| | 14138 | | { |
| | 14139 | | // Create the result |
| | 14140 | | Azure.Storage.Blobs.Models.DirectoryCreateResult _value = new Azure.Storage.Blobs.Models.Directo |
| | 14141 | |
|
| | 14142 | | // Get response headers |
| | 14143 | | string _header; |
| | 14144 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 14145 | | { |
| | 14146 | | _value.ETag = new Azure.ETag(_header); |
| | 14147 | | } |
| | 14148 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 14149 | | { |
| | 14150 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 14151 | | } |
| | 14152 | | if (response.Headers.TryGetValue("Content-Length", out _header)) |
| | 14153 | | { |
| | 14154 | | _value.ContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture |
| | 14155 | | } |
| | 14156 | |
|
| | 14157 | | // Create the response |
| | 14158 | | return Response.FromValue(_value, response); |
| | 14159 | | } |
| | 14160 | | default: |
| | 14161 | | { |
| | 14162 | | // Create the result |
| | 14163 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 14164 | | Azure.Storage.Blobs.Models.DataLakeStorageError _value = Azure.Storage.Blobs.Models.DataLakeStor |
| | 14165 | |
|
| | 14166 | | throw _value.CreateException(clientDiagnostics, response); |
| | 14167 | | } |
| | 14168 | | } |
| | 14169 | | } |
| | 14170 | | #endregion Directory.CreateAsync |
| | 14171 | |
|
| | 14172 | | #region Directory.RenameAsync |
| | 14173 | | /// <summary> |
| | 14174 | | /// Rename a directory. By default, the destination is overwritten and if the destination already exists and |
| | 14175 | | /// </summary> |
| | 14176 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 14177 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 14178 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 14179 | | /// <param name="renameSource">The file or directory to be renamed. The value must have the following format |
| | 14180 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 14181 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 14182 | | /// <param name="marker">When renaming a directory, the number of paths that are renamed with each invocatio |
| | 14183 | | /// <param name="pathRenameMode">Determines the behavior of the rename operation</param> |
| | 14184 | | /// <param name="directoryProperties">Optional. User-defined properties to be stored with the file or direc |
| | 14185 | | /// <param name="posixPermissions">Optional and only valid if Hierarchical Namespace is enabled for the acco |
| | 14186 | | /// <param name="posixUmask">Only valid if Hierarchical Namespace is enabled for the account. This umask res |
| | 14187 | | /// <param name="cacheControl">Cache control for given resource</param> |
| | 14188 | | /// <param name="contentType">Content type for given resource</param> |
| | 14189 | | /// <param name="contentEncoding">Content encoding for given resource</param> |
| | 14190 | | /// <param name="contentLanguage">Content language for given resource</param> |
| | 14191 | | /// <param name="contentDisposition">Content disposition for given resource</param> |
| | 14192 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 14193 | | /// <param name="sourceLeaseId">A lease ID for the source path. If specified, the source path must have an a |
| | 14194 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 14195 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 14196 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 14197 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 14198 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 14199 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 14200 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 14201 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 14202 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 14203 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 14204 | | /// <param name="operationName">Operation name.</param> |
| | 14205 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 14206 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.DirectoryRenameResult}</returns> |
| | 14207 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.DirectoryRena |
| | 14208 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 14209 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 14210 | | System.Uri resourceUri, |
| | 14211 | | string renameSource, |
| | 14212 | | string version, |
| | 14213 | | int? timeout = default, |
| | 14214 | | string marker = default, |
| | 14215 | | Azure.Storage.Blobs.Models.PathRenameMode? pathRenameMode = default, |
| | 14216 | | string directoryProperties = default, |
| | 14217 | | string posixPermissions = default, |
| | 14218 | | string posixUmask = default, |
| | 14219 | | string cacheControl = default, |
| | 14220 | | string contentType = default, |
| | 14221 | | string contentEncoding = default, |
| | 14222 | | string contentLanguage = default, |
| | 14223 | | string contentDisposition = default, |
| | 14224 | | string leaseId = default, |
| | 14225 | | string sourceLeaseId = default, |
| | 14226 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 14227 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 14228 | | Azure.ETag? ifMatch = default, |
| | 14229 | | Azure.ETag? ifNoneMatch = default, |
| | 14230 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 14231 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 14232 | | Azure.ETag? sourceIfMatch = default, |
| | 14233 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 14234 | | string requestId = default, |
| | 14235 | | bool async = true, |
| | 14236 | | string operationName = "DirectoryClient.Rename", |
| | 14237 | | System.Threading.CancellationToken cancellationToken = default) |
| | 14238 | | { |
| | 14239 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 14240 | | try |
| | 14241 | | { |
| | 14242 | | _scope.AddAttribute("url", resourceUri); |
| | 14243 | | _scope.Start(); |
| | 14244 | | using (Azure.Core.HttpMessage _message = RenameAsync_CreateMessage( |
| | 14245 | | pipeline, |
| | 14246 | | resourceUri, |
| | 14247 | | renameSource, |
| | 14248 | | version, |
| | 14249 | | timeout, |
| | 14250 | | marker, |
| | 14251 | | pathRenameMode, |
| | 14252 | | directoryProperties, |
| | 14253 | | posixPermissions, |
| | 14254 | | posixUmask, |
| | 14255 | | cacheControl, |
| | 14256 | | contentType, |
| | 14257 | | contentEncoding, |
| | 14258 | | contentLanguage, |
| | 14259 | | contentDisposition, |
| | 14260 | | leaseId, |
| | 14261 | | sourceLeaseId, |
| | 14262 | | ifModifiedSince, |
| | 14263 | | ifUnmodifiedSince, |
| | 14264 | | ifMatch, |
| | 14265 | | ifNoneMatch, |
| | 14266 | | sourceIfModifiedSince, |
| | 14267 | | sourceIfUnmodifiedSince, |
| | 14268 | | sourceIfMatch, |
| | 14269 | | sourceIfNoneMatch, |
| | 14270 | | requestId)) |
| | 14271 | | { |
| | 14272 | | if (async) |
| | 14273 | | { |
| | 14274 | | // Send the request asynchronously if we're being called via an async path |
| | 14275 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 14276 | | } |
| | 14277 | | else |
| | 14278 | | { |
| | 14279 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 14280 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 14281 | | pipeline.Send(_message, cancellationToken); |
| | 14282 | | } |
| | 14283 | | Azure.Response _response = _message.Response; |
| | 14284 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 14285 | | return RenameAsync_CreateResponse(clientDiagnostics, _response); |
| | 14286 | | } |
| | 14287 | | } |
| | 14288 | | catch (System.Exception ex) |
| | 14289 | | { |
| | 14290 | | _scope.Failed(ex); |
| | 14291 | | throw; |
| | 14292 | | } |
| | 14293 | | finally |
| | 14294 | | { |
| | 14295 | | _scope.Dispose(); |
| | 14296 | | } |
| | 14297 | | } |
| | 14298 | |
|
| | 14299 | | /// <summary> |
| | 14300 | | /// Create the Directory.RenameAsync request. |
| | 14301 | | /// </summary> |
| | 14302 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 14303 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 14304 | | /// <param name="renameSource">The file or directory to be renamed. The value must have the following format |
| | 14305 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 14306 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 14307 | | /// <param name="marker">When renaming a directory, the number of paths that are renamed with each invocatio |
| | 14308 | | /// <param name="pathRenameMode">Determines the behavior of the rename operation</param> |
| | 14309 | | /// <param name="directoryProperties">Optional. User-defined properties to be stored with the file or direc |
| | 14310 | | /// <param name="posixPermissions">Optional and only valid if Hierarchical Namespace is enabled for the acco |
| | 14311 | | /// <param name="posixUmask">Only valid if Hierarchical Namespace is enabled for the account. This umask res |
| | 14312 | | /// <param name="cacheControl">Cache control for given resource</param> |
| | 14313 | | /// <param name="contentType">Content type for given resource</param> |
| | 14314 | | /// <param name="contentEncoding">Content encoding for given resource</param> |
| | 14315 | | /// <param name="contentLanguage">Content language for given resource</param> |
| | 14316 | | /// <param name="contentDisposition">Content disposition for given resource</param> |
| | 14317 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 14318 | | /// <param name="sourceLeaseId">A lease ID for the source path. If specified, the source path must have an a |
| | 14319 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 14320 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 14321 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 14322 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 14323 | | /// <param name="sourceIfModifiedSince">Specify this header value to operate only on a blob if it has been m |
| | 14324 | | /// <param name="sourceIfUnmodifiedSince">Specify this header value to operate only on a blob if it has not |
| | 14325 | | /// <param name="sourceIfMatch">Specify an ETag value to operate only on blobs with a matching value.</param |
| | 14326 | | /// <param name="sourceIfNoneMatch">Specify an ETag value to operate only on blobs without a matching value. |
| | 14327 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 14328 | | /// <returns>The Directory.RenameAsync Message.</returns> |
| | 14329 | | internal static Azure.Core.HttpMessage RenameAsync_CreateMessage( |
| | 14330 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 14331 | | System.Uri resourceUri, |
| | 14332 | | string renameSource, |
| | 14333 | | string version, |
| | 14334 | | int? timeout = default, |
| | 14335 | | string marker = default, |
| | 14336 | | Azure.Storage.Blobs.Models.PathRenameMode? pathRenameMode = default, |
| | 14337 | | string directoryProperties = default, |
| | 14338 | | string posixPermissions = default, |
| | 14339 | | string posixUmask = default, |
| | 14340 | | string cacheControl = default, |
| | 14341 | | string contentType = default, |
| | 14342 | | string contentEncoding = default, |
| | 14343 | | string contentLanguage = default, |
| | 14344 | | string contentDisposition = default, |
| | 14345 | | string leaseId = default, |
| | 14346 | | string sourceLeaseId = default, |
| | 14347 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 14348 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 14349 | | Azure.ETag? ifMatch = default, |
| | 14350 | | Azure.ETag? ifNoneMatch = default, |
| | 14351 | | System.DateTimeOffset? sourceIfModifiedSince = default, |
| | 14352 | | System.DateTimeOffset? sourceIfUnmodifiedSince = default, |
| | 14353 | | Azure.ETag? sourceIfMatch = default, |
| | 14354 | | Azure.ETag? sourceIfNoneMatch = default, |
| | 14355 | | string requestId = default) |
| | 14356 | | { |
| | 14357 | | // Validation |
| | 14358 | | if (resourceUri == null) |
| | 14359 | | { |
| | 14360 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 14361 | | } |
| | 14362 | | if (renameSource == null) |
| | 14363 | | { |
| | 14364 | | throw new System.ArgumentNullException(nameof(renameSource)); |
| | 14365 | | } |
| | 14366 | | if (version == null) |
| | 14367 | | { |
| | 14368 | | throw new System.ArgumentNullException(nameof(version)); |
| | 14369 | | } |
| | 14370 | |
|
| | 14371 | | // Create the request |
| | 14372 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 14373 | | Azure.Core.Request _request = _message.Request; |
| | 14374 | |
|
| | 14375 | | // Set the endpoint |
| | 14376 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 14377 | | _request.Uri.Reset(resourceUri); |
| | 14378 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 14379 | | if (marker != null) { _request.Uri.AppendQuery("continuation", marker); } |
| | 14380 | | if (pathRenameMode != null) { _request.Uri.AppendQuery("mode", Azure.Storage.Blobs.BlobRestClient.Serial |
| | 14381 | |
|
| | 14382 | | // Add request headers |
| | 14383 | | _request.Headers.SetValue("x-ms-rename-source", renameSource); |
| | 14384 | | _request.Headers.SetValue("x-ms-version", version); |
| | 14385 | | if (directoryProperties != null) { _request.Headers.SetValue("x-ms-properties", directoryProperties); } |
| | 14386 | | if (posixPermissions != null) { _request.Headers.SetValue("x-ms-permissions", posixPermissions); } |
| | 14387 | | if (posixUmask != null) { _request.Headers.SetValue("x-ms-umask", posixUmask); } |
| | 14388 | | if (cacheControl != null) { _request.Headers.SetValue("x-ms-cache-control", cacheControl); } |
| | 14389 | | if (contentType != null) { _request.Headers.SetValue("x-ms-content-type", contentType); } |
| | 14390 | | if (contentEncoding != null) { _request.Headers.SetValue("x-ms-content-encoding", contentEncoding); } |
| | 14391 | | if (contentLanguage != null) { _request.Headers.SetValue("x-ms-content-language", contentLanguage); } |
| | 14392 | | if (contentDisposition != null) { _request.Headers.SetValue("x-ms-content-disposition", contentDispositi |
| | 14393 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 14394 | | if (sourceLeaseId != null) { _request.Headers.SetValue("x-ms-source-lease-id", sourceLeaseId); } |
| | 14395 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 14396 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 14397 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 14398 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 14399 | | if (sourceIfModifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-modified-since", sourceIf |
| | 14400 | | if (sourceIfUnmodifiedSince != null) { _request.Headers.SetValue("x-ms-source-if-unmodified-since", sour |
| | 14401 | | if (sourceIfMatch != null) { _request.Headers.SetValue("x-ms-source-if-match", sourceIfMatch.Value.ToStr |
| | 14402 | | if (sourceIfNoneMatch != null) { _request.Headers.SetValue("x-ms-source-if-none-match", sourceIfNoneMatc |
| | 14403 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 14404 | |
|
| | 14405 | | return _message; |
| | 14406 | | } |
| | 14407 | |
|
| | 14408 | | /// <summary> |
| | 14409 | | /// Create the Directory.RenameAsync response or throw a failure exception. |
| | 14410 | | /// </summary> |
| | 14411 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 14412 | | /// <param name="response">The raw Response.</param> |
| | 14413 | | /// <returns>The Directory.RenameAsync Azure.Response{Azure.Storage.Blobs.Models.DirectoryRenameResult}.</re |
| | 14414 | | internal static Azure.Response<Azure.Storage.Blobs.Models.DirectoryRenameResult> RenameAsync_CreateResponse( |
| | 14415 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 14416 | | Azure.Response response) |
| | 14417 | | { |
| | 14418 | | // Process the response |
| | 14419 | | switch (response.Status) |
| | 14420 | | { |
| | 14421 | | case 201: |
| | 14422 | | { |
| | 14423 | | // Create the result |
| | 14424 | | Azure.Storage.Blobs.Models.DirectoryRenameResult _value = new Azure.Storage.Blobs.Models.Directo |
| | 14425 | |
|
| | 14426 | | // Get response headers |
| | 14427 | | string _header; |
| | 14428 | | if (response.Headers.TryGetValue("x-ms-continuation", out _header)) |
| | 14429 | | { |
| | 14430 | | _value.Marker = _header; |
| | 14431 | | } |
| | 14432 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 14433 | | { |
| | 14434 | | _value.ETag = new Azure.ETag(_header); |
| | 14435 | | } |
| | 14436 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 14437 | | { |
| | 14438 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 14439 | | } |
| | 14440 | | if (response.Headers.TryGetValue("Content-Length", out _header)) |
| | 14441 | | { |
| | 14442 | | _value.ContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture |
| | 14443 | | } |
| | 14444 | |
|
| | 14445 | | // Create the response |
| | 14446 | | return Response.FromValue(_value, response); |
| | 14447 | | } |
| | 14448 | | default: |
| | 14449 | | { |
| | 14450 | | // Create the result |
| | 14451 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 14452 | | Azure.Storage.Blobs.Models.DataLakeStorageError _value = Azure.Storage.Blobs.Models.DataLakeStor |
| | 14453 | |
|
| | 14454 | | throw _value.CreateException(clientDiagnostics, response); |
| | 14455 | | } |
| | 14456 | | } |
| | 14457 | | } |
| | 14458 | | #endregion Directory.RenameAsync |
| | 14459 | |
|
| | 14460 | | #region Directory.DeleteAsync |
| | 14461 | | /// <summary> |
| | 14462 | | /// Deletes the directory |
| | 14463 | | /// </summary> |
| | 14464 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 14465 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 14466 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 14467 | | /// <param name="recursiveDirectoryDelete">If "true", all paths beneath the directory will be deleted. If "f |
| | 14468 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 14469 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 14470 | | /// <param name="marker">When renaming a directory, the number of paths that are renamed with each invocatio |
| | 14471 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 14472 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 14473 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 14474 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 14475 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 14476 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 14477 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 14478 | | /// <param name="operationName">Operation name.</param> |
| | 14479 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 14480 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.DirectoryDeleteResult}</returns> |
| | 14481 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.DirectoryDele |
| | 14482 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 14483 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 14484 | | System.Uri resourceUri, |
| | 14485 | | bool recursiveDirectoryDelete, |
| | 14486 | | string version, |
| | 14487 | | int? timeout = default, |
| | 14488 | | string marker = default, |
| | 14489 | | string leaseId = default, |
| | 14490 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 14491 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 14492 | | Azure.ETag? ifMatch = default, |
| | 14493 | | Azure.ETag? ifNoneMatch = default, |
| | 14494 | | string requestId = default, |
| | 14495 | | bool async = true, |
| | 14496 | | string operationName = "DirectoryClient.Delete", |
| | 14497 | | System.Threading.CancellationToken cancellationToken = default) |
| | 14498 | | { |
| | 14499 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 14500 | | try |
| | 14501 | | { |
| | 14502 | | _scope.AddAttribute("url", resourceUri); |
| | 14503 | | _scope.Start(); |
| | 14504 | | using (Azure.Core.HttpMessage _message = DeleteAsync_CreateMessage( |
| | 14505 | | pipeline, |
| | 14506 | | resourceUri, |
| | 14507 | | recursiveDirectoryDelete, |
| | 14508 | | version, |
| | 14509 | | timeout, |
| | 14510 | | marker, |
| | 14511 | | leaseId, |
| | 14512 | | ifModifiedSince, |
| | 14513 | | ifUnmodifiedSince, |
| | 14514 | | ifMatch, |
| | 14515 | | ifNoneMatch, |
| | 14516 | | requestId)) |
| | 14517 | | { |
| | 14518 | | if (async) |
| | 14519 | | { |
| | 14520 | | // Send the request asynchronously if we're being called via an async path |
| | 14521 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 14522 | | } |
| | 14523 | | else |
| | 14524 | | { |
| | 14525 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 14526 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 14527 | | pipeline.Send(_message, cancellationToken); |
| | 14528 | | } |
| | 14529 | | Azure.Response _response = _message.Response; |
| | 14530 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 14531 | | return DeleteAsync_CreateResponse(clientDiagnostics, _response); |
| | 14532 | | } |
| | 14533 | | } |
| | 14534 | | catch (System.Exception ex) |
| | 14535 | | { |
| | 14536 | | _scope.Failed(ex); |
| | 14537 | | throw; |
| | 14538 | | } |
| | 14539 | | finally |
| | 14540 | | { |
| | 14541 | | _scope.Dispose(); |
| | 14542 | | } |
| | 14543 | | } |
| | 14544 | |
|
| | 14545 | | /// <summary> |
| | 14546 | | /// Create the Directory.DeleteAsync request. |
| | 14547 | | /// </summary> |
| | 14548 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 14549 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 14550 | | /// <param name="recursiveDirectoryDelete">If "true", all paths beneath the directory will be deleted. If "f |
| | 14551 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 14552 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 14553 | | /// <param name="marker">When renaming a directory, the number of paths that are renamed with each invocatio |
| | 14554 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 14555 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 14556 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 14557 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 14558 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 14559 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 14560 | | /// <returns>The Directory.DeleteAsync Message.</returns> |
| | 14561 | | internal static Azure.Core.HttpMessage DeleteAsync_CreateMessage( |
| | 14562 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 14563 | | System.Uri resourceUri, |
| | 14564 | | bool recursiveDirectoryDelete, |
| | 14565 | | string version, |
| | 14566 | | int? timeout = default, |
| | 14567 | | string marker = default, |
| | 14568 | | string leaseId = default, |
| | 14569 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 14570 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 14571 | | Azure.ETag? ifMatch = default, |
| | 14572 | | Azure.ETag? ifNoneMatch = default, |
| | 14573 | | string requestId = default) |
| | 14574 | | { |
| | 14575 | | // Validation |
| | 14576 | | if (resourceUri == null) |
| | 14577 | | { |
| | 14578 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 14579 | | } |
| | 14580 | | if (version == null) |
| | 14581 | | { |
| | 14582 | | throw new System.ArgumentNullException(nameof(version)); |
| | 14583 | | } |
| | 14584 | |
|
| | 14585 | | // Create the request |
| | 14586 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 14587 | | Azure.Core.Request _request = _message.Request; |
| | 14588 | |
|
| | 14589 | | // Set the endpoint |
| | 14590 | | _request.Method = Azure.Core.RequestMethod.Delete; |
| | 14591 | | _request.Uri.Reset(resourceUri); |
| | 14592 | |
|
| | 14593 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 14594 | | _request.Uri.AppendQuery("recursive", recursiveDirectoryDelete.ToString(System.Globalization.CultureInfo |
| | 14595 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 14596 | |
|
| | 14597 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 14598 | | if (marker != null) { _request.Uri.AppendQuery("continuation", marker); } |
| | 14599 | |
|
| | 14600 | | // Add request headers |
| | 14601 | | _request.Headers.SetValue("x-ms-version", version); |
| | 14602 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 14603 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 14604 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 14605 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 14606 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 14607 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 14608 | |
|
| | 14609 | | return _message; |
| | 14610 | | } |
| | 14611 | |
|
| | 14612 | | /// <summary> |
| | 14613 | | /// Create the Directory.DeleteAsync response or throw a failure exception. |
| | 14614 | | /// </summary> |
| | 14615 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 14616 | | /// <param name="response">The raw Response.</param> |
| | 14617 | | /// <returns>The Directory.DeleteAsync Azure.Response{Azure.Storage.Blobs.Models.DirectoryDeleteResult}.</re |
| | 14618 | | internal static Azure.Response<Azure.Storage.Blobs.Models.DirectoryDeleteResult> DeleteAsync_CreateResponse( |
| | 14619 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 14620 | | Azure.Response response) |
| | 14621 | | { |
| | 14622 | | // Process the response |
| | 14623 | | switch (response.Status) |
| | 14624 | | { |
| | 14625 | | case 200: |
| | 14626 | | { |
| | 14627 | | // Create the result |
| | 14628 | | Azure.Storage.Blobs.Models.DirectoryDeleteResult _value = new Azure.Storage.Blobs.Models.Directo |
| | 14629 | |
|
| | 14630 | | // Get response headers |
| | 14631 | | string _header; |
| | 14632 | | if (response.Headers.TryGetValue("x-ms-continuation", out _header)) |
| | 14633 | | { |
| | 14634 | | _value.Marker = _header; |
| | 14635 | | } |
| | 14636 | |
|
| | 14637 | | // Create the response |
| | 14638 | | return Response.FromValue(_value, response); |
| | 14639 | | } |
| | 14640 | | default: |
| | 14641 | | { |
| | 14642 | | // Create the result |
| | 14643 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 14644 | | Azure.Storage.Blobs.Models.DataLakeStorageError _value = Azure.Storage.Blobs.Models.DataLakeStor |
| | 14645 | |
|
| | 14646 | | throw _value.CreateException(clientDiagnostics, response); |
| | 14647 | | } |
| | 14648 | | } |
| | 14649 | | } |
| | 14650 | | #endregion Directory.DeleteAsync |
| | 14651 | |
|
| | 14652 | | #region Directory.SetAccessControlAsync |
| | 14653 | | /// <summary> |
| | 14654 | | /// Set the owner, group, permissions, or access control list for a directory. |
| | 14655 | | /// </summary> |
| | 14656 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 14657 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 14658 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 14659 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 14660 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 14661 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 14662 | | /// <param name="owner">Optional. The owner of the blob or directory.</param> |
| | 14663 | | /// <param name="group">Optional. The owning group of the blob or directory.</param> |
| | 14664 | | /// <param name="posixPermissions">Optional and only valid if Hierarchical Namespace is enabled for the acco |
| | 14665 | | /// <param name="posixAcl">Sets POSIX access control rights on files and directories. The value is a comma-s |
| | 14666 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 14667 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 14668 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 14669 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 14670 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 14671 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 14672 | | /// <param name="operationName">Operation name.</param> |
| | 14673 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 14674 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.DirectorySetAccessControlResult}</returns> |
| | 14675 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.DirectorySetA |
| | 14676 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 14677 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 14678 | | System.Uri resourceUri, |
| | 14679 | | string version, |
| | 14680 | | int? timeout = default, |
| | 14681 | | string leaseId = default, |
| | 14682 | | string owner = default, |
| | 14683 | | string group = default, |
| | 14684 | | string posixPermissions = default, |
| | 14685 | | string posixAcl = default, |
| | 14686 | | Azure.ETag? ifMatch = default, |
| | 14687 | | Azure.ETag? ifNoneMatch = default, |
| | 14688 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 14689 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 14690 | | string requestId = default, |
| | 14691 | | bool async = true, |
| | 14692 | | string operationName = "DirectoryClient.SetAccessControl", |
| | 14693 | | System.Threading.CancellationToken cancellationToken = default) |
| | 14694 | | { |
| | 14695 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 14696 | | try |
| | 14697 | | { |
| | 14698 | | _scope.AddAttribute("url", resourceUri); |
| | 14699 | | _scope.Start(); |
| | 14700 | | using (Azure.Core.HttpMessage _message = SetAccessControlAsync_CreateMessage( |
| | 14701 | | pipeline, |
| | 14702 | | resourceUri, |
| | 14703 | | version, |
| | 14704 | | timeout, |
| | 14705 | | leaseId, |
| | 14706 | | owner, |
| | 14707 | | group, |
| | 14708 | | posixPermissions, |
| | 14709 | | posixAcl, |
| | 14710 | | ifMatch, |
| | 14711 | | ifNoneMatch, |
| | 14712 | | ifModifiedSince, |
| | 14713 | | ifUnmodifiedSince, |
| | 14714 | | requestId)) |
| | 14715 | | { |
| | 14716 | | if (async) |
| | 14717 | | { |
| | 14718 | | // Send the request asynchronously if we're being called via an async path |
| | 14719 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 14720 | | } |
| | 14721 | | else |
| | 14722 | | { |
| | 14723 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 14724 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 14725 | | pipeline.Send(_message, cancellationToken); |
| | 14726 | | } |
| | 14727 | | Azure.Response _response = _message.Response; |
| | 14728 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 14729 | | return SetAccessControlAsync_CreateResponse(clientDiagnostics, _response); |
| | 14730 | | } |
| | 14731 | | } |
| | 14732 | | catch (System.Exception ex) |
| | 14733 | | { |
| | 14734 | | _scope.Failed(ex); |
| | 14735 | | throw; |
| | 14736 | | } |
| | 14737 | | finally |
| | 14738 | | { |
| | 14739 | | _scope.Dispose(); |
| | 14740 | | } |
| | 14741 | | } |
| | 14742 | |
|
| | 14743 | | /// <summary> |
| | 14744 | | /// Create the Directory.SetAccessControlAsync request. |
| | 14745 | | /// </summary> |
| | 14746 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 14747 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 14748 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 14749 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 14750 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 14751 | | /// <param name="owner">Optional. The owner of the blob or directory.</param> |
| | 14752 | | /// <param name="group">Optional. The owning group of the blob or directory.</param> |
| | 14753 | | /// <param name="posixPermissions">Optional and only valid if Hierarchical Namespace is enabled for the acco |
| | 14754 | | /// <param name="posixAcl">Sets POSIX access control rights on files and directories. The value is a comma-s |
| | 14755 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 14756 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 14757 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 14758 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 14759 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 14760 | | /// <returns>The Directory.SetAccessControlAsync Message.</returns> |
| | 14761 | | internal static Azure.Core.HttpMessage SetAccessControlAsync_CreateMessage( |
| | 14762 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 14763 | | System.Uri resourceUri, |
| | 14764 | | string version, |
| | 14765 | | int? timeout = default, |
| | 14766 | | string leaseId = default, |
| | 14767 | | string owner = default, |
| | 14768 | | string group = default, |
| | 14769 | | string posixPermissions = default, |
| | 14770 | | string posixAcl = default, |
| | 14771 | | Azure.ETag? ifMatch = default, |
| | 14772 | | Azure.ETag? ifNoneMatch = default, |
| | 14773 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 14774 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 14775 | | string requestId = default) |
| | 14776 | | { |
| | 14777 | | // Validation |
| | 14778 | | if (resourceUri == null) |
| | 14779 | | { |
| | 14780 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 14781 | | } |
| | 14782 | | if (version == null) |
| | 14783 | | { |
| | 14784 | | throw new System.ArgumentNullException(nameof(version)); |
| | 14785 | | } |
| | 14786 | |
|
| | 14787 | | // Create the request |
| | 14788 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 14789 | | Azure.Core.Request _request = _message.Request; |
| | 14790 | |
|
| | 14791 | | // Set the endpoint |
| | 14792 | | _request.Method = Azure.Core.RequestMethod.Patch; |
| | 14793 | | _request.Uri.Reset(resourceUri); |
| | 14794 | | _request.Uri.AppendQuery("action", "setAccessControl", escapeValue: false); |
| | 14795 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 14796 | |
|
| | 14797 | | // Add request headers |
| | 14798 | | _request.Headers.SetValue("x-ms-version", version); |
| | 14799 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 14800 | | if (owner != null) { _request.Headers.SetValue("x-ms-owner", owner); } |
| | 14801 | | if (group != null) { _request.Headers.SetValue("x-ms-group", group); } |
| | 14802 | | if (posixPermissions != null) { _request.Headers.SetValue("x-ms-permissions", posixPermissions); } |
| | 14803 | | if (posixAcl != null) { _request.Headers.SetValue("x-ms-acl", posixAcl); } |
| | 14804 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 14805 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 14806 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 14807 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 14808 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 14809 | |
|
| | 14810 | | return _message; |
| | 14811 | | } |
| | 14812 | |
|
| | 14813 | | /// <summary> |
| | 14814 | | /// Create the Directory.SetAccessControlAsync response or throw a failure exception. |
| | 14815 | | /// </summary> |
| | 14816 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 14817 | | /// <param name="response">The raw Response.</param> |
| | 14818 | | /// <returns>The Directory.SetAccessControlAsync Azure.Response{Azure.Storage.Blobs.Models.DirectorySetAcces |
| | 14819 | | internal static Azure.Response<Azure.Storage.Blobs.Models.DirectorySetAccessControlResult> SetAccessControlA |
| | 14820 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 14821 | | Azure.Response response) |
| | 14822 | | { |
| | 14823 | | // Process the response |
| | 14824 | | switch (response.Status) |
| | 14825 | | { |
| | 14826 | | case 200: |
| | 14827 | | { |
| | 14828 | | // Create the result |
| | 14829 | | Azure.Storage.Blobs.Models.DirectorySetAccessControlResult _value = new Azure.Storage.Blobs.Mode |
| | 14830 | |
|
| | 14831 | | // Get response headers |
| | 14832 | | string _header; |
| | 14833 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 14834 | | { |
| | 14835 | | _value.ETag = new Azure.ETag(_header); |
| | 14836 | | } |
| | 14837 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 14838 | | { |
| | 14839 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 14840 | | } |
| | 14841 | |
|
| | 14842 | | // Create the response |
| | 14843 | | return Response.FromValue(_value, response); |
| | 14844 | | } |
| | 14845 | | default: |
| | 14846 | | { |
| | 14847 | | // Create the result |
| | 14848 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 14849 | | Azure.Storage.Blobs.Models.DataLakeStorageError _value = Azure.Storage.Blobs.Models.DataLakeStor |
| | 14850 | |
|
| | 14851 | | throw _value.CreateException(clientDiagnostics, response); |
| | 14852 | | } |
| | 14853 | | } |
| | 14854 | | } |
| | 14855 | | #endregion Directory.SetAccessControlAsync |
| | 14856 | |
|
| | 14857 | | #region Directory.GetAccessControlAsync |
| | 14858 | | /// <summary> |
| | 14859 | | /// Get the owner, group, permissions, or access control list for a directory. |
| | 14860 | | /// </summary> |
| | 14861 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 14862 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 14863 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 14864 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 14865 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 14866 | | /// <param name="upn">Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true" |
| | 14867 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 14868 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 14869 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 14870 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 14871 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 14872 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 14873 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 14874 | | /// <param name="operationName">Operation name.</param> |
| | 14875 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 14876 | | /// <returns>Azure.Response{Azure.Storage.Blobs.Models.DirectoryGetAccessControlResult}</returns> |
| | 14877 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Blobs.Models.DirectoryGetA |
| | 14878 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 14879 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 14880 | | System.Uri resourceUri, |
| | 14881 | | string version, |
| | 14882 | | int? timeout = default, |
| | 14883 | | bool? upn = default, |
| | 14884 | | string leaseId = default, |
| | 14885 | | Azure.ETag? ifMatch = default, |
| | 14886 | | Azure.ETag? ifNoneMatch = default, |
| | 14887 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 14888 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 14889 | | string requestId = default, |
| | 14890 | | bool async = true, |
| | 14891 | | string operationName = "DirectoryClient.GetAccessControl", |
| | 14892 | | System.Threading.CancellationToken cancellationToken = default) |
| | 14893 | | { |
| | 14894 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 14895 | | try |
| | 14896 | | { |
| | 14897 | | _scope.AddAttribute("url", resourceUri); |
| | 14898 | | _scope.Start(); |
| | 14899 | | using (Azure.Core.HttpMessage _message = GetAccessControlAsync_CreateMessage( |
| | 14900 | | pipeline, |
| | 14901 | | resourceUri, |
| | 14902 | | version, |
| | 14903 | | timeout, |
| | 14904 | | upn, |
| | 14905 | | leaseId, |
| | 14906 | | ifMatch, |
| | 14907 | | ifNoneMatch, |
| | 14908 | | ifModifiedSince, |
| | 14909 | | ifUnmodifiedSince, |
| | 14910 | | requestId)) |
| | 14911 | | { |
| | 14912 | | if (async) |
| | 14913 | | { |
| | 14914 | | // Send the request asynchronously if we're being called via an async path |
| | 14915 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 14916 | | } |
| | 14917 | | else |
| | 14918 | | { |
| | 14919 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 14920 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 14921 | | pipeline.Send(_message, cancellationToken); |
| | 14922 | | } |
| | 14923 | | Azure.Response _response = _message.Response; |
| | 14924 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 14925 | | return GetAccessControlAsync_CreateResponse(clientDiagnostics, _response); |
| | 14926 | | } |
| | 14927 | | } |
| | 14928 | | catch (System.Exception ex) |
| | 14929 | | { |
| | 14930 | | _scope.Failed(ex); |
| | 14931 | | throw; |
| | 14932 | | } |
| | 14933 | | finally |
| | 14934 | | { |
| | 14935 | | _scope.Dispose(); |
| | 14936 | | } |
| | 14937 | | } |
| | 14938 | |
|
| | 14939 | | /// <summary> |
| | 14940 | | /// Create the Directory.GetAccessControlAsync request. |
| | 14941 | | /// </summary> |
| | 14942 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 14943 | | /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the de |
| | 14944 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 14945 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 14946 | | /// <param name="upn">Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true" |
| | 14947 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 14948 | | /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param> |
| | 14949 | | /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</para |
| | 14950 | | /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modifie |
| | 14951 | | /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been m |
| | 14952 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 14953 | | /// <returns>The Directory.GetAccessControlAsync Message.</returns> |
| | 14954 | | internal static Azure.Core.HttpMessage GetAccessControlAsync_CreateMessage( |
| | 14955 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 14956 | | System.Uri resourceUri, |
| | 14957 | | string version, |
| | 14958 | | int? timeout = default, |
| | 14959 | | bool? upn = default, |
| | 14960 | | string leaseId = default, |
| | 14961 | | Azure.ETag? ifMatch = default, |
| | 14962 | | Azure.ETag? ifNoneMatch = default, |
| | 14963 | | System.DateTimeOffset? ifModifiedSince = default, |
| | 14964 | | System.DateTimeOffset? ifUnmodifiedSince = default, |
| | 14965 | | string requestId = default) |
| | 14966 | | { |
| | 14967 | | // Validation |
| | 14968 | | if (resourceUri == null) |
| | 14969 | | { |
| | 14970 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 14971 | | } |
| | 14972 | | if (version == null) |
| | 14973 | | { |
| | 14974 | | throw new System.ArgumentNullException(nameof(version)); |
| | 14975 | | } |
| | 14976 | |
|
| | 14977 | | // Create the request |
| | 14978 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 14979 | | Azure.Core.Request _request = _message.Request; |
| | 14980 | |
|
| | 14981 | | // Set the endpoint |
| | 14982 | | _request.Method = Azure.Core.RequestMethod.Head; |
| | 14983 | | _request.Uri.Reset(resourceUri); |
| | 14984 | | _request.Uri.AppendQuery("action", "getAccessControl", escapeValue: false); |
| | 14985 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 14986 | | if (upn != null) { |
| | 14987 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 14988 | | _request.Uri.AppendQuery("upn", upn.Value.ToString(System.Globalization.CultureInfo.InvariantCulture).To |
| | 14989 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 14990 | | } |
| | 14991 | |
|
| | 14992 | | // Add request headers |
| | 14993 | | _request.Headers.SetValue("x-ms-version", version); |
| | 14994 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 14995 | | if (ifMatch != null) { _request.Headers.SetValue("If-Match", ifMatch.Value.ToString()); } |
| | 14996 | | if (ifNoneMatch != null) { _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString()); } |
| | 14997 | | if (ifModifiedSince != null) { _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToSt |
| | 14998 | | if (ifUnmodifiedSince != null) { _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Valu |
| | 14999 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 15000 | |
|
| | 15001 | | return _message; |
| | 15002 | | } |
| | 15003 | |
|
| | 15004 | | /// <summary> |
| | 15005 | | /// Create the Directory.GetAccessControlAsync response or throw a failure exception. |
| | 15006 | | /// </summary> |
| | 15007 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 15008 | | /// <param name="response">The raw Response.</param> |
| | 15009 | | /// <returns>The Directory.GetAccessControlAsync Azure.Response{Azure.Storage.Blobs.Models.DirectoryGetAcces |
| | 15010 | | internal static Azure.Response<Azure.Storage.Blobs.Models.DirectoryGetAccessControlResult> GetAccessControlA |
| | 15011 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 15012 | | Azure.Response response) |
| | 15013 | | { |
| | 15014 | | // Process the response |
| | 15015 | | switch (response.Status) |
| | 15016 | | { |
| | 15017 | | case 200: |
| | 15018 | | { |
| | 15019 | | // Create the result |
| | 15020 | | Azure.Storage.Blobs.Models.DirectoryGetAccessControlResult _value = new Azure.Storage.Blobs.Mode |
| | 15021 | |
|
| | 15022 | | // Get response headers |
| | 15023 | | string _header; |
| | 15024 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 15025 | | { |
| | 15026 | | _value.ETag = new Azure.ETag(_header); |
| | 15027 | | } |
| | 15028 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 15029 | | { |
| | 15030 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 15031 | | } |
| | 15032 | | if (response.Headers.TryGetValue("x-ms-owner", out _header)) |
| | 15033 | | { |
| | 15034 | | _value.XMSOwner = _header; |
| | 15035 | | } |
| | 15036 | | if (response.Headers.TryGetValue("x-ms-group", out _header)) |
| | 15037 | | { |
| | 15038 | | _value.XMSGroup = _header; |
| | 15039 | | } |
| | 15040 | | if (response.Headers.TryGetValue("x-ms-permissions", out _header)) |
| | 15041 | | { |
| | 15042 | | _value.XMSPermissions = _header; |
| | 15043 | | } |
| | 15044 | | if (response.Headers.TryGetValue("x-ms-acl", out _header)) |
| | 15045 | | { |
| | 15046 | | _value.XMSAcl = _header; |
| | 15047 | | } |
| | 15048 | |
|
| | 15049 | | // Create the response |
| | 15050 | | return Response.FromValue(_value, response); |
| | 15051 | | } |
| | 15052 | | case 304: |
| | 15053 | | { |
| | 15054 | | return new Azure.NoBodyResponse<Azure.Storage.Blobs.Models.DirectoryGetAccessControlResult>(resp |
| | 15055 | | } |
| | 15056 | | default: |
| | 15057 | | { |
| | 15058 | | // Create the result |
| | 15059 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 15060 | | Azure.Storage.Blobs.Models.DataLakeStorageError _value = Azure.Storage.Blobs.Models.DataLakeStor |
| | 15061 | |
|
| | 15062 | | throw _value.CreateException(clientDiagnostics, response); |
| | 15063 | | } |
| | 15064 | | } |
| | 15065 | | } |
| | 15066 | | #endregion Directory.GetAccessControlAsync |
| | 15067 | | } |
| | 15068 | | #endregion Directory operations |
| | 15069 | | } |
| | 15070 | | } |
| | 15071 | | #endregion Service |
| | 15072 | |
|
| | 15073 | | #region Models |
| | 15074 | | #region enum strings AccessTier |
| | 15075 | | namespace Azure.Storage.Blobs.Models |
| | 15076 | | { |
| | 15077 | | /// <summary> |
| | 15078 | | /// Indicates the tier to be set on the blob. |
| | 15079 | | /// </summary> |
| | 15080 | | public readonly struct AccessTier : System.IEquatable<AccessTier> |
| | 15081 | | { |
| | 15082 | | /// <summary> |
| | 15083 | | /// The AccessTier value. |
| | 15084 | | /// </summary> |
| | 15085 | | private readonly string _value; |
| | 15086 | |
|
| | 15087 | | /// <summary> |
| | 15088 | | /// Initializes a new instance of the <see cref="AccessTier"/> structure. |
| | 15089 | | /// </summary> |
| | 15090 | | /// <param name="value">The string value of the instance.</param> |
| | 15091 | | public AccessTier(string value) { _value = value ?? throw new System.ArgumentNullException(nameof(value)); } |
| | 15092 | |
|
| | 15093 | | /// <summary> |
| | 15094 | | /// P4 |
| | 15095 | | /// </summary> |
| | 15096 | | public static Azure.Storage.Blobs.Models.AccessTier P4 { get; } = new AccessTier(@"P4"); |
| | 15097 | |
|
| | 15098 | | /// <summary> |
| | 15099 | | /// P6 |
| | 15100 | | /// </summary> |
| | 15101 | | public static Azure.Storage.Blobs.Models.AccessTier P6 { get; } = new AccessTier(@"P6"); |
| | 15102 | |
|
| | 15103 | | /// <summary> |
| | 15104 | | /// P10 |
| | 15105 | | /// </summary> |
| | 15106 | | public static Azure.Storage.Blobs.Models.AccessTier P10 { get; } = new AccessTier(@"P10"); |
| | 15107 | |
|
| | 15108 | | /// <summary> |
| | 15109 | | /// P15 |
| | 15110 | | /// </summary> |
| | 15111 | | public static Azure.Storage.Blobs.Models.AccessTier P15 { get; } = new AccessTier(@"P15"); |
| | 15112 | |
|
| | 15113 | | /// <summary> |
| | 15114 | | /// P20 |
| | 15115 | | /// </summary> |
| | 15116 | | public static Azure.Storage.Blobs.Models.AccessTier P20 { get; } = new AccessTier(@"P20"); |
| | 15117 | |
|
| | 15118 | | /// <summary> |
| | 15119 | | /// P30 |
| | 15120 | | /// </summary> |
| | 15121 | | public static Azure.Storage.Blobs.Models.AccessTier P30 { get; } = new AccessTier(@"P30"); |
| | 15122 | |
|
| | 15123 | | /// <summary> |
| | 15124 | | /// P40 |
| | 15125 | | /// </summary> |
| | 15126 | | public static Azure.Storage.Blobs.Models.AccessTier P40 { get; } = new AccessTier(@"P40"); |
| | 15127 | |
|
| | 15128 | | /// <summary> |
| | 15129 | | /// P50 |
| | 15130 | | /// </summary> |
| | 15131 | | public static Azure.Storage.Blobs.Models.AccessTier P50 { get; } = new AccessTier(@"P50"); |
| | 15132 | |
|
| | 15133 | | /// <summary> |
| | 15134 | | /// P60 |
| | 15135 | | /// </summary> |
| | 15136 | | public static Azure.Storage.Blobs.Models.AccessTier P60 { get; } = new AccessTier(@"P60"); |
| | 15137 | |
|
| | 15138 | | /// <summary> |
| | 15139 | | /// P70 |
| | 15140 | | /// </summary> |
| | 15141 | | public static Azure.Storage.Blobs.Models.AccessTier P70 { get; } = new AccessTier(@"P70"); |
| | 15142 | |
|
| | 15143 | | /// <summary> |
| | 15144 | | /// P80 |
| | 15145 | | /// </summary> |
| | 15146 | | public static Azure.Storage.Blobs.Models.AccessTier P80 { get; } = new AccessTier(@"P80"); |
| | 15147 | |
|
| | 15148 | | /// <summary> |
| | 15149 | | /// Hot |
| | 15150 | | /// </summary> |
| | 15151 | | public static Azure.Storage.Blobs.Models.AccessTier Hot { get; } = new AccessTier(@"Hot"); |
| | 15152 | |
|
| | 15153 | | /// <summary> |
| | 15154 | | /// Cool |
| | 15155 | | /// </summary> |
| | 15156 | | public static Azure.Storage.Blobs.Models.AccessTier Cool { get; } = new AccessTier(@"Cool"); |
| | 15157 | |
|
| | 15158 | | /// <summary> |
| | 15159 | | /// Archive |
| | 15160 | | /// </summary> |
| | 15161 | | public static Azure.Storage.Blobs.Models.AccessTier Archive { get; } = new AccessTier(@"Archive"); |
| | 15162 | |
|
| | 15163 | | /// <summary> |
| | 15164 | | /// Determines if two <see cref="AccessTier"/> values are the same. |
| | 15165 | | /// </summary> |
| | 15166 | | /// <param name="left">The first <see cref="AccessTier"/> to compare.</param> |
| | 15167 | | /// <param name="right">The second <see cref="AccessTier"/> to compare.</param> |
| | 15168 | | /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are the same; otherwise, false.</retur |
| | 15169 | | public static bool operator ==(Azure.Storage.Blobs.Models.AccessTier left, Azure.Storage.Blobs.Models.AccessTier |
| | 15170 | |
|
| | 15171 | | /// <summary> |
| | 15172 | | /// Determines if two <see cref="AccessTier"/> values are different. |
| | 15173 | | /// </summary> |
| | 15174 | | /// <param name="left">The first <see cref="AccessTier"/> to compare.</param> |
| | 15175 | | /// <param name="right">The second <see cref="AccessTier"/> to compare.</param> |
| | 15176 | | /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are different; otherwise, false.</retu |
| | 15177 | | public static bool operator !=(Azure.Storage.Blobs.Models.AccessTier left, Azure.Storage.Blobs.Models.AccessTier |
| | 15178 | |
|
| | 15179 | | /// <summary> |
| | 15180 | | /// Converts a string to a <see cref="AccessTier"/>. |
| | 15181 | | /// </summary> |
| | 15182 | | /// <param name="value">The string value to convert.</param> |
| | 15183 | | /// <returns>The AccessTier value.</returns> |
| | 15184 | | public static implicit operator AccessTier(string value) => new Azure.Storage.Blobs.Models.AccessTier(value); |
| | 15185 | |
|
| | 15186 | | /// <summary> |
| | 15187 | | /// Check if two <see cref="AccessTier"/> instances are equal. |
| | 15188 | | /// </summary> |
| | 15189 | | /// <param name="obj">The instance to compare to.</param> |
| | 15190 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 15191 | | [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] |
| | 15192 | | public override bool Equals(object obj) => obj is Azure.Storage.Blobs.Models.AccessTier other && Equals(other); |
| | 15193 | |
|
| | 15194 | | /// <summary> |
| | 15195 | | /// Check if two <see cref="AccessTier"/> instances are equal. |
| | 15196 | | /// </summary> |
| | 15197 | | /// <param name="other">The instance to compare to.</param> |
| | 15198 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 15199 | | public bool Equals(Azure.Storage.Blobs.Models.AccessTier other) => string.Equals(_value, other._value, System.St |
| | 15200 | |
|
| | 15201 | | /// <summary> |
| | 15202 | | /// Get a hash code for the <see cref="AccessTier"/>. |
| | 15203 | | /// </summary> |
| | 15204 | | /// <returns>Hash code for the AccessTier.</returns> |
| | 15205 | | [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] |
| | 15206 | | public override int GetHashCode() => _value?.GetHashCode() ?? 0; |
| | 15207 | |
|
| | 15208 | | /// <summary> |
| | 15209 | | /// Convert the <see cref="AccessTier"/> to a string. |
| | 15210 | | /// </summary> |
| | 15211 | | /// <returns>String representation of the AccessTier.</returns> |
| | 15212 | | public override string ToString() => _value; |
| | 15213 | | } |
| | 15214 | | } |
| | 15215 | | #endregion enum strings AccessTier |
| | 15216 | |
|
| | 15217 | | #region class AccountInfo |
| | 15218 | | namespace Azure.Storage.Blobs.Models |
| | 15219 | | { |
| | 15220 | | /// <summary> |
| | 15221 | | /// AccountInfo |
| | 15222 | | /// </summary> |
| | 15223 | | public partial class AccountInfo |
| | 15224 | | { |
| | 15225 | | /// <summary> |
| | 15226 | | /// Identifies the sku name of the account |
| | 15227 | | /// </summary> |
| | 15228 | | public Azure.Storage.Blobs.Models.SkuName SkuName { get; internal set; } |
| | 15229 | |
|
| | 15230 | | /// <summary> |
| | 15231 | | /// Identifies the account kind |
| | 15232 | | /// </summary> |
| | 15233 | | public Azure.Storage.Blobs.Models.AccountKind AccountKind { get; internal set; } |
| | 15234 | |
|
| | 15235 | | /// <summary> |
| | 15236 | | /// Prevent direct instantiation of AccountInfo instances. |
| | 15237 | | /// You can use BlobsModelFactory.AccountInfo instead. |
| | 15238 | | /// </summary> |
| | 15239 | | internal AccountInfo() { } |
| | 15240 | | } |
| | 15241 | |
|
| | 15242 | | /// <summary> |
| | 15243 | | /// BlobsModelFactory provides utilities for mocking. |
| | 15244 | | /// </summary> |
| | 15245 | | public static partial class BlobsModelFactory |
| | 15246 | | { |
| | 15247 | | /// <summary> |
| | 15248 | | /// Creates a new AccountInfo instance for mocking. |
| | 15249 | | /// </summary> |
| | 15250 | | public static AccountInfo AccountInfo( |
| | 15251 | | Azure.Storage.Blobs.Models.SkuName skuName, |
| | 15252 | | Azure.Storage.Blobs.Models.AccountKind accountKind) |
| | 15253 | | { |
| | 15254 | | return new AccountInfo() |
| | 15255 | | { |
| | 15256 | | SkuName = skuName, |
| | 15257 | | AccountKind = accountKind, |
| | 15258 | | }; |
| | 15259 | | } |
| | 15260 | | } |
| | 15261 | | } |
| | 15262 | | #endregion class AccountInfo |
| | 15263 | |
|
| | 15264 | | #region enum AccountKind |
| | 15265 | | namespace Azure.Storage.Blobs.Models |
| | 15266 | | { |
| | 15267 | | /// <summary> |
| | 15268 | | /// Identifies the account kind |
| | 15269 | | /// </summary> |
| | 15270 | | public enum AccountKind |
| | 15271 | | { |
| | 15272 | | /// <summary> |
| | 15273 | | /// Storage |
| | 15274 | | /// </summary> |
| | 15275 | | Storage, |
| | 15276 | |
|
| | 15277 | | /// <summary> |
| | 15278 | | /// BlobStorage |
| | 15279 | | /// </summary> |
| | 15280 | | BlobStorage, |
| | 15281 | |
|
| | 15282 | | /// <summary> |
| | 15283 | | /// StorageV2 |
| | 15284 | | /// </summary> |
| | 15285 | | StorageV2, |
| | 15286 | |
|
| | 15287 | | /// <summary> |
| | 15288 | | /// FileStorage |
| | 15289 | | /// </summary> |
| | 15290 | | FileStorage, |
| | 15291 | |
|
| | 15292 | | /// <summary> |
| | 15293 | | /// BlockBlobStorage |
| | 15294 | | /// </summary> |
| | 15295 | | BlockBlobStorage |
| | 15296 | | } |
| | 15297 | | } |
| | 15298 | | #endregion enum AccountKind |
| | 15299 | |
|
| | 15300 | | #region class AppendBlobSealInternal |
| | 15301 | | namespace Azure.Storage.Blobs.Models |
| | 15302 | | { |
| | 15303 | | /// <summary> |
| | 15304 | | /// AppendBlobSealInternal |
| | 15305 | | /// </summary> |
| | 15306 | | internal partial class AppendBlobSealInternal |
| | 15307 | | { |
| | 15308 | | /// <summary> |
| | 15309 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 15310 | | /// </summary> |
| | 15311 | | public Azure.ETag ETag { get; internal set; } |
| | 15312 | |
|
| | 15313 | | /// <summary> |
| | 15314 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 15315 | | /// </summary> |
| | 15316 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 15317 | |
|
| | 15318 | | /// <summary> |
| | 15319 | | /// If this blob has been sealed |
| | 15320 | | /// </summary> |
| | 15321 | | public bool IsSealed { get; internal set; } |
| | 15322 | |
|
| | 15323 | | /// <summary> |
| | 15324 | | /// Prevent direct instantiation of AppendBlobSealInternal instances. |
| | 15325 | | /// You can use BlobsModelFactory.AppendBlobSealInternal instead. |
| | 15326 | | /// </summary> |
| | 15327 | | internal AppendBlobSealInternal() { } |
| | 15328 | | } |
| | 15329 | | } |
| | 15330 | | #endregion class AppendBlobSealInternal |
| | 15331 | |
|
| | 15332 | | #region enum ArchiveStatus |
| | 15333 | | namespace Azure.Storage.Blobs.Models |
| | 15334 | | { |
| | 15335 | | /// <summary> |
| | 15336 | | /// ArchiveStatus values |
| | 15337 | | /// </summary> |
| | 15338 | | #pragma warning disable CA1717 // Only FlagsAttribute enums should have plural names |
| | 15339 | | public enum ArchiveStatus |
| | 15340 | | #pragma warning restore CA1717 // Only FlagsAttribute enums should have plural names |
| | 15341 | | { |
| | 15342 | | /// <summary> |
| | 15343 | | /// rehydrate-pending-to-hot |
| | 15344 | | /// </summary> |
| | 15345 | | RehydratePendingToHot, |
| | 15346 | |
|
| | 15347 | | /// <summary> |
| | 15348 | | /// rehydrate-pending-to-cool |
| | 15349 | | /// </summary> |
| | 15350 | | RehydratePendingToCool |
| | 15351 | | } |
| | 15352 | | } |
| | 15353 | |
|
| | 15354 | | namespace Azure.Storage.Blobs |
| | 15355 | | { |
| | 15356 | | internal static partial class BlobRestClient |
| | 15357 | | { |
| | 15358 | | public static partial class Serialization |
| | 15359 | | { |
| | 15360 | | public static string ToString(Azure.Storage.Blobs.Models.ArchiveStatus value) |
| | 15361 | | { |
| | 15362 | | return value switch |
| | 15363 | | { |
| | 15364 | | Azure.Storage.Blobs.Models.ArchiveStatus.RehydratePendingToHot => "rehydrate-pending-to-hot", |
| | 15365 | | Azure.Storage.Blobs.Models.ArchiveStatus.RehydratePendingToCool => "rehydrate-pending-to-cool", |
| | 15366 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 15367 | | }; |
| | 15368 | | } |
| | 15369 | |
|
| | 15370 | | public static Azure.Storage.Blobs.Models.ArchiveStatus ParseArchiveStatus(string value) |
| | 15371 | | { |
| | 15372 | | return value switch |
| | 15373 | | { |
| | 15374 | | "rehydrate-pending-to-hot" => Azure.Storage.Blobs.Models.ArchiveStatus.RehydratePendingToHot, |
| | 15375 | | "rehydrate-pending-to-cool" => Azure.Storage.Blobs.Models.ArchiveStatus.RehydratePendingToCool, |
| | 15376 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 15377 | | }; |
| | 15378 | | } |
| | 15379 | | } |
| | 15380 | | } |
| | 15381 | | } |
| | 15382 | | #endregion enum ArchiveStatus |
| | 15383 | |
|
| | 15384 | | #region class BlobGetAccessControlResult |
| | 15385 | | namespace Azure.Storage.Blobs.Models |
| | 15386 | | { |
| | 15387 | | /// <summary> |
| | 15388 | | /// Blob GetAccessControlResult |
| | 15389 | | /// </summary> |
| | 15390 | | internal partial class BlobGetAccessControlResult |
| | 15391 | | { |
| | 15392 | | /// <summary> |
| | 15393 | | /// An HTTP entity tag associated with the file or directory. |
| | 15394 | | /// </summary> |
| | 15395 | | public Azure.ETag ETag { get; internal set; } |
| | 15396 | |
|
| | 15397 | | /// <summary> |
| | 15398 | | /// The data and time the file or directory was last modified. Write operations on the file or directory update |
| | 15399 | | /// </summary> |
| | 15400 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 15401 | |
|
| | 15402 | | /// <summary> |
| | 15403 | | /// The owner of the file or directory. Included in the response if Hierarchical Namespace is enabled for the ac |
| | 15404 | | /// </summary> |
| | 15405 | | public string XMSOwner { get; internal set; } |
| | 15406 | |
|
| | 15407 | | /// <summary> |
| | 15408 | | /// The owning group of the file or directory. Included in the response if Hierarchical Namespace is enabled for |
| | 15409 | | /// </summary> |
| | 15410 | | public string XMSGroup { get; internal set; } |
| | 15411 | |
|
| | 15412 | | /// <summary> |
| | 15413 | | /// The POSIX access permissions for the file owner, the file owning group, and others. Included in the response |
| | 15414 | | /// </summary> |
| | 15415 | | public string XMSPermissions { get; internal set; } |
| | 15416 | |
|
| | 15417 | | /// <summary> |
| | 15418 | | /// The POSIX access control list for the file or directory. Included in the response only if the action is "ge |
| | 15419 | | /// </summary> |
| | 15420 | | public string XMSAcl { get; internal set; } |
| | 15421 | |
|
| | 15422 | | /// <summary> |
| | 15423 | | /// Prevent direct instantiation of BlobGetAccessControlResult instances. |
| | 15424 | | /// You can use BlobsModelFactory.BlobGetAccessControlResult instead. |
| | 15425 | | /// </summary> |
| | 15426 | | internal BlobGetAccessControlResult() { } |
| | 15427 | | } |
| | 15428 | | } |
| | 15429 | | #endregion class BlobGetAccessControlResult |
| | 15430 | |
|
| | 15431 | | #region class BlobQueryResult |
| | 15432 | | namespace Azure.Storage.Blobs.Models |
| | 15433 | | { |
| | 15434 | | /// <summary> |
| | 15435 | | /// Blob QueryResult |
| | 15436 | | /// </summary> |
| | 15437 | | internal partial class BlobQueryResult |
| | 15438 | | { |
| | 15439 | | /// <summary> |
| | 15440 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 15441 | | /// </summary> |
| | 15442 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 15443 | |
|
| | 15444 | | /// <summary> |
| | 15445 | | /// x-ms-meta |
| | 15446 | | /// </summary> |
| | 15447 | | public System.Collections.Generic.IDictionary<string, string> Metadata { get; internal set; } |
| | 15448 | |
|
| | 15449 | | /// <summary> |
| | 15450 | | /// The number of bytes present in the response body. |
| | 15451 | | /// </summary> |
| | 15452 | | public long ContentLength { get; internal set; } |
| | 15453 | |
|
| | 15454 | | /// <summary> |
| | 15455 | | /// The media type of the body of the response. For Download Blob this is 'application/octet-stream' |
| | 15456 | | /// </summary> |
| | 15457 | | public string ContentType { get; internal set; } |
| | 15458 | |
|
| | 15459 | | /// <summary> |
| | 15460 | | /// Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting |
| | 15461 | | /// </summary> |
| | 15462 | | public string ContentRange { get; internal set; } |
| | 15463 | |
|
| | 15464 | | /// <summary> |
| | 15465 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 15466 | | /// </summary> |
| | 15467 | | public Azure.ETag ETag { get; internal set; } |
| | 15468 | |
|
| | 15469 | | /// <summary> |
| | 15470 | | /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so |
| | 15471 | | /// </summary> |
| | 15472 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 15473 | | public byte[] ContentHash { get; internal set; } |
| | 15474 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 15475 | |
|
| | 15476 | | /// <summary> |
| | 15477 | | /// This header returns the value that was specified for the Content-Encoding request header |
| | 15478 | | /// </summary> |
| | 15479 | | public string ContentEncoding { get; internal set; } |
| | 15480 | |
|
| | 15481 | | /// <summary> |
| | 15482 | | /// This header is returned if it was previously specified for the blob. |
| | 15483 | | /// </summary> |
| | 15484 | | public string CacheControl { get; internal set; } |
| | 15485 | |
|
| | 15486 | | /// <summary> |
| | 15487 | | /// This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content |
| | 15488 | | /// </summary> |
| | 15489 | | public string ContentDisposition { get; internal set; } |
| | 15490 | |
|
| | 15491 | | /// <summary> |
| | 15492 | | /// This header returns the value that was specified for the Content-Language request header. |
| | 15493 | | /// </summary> |
| | 15494 | | public string ContentLanguage { get; internal set; } |
| | 15495 | |
|
| | 15496 | | /// <summary> |
| | 15497 | | /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs |
| | 15498 | | /// </summary> |
| | 15499 | | public long BlobSequenceNumber { get; internal set; } |
| | 15500 | |
|
| | 15501 | | /// <summary> |
| | 15502 | | /// The blob's type. |
| | 15503 | | /// </summary> |
| | 15504 | | public Azure.Storage.Blobs.Models.BlobType BlobType { get; internal set; } |
| | 15505 | |
|
| | 15506 | | /// <summary> |
| | 15507 | | /// If the request is to read a specified range and the x-ms-range-get-content-crc64 is set to true, then the re |
| | 15508 | | /// </summary> |
| | 15509 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 15510 | | public byte[] ContentCrc64 { get; internal set; } |
| | 15511 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 15512 | |
|
| | 15513 | | /// <summary> |
| | 15514 | | /// Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This val |
| | 15515 | | /// </summary> |
| | 15516 | | public System.DateTimeOffset CopyCompletionTime { get; internal set; } |
| | 15517 | |
|
| | 15518 | | /// <summary> |
| | 15519 | | /// Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal |
| | 15520 | | /// </summary> |
| | 15521 | | public string CopyStatusDescription { get; internal set; } |
| | 15522 | |
|
| | 15523 | | /// <summary> |
| | 15524 | | /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy ope |
| | 15525 | | /// </summary> |
| | 15526 | | public string CopyId { get; internal set; } |
| | 15527 | |
|
| | 15528 | | /// <summary> |
| | 15529 | | /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operat |
| | 15530 | | /// </summary> |
| | 15531 | | public string CopyProgress { get; internal set; } |
| | 15532 | |
|
| | 15533 | | /// <summary> |
| | 15534 | | /// URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operati |
| | 15535 | | /// </summary> |
| | 15536 | | public string CopySource { get; internal set; } |
| | 15537 | |
|
| | 15538 | | /// <summary> |
| | 15539 | | /// State of the copy operation identified by x-ms-copy-id. |
| | 15540 | | /// </summary> |
| | 15541 | | public Azure.Storage.Blobs.Models.CopyStatus CopyStatus { get; internal set; } |
| | 15542 | |
|
| | 15543 | | /// <summary> |
| | 15544 | | /// When a blob is leased, specifies whether the lease is of infinite or fixed duration. |
| | 15545 | | /// </summary> |
| | 15546 | | public Azure.Storage.Blobs.Models.LeaseDurationType LeaseDuration { get; internal set; } |
| | 15547 | |
|
| | 15548 | | /// <summary> |
| | 15549 | | /// Lease state of the blob. |
| | 15550 | | /// </summary> |
| | 15551 | | public Azure.Storage.Blobs.Models.LeaseState LeaseState { get; internal set; } |
| | 15552 | |
|
| | 15553 | | /// <summary> |
| | 15554 | | /// The current lease status of the blob. |
| | 15555 | | /// </summary> |
| | 15556 | | public Azure.Storage.Blobs.Models.LeaseStatus LeaseStatus { get; internal set; } |
| | 15557 | |
|
| | 15558 | | /// <summary> |
| | 15559 | | /// Indicates that the service supports requests for partial blob content. |
| | 15560 | | /// </summary> |
| | 15561 | | public string AcceptRanges { get; internal set; } |
| | 15562 | |
|
| | 15563 | | /// <summary> |
| | 15564 | | /// The number of committed blocks present in the blob. This header is returned only for append blobs. |
| | 15565 | | /// </summary> |
| | 15566 | | public int BlobCommittedBlockCount { get; internal set; } |
| | 15567 | |
|
| | 15568 | | /// <summary> |
| | 15569 | | /// The value of this header is set to true if the blob data and application metadata are completely encrypted u |
| | 15570 | | /// </summary> |
| | 15571 | | public bool IsServerEncrypted { get; internal set; } |
| | 15572 | |
|
| | 15573 | | /// <summary> |
| | 15574 | | /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob |
| | 15575 | | /// </summary> |
| | 15576 | | public string EncryptionKeySha256 { get; internal set; } |
| | 15577 | |
|
| | 15578 | | /// <summary> |
| | 15579 | | /// Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note t |
| | 15580 | | /// </summary> |
| | 15581 | | public string EncryptionScope { get; internal set; } |
| | 15582 | |
|
| | 15583 | | /// <summary> |
| | 15584 | | /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header |
| | 15585 | | /// </summary> |
| | 15586 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 15587 | | public byte[] BlobContentMD5 { get; internal set; } |
| | 15588 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 15589 | |
|
| | 15590 | | /// <summary> |
| | 15591 | | /// Body |
| | 15592 | | /// </summary> |
| | 15593 | | public System.IO.Stream Body { get; internal set; } |
| | 15594 | |
|
| | 15595 | | /// <summary> |
| | 15596 | | /// Creates a new BlobQueryResult instance |
| | 15597 | | /// </summary> |
| | 15598 | | public BlobQueryResult() |
| | 15599 | | { |
| | 15600 | | Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgnoreCase |
| | 15601 | | } |
| | 15602 | | } |
| | 15603 | | } |
| | 15604 | | #endregion class BlobQueryResult |
| | 15605 | |
|
| | 15606 | | #region class BlobRenameResult |
| | 15607 | | namespace Azure.Storage.Blobs.Models |
| | 15608 | | { |
| | 15609 | | /// <summary> |
| | 15610 | | /// Blob RenameResult |
| | 15611 | | /// </summary> |
| | 15612 | | internal partial class BlobRenameResult |
| | 15613 | | { |
| | 15614 | | /// <summary> |
| | 15615 | | /// An HTTP entity tag associated with the file or directory. |
| | 15616 | | /// </summary> |
| | 15617 | | public Azure.ETag ETag { get; internal set; } |
| | 15618 | |
|
| | 15619 | | /// <summary> |
| | 15620 | | /// The data and time the file or directory was last modified. Write operations on the file or directory update |
| | 15621 | | /// </summary> |
| | 15622 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 15623 | |
|
| | 15624 | | /// <summary> |
| | 15625 | | /// The size of the resource in bytes. |
| | 15626 | | /// </summary> |
| | 15627 | | public long ContentLength { get; internal set; } |
| | 15628 | |
|
| | 15629 | | /// <summary> |
| | 15630 | | /// Prevent direct instantiation of BlobRenameResult instances. |
| | 15631 | | /// You can use BlobsModelFactory.BlobRenameResult instead. |
| | 15632 | | /// </summary> |
| | 15633 | | internal BlobRenameResult() { } |
| | 15634 | | } |
| | 15635 | | } |
| | 15636 | | #endregion class BlobRenameResult |
| | 15637 | |
|
| | 15638 | | #region class BlobSetAccessControlResult |
| | 15639 | | namespace Azure.Storage.Blobs.Models |
| | 15640 | | { |
| | 15641 | | /// <summary> |
| | 15642 | | /// Blob SetAccessControlResult |
| | 15643 | | /// </summary> |
| | 15644 | | internal partial class BlobSetAccessControlResult |
| | 15645 | | { |
| | 15646 | | /// <summary> |
| | 15647 | | /// An HTTP entity tag associated with the file or directory. |
| | 15648 | | /// </summary> |
| | 15649 | | public Azure.ETag ETag { get; internal set; } |
| | 15650 | |
|
| | 15651 | | /// <summary> |
| | 15652 | | /// The data and time the file or directory was last modified. Write operations on the file or directory update |
| | 15653 | | /// </summary> |
| | 15654 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 15655 | |
|
| | 15656 | | /// <summary> |
| | 15657 | | /// Prevent direct instantiation of BlobSetAccessControlResult instances. |
| | 15658 | | /// You can use BlobsModelFactory.BlobSetAccessControlResult instead. |
| | 15659 | | /// </summary> |
| | 15660 | | internal BlobSetAccessControlResult() { } |
| | 15661 | | } |
| | 15662 | | } |
| | 15663 | | #endregion class BlobSetAccessControlResult |
| | 15664 | |
|
| | 15665 | | #region class BlobAccessPolicy |
| | 15666 | | namespace Azure.Storage.Blobs.Models |
| | 15667 | | { |
| | 15668 | | /// <summary> |
| | 15669 | | /// An Access policy |
| | 15670 | | /// </summary> |
| | 15671 | | public partial class BlobAccessPolicy |
| | 15672 | | { |
| | 15673 | | /// <summary> |
| | 15674 | | /// the date-time the policy is active |
| | 15675 | | /// </summary> |
| | 15676 | | public System.DateTimeOffset? PolicyStartsOn { get; set; } |
| | 15677 | |
|
| | 15678 | | /// <summary> |
| | 15679 | | /// the date-time the policy expires |
| | 15680 | | /// </summary> |
| | 15681 | | public System.DateTimeOffset? PolicyExpiresOn { get; set; } |
| | 15682 | |
|
| | 15683 | | /// <summary> |
| | 15684 | | /// the permissions for the acl policy |
| | 15685 | | /// </summary> |
| | 15686 | | public string Permissions { get; set; } |
| | 15687 | |
|
| | 15688 | | /// <summary> |
| | 15689 | | /// Creates a new BlobAccessPolicy instance |
| | 15690 | | /// </summary> |
| | 15691 | | public BlobAccessPolicy() { } |
| | 15692 | |
|
| | 15693 | | /// <summary> |
| | 15694 | | /// Serialize a BlobAccessPolicy instance as XML. |
| | 15695 | | /// </summary> |
| | 15696 | | /// <param name="value">The BlobAccessPolicy instance to serialize.</param> |
| | 15697 | | /// <param name="name">An optional name to use for the root element instead of "AccessPolicy".</param> |
| | 15698 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 15699 | | /// <returns>The serialized XML element.</returns> |
| | 15700 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.BlobAccessPolicy value, string name = |
| | 15701 | | { |
| | 15702 | | System.Diagnostics.Debug.Assert(value != null); |
| | 15703 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 15704 | | if (value.PolicyStartsOn != null) |
| | 15705 | | { |
| | 15706 | | _element.Add(new System.Xml.Linq.XElement( |
| | 15707 | | System.Xml.Linq.XName.Get("Start", ""), |
| | 15708 | | value.PolicyStartsOn.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffZ", System.Globalization.C |
| | 15709 | | } |
| | 15710 | | if (value.PolicyExpiresOn != null) |
| | 15711 | | { |
| | 15712 | | _element.Add(new System.Xml.Linq.XElement( |
| | 15713 | | System.Xml.Linq.XName.Get("Expiry", ""), |
| | 15714 | | value.PolicyExpiresOn.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffZ", System.Globalization. |
| | 15715 | | } |
| | 15716 | | if (value.Permissions != null) |
| | 15717 | | { |
| | 15718 | | _element.Add(new System.Xml.Linq.XElement( |
| | 15719 | | System.Xml.Linq.XName.Get("Permission", ""), |
| | 15720 | | value.Permissions)); |
| | 15721 | | } |
| | 15722 | | return _element; |
| | 15723 | | } |
| | 15724 | |
|
| | 15725 | | /// <summary> |
| | 15726 | | /// Deserializes XML into a new BlobAccessPolicy instance. |
| | 15727 | | /// </summary> |
| | 15728 | | /// <param name="element">The XML element to deserialize.</param> |
| | 15729 | | /// <returns>A deserialized BlobAccessPolicy instance.</returns> |
| | 15730 | | internal static Azure.Storage.Blobs.Models.BlobAccessPolicy FromXml(System.Xml.Linq.XElement element) |
| | 15731 | | { |
| | 15732 | | System.Diagnostics.Debug.Assert(element != null); |
| | 15733 | | System.Xml.Linq.XElement _child; |
| | 15734 | | Azure.Storage.Blobs.Models.BlobAccessPolicy _value = new Azure.Storage.Blobs.Models.BlobAccessPolicy(); |
| | 15735 | | _child = element.Element(System.Xml.Linq.XName.Get("Start", "")); |
| | 15736 | | if (_child != null) |
| | 15737 | | { |
| | 15738 | | _value.PolicyStartsOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.Invar |
| | 15739 | | } |
| | 15740 | | _child = element.Element(System.Xml.Linq.XName.Get("Expiry", "")); |
| | 15741 | | if (_child != null) |
| | 15742 | | { |
| | 15743 | | _value.PolicyExpiresOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.Inva |
| | 15744 | | } |
| | 15745 | | _child = element.Element(System.Xml.Linq.XName.Get("Permission", "")); |
| | 15746 | | if (_child != null) |
| | 15747 | | { |
| | 15748 | | _value.Permissions = _child.Value; |
| | 15749 | | } |
| | 15750 | | CustomizeFromXml(element, _value); |
| | 15751 | | return _value; |
| | 15752 | | } |
| | 15753 | |
|
| | 15754 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobAccessPoli |
| | 15755 | | } |
| | 15756 | | } |
| | 15757 | | #endregion class BlobAccessPolicy |
| | 15758 | |
|
| | 15759 | | #region class BlobAnalyticsLogging |
| | 15760 | | namespace Azure.Storage.Blobs.Models |
| | 15761 | | { |
| | 15762 | | /// <summary> |
| | 15763 | | /// Azure Analytics Logging settings. |
| | 15764 | | /// </summary> |
| | 15765 | | public partial class BlobAnalyticsLogging |
| | 15766 | | { |
| | 15767 | | /// <summary> |
| | 15768 | | /// The version of Storage Analytics to configure. |
| | 15769 | | /// </summary> |
| | 15770 | | public string Version { get; set; } |
| | 15771 | |
|
| | 15772 | | /// <summary> |
| | 15773 | | /// Indicates whether all delete requests should be logged. |
| | 15774 | | /// </summary> |
| | 15775 | | public bool Delete { get; set; } |
| | 15776 | |
|
| | 15777 | | /// <summary> |
| | 15778 | | /// Indicates whether all read requests should be logged. |
| | 15779 | | /// </summary> |
| | 15780 | | public bool Read { get; set; } |
| | 15781 | |
|
| | 15782 | | /// <summary> |
| | 15783 | | /// Indicates whether all write requests should be logged. |
| | 15784 | | /// </summary> |
| | 15785 | | public bool Write { get; set; } |
| | 15786 | |
|
| | 15787 | | /// <summary> |
| | 15788 | | /// the retention policy which determines how long the associated data should persist |
| | 15789 | | /// </summary> |
| | 15790 | | public Azure.Storage.Blobs.Models.BlobRetentionPolicy RetentionPolicy { get; set; } |
| | 15791 | |
|
| | 15792 | | /// <summary> |
| | 15793 | | /// Creates a new BlobAnalyticsLogging instance |
| | 15794 | | /// </summary> |
| | 15795 | | public BlobAnalyticsLogging() |
| | 15796 | | : this(false) |
| | 15797 | | { |
| | 15798 | | } |
| | 15799 | |
|
| | 15800 | | /// <summary> |
| | 15801 | | /// Creates a new BlobAnalyticsLogging instance |
| | 15802 | | /// </summary> |
| | 15803 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 15804 | | internal BlobAnalyticsLogging(bool skipInitialization) |
| | 15805 | | { |
| | 15806 | | if (!skipInitialization) |
| | 15807 | | { |
| | 15808 | | RetentionPolicy = new Azure.Storage.Blobs.Models.BlobRetentionPolicy(); |
| | 15809 | | } |
| | 15810 | | } |
| | 15811 | |
|
| | 15812 | | /// <summary> |
| | 15813 | | /// Serialize a BlobAnalyticsLogging instance as XML. |
| | 15814 | | /// </summary> |
| | 15815 | | /// <param name="value">The BlobAnalyticsLogging instance to serialize.</param> |
| | 15816 | | /// <param name="name">An optional name to use for the root element instead of "Logging".</param> |
| | 15817 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 15818 | | /// <returns>The serialized XML element.</returns> |
| | 15819 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.BlobAnalyticsLogging value, string nam |
| | 15820 | | { |
| | 15821 | | System.Diagnostics.Debug.Assert(value != null); |
| | 15822 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 15823 | | _element.Add(new System.Xml.Linq.XElement( |
| | 15824 | | System.Xml.Linq.XName.Get("Version", ""), |
| | 15825 | | value.Version)); |
| | 15826 | | _element.Add(new System.Xml.Linq.XElement( |
| | 15827 | | System.Xml.Linq.XName.Get("Delete", ""), |
| | 15828 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 15829 | | value.Delete.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant())); |
| | 15830 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 15831 | | _element.Add(new System.Xml.Linq.XElement( |
| | 15832 | | System.Xml.Linq.XName.Get("Read", ""), |
| | 15833 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 15834 | | value.Read.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant())); |
| | 15835 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 15836 | | _element.Add(new System.Xml.Linq.XElement( |
| | 15837 | | System.Xml.Linq.XName.Get("Write", ""), |
| | 15838 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 15839 | | value.Write.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant())); |
| | 15840 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 15841 | | _element.Add(Azure.Storage.Blobs.Models.BlobRetentionPolicy.ToXml(value.RetentionPolicy, "RetentionPolicy", |
| | 15842 | | return _element; |
| | 15843 | | } |
| | 15844 | |
|
| | 15845 | | /// <summary> |
| | 15846 | | /// Deserializes XML into a new BlobAnalyticsLogging instance. |
| | 15847 | | /// </summary> |
| | 15848 | | /// <param name="element">The XML element to deserialize.</param> |
| | 15849 | | /// <returns>A deserialized BlobAnalyticsLogging instance.</returns> |
| | 15850 | | internal static Azure.Storage.Blobs.Models.BlobAnalyticsLogging FromXml(System.Xml.Linq.XElement element) |
| | 15851 | | { |
| | 15852 | | System.Diagnostics.Debug.Assert(element != null); |
| | 15853 | | System.Xml.Linq.XElement _child; |
| | 15854 | | Azure.Storage.Blobs.Models.BlobAnalyticsLogging _value = new Azure.Storage.Blobs.Models.BlobAnalyticsLogging |
| | 15855 | | _child = element.Element(System.Xml.Linq.XName.Get("Version", "")); |
| | 15856 | | if (_child != null) |
| | 15857 | | { |
| | 15858 | | _value.Version = _child.Value; |
| | 15859 | | } |
| | 15860 | | _child = element.Element(System.Xml.Linq.XName.Get("Delete", "")); |
| | 15861 | | if (_child != null) |
| | 15862 | | { |
| | 15863 | | _value.Delete = bool.Parse(_child.Value); |
| | 15864 | | } |
| | 15865 | | _child = element.Element(System.Xml.Linq.XName.Get("Read", "")); |
| | 15866 | | if (_child != null) |
| | 15867 | | { |
| | 15868 | | _value.Read = bool.Parse(_child.Value); |
| | 15869 | | } |
| | 15870 | | _child = element.Element(System.Xml.Linq.XName.Get("Write", "")); |
| | 15871 | | if (_child != null) |
| | 15872 | | { |
| | 15873 | | _value.Write = bool.Parse(_child.Value); |
| | 15874 | | } |
| | 15875 | | _child = element.Element(System.Xml.Linq.XName.Get("RetentionPolicy", "")); |
| | 15876 | | if (_child != null) |
| | 15877 | | { |
| | 15878 | | _value.RetentionPolicy = Azure.Storage.Blobs.Models.BlobRetentionPolicy.FromXml(_child); |
| | 15879 | | } |
| | 15880 | | CustomizeFromXml(element, _value); |
| | 15881 | | return _value; |
| | 15882 | | } |
| | 15883 | |
|
| | 15884 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobAnalyticsL |
| | 15885 | | } |
| | 15886 | | } |
| | 15887 | | #endregion class BlobAnalyticsLogging |
| | 15888 | |
|
| | 15889 | | #region class BlobAppendInfo |
| | 15890 | | namespace Azure.Storage.Blobs.Models |
| | 15891 | | { |
| | 15892 | | /// <summary> |
| | 15893 | | /// BlobAppendInfo |
| | 15894 | | /// </summary> |
| | 15895 | | public partial class BlobAppendInfo |
| | 15896 | | { |
| | 15897 | | /// <summary> |
| | 15898 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 15899 | | /// </summary> |
| | 15900 | | public Azure.ETag ETag { get; internal set; } |
| | 15901 | |
|
| | 15902 | | /// <summary> |
| | 15903 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 15904 | | /// </summary> |
| | 15905 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 15906 | |
|
| | 15907 | | /// <summary> |
| | 15908 | | /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so |
| | 15909 | | /// </summary> |
| | 15910 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 15911 | | public byte[] ContentHash { get; internal set; } |
| | 15912 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 15913 | |
|
| | 15914 | | /// <summary> |
| | 15915 | | /// This header is returned so that the client can check for message content integrity. The value of this header |
| | 15916 | | /// </summary> |
| | 15917 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 15918 | | public byte[] ContentCrc64 { get; internal set; } |
| | 15919 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 15920 | |
|
| | 15921 | | /// <summary> |
| | 15922 | | /// This response header is returned only for append operations. It returns the offset at which the block was co |
| | 15923 | | /// </summary> |
| | 15924 | | public string BlobAppendOffset { get; internal set; } |
| | 15925 | |
|
| | 15926 | | /// <summary> |
| | 15927 | | /// The number of committed blocks present in the blob. This header is returned only for append blobs. |
| | 15928 | | /// </summary> |
| | 15929 | | public int BlobCommittedBlockCount { get; internal set; } |
| | 15930 | |
|
| | 15931 | | /// <summary> |
| | 15932 | | /// The value of this header is set to true if the contents of the request are successfully encrypted using the |
| | 15933 | | /// </summary> |
| | 15934 | | public bool IsServerEncrypted { get; internal set; } |
| | 15935 | |
|
| | 15936 | | /// <summary> |
| | 15937 | | /// The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the bloc |
| | 15938 | | /// </summary> |
| | 15939 | | public string EncryptionKeySha256 { get; internal set; } |
| | 15940 | |
|
| | 15941 | | /// <summary> |
| | 15942 | | /// Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note t |
| | 15943 | | /// </summary> |
| | 15944 | | public string EncryptionScope { get; internal set; } |
| | 15945 | |
|
| | 15946 | | /// <summary> |
| | 15947 | | /// Prevent direct instantiation of BlobAppendInfo instances. |
| | 15948 | | /// You can use BlobsModelFactory.BlobAppendInfo instead. |
| | 15949 | | /// </summary> |
| | 15950 | | internal BlobAppendInfo() { } |
| | 15951 | | } |
| | 15952 | |
|
| | 15953 | | /// <summary> |
| | 15954 | | /// BlobsModelFactory provides utilities for mocking. |
| | 15955 | | /// </summary> |
| | 15956 | | public static partial class BlobsModelFactory |
| | 15957 | | { |
| | 15958 | | /// <summary> |
| | 15959 | | /// Creates a new BlobAppendInfo instance for mocking. |
| | 15960 | | /// </summary> |
| | 15961 | | public static BlobAppendInfo BlobAppendInfo( |
| | 15962 | | Azure.ETag eTag, |
| | 15963 | | System.DateTimeOffset lastModified, |
| | 15964 | | byte[] contentHash, |
| | 15965 | | byte[] contentCrc64, |
| | 15966 | | string blobAppendOffset, |
| | 15967 | | int blobCommittedBlockCount, |
| | 15968 | | bool isServerEncrypted, |
| | 15969 | | string encryptionKeySha256, |
| | 15970 | | string encryptionScope) |
| | 15971 | | { |
| | 15972 | | return new BlobAppendInfo() |
| | 15973 | | { |
| | 15974 | | ETag = eTag, |
| | 15975 | | LastModified = lastModified, |
| | 15976 | | ContentHash = contentHash, |
| | 15977 | | ContentCrc64 = contentCrc64, |
| | 15978 | | BlobAppendOffset = blobAppendOffset, |
| | 15979 | | BlobCommittedBlockCount = blobCommittedBlockCount, |
| | 15980 | | IsServerEncrypted = isServerEncrypted, |
| | 15981 | | EncryptionKeySha256 = encryptionKeySha256, |
| | 15982 | | EncryptionScope = encryptionScope, |
| | 15983 | | }; |
| | 15984 | | } |
| | 15985 | | } |
| | 15986 | | } |
| | 15987 | | #endregion class BlobAppendInfo |
| | 15988 | |
|
| | 15989 | | #region class BlobBatchResult |
| | 15990 | | namespace Azure.Storage.Blobs.Models |
| | 15991 | | { |
| | 15992 | | /// <summary> |
| | 15993 | | /// BlobBatchResult |
| | 15994 | | /// </summary> |
| | 15995 | | internal partial class BlobBatchResult |
| | 15996 | | { |
| | 15997 | | /// <summary> |
| | 15998 | | /// The media type of the body of the response. For batch requests, this is multipart/mixed; boundary=batchrespo |
| | 15999 | | /// </summary> |
| | 16000 | | public string ContentType { get; internal set; } |
| | 16001 | |
|
| | 16002 | | /// <summary> |
| | 16003 | | /// Content |
| | 16004 | | /// </summary> |
| | 16005 | | public System.IO.Stream Content { get; internal set; } |
| | 16006 | |
|
| | 16007 | | /// <summary> |
| | 16008 | | /// Prevent direct instantiation of BlobBatchResult instances. |
| | 16009 | | /// You can use BlobsModelFactory.BlobBatchResult instead. |
| | 16010 | | /// </summary> |
| | 16011 | | internal BlobBatchResult() { } |
| | 16012 | | } |
| | 16013 | | } |
| | 16014 | | #endregion class BlobBatchResult |
| | 16015 | |
|
| | 16016 | | #region struct BlobBlock |
| | 16017 | | namespace Azure.Storage.Blobs.Models |
| | 16018 | | { |
| | 16019 | | /// <summary> |
| | 16020 | | /// Represents a single block in a block blob. It describes the block's ID and size. |
| | 16021 | | /// </summary> |
| | 16022 | | public readonly partial struct BlobBlock: System.IEquatable<BlobBlock> |
| | 16023 | | { |
| | 16024 | | /// <summary> |
| | 16025 | | /// The base64 encoded block ID. |
| | 16026 | | /// </summary> |
| | 16027 | | public string Name { get; } |
| | 16028 | |
|
| | 16029 | | /// <summary> |
| | 16030 | | /// The block size in bytes. |
| | 16031 | | /// </summary> |
| | 16032 | | public int Size { get; } |
| | 16033 | |
|
| | 16034 | | /// <summary> |
| | 16035 | | /// Prevent direct instantiation of BlobBlock instances. |
| | 16036 | | /// You can use BlobsModelFactory.BlobBlock instead. |
| | 16037 | | /// </summary> |
| | 16038 | | internal BlobBlock( |
| | 16039 | | string name, |
| | 16040 | | int size) |
| | 16041 | | { |
| | 16042 | | Name = name; |
| | 16043 | | Size = size; |
| | 16044 | | } |
| | 16045 | |
|
| | 16046 | | /// <summary> |
| | 16047 | | /// Check if two BlobBlock instances are equal. |
| | 16048 | | /// </summary> |
| | 16049 | | /// <param name="other">The instance to compare to.</param> |
| | 16050 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 16051 | | [System.ComponentModel.EditorBrowsable((System.ComponentModel.EditorBrowsableState.Never))] |
| | 16052 | | public bool Equals(BlobBlock other) |
| | 16053 | | { |
| | 16054 | | if (!System.StringComparer.Ordinal.Equals(Name, other.Name)) |
| | 16055 | | { |
| | 16056 | | return false; |
| | 16057 | | } |
| | 16058 | | if (!Size.Equals(other.Size)) |
| | 16059 | | { |
| | 16060 | | return false; |
| | 16061 | | } |
| | 16062 | |
|
| | 16063 | | return true; |
| | 16064 | | } |
| | 16065 | |
|
| | 16066 | | /// <summary> |
| | 16067 | | /// Check if two BlobBlock instances are equal. |
| | 16068 | | /// </summary> |
| | 16069 | | /// <param name="obj">The instance to compare to.</param> |
| | 16070 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 16071 | | [System.ComponentModel.EditorBrowsable((System.ComponentModel.EditorBrowsableState.Never))] |
| | 16072 | | public override bool Equals(object obj) => obj is BlobBlock && Equals((BlobBlock)obj); |
| | 16073 | |
|
| | 16074 | | /// <summary> |
| | 16075 | | /// Get a hash code for the BlobBlock. |
| | 16076 | | /// </summary> |
| | 16077 | | [System.ComponentModel.EditorBrowsable((System.ComponentModel.EditorBrowsableState.Never))] |
| | 16078 | | public override int GetHashCode() |
| | 16079 | | { |
| | 16080 | | var hashCode = new Azure.Core.HashCodeBuilder(); |
| | 16081 | | if (Name != null) |
| | 16082 | | { |
| | 16083 | | hashCode.Add(Name, System.StringComparer.Ordinal); |
| | 16084 | | } |
| | 16085 | | hashCode.Add(Size); |
| | 16086 | |
|
| | 16087 | | return hashCode.ToHashCode(); |
| | 16088 | | } |
| | 16089 | |
|
| | 16090 | | /// <summary> |
| | 16091 | | /// Deserializes XML into a new BlobBlock instance. |
| | 16092 | | /// </summary> |
| | 16093 | | /// <param name="element">The XML element to deserialize.</param> |
| | 16094 | | /// <returns>A deserialized BlobBlock instance.</returns> |
| | 16095 | | internal static Azure.Storage.Blobs.Models.BlobBlock FromXml(System.Xml.Linq.XElement element) |
| | 16096 | | { |
| | 16097 | | System.Diagnostics.Debug.Assert(element != null); |
| | 16098 | | System.Xml.Linq.XElement _child; |
| | 16099 | | string name = default; |
| | 16100 | | int size = default; |
| | 16101 | | _child = element.Element(System.Xml.Linq.XName.Get("Name", "")); |
| | 16102 | | if (_child != null) |
| | 16103 | | { |
| | 16104 | | name = _child.Value; |
| | 16105 | | } |
| | 16106 | | _child = element.Element(System.Xml.Linq.XName.Get("Size", "")); |
| | 16107 | | if (_child != null) |
| | 16108 | | { |
| | 16109 | | size = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 16110 | | } |
| | 16111 | | Azure.Storage.Blobs.Models.BlobBlock _value = new Azure.Storage.Blobs.Models.BlobBlock(name, size); |
| | 16112 | | CustomizeFromXml(element, _value); |
| | 16113 | | return _value; |
| | 16114 | | } |
| | 16115 | |
|
| | 16116 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobBlock valu |
| | 16117 | | } |
| | 16118 | |
|
| | 16119 | | /// <summary> |
| | 16120 | | /// BlobsModelFactory provides utilities for mocking. |
| | 16121 | | /// </summary> |
| | 16122 | | public static partial class BlobsModelFactory |
| | 16123 | | { |
| | 16124 | | /// <summary> |
| | 16125 | | /// Creates a new BlobBlock instance for mocking. |
| | 16126 | | /// </summary> |
| | 16127 | | public static BlobBlock BlobBlock( |
| | 16128 | | string name, |
| | 16129 | | int size) |
| | 16130 | | { |
| | 16131 | | return new BlobBlock(name, size); |
| | 16132 | | } |
| | 16133 | | } |
| | 16134 | | } |
| | 16135 | | #endregion struct BlobBlock |
| | 16136 | |
|
| | 16137 | | #region class BlobContainerAccessPolicy |
| | 16138 | | namespace Azure.Storage.Blobs.Models |
| | 16139 | | { |
| | 16140 | | /// <summary> |
| | 16141 | | /// BlobContainerAccessPolicy |
| | 16142 | | /// </summary> |
| | 16143 | | public partial class BlobContainerAccessPolicy |
| | 16144 | | { |
| | 16145 | | /// <summary> |
| | 16146 | | /// Indicated whether data in the container may be accessed publicly and the level of access |
| | 16147 | | /// </summary> |
| | 16148 | | public Azure.Storage.Blobs.Models.PublicAccessType BlobPublicAccess { get; internal set; } |
| | 16149 | |
|
| | 16150 | | /// <summary> |
| | 16151 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 16152 | | /// </summary> |
| | 16153 | | public Azure.ETag ETag { get; internal set; } |
| | 16154 | |
|
| | 16155 | | /// <summary> |
| | 16156 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 16157 | | /// </summary> |
| | 16158 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 16159 | |
|
| | 16160 | | /// <summary> |
| | 16161 | | /// a collection of signed identifiers |
| | 16162 | | /// </summary> |
| | 16163 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobSignedIdentifier> SignedIdentifiers |
| | 16164 | |
|
| | 16165 | | /// <summary> |
| | 16166 | | /// Creates a new BlobContainerAccessPolicy instance |
| | 16167 | | /// </summary> |
| | 16168 | | public BlobContainerAccessPolicy() |
| | 16169 | | { |
| | 16170 | | SignedIdentifiers = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobSignedIdentifier>(); |
| | 16171 | | } |
| | 16172 | | } |
| | 16173 | |
|
| | 16174 | | /// <summary> |
| | 16175 | | /// BlobsModelFactory provides utilities for mocking. |
| | 16176 | | /// </summary> |
| | 16177 | | public static partial class BlobsModelFactory |
| | 16178 | | { |
| | 16179 | | /// <summary> |
| | 16180 | | /// Creates a new BlobContainerAccessPolicy instance for mocking. |
| | 16181 | | /// </summary> |
| | 16182 | | public static BlobContainerAccessPolicy BlobContainerAccessPolicy( |
| | 16183 | | Azure.Storage.Blobs.Models.PublicAccessType blobPublicAccess, |
| | 16184 | | Azure.ETag eTag, |
| | 16185 | | System.DateTimeOffset lastModified, |
| | 16186 | | System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobSignedIdentifier> signedIdentifiers) |
| | 16187 | | { |
| | 16188 | | return new BlobContainerAccessPolicy() |
| | 16189 | | { |
| | 16190 | | BlobPublicAccess = blobPublicAccess, |
| | 16191 | | ETag = eTag, |
| | 16192 | | LastModified = lastModified, |
| | 16193 | | SignedIdentifiers = signedIdentifiers, |
| | 16194 | | }; |
| | 16195 | | } |
| | 16196 | | } |
| | 16197 | | } |
| | 16198 | | #endregion class BlobContainerAccessPolicy |
| | 16199 | |
|
| | 16200 | | #region class BlobContainerInfo |
| | 16201 | | namespace Azure.Storage.Blobs.Models |
| | 16202 | | { |
| | 16203 | | /// <summary> |
| | 16204 | | /// BlobContainerInfo |
| | 16205 | | /// </summary> |
| | 16206 | | public partial class BlobContainerInfo |
| | 16207 | | { |
| | 16208 | | /// <summary> |
| | 16209 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 16210 | | /// </summary> |
| | 16211 | | public Azure.ETag ETag { get; internal set; } |
| | 16212 | |
|
| | 16213 | | /// <summary> |
| | 16214 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 16215 | | /// </summary> |
| | 16216 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 16217 | |
|
| | 16218 | | /// <summary> |
| | 16219 | | /// Prevent direct instantiation of BlobContainerInfo instances. |
| | 16220 | | /// You can use BlobsModelFactory.BlobContainerInfo instead. |
| | 16221 | | /// </summary> |
| | 16222 | | internal BlobContainerInfo() { } |
| | 16223 | | } |
| | 16224 | |
|
| | 16225 | | /// <summary> |
| | 16226 | | /// BlobsModelFactory provides utilities for mocking. |
| | 16227 | | /// </summary> |
| | 16228 | | public static partial class BlobsModelFactory |
| | 16229 | | { |
| | 16230 | | /// <summary> |
| | 16231 | | /// Creates a new BlobContainerInfo instance for mocking. |
| | 16232 | | /// </summary> |
| | 16233 | | public static BlobContainerInfo BlobContainerInfo( |
| | 16234 | | Azure.ETag eTag, |
| | 16235 | | System.DateTimeOffset lastModified) |
| | 16236 | | { |
| | 16237 | | return new BlobContainerInfo() |
| | 16238 | | { |
| | 16239 | | ETag = eTag, |
| | 16240 | | LastModified = lastModified, |
| | 16241 | | }; |
| | 16242 | | } |
| | 16243 | | } |
| | 16244 | | } |
| | 16245 | | #endregion class BlobContainerInfo |
| | 16246 | |
|
| | 16247 | | #region class BlobContainerItem |
| | 16248 | | namespace Azure.Storage.Blobs.Models |
| | 16249 | | { |
| | 16250 | | /// <summary> |
| | 16251 | | /// An Azure Storage container |
| | 16252 | | /// </summary> |
| | 16253 | | public partial class BlobContainerItem |
| | 16254 | | { |
| | 16255 | | /// <summary> |
| | 16256 | | /// Name |
| | 16257 | | /// </summary> |
| | 16258 | | public string Name { get; internal set; } |
| | 16259 | |
|
| | 16260 | | /// <summary> |
| | 16261 | | /// Deleted |
| | 16262 | | /// </summary> |
| | 16263 | | public bool? IsDeleted { get; internal set; } |
| | 16264 | |
|
| | 16265 | | /// <summary> |
| | 16266 | | /// Version |
| | 16267 | | /// </summary> |
| | 16268 | | public string VersionId { get; internal set; } |
| | 16269 | |
|
| | 16270 | | /// <summary> |
| | 16271 | | /// Properties of a container |
| | 16272 | | /// </summary> |
| | 16273 | | public Azure.Storage.Blobs.Models.BlobContainerProperties Properties { get; internal set; } |
| | 16274 | |
|
| | 16275 | | /// <summary> |
| | 16276 | | /// Creates a new BlobContainerItem instance |
| | 16277 | | /// </summary> |
| | 16278 | | internal BlobContainerItem() |
| | 16279 | | : this(false) |
| | 16280 | | { |
| | 16281 | | } |
| | 16282 | |
|
| | 16283 | | /// <summary> |
| | 16284 | | /// Creates a new BlobContainerItem instance |
| | 16285 | | /// </summary> |
| | 16286 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 16287 | | internal BlobContainerItem(bool skipInitialization) |
| | 16288 | | { |
| | 16289 | | if (!skipInitialization) |
| | 16290 | | { |
| | 16291 | | Properties = new Azure.Storage.Blobs.Models.BlobContainerProperties(); |
| | 16292 | | } |
| | 16293 | | } |
| | 16294 | |
|
| | 16295 | | /// <summary> |
| | 16296 | | /// Deserializes XML into a new BlobContainerItem instance. |
| | 16297 | | /// </summary> |
| | 16298 | | /// <param name="element">The XML element to deserialize.</param> |
| | 16299 | | /// <returns>A deserialized BlobContainerItem instance.</returns> |
| | 16300 | | internal static Azure.Storage.Blobs.Models.BlobContainerItem FromXml(System.Xml.Linq.XElement element) |
| | 16301 | | { |
| | 16302 | | System.Diagnostics.Debug.Assert(element != null); |
| | 16303 | | System.Xml.Linq.XElement _child; |
| | 16304 | | Azure.Storage.Blobs.Models.BlobContainerItem _value = new Azure.Storage.Blobs.Models.BlobContainerItem(true) |
| | 16305 | | _child = element.Element(System.Xml.Linq.XName.Get("Name", "")); |
| | 16306 | | if (_child != null) |
| | 16307 | | { |
| | 16308 | | _value.Name = _child.Value; |
| | 16309 | | } |
| | 16310 | | _child = element.Element(System.Xml.Linq.XName.Get("Deleted", "")); |
| | 16311 | | if (_child != null) |
| | 16312 | | { |
| | 16313 | | _value.IsDeleted = bool.Parse(_child.Value); |
| | 16314 | | } |
| | 16315 | | _child = element.Element(System.Xml.Linq.XName.Get("Version", "")); |
| | 16316 | | if (_child != null) |
| | 16317 | | { |
| | 16318 | | _value.VersionId = _child.Value; |
| | 16319 | | } |
| | 16320 | | _child = element.Element(System.Xml.Linq.XName.Get("Properties", "")); |
| | 16321 | | if (_child != null) |
| | 16322 | | { |
| | 16323 | | _value.Properties = Azure.Storage.Blobs.Models.BlobContainerProperties.FromXml(_child); |
| | 16324 | | } |
| | 16325 | | CustomizeFromXml(element, _value); |
| | 16326 | | return _value; |
| | 16327 | | } |
| | 16328 | |
|
| | 16329 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobContainerI |
| | 16330 | | } |
| | 16331 | |
|
| | 16332 | | /// <summary> |
| | 16333 | | /// BlobsModelFactory provides utilities for mocking. |
| | 16334 | | /// </summary> |
| | 16335 | | public static partial class BlobsModelFactory |
| | 16336 | | { |
| | 16337 | | /// <summary> |
| | 16338 | | /// Creates a new BlobContainerItem instance for mocking. |
| | 16339 | | /// </summary> |
| | 16340 | | public static BlobContainerItem BlobContainerItem( |
| | 16341 | | string name, |
| | 16342 | | Azure.Storage.Blobs.Models.BlobContainerProperties properties, |
| | 16343 | | bool? isDeleted = default, |
| | 16344 | | string versionId = default) |
| | 16345 | | { |
| | 16346 | | return new BlobContainerItem() |
| | 16347 | | { |
| | 16348 | | Name = name, |
| | 16349 | | Properties = properties, |
| | 16350 | | IsDeleted = isDeleted, |
| | 16351 | | VersionId = versionId, |
| | 16352 | | }; |
| | 16353 | | } |
| | 16354 | | } |
| | 16355 | | } |
| | 16356 | | #endregion class BlobContainerItem |
| | 16357 | |
|
| | 16358 | | #region class BlobContainerProperties |
| | 16359 | | namespace Azure.Storage.Blobs.Models |
| | 16360 | | { |
| | 16361 | | /// <summary> |
| | 16362 | | /// Properties of a container |
| | 16363 | | /// </summary> |
| | 16364 | | public partial class BlobContainerProperties |
| | 16365 | | { |
| | 16366 | | /// <summary> |
| | 16367 | | /// Last-Modified |
| | 16368 | | /// </summary> |
| | 16369 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 16370 | |
|
| | 16371 | | /// <summary> |
| | 16372 | | /// LeaseStatus |
| | 16373 | | /// </summary> |
| | 16374 | | public Azure.Storage.Blobs.Models.LeaseStatus? LeaseStatus { get; internal set; } |
| | 16375 | |
|
| | 16376 | | /// <summary> |
| | 16377 | | /// LeaseState |
| | 16378 | | /// </summary> |
| | 16379 | | public Azure.Storage.Blobs.Models.LeaseState? LeaseState { get; internal set; } |
| | 16380 | |
|
| | 16381 | | /// <summary> |
| | 16382 | | /// LeaseDuration |
| | 16383 | | /// </summary> |
| | 16384 | | public Azure.Storage.Blobs.Models.LeaseDurationType? LeaseDuration { get; internal set; } |
| | 16385 | |
|
| | 16386 | | /// <summary> |
| | 16387 | | /// PublicAccess |
| | 16388 | | /// </summary> |
| | 16389 | | public Azure.Storage.Blobs.Models.PublicAccessType? PublicAccess { get; internal set; } |
| | 16390 | |
|
| | 16391 | | /// <summary> |
| | 16392 | | /// HasImmutabilityPolicy |
| | 16393 | | /// </summary> |
| | 16394 | | public bool? HasImmutabilityPolicy { get; internal set; } |
| | 16395 | |
|
| | 16396 | | /// <summary> |
| | 16397 | | /// HasLegalHold |
| | 16398 | | /// </summary> |
| | 16399 | | public bool? HasLegalHold { get; internal set; } |
| | 16400 | |
|
| | 16401 | | /// <summary> |
| | 16402 | | /// DefaultEncryptionScope |
| | 16403 | | /// </summary> |
| | 16404 | | public string DefaultEncryptionScope { get; internal set; } |
| | 16405 | |
|
| | 16406 | | /// <summary> |
| | 16407 | | /// DenyEncryptionScopeOverride |
| | 16408 | | /// </summary> |
| | 16409 | | public bool? PreventEncryptionScopeOverride { get; internal set; } |
| | 16410 | |
|
| | 16411 | | /// <summary> |
| | 16412 | | /// DeletedTime |
| | 16413 | | /// </summary> |
| | 16414 | | public System.DateTimeOffset? DeletedOn { get; internal set; } |
| | 16415 | |
|
| | 16416 | | /// <summary> |
| | 16417 | | /// RemainingRetentionDays |
| | 16418 | | /// </summary> |
| | 16419 | | public int? RemainingRetentionDays { get; internal set; } |
| | 16420 | |
|
| | 16421 | | /// <summary> |
| | 16422 | | /// ETag |
| | 16423 | | /// </summary> |
| | 16424 | | public Azure.ETag ETag { get; internal set; } |
| | 16425 | |
|
| | 16426 | | /// <summary> |
| | 16427 | | /// Metadata |
| | 16428 | | /// </summary> |
| | 16429 | | public System.Collections.Generic.IDictionary<string, string> Metadata { get; internal set; } |
| | 16430 | |
|
| | 16431 | | /// <summary> |
| | 16432 | | /// Creates a new BlobContainerProperties instance |
| | 16433 | | /// </summary> |
| | 16434 | | internal BlobContainerProperties() |
| | 16435 | | : this(false) |
| | 16436 | | { |
| | 16437 | | } |
| | 16438 | |
|
| | 16439 | | /// <summary> |
| | 16440 | | /// Creates a new BlobContainerProperties instance |
| | 16441 | | /// </summary> |
| | 16442 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 16443 | | internal BlobContainerProperties(bool skipInitialization) |
| | 16444 | | { |
| | 16445 | | if (!skipInitialization) |
| | 16446 | | { |
| | 16447 | | Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgnore |
| | 16448 | | } |
| | 16449 | | } |
| | 16450 | |
|
| | 16451 | | /// <summary> |
| | 16452 | | /// Deserializes XML into a new BlobContainerProperties instance. |
| | 16453 | | /// </summary> |
| | 16454 | | /// <param name="element">The XML element to deserialize.</param> |
| | 16455 | | /// <returns>A deserialized BlobContainerProperties instance.</returns> |
| | 16456 | | internal static Azure.Storage.Blobs.Models.BlobContainerProperties FromXml(System.Xml.Linq.XElement element) |
| | 16457 | | { |
| | 16458 | | System.Diagnostics.Debug.Assert(element != null); |
| | 16459 | | System.Xml.Linq.XElement _child; |
| | 16460 | | Azure.Storage.Blobs.Models.BlobContainerProperties _value = new Azure.Storage.Blobs.Models.BlobContainerProp |
| | 16461 | | _child = element.Element(System.Xml.Linq.XName.Get("Last-Modified", "")); |
| | 16462 | | if (_child != null) |
| | 16463 | | { |
| | 16464 | | _value.LastModified = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.Invaria |
| | 16465 | | } |
| | 16466 | | _child = element.Element(System.Xml.Linq.XName.Get("LeaseStatus", "")); |
| | 16467 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 16468 | | { |
| | 16469 | | _value.LeaseStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseStatus(_child.Value); |
| | 16470 | | } |
| | 16471 | | _child = element.Element(System.Xml.Linq.XName.Get("LeaseState", "")); |
| | 16472 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 16473 | | { |
| | 16474 | | _value.LeaseState = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseState(_child.Value); |
| | 16475 | | } |
| | 16476 | | _child = element.Element(System.Xml.Linq.XName.Get("LeaseDuration", "")); |
| | 16477 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 16478 | | { |
| | 16479 | | _value.LeaseDuration = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseDurationType(_child.Va |
| | 16480 | | } |
| | 16481 | | _child = element.Element(System.Xml.Linq.XName.Get("PublicAccess", "")); |
| | 16482 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 16483 | | { |
| | 16484 | | _value.PublicAccess = Azure.Storage.Blobs.BlobRestClient.Serialization.ParsePublicAccessType(_child?.Val |
| | 16485 | | } |
| | 16486 | | _child = element.Element(System.Xml.Linq.XName.Get("HasImmutabilityPolicy", "")); |
| | 16487 | | if (_child != null) |
| | 16488 | | { |
| | 16489 | | _value.HasImmutabilityPolicy = bool.Parse(_child.Value); |
| | 16490 | | } |
| | 16491 | | _child = element.Element(System.Xml.Linq.XName.Get("HasLegalHold", "")); |
| | 16492 | | if (_child != null) |
| | 16493 | | { |
| | 16494 | | _value.HasLegalHold = bool.Parse(_child.Value); |
| | 16495 | | } |
| | 16496 | | _child = element.Element(System.Xml.Linq.XName.Get("DefaultEncryptionScope", "")); |
| | 16497 | | if (_child != null) |
| | 16498 | | { |
| | 16499 | | _value.DefaultEncryptionScope = _child.Value; |
| | 16500 | | } |
| | 16501 | | _child = element.Element(System.Xml.Linq.XName.Get("DenyEncryptionScopeOverride", "")); |
| | 16502 | | if (_child != null) |
| | 16503 | | { |
| | 16504 | | _value.PreventEncryptionScopeOverride = bool.Parse(_child.Value); |
| | 16505 | | } |
| | 16506 | | _child = element.Element(System.Xml.Linq.XName.Get("DeletedTime", "")); |
| | 16507 | | if (_child != null) |
| | 16508 | | { |
| | 16509 | | _value.DeletedOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.InvariantC |
| | 16510 | | } |
| | 16511 | | _child = element.Element(System.Xml.Linq.XName.Get("RemainingRetentionDays", "")); |
| | 16512 | | if (_child != null) |
| | 16513 | | { |
| | 16514 | | _value.RemainingRetentionDays = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCultur |
| | 16515 | | } |
| | 16516 | | _child = element.Element(System.Xml.Linq.XName.Get("Etag", "")); |
| | 16517 | | if (_child != null) |
| | 16518 | | { |
| | 16519 | | _value.ETag = new Azure.ETag(_child.Value); |
| | 16520 | | } |
| | 16521 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgn |
| | 16522 | | _child = element.Element(System.Xml.Linq.XName.Get("Metadata", "")); |
| | 16523 | | if (_child != null) |
| | 16524 | | { |
| | 16525 | | foreach (System.Xml.Linq.XElement _pair in _child.Elements()) |
| | 16526 | | { |
| | 16527 | | _value.Metadata[_pair.Name.LocalName] = _pair.Value; |
| | 16528 | | } |
| | 16529 | | } |
| | 16530 | | CustomizeFromXml(element, _value); |
| | 16531 | | return _value; |
| | 16532 | | } |
| | 16533 | |
|
| | 16534 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobContainerP |
| | 16535 | | } |
| | 16536 | |
|
| | 16537 | | /// <summary> |
| | 16538 | | /// BlobsModelFactory provides utilities for mocking. |
| | 16539 | | /// </summary> |
| | 16540 | | public static partial class BlobsModelFactory |
| | 16541 | | { |
| | 16542 | | /// <summary> |
| | 16543 | | /// Creates a new BlobContainerProperties instance for mocking. |
| | 16544 | | /// </summary> |
| | 16545 | | public static BlobContainerProperties BlobContainerProperties( |
| | 16546 | | System.DateTimeOffset lastModified, |
| | 16547 | | Azure.ETag eTag, |
| | 16548 | | Azure.Storage.Blobs.Models.LeaseState? leaseState = default, |
| | 16549 | | Azure.Storage.Blobs.Models.LeaseDurationType? leaseDuration = default, |
| | 16550 | | Azure.Storage.Blobs.Models.PublicAccessType? publicAccess = default, |
| | 16551 | | bool? hasImmutabilityPolicy = default, |
| | 16552 | | Azure.Storage.Blobs.Models.LeaseStatus? leaseStatus = default, |
| | 16553 | | string defaultEncryptionScope = default, |
| | 16554 | | bool? preventEncryptionScopeOverride = default, |
| | 16555 | | System.DateTimeOffset? deletedOn = default, |
| | 16556 | | int? remainingRetentionDays = default, |
| | 16557 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 16558 | | bool? hasLegalHold = default) |
| | 16559 | | { |
| | 16560 | | return new BlobContainerProperties() |
| | 16561 | | { |
| | 16562 | | LastModified = lastModified, |
| | 16563 | | ETag = eTag, |
| | 16564 | | LeaseState = leaseState, |
| | 16565 | | LeaseDuration = leaseDuration, |
| | 16566 | | PublicAccess = publicAccess, |
| | 16567 | | HasImmutabilityPolicy = hasImmutabilityPolicy, |
| | 16568 | | LeaseStatus = leaseStatus, |
| | 16569 | | DefaultEncryptionScope = defaultEncryptionScope, |
| | 16570 | | PreventEncryptionScopeOverride = preventEncryptionScopeOverride, |
| | 16571 | | DeletedOn = deletedOn, |
| | 16572 | | RemainingRetentionDays = remainingRetentionDays, |
| | 16573 | | Metadata = metadata, |
| | 16574 | | HasLegalHold = hasLegalHold, |
| | 16575 | | }; |
| | 16576 | | } |
| | 16577 | | } |
| | 16578 | | } |
| | 16579 | | #endregion class BlobContainerProperties |
| | 16580 | |
|
| | 16581 | | #region class BlobContainersSegment |
| | 16582 | | namespace Azure.Storage.Blobs.Models |
| | 16583 | | { |
| | 16584 | | /// <summary> |
| | 16585 | | /// An enumeration of containers |
| | 16586 | | /// </summary> |
| | 16587 | | internal partial class BlobContainersSegment |
| | 16588 | | { |
| | 16589 | | /// <summary> |
| | 16590 | | /// ServiceEndpoint |
| | 16591 | | /// </summary> |
| | 16592 | | public string ServiceEndpoint { get; internal set; } |
| | 16593 | |
|
| | 16594 | | /// <summary> |
| | 16595 | | /// Prefix |
| | 16596 | | /// </summary> |
| | 16597 | | public string Prefix { get; internal set; } |
| | 16598 | |
|
| | 16599 | | /// <summary> |
| | 16600 | | /// Marker |
| | 16601 | | /// </summary> |
| | 16602 | | public string Marker { get; internal set; } |
| | 16603 | |
|
| | 16604 | | /// <summary> |
| | 16605 | | /// MaxResults |
| | 16606 | | /// </summary> |
| | 16607 | | public int? MaxResults { get; internal set; } |
| | 16608 | |
|
| | 16609 | | /// <summary> |
| | 16610 | | /// NextMarker |
| | 16611 | | /// </summary> |
| | 16612 | | public string NextMarker { get; internal set; } |
| | 16613 | |
|
| | 16614 | | /// <summary> |
| | 16615 | | /// BlobContainerItems |
| | 16616 | | /// </summary> |
| | 16617 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobContainerItem> BlobContainerItems { |
| | 16618 | |
|
| | 16619 | | /// <summary> |
| | 16620 | | /// Creates a new BlobContainersSegment instance |
| | 16621 | | /// </summary> |
| | 16622 | | public BlobContainersSegment() |
| | 16623 | | : this(false) |
| | 16624 | | { |
| | 16625 | | } |
| | 16626 | |
|
| | 16627 | | /// <summary> |
| | 16628 | | /// Creates a new BlobContainersSegment instance |
| | 16629 | | /// </summary> |
| | 16630 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 16631 | | internal BlobContainersSegment(bool skipInitialization) |
| | 16632 | | { |
| | 16633 | | if (!skipInitialization) |
| | 16634 | | { |
| | 16635 | | BlobContainerItems = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobContainerItem>() |
| | 16636 | | } |
| | 16637 | | } |
| | 16638 | |
|
| | 16639 | | /// <summary> |
| | 16640 | | /// Deserializes XML into a new BlobContainersSegment instance. |
| | 16641 | | /// </summary> |
| | 16642 | | /// <param name="element">The XML element to deserialize.</param> |
| | 16643 | | /// <returns>A deserialized BlobContainersSegment instance.</returns> |
| | 16644 | | internal static Azure.Storage.Blobs.Models.BlobContainersSegment FromXml(System.Xml.Linq.XElement element) |
| | 16645 | | { |
| | 16646 | | System.Diagnostics.Debug.Assert(element != null); |
| | 16647 | | System.Xml.Linq.XElement _child; |
| | 16648 | | System.Xml.Linq.XAttribute _attribute; |
| | 16649 | | Azure.Storage.Blobs.Models.BlobContainersSegment _value = new Azure.Storage.Blobs.Models.BlobContainersSegme |
| | 16650 | | _attribute = element.Attribute(System.Xml.Linq.XName.Get("ServiceEndpoint", "")); |
| | 16651 | | if (_attribute != null) |
| | 16652 | | { |
| | 16653 | | _value.ServiceEndpoint = _attribute.Value; |
| | 16654 | | } |
| | 16655 | | _child = element.Element(System.Xml.Linq.XName.Get("Prefix", "")); |
| | 16656 | | if (_child != null) |
| | 16657 | | { |
| | 16658 | | _value.Prefix = _child.Value; |
| | 16659 | | } |
| | 16660 | | _child = element.Element(System.Xml.Linq.XName.Get("Marker", "")); |
| | 16661 | | if (_child != null) |
| | 16662 | | { |
| | 16663 | | _value.Marker = _child.Value; |
| | 16664 | | } |
| | 16665 | | _child = element.Element(System.Xml.Linq.XName.Get("MaxResults", "")); |
| | 16666 | | if (_child != null) |
| | 16667 | | { |
| | 16668 | | _value.MaxResults = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 16669 | | } |
| | 16670 | | _child = element.Element(System.Xml.Linq.XName.Get("NextMarker", "")); |
| | 16671 | | if (_child != null) |
| | 16672 | | { |
| | 16673 | | _value.NextMarker = _child.Value; |
| | 16674 | | } |
| | 16675 | | _child = element.Element(System.Xml.Linq.XName.Get("Containers", "")); |
| | 16676 | | if (_child != null) |
| | 16677 | | { |
| | 16678 | | _value.BlobContainerItems = System.Linq.Enumerable.ToList( |
| | 16679 | | System.Linq.Enumerable.Select( |
| | 16680 | | _child.Elements(System.Xml.Linq.XName.Get("Container", "")), |
| | 16681 | | e => Azure.Storage.Blobs.Models.BlobContainerItem.FromXml(e))); |
| | 16682 | | } |
| | 16683 | | else |
| | 16684 | | { |
| | 16685 | | _value.BlobContainerItems = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobContainer |
| | 16686 | | } |
| | 16687 | | CustomizeFromXml(element, _value); |
| | 16688 | | return _value; |
| | 16689 | | } |
| | 16690 | |
|
| | 16691 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobContainers |
| | 16692 | | } |
| | 16693 | | } |
| | 16694 | | #endregion class BlobContainersSegment |
| | 16695 | |
|
| | 16696 | | #region class BlobContentInfo |
| | 16697 | | namespace Azure.Storage.Blobs.Models |
| | 16698 | | { |
| | 16699 | | /// <summary> |
| | 16700 | | /// BlobContentInfo |
| | 16701 | | /// </summary> |
| | 16702 | | public partial class BlobContentInfo |
| | 16703 | | { |
| | 16704 | | /// <summary> |
| | 16705 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 16706 | | /// </summary> |
| | 16707 | | public Azure.ETag ETag { get; internal set; } |
| | 16708 | |
|
| | 16709 | | /// <summary> |
| | 16710 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 16711 | | /// </summary> |
| | 16712 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 16713 | |
|
| | 16714 | | /// <summary> |
| | 16715 | | /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so |
| | 16716 | | /// </summary> |
| | 16717 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 16718 | | public byte[] ContentHash { get; internal set; } |
| | 16719 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 16720 | |
|
| | 16721 | | /// <summary> |
| | 16722 | | /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicat |
| | 16723 | | /// </summary> |
| | 16724 | | public string VersionId { get; internal set; } |
| | 16725 | |
|
| | 16726 | | /// <summary> |
| | 16727 | | /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob |
| | 16728 | | /// </summary> |
| | 16729 | | public string EncryptionKeySha256 { get; internal set; } |
| | 16730 | |
|
| | 16731 | | /// <summary> |
| | 16732 | | /// Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note t |
| | 16733 | | /// </summary> |
| | 16734 | | public string EncryptionScope { get; internal set; } |
| | 16735 | |
|
| | 16736 | | /// <summary> |
| | 16737 | | /// The current sequence number for the page blob. This is only returned for page blobs. |
| | 16738 | | /// </summary> |
| | 16739 | | public long BlobSequenceNumber { get; internal set; } |
| | 16740 | |
|
| | 16741 | | /// <summary> |
| | 16742 | | /// Prevent direct instantiation of BlobContentInfo instances. |
| | 16743 | | /// You can use BlobsModelFactory.BlobContentInfo instead. |
| | 16744 | | /// </summary> |
| | 16745 | | internal BlobContentInfo() { } |
| | 16746 | | } |
| | 16747 | |
|
| | 16748 | | /// <summary> |
| | 16749 | | /// BlobsModelFactory provides utilities for mocking. |
| | 16750 | | /// </summary> |
| | 16751 | | public static partial class BlobsModelFactory |
| | 16752 | | { |
| | 16753 | | /// <summary> |
| | 16754 | | /// Creates a new BlobContentInfo instance for mocking. |
| | 16755 | | /// </summary> |
| | 16756 | | public static BlobContentInfo BlobContentInfo( |
| | 16757 | | Azure.ETag eTag, |
| | 16758 | | System.DateTimeOffset lastModified, |
| | 16759 | | byte[] contentHash, |
| | 16760 | | string versionId, |
| | 16761 | | string encryptionKeySha256, |
| | 16762 | | string encryptionScope, |
| | 16763 | | long blobSequenceNumber) |
| | 16764 | | { |
| | 16765 | | return new BlobContentInfo() |
| | 16766 | | { |
| | 16767 | | ETag = eTag, |
| | 16768 | | LastModified = lastModified, |
| | 16769 | | ContentHash = contentHash, |
| | 16770 | | VersionId = versionId, |
| | 16771 | | EncryptionKeySha256 = encryptionKeySha256, |
| | 16772 | | EncryptionScope = encryptionScope, |
| | 16773 | | BlobSequenceNumber = blobSequenceNumber, |
| | 16774 | | }; |
| | 16775 | | } |
| | 16776 | | } |
| | 16777 | | } |
| | 16778 | | #endregion class BlobContentInfo |
| | 16779 | |
|
| | 16780 | | #region class BlobCopyInfo |
| | 16781 | | namespace Azure.Storage.Blobs.Models |
| | 16782 | | { |
| | 16783 | | /// <summary> |
| | 16784 | | /// BlobCopyInfo |
| | 16785 | | /// </summary> |
| | 16786 | | public partial class BlobCopyInfo |
| | 16787 | | { |
| | 16788 | | /// <summary> |
| | 16789 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 16790 | | /// </summary> |
| | 16791 | | public Azure.ETag ETag { get; internal set; } |
| | 16792 | |
|
| | 16793 | | /// <summary> |
| | 16794 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 16795 | | /// </summary> |
| | 16796 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 16797 | |
|
| | 16798 | | /// <summary> |
| | 16799 | | /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicat |
| | 16800 | | /// </summary> |
| | 16801 | | public string VersionId { get; internal set; } |
| | 16802 | |
|
| | 16803 | | /// <summary> |
| | 16804 | | /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy ope |
| | 16805 | | /// </summary> |
| | 16806 | | public string CopyId { get; internal set; } |
| | 16807 | |
|
| | 16808 | | /// <summary> |
| | 16809 | | /// State of the copy operation identified by x-ms-copy-id. |
| | 16810 | | /// </summary> |
| | 16811 | | public Azure.Storage.Blobs.Models.CopyStatus CopyStatus { get; internal set; } |
| | 16812 | |
|
| | 16813 | | /// <summary> |
| | 16814 | | /// Prevent direct instantiation of BlobCopyInfo instances. |
| | 16815 | | /// You can use BlobsModelFactory.BlobCopyInfo instead. |
| | 16816 | | /// </summary> |
| | 16817 | | internal BlobCopyInfo() { } |
| | 16818 | | } |
| | 16819 | |
|
| | 16820 | | /// <summary> |
| | 16821 | | /// BlobsModelFactory provides utilities for mocking. |
| | 16822 | | /// </summary> |
| | 16823 | | public static partial class BlobsModelFactory |
| | 16824 | | { |
| | 16825 | | /// <summary> |
| | 16826 | | /// Creates a new BlobCopyInfo instance for mocking. |
| | 16827 | | /// </summary> |
| | 16828 | | public static BlobCopyInfo BlobCopyInfo( |
| | 16829 | | Azure.ETag eTag, |
| | 16830 | | System.DateTimeOffset lastModified, |
| | 16831 | | string versionId, |
| | 16832 | | string copyId, |
| | 16833 | | Azure.Storage.Blobs.Models.CopyStatus copyStatus) |
| | 16834 | | { |
| | 16835 | | return new BlobCopyInfo() |
| | 16836 | | { |
| | 16837 | | ETag = eTag, |
| | 16838 | | LastModified = lastModified, |
| | 16839 | | VersionId = versionId, |
| | 16840 | | CopyId = copyId, |
| | 16841 | | CopyStatus = copyStatus, |
| | 16842 | | }; |
| | 16843 | | } |
| | 16844 | | } |
| | 16845 | | } |
| | 16846 | | #endregion class BlobCopyInfo |
| | 16847 | |
|
| | 16848 | | #region class BlobCorsRule |
| | 16849 | | namespace Azure.Storage.Blobs.Models |
| | 16850 | | { |
| | 16851 | | /// <summary> |
| | 16852 | | /// CORS is an HTTP feature that enables a web application running under one domain to access resources in another d |
| | 16853 | | /// </summary> |
| | 16854 | | public partial class BlobCorsRule |
| | 16855 | | { |
| | 16856 | | /// <summary> |
| | 16857 | | /// The origin domains that are permitted to make a request against the storage service via CORS. The origin dom |
| | 16858 | | /// </summary> |
| 92 | 16859 | | public string AllowedOrigins { get; set; } |
| | 16860 | |
|
| | 16861 | | /// <summary> |
| | 16862 | | /// The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated) |
| | 16863 | | /// </summary> |
| 92 | 16864 | | public string AllowedMethods { get; set; } |
| | 16865 | |
|
| | 16866 | | /// <summary> |
| | 16867 | | /// the request headers that the origin domain may specify on the CORS request. |
| | 16868 | | /// </summary> |
| 92 | 16869 | | public string AllowedHeaders { get; set; } |
| | 16870 | |
|
| | 16871 | | /// <summary> |
| | 16872 | | /// The response headers that may be sent in the response to the CORS request and exposed by the browser to the |
| | 16873 | | /// </summary> |
| 92 | 16874 | | public string ExposedHeaders { get; set; } |
| | 16875 | |
|
| | 16876 | | /// <summary> |
| | 16877 | | /// The maximum amount time that a browser should cache the preflight OPTIONS request. |
| | 16878 | | /// </summary> |
| 96 | 16879 | | public int MaxAgeInSeconds { get; set; } |
| | 16880 | |
|
| | 16881 | | /// <summary> |
| | 16882 | | /// Creates a new BlobCorsRule instance |
| | 16883 | | /// </summary> |
| 96 | 16884 | | public BlobCorsRule() { } |
| | 16885 | |
|
| | 16886 | | /// <summary> |
| | 16887 | | /// Serialize a BlobCorsRule instance as XML. |
| | 16888 | | /// </summary> |
| | 16889 | | /// <param name="value">The BlobCorsRule instance to serialize.</param> |
| | 16890 | | /// <param name="name">An optional name to use for the root element instead of "CorsRule".</param> |
| | 16891 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 16892 | | /// <returns>The serialized XML element.</returns> |
| | 16893 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.BlobCorsRule value, string name = "Cor |
| | 16894 | | { |
| | 16895 | | System.Diagnostics.Debug.Assert(value != null); |
| 44 | 16896 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| 44 | 16897 | | _element.Add(new System.Xml.Linq.XElement( |
| 44 | 16898 | | System.Xml.Linq.XName.Get("AllowedOrigins", ""), |
| 44 | 16899 | | value.AllowedOrigins)); |
| 44 | 16900 | | _element.Add(new System.Xml.Linq.XElement( |
| 44 | 16901 | | System.Xml.Linq.XName.Get("AllowedMethods", ""), |
| 44 | 16902 | | value.AllowedMethods)); |
| 44 | 16903 | | _element.Add(new System.Xml.Linq.XElement( |
| 44 | 16904 | | System.Xml.Linq.XName.Get("AllowedHeaders", ""), |
| 44 | 16905 | | value.AllowedHeaders)); |
| 44 | 16906 | | _element.Add(new System.Xml.Linq.XElement( |
| 44 | 16907 | | System.Xml.Linq.XName.Get("ExposedHeaders", ""), |
| 44 | 16908 | | value.ExposedHeaders)); |
| 44 | 16909 | | _element.Add(new System.Xml.Linq.XElement( |
| 44 | 16910 | | System.Xml.Linq.XName.Get("MaxAgeInSeconds", ""), |
| 44 | 16911 | | value.MaxAgeInSeconds.ToString(System.Globalization.CultureInfo.InvariantCulture))); |
| 44 | 16912 | | return _element; |
| | 16913 | | } |
| | 16914 | |
|
| | 16915 | | /// <summary> |
| | 16916 | | /// Deserializes XML into a new BlobCorsRule instance. |
| | 16917 | | /// </summary> |
| | 16918 | | /// <param name="element">The XML element to deserialize.</param> |
| | 16919 | | /// <returns>A deserialized BlobCorsRule instance.</returns> |
| | 16920 | | internal static Azure.Storage.Blobs.Models.BlobCorsRule FromXml(System.Xml.Linq.XElement element) |
| | 16921 | | { |
| | 16922 | | System.Diagnostics.Debug.Assert(element != null); |
| | 16923 | | System.Xml.Linq.XElement _child; |
| 44 | 16924 | | Azure.Storage.Blobs.Models.BlobCorsRule _value = new Azure.Storage.Blobs.Models.BlobCorsRule(); |
| 44 | 16925 | | _child = element.Element(System.Xml.Linq.XName.Get("AllowedOrigins", "")); |
| 44 | 16926 | | if (_child != null) |
| | 16927 | | { |
| 44 | 16928 | | _value.AllowedOrigins = _child.Value; |
| | 16929 | | } |
| 44 | 16930 | | _child = element.Element(System.Xml.Linq.XName.Get("AllowedMethods", "")); |
| 44 | 16931 | | if (_child != null) |
| | 16932 | | { |
| 44 | 16933 | | _value.AllowedMethods = _child.Value; |
| | 16934 | | } |
| 44 | 16935 | | _child = element.Element(System.Xml.Linq.XName.Get("AllowedHeaders", "")); |
| 44 | 16936 | | if (_child != null) |
| | 16937 | | { |
| 44 | 16938 | | _value.AllowedHeaders = _child.Value; |
| | 16939 | | } |
| 44 | 16940 | | _child = element.Element(System.Xml.Linq.XName.Get("ExposedHeaders", "")); |
| 44 | 16941 | | if (_child != null) |
| | 16942 | | { |
| 44 | 16943 | | _value.ExposedHeaders = _child.Value; |
| | 16944 | | } |
| 44 | 16945 | | _child = element.Element(System.Xml.Linq.XName.Get("MaxAgeInSeconds", "")); |
| 44 | 16946 | | if (_child != null) |
| | 16947 | | { |
| 44 | 16948 | | _value.MaxAgeInSeconds = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 16949 | | } |
| | 16950 | | CustomizeFromXml(element, _value); |
| 44 | 16951 | | return _value; |
| | 16952 | | } |
| | 16953 | |
|
| | 16954 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobCorsRule v |
| | 16955 | | } |
| | 16956 | | } |
| | 16957 | | #endregion class BlobCorsRule |
| | 16958 | |
|
| | 16959 | | #region enum strings BlobErrorCode |
| | 16960 | | namespace Azure.Storage.Blobs.Models |
| | 16961 | | { |
| | 16962 | | /// <summary> |
| | 16963 | | /// Error codes returned by the service |
| | 16964 | | /// </summary> |
| | 16965 | | public readonly struct BlobErrorCode : System.IEquatable<BlobErrorCode> |
| | 16966 | | { |
| | 16967 | | /// <summary> |
| | 16968 | | /// The BlobErrorCode value. |
| | 16969 | | /// </summary> |
| | 16970 | | private readonly string _value; |
| | 16971 | |
|
| | 16972 | | /// <summary> |
| | 16973 | | /// Initializes a new instance of the <see cref="BlobErrorCode"/> structure. |
| | 16974 | | /// </summary> |
| | 16975 | | /// <param name="value">The string value of the instance.</param> |
| | 16976 | | public BlobErrorCode(string value) { _value = value ?? throw new System.ArgumentNullException(nameof(value)); } |
| | 16977 | |
|
| | 16978 | | /// <summary> |
| | 16979 | | /// AccountAlreadyExists |
| | 16980 | | /// </summary> |
| | 16981 | | public static Azure.Storage.Blobs.Models.BlobErrorCode AccountAlreadyExists { get; } = new BlobErrorCode(@"Accou |
| | 16982 | |
|
| | 16983 | | /// <summary> |
| | 16984 | | /// AccountBeingCreated |
| | 16985 | | /// </summary> |
| | 16986 | | public static Azure.Storage.Blobs.Models.BlobErrorCode AccountBeingCreated { get; } = new BlobErrorCode(@"Accoun |
| | 16987 | |
|
| | 16988 | | /// <summary> |
| | 16989 | | /// AccountIsDisabled |
| | 16990 | | /// </summary> |
| | 16991 | | public static Azure.Storage.Blobs.Models.BlobErrorCode AccountIsDisabled { get; } = new BlobErrorCode(@"AccountI |
| | 16992 | |
|
| | 16993 | | /// <summary> |
| | 16994 | | /// AuthenticationFailed |
| | 16995 | | /// </summary> |
| | 16996 | | public static Azure.Storage.Blobs.Models.BlobErrorCode AuthenticationFailed { get; } = new BlobErrorCode(@"Authe |
| | 16997 | |
|
| | 16998 | | /// <summary> |
| | 16999 | | /// AuthorizationFailure |
| | 17000 | | /// </summary> |
| | 17001 | | public static Azure.Storage.Blobs.Models.BlobErrorCode AuthorizationFailure { get; } = new BlobErrorCode(@"Autho |
| | 17002 | |
|
| | 17003 | | /// <summary> |
| | 17004 | | /// ConditionHeadersNotSupported |
| | 17005 | | /// </summary> |
| | 17006 | | public static Azure.Storage.Blobs.Models.BlobErrorCode ConditionHeadersNotSupported { get; } = new BlobErrorCode |
| | 17007 | |
|
| | 17008 | | /// <summary> |
| | 17009 | | /// ConditionNotMet |
| | 17010 | | /// </summary> |
| | 17011 | | public static Azure.Storage.Blobs.Models.BlobErrorCode ConditionNotMet { get; } = new BlobErrorCode(@"ConditionN |
| | 17012 | |
|
| | 17013 | | /// <summary> |
| | 17014 | | /// EmptyMetadataKey |
| | 17015 | | /// </summary> |
| | 17016 | | public static Azure.Storage.Blobs.Models.BlobErrorCode EmptyMetadataKey { get; } = new BlobErrorCode(@"EmptyMeta |
| | 17017 | |
|
| | 17018 | | /// <summary> |
| | 17019 | | /// InsufficientAccountPermissions |
| | 17020 | | /// </summary> |
| | 17021 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InsufficientAccountPermissions { get; } = new BlobErrorCo |
| | 17022 | |
|
| | 17023 | | /// <summary> |
| | 17024 | | /// InternalError |
| | 17025 | | /// </summary> |
| | 17026 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InternalError { get; } = new BlobErrorCode(@"InternalErro |
| | 17027 | |
|
| | 17028 | | /// <summary> |
| | 17029 | | /// InvalidAuthenticationInfo |
| | 17030 | | /// </summary> |
| | 17031 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidAuthenticationInfo { get; } = new BlobErrorCode(@" |
| | 17032 | |
|
| | 17033 | | /// <summary> |
| | 17034 | | /// InvalidHeaderValue |
| | 17035 | | /// </summary> |
| | 17036 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidHeaderValue { get; } = new BlobErrorCode(@"Invalid |
| | 17037 | |
|
| | 17038 | | /// <summary> |
| | 17039 | | /// InvalidHttpVerb |
| | 17040 | | /// </summary> |
| | 17041 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidHttpVerb { get; } = new BlobErrorCode(@"InvalidHtt |
| | 17042 | |
|
| | 17043 | | /// <summary> |
| | 17044 | | /// InvalidInput |
| | 17045 | | /// </summary> |
| | 17046 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidInput { get; } = new BlobErrorCode(@"InvalidInput" |
| | 17047 | |
|
| | 17048 | | /// <summary> |
| | 17049 | | /// InvalidMd5 |
| | 17050 | | /// </summary> |
| | 17051 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidMd5 { get; } = new BlobErrorCode(@"InvalidMd5"); |
| | 17052 | |
|
| | 17053 | | /// <summary> |
| | 17054 | | /// InvalidMetadata |
| | 17055 | | /// </summary> |
| | 17056 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidMetadata { get; } = new BlobErrorCode(@"InvalidMet |
| | 17057 | |
|
| | 17058 | | /// <summary> |
| | 17059 | | /// InvalidQueryParameterValue |
| | 17060 | | /// </summary> |
| | 17061 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidQueryParameterValue { get; } = new BlobErrorCode(@ |
| | 17062 | |
|
| | 17063 | | /// <summary> |
| | 17064 | | /// InvalidRange |
| | 17065 | | /// </summary> |
| | 17066 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidRange { get; } = new BlobErrorCode(@"InvalidRange" |
| | 17067 | |
|
| | 17068 | | /// <summary> |
| | 17069 | | /// InvalidResourceName |
| | 17070 | | /// </summary> |
| | 17071 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidResourceName { get; } = new BlobErrorCode(@"Invali |
| | 17072 | |
|
| | 17073 | | /// <summary> |
| | 17074 | | /// InvalidUri |
| | 17075 | | /// </summary> |
| | 17076 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidUri { get; } = new BlobErrorCode(@"InvalidUri"); |
| | 17077 | |
|
| | 17078 | | /// <summary> |
| | 17079 | | /// InvalidXmlDocument |
| | 17080 | | /// </summary> |
| | 17081 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidXmlDocument { get; } = new BlobErrorCode(@"Invalid |
| | 17082 | |
|
| | 17083 | | /// <summary> |
| | 17084 | | /// InvalidXmlNodeValue |
| | 17085 | | /// </summary> |
| | 17086 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidXmlNodeValue { get; } = new BlobErrorCode(@"Invali |
| | 17087 | |
|
| | 17088 | | /// <summary> |
| | 17089 | | /// Md5Mismatch |
| | 17090 | | /// </summary> |
| | 17091 | | public static Azure.Storage.Blobs.Models.BlobErrorCode Md5Mismatch { get; } = new BlobErrorCode(@"Md5Mismatch"); |
| | 17092 | |
|
| | 17093 | | /// <summary> |
| | 17094 | | /// MetadataTooLarge |
| | 17095 | | /// </summary> |
| | 17096 | | public static Azure.Storage.Blobs.Models.BlobErrorCode MetadataTooLarge { get; } = new BlobErrorCode(@"MetadataT |
| | 17097 | |
|
| | 17098 | | /// <summary> |
| | 17099 | | /// MissingContentLengthHeader |
| | 17100 | | /// </summary> |
| | 17101 | | public static Azure.Storage.Blobs.Models.BlobErrorCode MissingContentLengthHeader { get; } = new BlobErrorCode(@ |
| | 17102 | |
|
| | 17103 | | /// <summary> |
| | 17104 | | /// MissingRequiredQueryParameter |
| | 17105 | | /// </summary> |
| | 17106 | | public static Azure.Storage.Blobs.Models.BlobErrorCode MissingRequiredQueryParameter { get; } = new BlobErrorCod |
| | 17107 | |
|
| | 17108 | | /// <summary> |
| | 17109 | | /// MissingRequiredHeader |
| | 17110 | | /// </summary> |
| | 17111 | | public static Azure.Storage.Blobs.Models.BlobErrorCode MissingRequiredHeader { get; } = new BlobErrorCode(@"Miss |
| | 17112 | |
|
| | 17113 | | /// <summary> |
| | 17114 | | /// MissingRequiredXmlNode |
| | 17115 | | /// </summary> |
| | 17116 | | public static Azure.Storage.Blobs.Models.BlobErrorCode MissingRequiredXmlNode { get; } = new BlobErrorCode(@"Mis |
| | 17117 | |
|
| | 17118 | | /// <summary> |
| | 17119 | | /// MultipleConditionHeadersNotSupported |
| | 17120 | | /// </summary> |
| | 17121 | | public static Azure.Storage.Blobs.Models.BlobErrorCode MultipleConditionHeadersNotSupported { get; } = new BlobE |
| | 17122 | |
|
| | 17123 | | /// <summary> |
| | 17124 | | /// OperationTimedOut |
| | 17125 | | /// </summary> |
| | 17126 | | public static Azure.Storage.Blobs.Models.BlobErrorCode OperationTimedOut { get; } = new BlobErrorCode(@"Operatio |
| | 17127 | |
|
| | 17128 | | /// <summary> |
| | 17129 | | /// OutOfRangeInput |
| | 17130 | | /// </summary> |
| | 17131 | | public static Azure.Storage.Blobs.Models.BlobErrorCode OutOfRangeInput { get; } = new BlobErrorCode(@"OutOfRange |
| | 17132 | |
|
| | 17133 | | /// <summary> |
| | 17134 | | /// OutOfRangeQueryParameterValue |
| | 17135 | | /// </summary> |
| | 17136 | | public static Azure.Storage.Blobs.Models.BlobErrorCode OutOfRangeQueryParameterValue { get; } = new BlobErrorCod |
| | 17137 | |
|
| | 17138 | | /// <summary> |
| | 17139 | | /// RequestBodyTooLarge |
| | 17140 | | /// </summary> |
| | 17141 | | public static Azure.Storage.Blobs.Models.BlobErrorCode RequestBodyTooLarge { get; } = new BlobErrorCode(@"Reques |
| | 17142 | |
|
| | 17143 | | /// <summary> |
| | 17144 | | /// ResourceTypeMismatch |
| | 17145 | | /// </summary> |
| | 17146 | | public static Azure.Storage.Blobs.Models.BlobErrorCode ResourceTypeMismatch { get; } = new BlobErrorCode(@"Resou |
| | 17147 | |
|
| | 17148 | | /// <summary> |
| | 17149 | | /// RequestUrlFailedToParse |
| | 17150 | | /// </summary> |
| | 17151 | | public static Azure.Storage.Blobs.Models.BlobErrorCode RequestUrlFailedToParse { get; } = new BlobErrorCode(@"Re |
| | 17152 | |
|
| | 17153 | | /// <summary> |
| | 17154 | | /// ResourceAlreadyExists |
| | 17155 | | /// </summary> |
| | 17156 | | public static Azure.Storage.Blobs.Models.BlobErrorCode ResourceAlreadyExists { get; } = new BlobErrorCode(@"Reso |
| | 17157 | |
|
| | 17158 | | /// <summary> |
| | 17159 | | /// ResourceNotFound |
| | 17160 | | /// </summary> |
| | 17161 | | public static Azure.Storage.Blobs.Models.BlobErrorCode ResourceNotFound { get; } = new BlobErrorCode(@"ResourceN |
| | 17162 | |
|
| | 17163 | | /// <summary> |
| | 17164 | | /// ServerBusy |
| | 17165 | | /// </summary> |
| | 17166 | | public static Azure.Storage.Blobs.Models.BlobErrorCode ServerBusy { get; } = new BlobErrorCode(@"ServerBusy"); |
| | 17167 | |
|
| | 17168 | | /// <summary> |
| | 17169 | | /// UnsupportedHeader |
| | 17170 | | /// </summary> |
| | 17171 | | public static Azure.Storage.Blobs.Models.BlobErrorCode UnsupportedHeader { get; } = new BlobErrorCode(@"Unsuppor |
| | 17172 | |
|
| | 17173 | | /// <summary> |
| | 17174 | | /// UnsupportedXmlNode |
| | 17175 | | /// </summary> |
| | 17176 | | public static Azure.Storage.Blobs.Models.BlobErrorCode UnsupportedXmlNode { get; } = new BlobErrorCode(@"Unsuppo |
| | 17177 | |
|
| | 17178 | | /// <summary> |
| | 17179 | | /// UnsupportedQueryParameter |
| | 17180 | | /// </summary> |
| | 17181 | | public static Azure.Storage.Blobs.Models.BlobErrorCode UnsupportedQueryParameter { get; } = new BlobErrorCode(@" |
| | 17182 | |
|
| | 17183 | | /// <summary> |
| | 17184 | | /// UnsupportedHttpVerb |
| | 17185 | | /// </summary> |
| | 17186 | | public static Azure.Storage.Blobs.Models.BlobErrorCode UnsupportedHttpVerb { get; } = new BlobErrorCode(@"Unsupp |
| | 17187 | |
|
| | 17188 | | /// <summary> |
| | 17189 | | /// AppendPositionConditionNotMet |
| | 17190 | | /// </summary> |
| | 17191 | | public static Azure.Storage.Blobs.Models.BlobErrorCode AppendPositionConditionNotMet { get; } = new BlobErrorCod |
| | 17192 | |
|
| | 17193 | | /// <summary> |
| | 17194 | | /// BlobAlreadyExists |
| | 17195 | | /// </summary> |
| | 17196 | | public static Azure.Storage.Blobs.Models.BlobErrorCode BlobAlreadyExists { get; } = new BlobErrorCode(@"BlobAlre |
| | 17197 | |
|
| | 17198 | | /// <summary> |
| | 17199 | | /// BlobNotFound |
| | 17200 | | /// </summary> |
| | 17201 | | public static Azure.Storage.Blobs.Models.BlobErrorCode BlobNotFound { get; } = new BlobErrorCode(@"BlobNotFound" |
| | 17202 | |
|
| | 17203 | | /// <summary> |
| | 17204 | | /// BlobOverwritten |
| | 17205 | | /// </summary> |
| | 17206 | | public static Azure.Storage.Blobs.Models.BlobErrorCode BlobOverwritten { get; } = new BlobErrorCode(@"BlobOverwr |
| | 17207 | |
|
| | 17208 | | /// <summary> |
| | 17209 | | /// BlobTierInadequateForContentLength |
| | 17210 | | /// </summary> |
| | 17211 | | public static Azure.Storage.Blobs.Models.BlobErrorCode BlobTierInadequateForContentLength { get; } = new BlobErr |
| | 17212 | |
|
| | 17213 | | /// <summary> |
| | 17214 | | /// BlockCountExceedsLimit |
| | 17215 | | /// </summary> |
| | 17216 | | public static Azure.Storage.Blobs.Models.BlobErrorCode BlockCountExceedsLimit { get; } = new BlobErrorCode(@"Blo |
| | 17217 | |
|
| | 17218 | | /// <summary> |
| | 17219 | | /// BlockListTooLong |
| | 17220 | | /// </summary> |
| | 17221 | | public static Azure.Storage.Blobs.Models.BlobErrorCode BlockListTooLong { get; } = new BlobErrorCode(@"BlockList |
| | 17222 | |
|
| | 17223 | | /// <summary> |
| | 17224 | | /// CannotChangeToLowerTier |
| | 17225 | | /// </summary> |
| | 17226 | | public static Azure.Storage.Blobs.Models.BlobErrorCode CannotChangeToLowerTier { get; } = new BlobErrorCode(@"Ca |
| | 17227 | |
|
| | 17228 | | /// <summary> |
| | 17229 | | /// CannotVerifyCopySource |
| | 17230 | | /// </summary> |
| | 17231 | | public static Azure.Storage.Blobs.Models.BlobErrorCode CannotVerifyCopySource { get; } = new BlobErrorCode(@"Can |
| | 17232 | |
|
| | 17233 | | /// <summary> |
| | 17234 | | /// ContainerAlreadyExists |
| | 17235 | | /// </summary> |
| | 17236 | | public static Azure.Storage.Blobs.Models.BlobErrorCode ContainerAlreadyExists { get; } = new BlobErrorCode(@"Con |
| | 17237 | |
|
| | 17238 | | /// <summary> |
| | 17239 | | /// ContainerBeingDeleted |
| | 17240 | | /// </summary> |
| | 17241 | | public static Azure.Storage.Blobs.Models.BlobErrorCode ContainerBeingDeleted { get; } = new BlobErrorCode(@"Cont |
| | 17242 | |
|
| | 17243 | | /// <summary> |
| | 17244 | | /// ContainerDisabled |
| | 17245 | | /// </summary> |
| | 17246 | | public static Azure.Storage.Blobs.Models.BlobErrorCode ContainerDisabled { get; } = new BlobErrorCode(@"Containe |
| | 17247 | |
|
| | 17248 | | /// <summary> |
| | 17249 | | /// ContainerNotFound |
| | 17250 | | /// </summary> |
| | 17251 | | public static Azure.Storage.Blobs.Models.BlobErrorCode ContainerNotFound { get; } = new BlobErrorCode(@"Containe |
| | 17252 | |
|
| | 17253 | | /// <summary> |
| | 17254 | | /// ContentLengthLargerThanTierLimit |
| | 17255 | | /// </summary> |
| | 17256 | | public static Azure.Storage.Blobs.Models.BlobErrorCode ContentLengthLargerThanTierLimit { get; } = new BlobError |
| | 17257 | |
|
| | 17258 | | /// <summary> |
| | 17259 | | /// CopyAcrossAccountsNotSupported |
| | 17260 | | /// </summary> |
| | 17261 | | public static Azure.Storage.Blobs.Models.BlobErrorCode CopyAcrossAccountsNotSupported { get; } = new BlobErrorCo |
| | 17262 | |
|
| | 17263 | | /// <summary> |
| | 17264 | | /// CopyIdMismatch |
| | 17265 | | /// </summary> |
| | 17266 | | public static Azure.Storage.Blobs.Models.BlobErrorCode CopyIdMismatch { get; } = new BlobErrorCode(@"CopyIdMisma |
| | 17267 | |
|
| | 17268 | | /// <summary> |
| | 17269 | | /// FeatureVersionMismatch |
| | 17270 | | /// </summary> |
| | 17271 | | public static Azure.Storage.Blobs.Models.BlobErrorCode FeatureVersionMismatch { get; } = new BlobErrorCode(@"Fea |
| | 17272 | |
|
| | 17273 | | /// <summary> |
| | 17274 | | /// IncrementalCopyBlobMismatch |
| | 17275 | | /// </summary> |
| | 17276 | | public static Azure.Storage.Blobs.Models.BlobErrorCode IncrementalCopyBlobMismatch { get; } = new BlobErrorCode( |
| | 17277 | |
|
| | 17278 | | /// <summary> |
| | 17279 | | /// IncrementalCopyOfEralierVersionSnapshotNotAllowed |
| | 17280 | | /// </summary> |
| | 17281 | | public static Azure.Storage.Blobs.Models.BlobErrorCode IncrementalCopyOfEralierVersionSnapshotNotAllowed { get; |
| | 17282 | |
|
| | 17283 | | /// <summary> |
| | 17284 | | /// IncrementalCopySourceMustBeSnapshot |
| | 17285 | | /// </summary> |
| | 17286 | | public static Azure.Storage.Blobs.Models.BlobErrorCode IncrementalCopySourceMustBeSnapshot { get; } = new BlobEr |
| | 17287 | |
|
| | 17288 | | /// <summary> |
| | 17289 | | /// InfiniteLeaseDurationRequired |
| | 17290 | | /// </summary> |
| | 17291 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InfiniteLeaseDurationRequired { get; } = new BlobErrorCod |
| | 17292 | |
|
| | 17293 | | /// <summary> |
| | 17294 | | /// InvalidBlobOrBlock |
| | 17295 | | /// </summary> |
| | 17296 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidBlobOrBlock { get; } = new BlobErrorCode(@"Invalid |
| | 17297 | |
|
| | 17298 | | /// <summary> |
| | 17299 | | /// InvalidBlobTier |
| | 17300 | | /// </summary> |
| | 17301 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidBlobTier { get; } = new BlobErrorCode(@"InvalidBlo |
| | 17302 | |
|
| | 17303 | | /// <summary> |
| | 17304 | | /// InvalidBlobType |
| | 17305 | | /// </summary> |
| | 17306 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidBlobType { get; } = new BlobErrorCode(@"InvalidBlo |
| | 17307 | |
|
| | 17308 | | /// <summary> |
| | 17309 | | /// InvalidBlockId |
| | 17310 | | /// </summary> |
| | 17311 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidBlockId { get; } = new BlobErrorCode(@"InvalidBloc |
| | 17312 | |
|
| | 17313 | | /// <summary> |
| | 17314 | | /// InvalidBlockList |
| | 17315 | | /// </summary> |
| | 17316 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidBlockList { get; } = new BlobErrorCode(@"InvalidBl |
| | 17317 | |
|
| | 17318 | | /// <summary> |
| | 17319 | | /// InvalidOperation |
| | 17320 | | /// </summary> |
| | 17321 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidOperation { get; } = new BlobErrorCode(@"InvalidOp |
| | 17322 | |
|
| | 17323 | | /// <summary> |
| | 17324 | | /// InvalidPageRange |
| | 17325 | | /// </summary> |
| | 17326 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidPageRange { get; } = new BlobErrorCode(@"InvalidPa |
| | 17327 | |
|
| | 17328 | | /// <summary> |
| | 17329 | | /// InvalidSourceBlobType |
| | 17330 | | /// </summary> |
| | 17331 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidSourceBlobType { get; } = new BlobErrorCode(@"Inva |
| | 17332 | |
|
| | 17333 | | /// <summary> |
| | 17334 | | /// InvalidSourceBlobUrl |
| | 17335 | | /// </summary> |
| | 17336 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidSourceBlobUrl { get; } = new BlobErrorCode(@"Inval |
| | 17337 | |
|
| | 17338 | | /// <summary> |
| | 17339 | | /// InvalidVersionForPageBlobOperation |
| | 17340 | | /// </summary> |
| | 17341 | | public static Azure.Storage.Blobs.Models.BlobErrorCode InvalidVersionForPageBlobOperation { get; } = new BlobErr |
| | 17342 | |
|
| | 17343 | | /// <summary> |
| | 17344 | | /// LeaseAlreadyPresent |
| | 17345 | | /// </summary> |
| | 17346 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseAlreadyPresent { get; } = new BlobErrorCode(@"LeaseA |
| | 17347 | |
|
| | 17348 | | /// <summary> |
| | 17349 | | /// LeaseAlreadyBroken |
| | 17350 | | /// </summary> |
| | 17351 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseAlreadyBroken { get; } = new BlobErrorCode(@"LeaseAl |
| | 17352 | |
|
| | 17353 | | /// <summary> |
| | 17354 | | /// LeaseIdMismatchWithBlobOperation |
| | 17355 | | /// </summary> |
| | 17356 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseIdMismatchWithBlobOperation { get; } = new BlobError |
| | 17357 | |
|
| | 17358 | | /// <summary> |
| | 17359 | | /// LeaseIdMismatchWithContainerOperation |
| | 17360 | | /// </summary> |
| | 17361 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseIdMismatchWithContainerOperation { get; } = new Blob |
| | 17362 | |
|
| | 17363 | | /// <summary> |
| | 17364 | | /// LeaseIdMismatchWithLeaseOperation |
| | 17365 | | /// </summary> |
| | 17366 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseIdMismatchWithLeaseOperation { get; } = new BlobErro |
| | 17367 | |
|
| | 17368 | | /// <summary> |
| | 17369 | | /// LeaseIdMissing |
| | 17370 | | /// </summary> |
| | 17371 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseIdMissing { get; } = new BlobErrorCode(@"LeaseIdMiss |
| | 17372 | |
|
| | 17373 | | /// <summary> |
| | 17374 | | /// LeaseIsBreakingAndCannotBeAcquired |
| | 17375 | | /// </summary> |
| | 17376 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseIsBreakingAndCannotBeAcquired { get; } = new BlobErr |
| | 17377 | |
|
| | 17378 | | /// <summary> |
| | 17379 | | /// LeaseIsBreakingAndCannotBeChanged |
| | 17380 | | /// </summary> |
| | 17381 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseIsBreakingAndCannotBeChanged { get; } = new BlobErro |
| | 17382 | |
|
| | 17383 | | /// <summary> |
| | 17384 | | /// LeaseIsBrokenAndCannotBeRenewed |
| | 17385 | | /// </summary> |
| | 17386 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseIsBrokenAndCannotBeRenewed { get; } = new BlobErrorC |
| | 17387 | |
|
| | 17388 | | /// <summary> |
| | 17389 | | /// LeaseLost |
| | 17390 | | /// </summary> |
| | 17391 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseLost { get; } = new BlobErrorCode(@"LeaseLost"); |
| | 17392 | |
|
| | 17393 | | /// <summary> |
| | 17394 | | /// LeaseNotPresentWithBlobOperation |
| | 17395 | | /// </summary> |
| | 17396 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseNotPresentWithBlobOperation { get; } = new BlobError |
| | 17397 | |
|
| | 17398 | | /// <summary> |
| | 17399 | | /// LeaseNotPresentWithContainerOperation |
| | 17400 | | /// </summary> |
| | 17401 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseNotPresentWithContainerOperation { get; } = new Blob |
| | 17402 | |
|
| | 17403 | | /// <summary> |
| | 17404 | | /// LeaseNotPresentWithLeaseOperation |
| | 17405 | | /// </summary> |
| | 17406 | | public static Azure.Storage.Blobs.Models.BlobErrorCode LeaseNotPresentWithLeaseOperation { get; } = new BlobErro |
| | 17407 | |
|
| | 17408 | | /// <summary> |
| | 17409 | | /// MaxBlobSizeConditionNotMet |
| | 17410 | | /// </summary> |
| | 17411 | | public static Azure.Storage.Blobs.Models.BlobErrorCode MaxBlobSizeConditionNotMet { get; } = new BlobErrorCode(@ |
| | 17412 | |
|
| | 17413 | | /// <summary> |
| | 17414 | | /// NoAuthenticationInformation |
| | 17415 | | /// </summary> |
| | 17416 | | public static Azure.Storage.Blobs.Models.BlobErrorCode NoAuthenticationInformation { get; } = new BlobErrorCode( |
| | 17417 | |
|
| | 17418 | | /// <summary> |
| | 17419 | | /// NoPendingCopyOperation |
| | 17420 | | /// </summary> |
| | 17421 | | public static Azure.Storage.Blobs.Models.BlobErrorCode NoPendingCopyOperation { get; } = new BlobErrorCode(@"NoP |
| | 17422 | |
|
| | 17423 | | /// <summary> |
| | 17424 | | /// OperationNotAllowedOnIncrementalCopyBlob |
| | 17425 | | /// </summary> |
| | 17426 | | public static Azure.Storage.Blobs.Models.BlobErrorCode OperationNotAllowedOnIncrementalCopyBlob { get; } = new B |
| | 17427 | |
|
| | 17428 | | /// <summary> |
| | 17429 | | /// PendingCopyOperation |
| | 17430 | | /// </summary> |
| | 17431 | | public static Azure.Storage.Blobs.Models.BlobErrorCode PendingCopyOperation { get; } = new BlobErrorCode(@"Pendi |
| | 17432 | |
|
| | 17433 | | /// <summary> |
| | 17434 | | /// PreviousSnapshotCannotBeNewer |
| | 17435 | | /// </summary> |
| | 17436 | | public static Azure.Storage.Blobs.Models.BlobErrorCode PreviousSnapshotCannotBeNewer { get; } = new BlobErrorCod |
| | 17437 | |
|
| | 17438 | | /// <summary> |
| | 17439 | | /// PreviousSnapshotNotFound |
| | 17440 | | /// </summary> |
| | 17441 | | public static Azure.Storage.Blobs.Models.BlobErrorCode PreviousSnapshotNotFound { get; } = new BlobErrorCode(@"P |
| | 17442 | |
|
| | 17443 | | /// <summary> |
| | 17444 | | /// PreviousSnapshotOperationNotSupported |
| | 17445 | | /// </summary> |
| | 17446 | | public static Azure.Storage.Blobs.Models.BlobErrorCode PreviousSnapshotOperationNotSupported { get; } = new Blob |
| | 17447 | |
|
| | 17448 | | /// <summary> |
| | 17449 | | /// SequenceNumberConditionNotMet |
| | 17450 | | /// </summary> |
| | 17451 | | public static Azure.Storage.Blobs.Models.BlobErrorCode SequenceNumberConditionNotMet { get; } = new BlobErrorCod |
| | 17452 | |
|
| | 17453 | | /// <summary> |
| | 17454 | | /// SequenceNumberIncrementTooLarge |
| | 17455 | | /// </summary> |
| | 17456 | | public static Azure.Storage.Blobs.Models.BlobErrorCode SequenceNumberIncrementTooLarge { get; } = new BlobErrorC |
| | 17457 | |
|
| | 17458 | | /// <summary> |
| | 17459 | | /// SnapshotCountExceeded |
| | 17460 | | /// </summary> |
| | 17461 | | public static Azure.Storage.Blobs.Models.BlobErrorCode SnapshotCountExceeded { get; } = new BlobErrorCode(@"Snap |
| | 17462 | |
|
| | 17463 | | /// <summary> |
| | 17464 | | /// SnaphotOperationRateExceeded |
| | 17465 | | /// </summary> |
| | 17466 | | public static Azure.Storage.Blobs.Models.BlobErrorCode SnaphotOperationRateExceeded { get; } = new BlobErrorCode |
| | 17467 | |
|
| | 17468 | | /// <summary> |
| | 17469 | | /// SnapshotsPresent |
| | 17470 | | /// </summary> |
| | 17471 | | public static Azure.Storage.Blobs.Models.BlobErrorCode SnapshotsPresent { get; } = new BlobErrorCode(@"Snapshots |
| | 17472 | |
|
| | 17473 | | /// <summary> |
| | 17474 | | /// SourceConditionNotMet |
| | 17475 | | /// </summary> |
| | 17476 | | public static Azure.Storage.Blobs.Models.BlobErrorCode SourceConditionNotMet { get; } = new BlobErrorCode(@"Sour |
| | 17477 | |
|
| | 17478 | | /// <summary> |
| | 17479 | | /// SystemInUse |
| | 17480 | | /// </summary> |
| | 17481 | | public static Azure.Storage.Blobs.Models.BlobErrorCode SystemInUse { get; } = new BlobErrorCode(@"SystemInUse"); |
| | 17482 | |
|
| | 17483 | | /// <summary> |
| | 17484 | | /// TargetConditionNotMet |
| | 17485 | | /// </summary> |
| | 17486 | | public static Azure.Storage.Blobs.Models.BlobErrorCode TargetConditionNotMet { get; } = new BlobErrorCode(@"Targ |
| | 17487 | |
|
| | 17488 | | /// <summary> |
| | 17489 | | /// UnauthorizedBlobOverwrite |
| | 17490 | | /// </summary> |
| | 17491 | | public static Azure.Storage.Blobs.Models.BlobErrorCode UnauthorizedBlobOverwrite { get; } = new BlobErrorCode(@" |
| | 17492 | |
|
| | 17493 | | /// <summary> |
| | 17494 | | /// BlobBeingRehydrated |
| | 17495 | | /// </summary> |
| | 17496 | | public static Azure.Storage.Blobs.Models.BlobErrorCode BlobBeingRehydrated { get; } = new BlobErrorCode(@"BlobBe |
| | 17497 | |
|
| | 17498 | | /// <summary> |
| | 17499 | | /// BlobArchived |
| | 17500 | | /// </summary> |
| | 17501 | | public static Azure.Storage.Blobs.Models.BlobErrorCode BlobArchived { get; } = new BlobErrorCode(@"BlobArchived" |
| | 17502 | |
|
| | 17503 | | /// <summary> |
| | 17504 | | /// BlobNotArchived |
| | 17505 | | /// </summary> |
| | 17506 | | public static Azure.Storage.Blobs.Models.BlobErrorCode BlobNotArchived { get; } = new BlobErrorCode(@"BlobNotArc |
| | 17507 | |
|
| | 17508 | | /// <summary> |
| | 17509 | | /// AuthorizationSourceIPMismatch |
| | 17510 | | /// </summary> |
| | 17511 | | public static Azure.Storage.Blobs.Models.BlobErrorCode AuthorizationSourceIPMismatch { get; } = new BlobErrorCod |
| | 17512 | |
|
| | 17513 | | /// <summary> |
| | 17514 | | /// AuthorizationProtocolMismatch |
| | 17515 | | /// </summary> |
| | 17516 | | public static Azure.Storage.Blobs.Models.BlobErrorCode AuthorizationProtocolMismatch { get; } = new BlobErrorCod |
| | 17517 | |
|
| | 17518 | | /// <summary> |
| | 17519 | | /// AuthorizationPermissionMismatch |
| | 17520 | | /// </summary> |
| | 17521 | | public static Azure.Storage.Blobs.Models.BlobErrorCode AuthorizationPermissionMismatch { get; } = new BlobErrorC |
| | 17522 | |
|
| | 17523 | | /// <summary> |
| | 17524 | | /// AuthorizationServiceMismatch |
| | 17525 | | /// </summary> |
| | 17526 | | public static Azure.Storage.Blobs.Models.BlobErrorCode AuthorizationServiceMismatch { get; } = new BlobErrorCode |
| | 17527 | |
|
| | 17528 | | /// <summary> |
| | 17529 | | /// AuthorizationResourceTypeMismatch |
| | 17530 | | /// </summary> |
| | 17531 | | public static Azure.Storage.Blobs.Models.BlobErrorCode AuthorizationResourceTypeMismatch { get; } = new BlobErro |
| | 17532 | |
|
| | 17533 | | /// <summary> |
| | 17534 | | /// Determines if two <see cref="BlobErrorCode"/> values are the same. |
| | 17535 | | /// </summary> |
| | 17536 | | /// <param name="left">The first <see cref="BlobErrorCode"/> to compare.</param> |
| | 17537 | | /// <param name="right">The second <see cref="BlobErrorCode"/> to compare.</param> |
| | 17538 | | /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are the same; otherwise, false.</retur |
| | 17539 | | public static bool operator ==(Azure.Storage.Blobs.Models.BlobErrorCode left, Azure.Storage.Blobs.Models.BlobErr |
| | 17540 | |
|
| | 17541 | | /// <summary> |
| | 17542 | | /// Determines if two <see cref="BlobErrorCode"/> values are different. |
| | 17543 | | /// </summary> |
| | 17544 | | /// <param name="left">The first <see cref="BlobErrorCode"/> to compare.</param> |
| | 17545 | | /// <param name="right">The second <see cref="BlobErrorCode"/> to compare.</param> |
| | 17546 | | /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are different; otherwise, false.</retu |
| | 17547 | | public static bool operator !=(Azure.Storage.Blobs.Models.BlobErrorCode left, Azure.Storage.Blobs.Models.BlobErr |
| | 17548 | |
|
| | 17549 | | /// <summary> |
| | 17550 | | /// Converts a string to a <see cref="BlobErrorCode"/>. |
| | 17551 | | /// </summary> |
| | 17552 | | /// <param name="value">The string value to convert.</param> |
| | 17553 | | /// <returns>The BlobErrorCode value.</returns> |
| | 17554 | | public static implicit operator BlobErrorCode(string value) => new Azure.Storage.Blobs.Models.BlobErrorCode(valu |
| | 17555 | |
|
| | 17556 | | /// <summary> |
| | 17557 | | /// Check if two <see cref="BlobErrorCode"/> instances are equal. |
| | 17558 | | /// </summary> |
| | 17559 | | /// <param name="obj">The instance to compare to.</param> |
| | 17560 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 17561 | | [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] |
| | 17562 | | public override bool Equals(object obj) => obj is Azure.Storage.Blobs.Models.BlobErrorCode other && Equals(other |
| | 17563 | |
|
| | 17564 | | /// <summary> |
| | 17565 | | /// Check if two <see cref="BlobErrorCode"/> instances are equal. |
| | 17566 | | /// </summary> |
| | 17567 | | /// <param name="other">The instance to compare to.</param> |
| | 17568 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 17569 | | public bool Equals(Azure.Storage.Blobs.Models.BlobErrorCode other) => string.Equals(_value, other._value, System |
| | 17570 | |
|
| | 17571 | | /// <summary> |
| | 17572 | | /// Get a hash code for the <see cref="BlobErrorCode"/>. |
| | 17573 | | /// </summary> |
| | 17574 | | /// <returns>Hash code for the BlobErrorCode.</returns> |
| | 17575 | | [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] |
| | 17576 | | public override int GetHashCode() => _value?.GetHashCode() ?? 0; |
| | 17577 | |
|
| | 17578 | | /// <summary> |
| | 17579 | | /// Convert the <see cref="BlobErrorCode"/> to a string. |
| | 17580 | | /// </summary> |
| | 17581 | | /// <returns>String representation of the BlobErrorCode.</returns> |
| | 17582 | | public override string ToString() => _value; |
| | 17583 | | } |
| | 17584 | | } |
| | 17585 | | #endregion enum strings BlobErrorCode |
| | 17586 | |
|
| | 17587 | | #region enum strings BlobExpiryOptions |
| | 17588 | | namespace Azure.Storage.Blobs.Models |
| | 17589 | | { |
| | 17590 | | /// <summary> |
| | 17591 | | /// Required. Indicates mode of the expiry time |
| | 17592 | | /// </summary> |
| | 17593 | | internal readonly struct BlobExpiryOptions : System.IEquatable<BlobExpiryOptions> |
| | 17594 | | { |
| | 17595 | | /// <summary> |
| | 17596 | | /// The BlobExpiryOptions value. |
| | 17597 | | /// </summary> |
| | 17598 | | private readonly string _value; |
| | 17599 | |
|
| | 17600 | | /// <summary> |
| | 17601 | | /// Initializes a new instance of the <see cref="BlobExpiryOptions"/> structure. |
| | 17602 | | /// </summary> |
| | 17603 | | /// <param name="value">The string value of the instance.</param> |
| | 17604 | | public BlobExpiryOptions(string value) { _value = value ?? throw new System.ArgumentNullException(nameof(value)) |
| | 17605 | |
|
| | 17606 | | /// <summary> |
| | 17607 | | /// NeverExpire |
| | 17608 | | /// </summary> |
| | 17609 | | public static Azure.Storage.Blobs.Models.BlobExpiryOptions NeverExpire { get; } = new BlobExpiryOptions(@"NeverE |
| | 17610 | |
|
| | 17611 | | /// <summary> |
| | 17612 | | /// RelativeToCreation |
| | 17613 | | /// </summary> |
| | 17614 | | public static Azure.Storage.Blobs.Models.BlobExpiryOptions RelativeToCreation { get; } = new BlobExpiryOptions(@ |
| | 17615 | |
|
| | 17616 | | /// <summary> |
| | 17617 | | /// RelativeToNow |
| | 17618 | | /// </summary> |
| | 17619 | | public static Azure.Storage.Blobs.Models.BlobExpiryOptions RelativeToNow { get; } = new BlobExpiryOptions(@"Rela |
| | 17620 | |
|
| | 17621 | | /// <summary> |
| | 17622 | | /// Absolute |
| | 17623 | | /// </summary> |
| | 17624 | | public static Azure.Storage.Blobs.Models.BlobExpiryOptions Absolute { get; } = new BlobExpiryOptions(@"Absolute" |
| | 17625 | |
|
| | 17626 | | /// <summary> |
| | 17627 | | /// Determines if two <see cref="BlobExpiryOptions"/> values are the same. |
| | 17628 | | /// </summary> |
| | 17629 | | /// <param name="left">The first <see cref="BlobExpiryOptions"/> to compare.</param> |
| | 17630 | | /// <param name="right">The second <see cref="BlobExpiryOptions"/> to compare.</param> |
| | 17631 | | /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are the same; otherwise, false.</retur |
| | 17632 | | public static bool operator ==(Azure.Storage.Blobs.Models.BlobExpiryOptions left, Azure.Storage.Blobs.Models.Blo |
| | 17633 | |
|
| | 17634 | | /// <summary> |
| | 17635 | | /// Determines if two <see cref="BlobExpiryOptions"/> values are different. |
| | 17636 | | /// </summary> |
| | 17637 | | /// <param name="left">The first <see cref="BlobExpiryOptions"/> to compare.</param> |
| | 17638 | | /// <param name="right">The second <see cref="BlobExpiryOptions"/> to compare.</param> |
| | 17639 | | /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are different; otherwise, false.</retu |
| | 17640 | | public static bool operator !=(Azure.Storage.Blobs.Models.BlobExpiryOptions left, Azure.Storage.Blobs.Models.Blo |
| | 17641 | |
|
| | 17642 | | /// <summary> |
| | 17643 | | /// Converts a string to a <see cref="BlobExpiryOptions"/>. |
| | 17644 | | /// </summary> |
| | 17645 | | /// <param name="value">The string value to convert.</param> |
| | 17646 | | /// <returns>The BlobExpiryOptions value.</returns> |
| | 17647 | | public static implicit operator BlobExpiryOptions(string value) => new Azure.Storage.Blobs.Models.BlobExpiryOpti |
| | 17648 | |
|
| | 17649 | | /// <summary> |
| | 17650 | | /// Check if two <see cref="BlobExpiryOptions"/> instances are equal. |
| | 17651 | | /// </summary> |
| | 17652 | | /// <param name="obj">The instance to compare to.</param> |
| | 17653 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 17654 | | [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] |
| | 17655 | | public override bool Equals(object obj) => obj is Azure.Storage.Blobs.Models.BlobExpiryOptions other && Equals(o |
| | 17656 | |
|
| | 17657 | | /// <summary> |
| | 17658 | | /// Check if two <see cref="BlobExpiryOptions"/> instances are equal. |
| | 17659 | | /// </summary> |
| | 17660 | | /// <param name="other">The instance to compare to.</param> |
| | 17661 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 17662 | | public bool Equals(Azure.Storage.Blobs.Models.BlobExpiryOptions other) => string.Equals(_value, other._value, Sy |
| | 17663 | |
|
| | 17664 | | /// <summary> |
| | 17665 | | /// Get a hash code for the <see cref="BlobExpiryOptions"/>. |
| | 17666 | | /// </summary> |
| | 17667 | | /// <returns>Hash code for the BlobExpiryOptions.</returns> |
| | 17668 | | [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] |
| | 17669 | | public override int GetHashCode() => _value?.GetHashCode() ?? 0; |
| | 17670 | |
|
| | 17671 | | /// <summary> |
| | 17672 | | /// Convert the <see cref="BlobExpiryOptions"/> to a string. |
| | 17673 | | /// </summary> |
| | 17674 | | /// <returns>String representation of the BlobExpiryOptions.</returns> |
| | 17675 | | public override string ToString() => _value; |
| | 17676 | | } |
| | 17677 | | } |
| | 17678 | | #endregion enum strings BlobExpiryOptions |
| | 17679 | |
|
| | 17680 | | #region class BlobGeoReplication |
| | 17681 | | namespace Azure.Storage.Blobs.Models |
| | 17682 | | { |
| | 17683 | | /// <summary> |
| | 17684 | | /// Geo-Replication information for the Secondary Storage Service |
| | 17685 | | /// </summary> |
| | 17686 | | public partial class BlobGeoReplication |
| | 17687 | | { |
| | 17688 | | /// <summary> |
| | 17689 | | /// The status of the secondary location |
| | 17690 | | /// </summary> |
| | 17691 | | public Azure.Storage.Blobs.Models.BlobGeoReplicationStatus Status { get; internal set; } |
| | 17692 | |
|
| | 17693 | | /// <summary> |
| | 17694 | | /// A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available |
| | 17695 | | /// </summary> |
| | 17696 | | public System.DateTimeOffset? LastSyncedOn { get; internal set; } |
| | 17697 | |
|
| | 17698 | | /// <summary> |
| | 17699 | | /// Prevent direct instantiation of BlobGeoReplication instances. |
| | 17700 | | /// You can use BlobsModelFactory.BlobGeoReplication instead. |
| | 17701 | | /// </summary> |
| | 17702 | | internal BlobGeoReplication() { } |
| | 17703 | |
|
| | 17704 | | /// <summary> |
| | 17705 | | /// Deserializes XML into a new BlobGeoReplication instance. |
| | 17706 | | /// </summary> |
| | 17707 | | /// <param name="element">The XML element to deserialize.</param> |
| | 17708 | | /// <returns>A deserialized BlobGeoReplication instance.</returns> |
| | 17709 | | internal static Azure.Storage.Blobs.Models.BlobGeoReplication FromXml(System.Xml.Linq.XElement element) |
| | 17710 | | { |
| | 17711 | | System.Diagnostics.Debug.Assert(element != null); |
| | 17712 | | System.Xml.Linq.XElement _child; |
| | 17713 | | Azure.Storage.Blobs.Models.BlobGeoReplication _value = new Azure.Storage.Blobs.Models.BlobGeoReplication(); |
| | 17714 | | _child = element.Element(System.Xml.Linq.XName.Get("Status", "")); |
| | 17715 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 17716 | | { |
| | 17717 | | _value.Status = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseBlobGeoReplicationStatus(_child.Va |
| | 17718 | | } |
| | 17719 | | _child = element.Element(System.Xml.Linq.XName.Get("LastSyncTime", "")); |
| | 17720 | | if (_child != null) |
| | 17721 | | { |
| | 17722 | | _value.LastSyncedOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.Invaria |
| | 17723 | | } |
| | 17724 | | CustomizeFromXml(element, _value); |
| | 17725 | | return _value; |
| | 17726 | | } |
| | 17727 | |
|
| | 17728 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobGeoReplica |
| | 17729 | | } |
| | 17730 | |
|
| | 17731 | | /// <summary> |
| | 17732 | | /// BlobsModelFactory provides utilities for mocking. |
| | 17733 | | /// </summary> |
| | 17734 | | public static partial class BlobsModelFactory |
| | 17735 | | { |
| | 17736 | | /// <summary> |
| | 17737 | | /// Creates a new BlobGeoReplication instance for mocking. |
| | 17738 | | /// </summary> |
| | 17739 | | public static BlobGeoReplication BlobGeoReplication( |
| | 17740 | | Azure.Storage.Blobs.Models.BlobGeoReplicationStatus status, |
| | 17741 | | System.DateTimeOffset? lastSyncedOn = default) |
| | 17742 | | { |
| | 17743 | | return new BlobGeoReplication() |
| | 17744 | | { |
| | 17745 | | Status = status, |
| | 17746 | | LastSyncedOn = lastSyncedOn, |
| | 17747 | | }; |
| | 17748 | | } |
| | 17749 | | } |
| | 17750 | | } |
| | 17751 | | #endregion class BlobGeoReplication |
| | 17752 | |
|
| | 17753 | | #region enum BlobGeoReplicationStatus |
| | 17754 | | namespace Azure.Storage.Blobs.Models |
| | 17755 | | { |
| | 17756 | | /// <summary> |
| | 17757 | | /// The status of the secondary location |
| | 17758 | | /// </summary> |
| | 17759 | | #pragma warning disable CA1717 // Only FlagsAttribute enums should have plural names |
| | 17760 | | public enum BlobGeoReplicationStatus |
| | 17761 | | #pragma warning restore CA1717 // Only FlagsAttribute enums should have plural names |
| | 17762 | | { |
| | 17763 | | /// <summary> |
| | 17764 | | /// live |
| | 17765 | | /// </summary> |
| | 17766 | | Live, |
| | 17767 | |
|
| | 17768 | | /// <summary> |
| | 17769 | | /// bootstrap |
| | 17770 | | /// </summary> |
| | 17771 | | Bootstrap, |
| | 17772 | |
|
| | 17773 | | /// <summary> |
| | 17774 | | /// unavailable |
| | 17775 | | /// </summary> |
| | 17776 | | Unavailable |
| | 17777 | | } |
| | 17778 | | } |
| | 17779 | |
|
| | 17780 | | namespace Azure.Storage.Blobs |
| | 17781 | | { |
| | 17782 | | internal static partial class BlobRestClient |
| | 17783 | | { |
| | 17784 | | public static partial class Serialization |
| | 17785 | | { |
| | 17786 | | public static string ToString(Azure.Storage.Blobs.Models.BlobGeoReplicationStatus value) |
| | 17787 | | { |
| | 17788 | | return value switch |
| | 17789 | | { |
| | 17790 | | Azure.Storage.Blobs.Models.BlobGeoReplicationStatus.Live => "live", |
| | 17791 | | Azure.Storage.Blobs.Models.BlobGeoReplicationStatus.Bootstrap => "bootstrap", |
| | 17792 | | Azure.Storage.Blobs.Models.BlobGeoReplicationStatus.Unavailable => "unavailable", |
| | 17793 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 17794 | | }; |
| | 17795 | | } |
| | 17796 | |
|
| | 17797 | | public static Azure.Storage.Blobs.Models.BlobGeoReplicationStatus ParseBlobGeoReplicationStatus(string value |
| | 17798 | | { |
| | 17799 | | return value switch |
| | 17800 | | { |
| | 17801 | | "live" => Azure.Storage.Blobs.Models.BlobGeoReplicationStatus.Live, |
| | 17802 | | "bootstrap" => Azure.Storage.Blobs.Models.BlobGeoReplicationStatus.Bootstrap, |
| | 17803 | | "unavailable" => Azure.Storage.Blobs.Models.BlobGeoReplicationStatus.Unavailable, |
| | 17804 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 17805 | | }; |
| | 17806 | | } |
| | 17807 | | } |
| | 17808 | | } |
| | 17809 | | } |
| | 17810 | | #endregion enum BlobGeoReplicationStatus |
| | 17811 | |
|
| | 17812 | | #region class BlobInfo |
| | 17813 | | namespace Azure.Storage.Blobs.Models |
| | 17814 | | { |
| | 17815 | | /// <summary> |
| | 17816 | | /// BlobInfo |
| | 17817 | | /// </summary> |
| | 17818 | | public partial class BlobInfo |
| | 17819 | | { |
| | 17820 | | /// <summary> |
| | 17821 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 17822 | | /// </summary> |
| | 17823 | | public Azure.ETag ETag { get; internal set; } |
| | 17824 | |
|
| | 17825 | | /// <summary> |
| | 17826 | | /// Returns the date and time the blob was last modified. Any operation that modifies the blob, including an upd |
| | 17827 | | /// </summary> |
| | 17828 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 17829 | |
|
| | 17830 | | /// <summary> |
| | 17831 | | /// Prevent direct instantiation of BlobInfo instances. |
| | 17832 | | /// You can use BlobsModelFactory.BlobInfo instead. |
| | 17833 | | /// </summary> |
| | 17834 | | internal BlobInfo() { } |
| | 17835 | | } |
| | 17836 | |
|
| | 17837 | | /// <summary> |
| | 17838 | | /// BlobsModelFactory provides utilities for mocking. |
| | 17839 | | /// </summary> |
| | 17840 | | public static partial class BlobsModelFactory |
| | 17841 | | { |
| | 17842 | | /// <summary> |
| | 17843 | | /// Creates a new BlobInfo instance for mocking. |
| | 17844 | | /// </summary> |
| | 17845 | | public static BlobInfo BlobInfo( |
| | 17846 | | Azure.ETag eTag, |
| | 17847 | | System.DateTimeOffset lastModified) |
| | 17848 | | { |
| | 17849 | | return new BlobInfo() |
| | 17850 | | { |
| | 17851 | | ETag = eTag, |
| | 17852 | | LastModified = lastModified, |
| | 17853 | | }; |
| | 17854 | | } |
| | 17855 | | } |
| | 17856 | | } |
| | 17857 | | #endregion class BlobInfo |
| | 17858 | |
|
| | 17859 | | #region class BlobItemInternal |
| | 17860 | | namespace Azure.Storage.Blobs.Models |
| | 17861 | | { |
| | 17862 | | /// <summary> |
| | 17863 | | /// An Azure Storage blob |
| | 17864 | | /// </summary> |
| | 17865 | | internal partial class BlobItemInternal |
| | 17866 | | { |
| | 17867 | | /// <summary> |
| | 17868 | | /// Name |
| | 17869 | | /// </summary> |
| | 17870 | | public string Name { get; internal set; } |
| | 17871 | |
|
| | 17872 | | /// <summary> |
| | 17873 | | /// Deleted |
| | 17874 | | /// </summary> |
| | 17875 | | public bool Deleted { get; internal set; } |
| | 17876 | |
|
| | 17877 | | /// <summary> |
| | 17878 | | /// Snapshot |
| | 17879 | | /// </summary> |
| | 17880 | | public string Snapshot { get; internal set; } |
| | 17881 | |
|
| | 17882 | | /// <summary> |
| | 17883 | | /// VersionId |
| | 17884 | | /// </summary> |
| | 17885 | | public string VersionId { get; internal set; } |
| | 17886 | |
|
| | 17887 | | /// <summary> |
| | 17888 | | /// IsCurrentVersion |
| | 17889 | | /// </summary> |
| | 17890 | | public bool? IsCurrentVersion { get; internal set; } |
| | 17891 | |
|
| | 17892 | | /// <summary> |
| | 17893 | | /// Properties of a blob |
| | 17894 | | /// </summary> |
| | 17895 | | public Azure.Storage.Blobs.Models.BlobItemProperties Properties { get; internal set; } |
| | 17896 | |
|
| | 17897 | | /// <summary> |
| | 17898 | | /// Metadata |
| | 17899 | | /// </summary> |
| | 17900 | | public System.Collections.Generic.IDictionary<string, string> Metadata { get; internal set; } |
| | 17901 | |
|
| | 17902 | | /// <summary> |
| | 17903 | | /// Blob tags |
| | 17904 | | /// </summary> |
| | 17905 | | public Azure.Storage.Blobs.Models.BlobTags BlobTags { get; internal set; } |
| | 17906 | |
|
| | 17907 | | /// <summary> |
| | 17908 | | /// ObjectReplicationMetadata |
| | 17909 | | /// </summary> |
| | 17910 | | public System.Collections.Generic.IDictionary<string, string> ObjectReplicationMetadata { get; internal set; } |
| | 17911 | |
|
| | 17912 | | /// <summary> |
| | 17913 | | /// Creates a new BlobItemInternal instance |
| | 17914 | | /// </summary> |
| | 17915 | | public BlobItemInternal() |
| | 17916 | | : this(false) |
| | 17917 | | { |
| | 17918 | | } |
| | 17919 | |
|
| | 17920 | | /// <summary> |
| | 17921 | | /// Creates a new BlobItemInternal instance |
| | 17922 | | /// </summary> |
| | 17923 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 17924 | | internal BlobItemInternal(bool skipInitialization) |
| | 17925 | | { |
| | 17926 | | if (!skipInitialization) |
| | 17927 | | { |
| | 17928 | | Properties = new Azure.Storage.Blobs.Models.BlobItemProperties(); |
| | 17929 | | Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgnore |
| | 17930 | | BlobTags = new Azure.Storage.Blobs.Models.BlobTags(); |
| | 17931 | | ObjectReplicationMetadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompa |
| | 17932 | | } |
| | 17933 | | } |
| | 17934 | |
|
| | 17935 | | /// <summary> |
| | 17936 | | /// Deserializes XML into a new BlobItemInternal instance. |
| | 17937 | | /// </summary> |
| | 17938 | | /// <param name="element">The XML element to deserialize.</param> |
| | 17939 | | /// <returns>A deserialized BlobItemInternal instance.</returns> |
| | 17940 | | internal static Azure.Storage.Blobs.Models.BlobItemInternal FromXml(System.Xml.Linq.XElement element) |
| | 17941 | | { |
| | 17942 | | System.Diagnostics.Debug.Assert(element != null); |
| | 17943 | | System.Xml.Linq.XElement _child; |
| | 17944 | | Azure.Storage.Blobs.Models.BlobItemInternal _value = new Azure.Storage.Blobs.Models.BlobItemInternal(true); |
| | 17945 | | _child = element.Element(System.Xml.Linq.XName.Get("Name", "")); |
| | 17946 | | if (_child != null) |
| | 17947 | | { |
| | 17948 | | _value.Name = _child.Value; |
| | 17949 | | } |
| | 17950 | | _child = element.Element(System.Xml.Linq.XName.Get("Deleted", "")); |
| | 17951 | | if (_child != null) |
| | 17952 | | { |
| | 17953 | | _value.Deleted = bool.Parse(_child.Value); |
| | 17954 | | } |
| | 17955 | | _child = element.Element(System.Xml.Linq.XName.Get("Snapshot", "")); |
| | 17956 | | if (_child != null) |
| | 17957 | | { |
| | 17958 | | _value.Snapshot = _child.Value; |
| | 17959 | | } |
| | 17960 | | _child = element.Element(System.Xml.Linq.XName.Get("VersionId", "")); |
| | 17961 | | if (_child != null) |
| | 17962 | | { |
| | 17963 | | _value.VersionId = _child.Value; |
| | 17964 | | } |
| | 17965 | | _child = element.Element(System.Xml.Linq.XName.Get("IsCurrentVersion", "")); |
| | 17966 | | if (_child != null) |
| | 17967 | | { |
| | 17968 | | _value.IsCurrentVersion = bool.Parse(_child.Value); |
| | 17969 | | } |
| | 17970 | | _child = element.Element(System.Xml.Linq.XName.Get("Properties", "")); |
| | 17971 | | if (_child != null) |
| | 17972 | | { |
| | 17973 | | _value.Properties = Azure.Storage.Blobs.Models.BlobItemProperties.FromXml(_child); |
| | 17974 | | } |
| | 17975 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgn |
| | 17976 | | _child = element.Element(System.Xml.Linq.XName.Get("Metadata", "")); |
| | 17977 | | if (_child != null) |
| | 17978 | | { |
| | 17979 | | foreach (System.Xml.Linq.XElement _pair in _child.Elements()) |
| | 17980 | | { |
| | 17981 | | _value.Metadata[_pair.Name.LocalName] = _pair.Value; |
| | 17982 | | } |
| | 17983 | | } |
| | 17984 | | _child = element.Element(System.Xml.Linq.XName.Get("Tags", "")); |
| | 17985 | | if (_child != null) |
| | 17986 | | { |
| | 17987 | | _value.BlobTags = Azure.Storage.Blobs.Models.BlobTags.FromXml(_child); |
| | 17988 | | } |
| | 17989 | | _value.ObjectReplicationMetadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCo |
| | 17990 | | _child = element.Element(System.Xml.Linq.XName.Get("OrMetadata", "")); |
| | 17991 | | if (_child != null) |
| | 17992 | | { |
| | 17993 | | foreach (System.Xml.Linq.XElement _pair in _child.Elements()) |
| | 17994 | | { |
| | 17995 | | _value.ObjectReplicationMetadata[_pair.Name.LocalName] = _pair.Value; |
| | 17996 | | } |
| | 17997 | | } |
| | 17998 | | CustomizeFromXml(element, _value); |
| | 17999 | | return _value; |
| | 18000 | | } |
| | 18001 | |
|
| | 18002 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobItemIntern |
| | 18003 | | } |
| | 18004 | | } |
| | 18005 | | #endregion class BlobItemInternal |
| | 18006 | |
|
| | 18007 | | #region class BlobItemProperties |
| | 18008 | | namespace Azure.Storage.Blobs.Models |
| | 18009 | | { |
| | 18010 | | /// <summary> |
| | 18011 | | /// Properties of a blob |
| | 18012 | | /// </summary> |
| | 18013 | | public partial class BlobItemProperties |
| | 18014 | | { |
| | 18015 | | /// <summary> |
| | 18016 | | /// Last-Modified |
| | 18017 | | /// </summary> |
| | 18018 | | public System.DateTimeOffset? LastModified { get; internal set; } |
| | 18019 | |
|
| | 18020 | | /// <summary> |
| | 18021 | | /// Size in bytes |
| | 18022 | | /// </summary> |
| | 18023 | | public long? ContentLength { get; internal set; } |
| | 18024 | |
|
| | 18025 | | /// <summary> |
| | 18026 | | /// Content-Type |
| | 18027 | | /// </summary> |
| | 18028 | | public string ContentType { get; internal set; } |
| | 18029 | |
|
| | 18030 | | /// <summary> |
| | 18031 | | /// Content-Encoding |
| | 18032 | | /// </summary> |
| | 18033 | | public string ContentEncoding { get; internal set; } |
| | 18034 | |
|
| | 18035 | | /// <summary> |
| | 18036 | | /// Content-Language |
| | 18037 | | /// </summary> |
| | 18038 | | public string ContentLanguage { get; internal set; } |
| | 18039 | |
|
| | 18040 | | /// <summary> |
| | 18041 | | /// Content-MD5 |
| | 18042 | | /// </summary> |
| | 18043 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 18044 | | public byte[] ContentHash { get; internal set; } |
| | 18045 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 18046 | |
|
| | 18047 | | /// <summary> |
| | 18048 | | /// Content-Disposition |
| | 18049 | | /// </summary> |
| | 18050 | | public string ContentDisposition { get; internal set; } |
| | 18051 | |
|
| | 18052 | | /// <summary> |
| | 18053 | | /// Cache-Control |
| | 18054 | | /// </summary> |
| | 18055 | | public string CacheControl { get; internal set; } |
| | 18056 | |
|
| | 18057 | | /// <summary> |
| | 18058 | | /// x-ms-blob-sequence-number |
| | 18059 | | /// </summary> |
| | 18060 | | public long? BlobSequenceNumber { get; internal set; } |
| | 18061 | |
|
| | 18062 | | /// <summary> |
| | 18063 | | /// BlobType |
| | 18064 | | /// </summary> |
| | 18065 | | public Azure.Storage.Blobs.Models.BlobType? BlobType { get; internal set; } |
| | 18066 | |
|
| | 18067 | | /// <summary> |
| | 18068 | | /// LeaseStatus |
| | 18069 | | /// </summary> |
| | 18070 | | public Azure.Storage.Blobs.Models.LeaseStatus? LeaseStatus { get; internal set; } |
| | 18071 | |
|
| | 18072 | | /// <summary> |
| | 18073 | | /// LeaseState |
| | 18074 | | /// </summary> |
| | 18075 | | public Azure.Storage.Blobs.Models.LeaseState? LeaseState { get; internal set; } |
| | 18076 | |
|
| | 18077 | | /// <summary> |
| | 18078 | | /// LeaseDuration |
| | 18079 | | /// </summary> |
| | 18080 | | public Azure.Storage.Blobs.Models.LeaseDurationType? LeaseDuration { get; internal set; } |
| | 18081 | |
|
| | 18082 | | /// <summary> |
| | 18083 | | /// CopyId |
| | 18084 | | /// </summary> |
| | 18085 | | public string CopyId { get; internal set; } |
| | 18086 | |
|
| | 18087 | | /// <summary> |
| | 18088 | | /// CopyStatus |
| | 18089 | | /// </summary> |
| | 18090 | | public Azure.Storage.Blobs.Models.CopyStatus? CopyStatus { get; internal set; } |
| | 18091 | |
|
| | 18092 | | /// <summary> |
| | 18093 | | /// CopySource |
| | 18094 | | /// </summary> |
| | 18095 | | public System.Uri CopySource { get; internal set; } |
| | 18096 | |
|
| | 18097 | | /// <summary> |
| | 18098 | | /// CopyProgress |
| | 18099 | | /// </summary> |
| | 18100 | | public string CopyProgress { get; internal set; } |
| | 18101 | |
|
| | 18102 | | /// <summary> |
| | 18103 | | /// CopyStatusDescription |
| | 18104 | | /// </summary> |
| | 18105 | | public string CopyStatusDescription { get; internal set; } |
| | 18106 | |
|
| | 18107 | | /// <summary> |
| | 18108 | | /// ServerEncrypted |
| | 18109 | | /// </summary> |
| | 18110 | | public bool? ServerEncrypted { get; internal set; } |
| | 18111 | |
|
| | 18112 | | /// <summary> |
| | 18113 | | /// IncrementalCopy |
| | 18114 | | /// </summary> |
| | 18115 | | public bool? IncrementalCopy { get; internal set; } |
| | 18116 | |
|
| | 18117 | | /// <summary> |
| | 18118 | | /// DestinationSnapshot |
| | 18119 | | /// </summary> |
| | 18120 | | public string DestinationSnapshot { get; internal set; } |
| | 18121 | |
|
| | 18122 | | /// <summary> |
| | 18123 | | /// RemainingRetentionDays |
| | 18124 | | /// </summary> |
| | 18125 | | public int? RemainingRetentionDays { get; internal set; } |
| | 18126 | |
|
| | 18127 | | /// <summary> |
| | 18128 | | /// AccessTier |
| | 18129 | | /// </summary> |
| | 18130 | | public Azure.Storage.Blobs.Models.AccessTier? AccessTier { get; internal set; } |
| | 18131 | |
|
| | 18132 | | /// <summary> |
| | 18133 | | /// AccessTierInferred |
| | 18134 | | /// </summary> |
| | 18135 | | public bool AccessTierInferred { get; internal set; } |
| | 18136 | |
|
| | 18137 | | /// <summary> |
| | 18138 | | /// ArchiveStatus |
| | 18139 | | /// </summary> |
| | 18140 | | public Azure.Storage.Blobs.Models.ArchiveStatus? ArchiveStatus { get; internal set; } |
| | 18141 | |
|
| | 18142 | | /// <summary> |
| | 18143 | | /// CustomerProvidedKeySha256 |
| | 18144 | | /// </summary> |
| | 18145 | | public string CustomerProvidedKeySha256 { get; internal set; } |
| | 18146 | |
|
| | 18147 | | /// <summary> |
| | 18148 | | /// The name of the encryption scope under which the blob is encrypted. |
| | 18149 | | /// </summary> |
| | 18150 | | public string EncryptionScope { get; internal set; } |
| | 18151 | |
|
| | 18152 | | /// <summary> |
| | 18153 | | /// TagCount |
| | 18154 | | /// </summary> |
| | 18155 | | public long? TagCount { get; internal set; } |
| | 18156 | |
|
| | 18157 | | /// <summary> |
| | 18158 | | /// Expiry-Time |
| | 18159 | | /// </summary> |
| | 18160 | | public System.DateTimeOffset? ExpiresOn { get; internal set; } |
| | 18161 | |
|
| | 18162 | | /// <summary> |
| | 18163 | | /// Sealed |
| | 18164 | | /// </summary> |
| | 18165 | | public bool? IsSealed { get; internal set; } |
| | 18166 | |
|
| | 18167 | | /// <summary> |
| | 18168 | | /// If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid va |
| | 18169 | | /// </summary> |
| | 18170 | | public Azure.Storage.Blobs.Models.RehydratePriority? RehydratePriority { get; internal set; } |
| | 18171 | |
|
| | 18172 | | /// <summary> |
| | 18173 | | /// ETag |
| | 18174 | | /// </summary> |
| | 18175 | | public Azure.ETag? ETag { get; internal set; } |
| | 18176 | |
|
| | 18177 | | /// <summary> |
| | 18178 | | /// CreatedOn |
| | 18179 | | /// </summary> |
| | 18180 | | public System.DateTimeOffset? CreatedOn { get; internal set; } |
| | 18181 | |
|
| | 18182 | | /// <summary> |
| | 18183 | | /// CopyCompletedOn |
| | 18184 | | /// </summary> |
| | 18185 | | public System.DateTimeOffset? CopyCompletedOn { get; internal set; } |
| | 18186 | |
|
| | 18187 | | /// <summary> |
| | 18188 | | /// DeletedOn |
| | 18189 | | /// </summary> |
| | 18190 | | public System.DateTimeOffset? DeletedOn { get; internal set; } |
| | 18191 | |
|
| | 18192 | | /// <summary> |
| | 18193 | | /// AccessTierChangedOn |
| | 18194 | | /// </summary> |
| | 18195 | | public System.DateTimeOffset? AccessTierChangedOn { get; internal set; } |
| | 18196 | |
|
| | 18197 | | /// <summary> |
| | 18198 | | /// Prevent direct instantiation of BlobItemProperties instances. |
| | 18199 | | /// You can use BlobsModelFactory.BlobItemProperties instead. |
| | 18200 | | /// </summary> |
| | 18201 | | internal BlobItemProperties() { } |
| | 18202 | |
|
| | 18203 | | /// <summary> |
| | 18204 | | /// Deserializes XML into a new BlobItemProperties instance. |
| | 18205 | | /// </summary> |
| | 18206 | | /// <param name="element">The XML element to deserialize.</param> |
| | 18207 | | /// <returns>A deserialized BlobItemProperties instance.</returns> |
| | 18208 | | internal static Azure.Storage.Blobs.Models.BlobItemProperties FromXml(System.Xml.Linq.XElement element) |
| | 18209 | | { |
| | 18210 | | System.Diagnostics.Debug.Assert(element != null); |
| | 18211 | | System.Xml.Linq.XElement _child; |
| | 18212 | | Azure.Storage.Blobs.Models.BlobItemProperties _value = new Azure.Storage.Blobs.Models.BlobItemProperties(); |
| | 18213 | | _child = element.Element(System.Xml.Linq.XName.Get("Last-Modified", "")); |
| | 18214 | | if (_child != null) |
| | 18215 | | { |
| | 18216 | | _value.LastModified = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.Invaria |
| | 18217 | | } |
| | 18218 | | _child = element.Element(System.Xml.Linq.XName.Get("Content-Length", "")); |
| | 18219 | | if (_child != null) |
| | 18220 | | { |
| | 18221 | | _value.ContentLength = long.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 18222 | | } |
| | 18223 | | _child = element.Element(System.Xml.Linq.XName.Get("Content-Type", "")); |
| | 18224 | | if (_child != null) |
| | 18225 | | { |
| | 18226 | | _value.ContentType = _child.Value; |
| | 18227 | | } |
| | 18228 | | _child = element.Element(System.Xml.Linq.XName.Get("Content-Encoding", "")); |
| | 18229 | | if (_child != null) |
| | 18230 | | { |
| | 18231 | | _value.ContentEncoding = _child.Value; |
| | 18232 | | } |
| | 18233 | | _child = element.Element(System.Xml.Linq.XName.Get("Content-Language", "")); |
| | 18234 | | if (_child != null) |
| | 18235 | | { |
| | 18236 | | _value.ContentLanguage = _child.Value; |
| | 18237 | | } |
| | 18238 | | _child = element.Element(System.Xml.Linq.XName.Get("Content-MD5", "")); |
| | 18239 | | if (_child != null) |
| | 18240 | | { |
| | 18241 | | _value.ContentHash = System.Convert.FromBase64String(_child.Value); |
| | 18242 | | } |
| | 18243 | | _child = element.Element(System.Xml.Linq.XName.Get("Content-Disposition", "")); |
| | 18244 | | if (_child != null) |
| | 18245 | | { |
| | 18246 | | _value.ContentDisposition = _child.Value; |
| | 18247 | | } |
| | 18248 | | _child = element.Element(System.Xml.Linq.XName.Get("Cache-Control", "")); |
| | 18249 | | if (_child != null) |
| | 18250 | | { |
| | 18251 | | _value.CacheControl = _child.Value; |
| | 18252 | | } |
| | 18253 | | _child = element.Element(System.Xml.Linq.XName.Get("x-ms-blob-sequence-number", "")); |
| | 18254 | | if (_child != null) |
| | 18255 | | { |
| | 18256 | | _value.BlobSequenceNumber = long.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 18257 | | } |
| | 18258 | | _child = element.Element(System.Xml.Linq.XName.Get("BlobType", "")); |
| | 18259 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 18260 | | { |
| | 18261 | | _value.BlobType = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseBlobType(_child.Value); |
| | 18262 | | } |
| | 18263 | | _child = element.Element(System.Xml.Linq.XName.Get("LeaseStatus", "")); |
| | 18264 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 18265 | | { |
| | 18266 | | _value.LeaseStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseStatus(_child.Value); |
| | 18267 | | } |
| | 18268 | | _child = element.Element(System.Xml.Linq.XName.Get("LeaseState", "")); |
| | 18269 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 18270 | | { |
| | 18271 | | _value.LeaseState = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseState(_child.Value); |
| | 18272 | | } |
| | 18273 | | _child = element.Element(System.Xml.Linq.XName.Get("LeaseDuration", "")); |
| | 18274 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 18275 | | { |
| | 18276 | | _value.LeaseDuration = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseLeaseDurationType(_child.Va |
| | 18277 | | } |
| | 18278 | | _child = element.Element(System.Xml.Linq.XName.Get("CopyId", "")); |
| | 18279 | | if (_child != null) |
| | 18280 | | { |
| | 18281 | | _value.CopyId = _child.Value; |
| | 18282 | | } |
| | 18283 | | _child = element.Element(System.Xml.Linq.XName.Get("CopyStatus", "")); |
| | 18284 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 18285 | | { |
| | 18286 | | _value.CopyStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseCopyStatus(_child.Value); |
| | 18287 | | } |
| | 18288 | | _child = element.Element(System.Xml.Linq.XName.Get("CopySource", "")); |
| | 18289 | | if (_child != null) |
| | 18290 | | { |
| | 18291 | | _value.CopySource = new System.Uri(_child.Value); |
| | 18292 | | } |
| | 18293 | | _child = element.Element(System.Xml.Linq.XName.Get("CopyProgress", "")); |
| | 18294 | | if (_child != null) |
| | 18295 | | { |
| | 18296 | | _value.CopyProgress = _child.Value; |
| | 18297 | | } |
| | 18298 | | _child = element.Element(System.Xml.Linq.XName.Get("CopyStatusDescription", "")); |
| | 18299 | | if (_child != null) |
| | 18300 | | { |
| | 18301 | | _value.CopyStatusDescription = _child.Value; |
| | 18302 | | } |
| | 18303 | | _child = element.Element(System.Xml.Linq.XName.Get("ServerEncrypted", "")); |
| | 18304 | | if (_child != null) |
| | 18305 | | { |
| | 18306 | | _value.ServerEncrypted = bool.Parse(_child.Value); |
| | 18307 | | } |
| | 18308 | | _child = element.Element(System.Xml.Linq.XName.Get("IncrementalCopy", "")); |
| | 18309 | | if (_child != null) |
| | 18310 | | { |
| | 18311 | | _value.IncrementalCopy = bool.Parse(_child.Value); |
| | 18312 | | } |
| | 18313 | | _child = element.Element(System.Xml.Linq.XName.Get("DestinationSnapshot", "")); |
| | 18314 | | if (_child != null) |
| | 18315 | | { |
| | 18316 | | _value.DestinationSnapshot = _child.Value; |
| | 18317 | | } |
| | 18318 | | _child = element.Element(System.Xml.Linq.XName.Get("RemainingRetentionDays", "")); |
| | 18319 | | if (_child != null) |
| | 18320 | | { |
| | 18321 | | _value.RemainingRetentionDays = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCultur |
| | 18322 | | } |
| | 18323 | | _child = element.Element(System.Xml.Linq.XName.Get("AccessTier", "")); |
| | 18324 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 18325 | | { |
| | 18326 | | _value.AccessTier = _child.Value; |
| | 18327 | | } |
| | 18328 | | _child = element.Element(System.Xml.Linq.XName.Get("AccessTierInferred", "")); |
| | 18329 | | if (_child != null) |
| | 18330 | | { |
| | 18331 | | _value.AccessTierInferred = bool.Parse(_child.Value); |
| | 18332 | | } |
| | 18333 | | _child = element.Element(System.Xml.Linq.XName.Get("ArchiveStatus", "")); |
| | 18334 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 18335 | | { |
| | 18336 | | _value.ArchiveStatus = Azure.Storage.Blobs.BlobRestClient.Serialization.ParseArchiveStatus(_child.Value) |
| | 18337 | | } |
| | 18338 | | _child = element.Element(System.Xml.Linq.XName.Get("CustomerProvidedKeySha256", "")); |
| | 18339 | | if (_child != null) |
| | 18340 | | { |
| | 18341 | | _value.CustomerProvidedKeySha256 = _child.Value; |
| | 18342 | | } |
| | 18343 | | _child = element.Element(System.Xml.Linq.XName.Get("EncryptionScope", "")); |
| | 18344 | | if (_child != null) |
| | 18345 | | { |
| | 18346 | | _value.EncryptionScope = _child.Value; |
| | 18347 | | } |
| | 18348 | | _child = element.Element(System.Xml.Linq.XName.Get("TagCount", "")); |
| | 18349 | | if (_child != null) |
| | 18350 | | { |
| | 18351 | | _value.TagCount = long.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 18352 | | } |
| | 18353 | | _child = element.Element(System.Xml.Linq.XName.Get("Expiry-Time", "")); |
| | 18354 | | if (_child != null) |
| | 18355 | | { |
| | 18356 | | _value.ExpiresOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.InvariantC |
| | 18357 | | } |
| | 18358 | | _child = element.Element(System.Xml.Linq.XName.Get("Sealed", "")); |
| | 18359 | | if (_child != null) |
| | 18360 | | { |
| | 18361 | | _value.IsSealed = bool.Parse(_child.Value); |
| | 18362 | | } |
| | 18363 | | _child = element.Element(System.Xml.Linq.XName.Get("RehydratePriority", "")); |
| | 18364 | | if (_child != null && !string.IsNullOrEmpty(_child.Value)) |
| | 18365 | | { |
| | 18366 | | _value.RehydratePriority = (Azure.Storage.Blobs.Models.RehydratePriority)System.Enum.Parse(typeof(Azure. |
| | 18367 | | } |
| | 18368 | | _child = element.Element(System.Xml.Linq.XName.Get("Etag", "")); |
| | 18369 | | if (_child != null) |
| | 18370 | | { |
| | 18371 | | _value.ETag = new Azure.ETag(_child.Value); |
| | 18372 | | } |
| | 18373 | | _child = element.Element(System.Xml.Linq.XName.Get("Creation-Time", "")); |
| | 18374 | | if (_child != null) |
| | 18375 | | { |
| | 18376 | | _value.CreatedOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.InvariantC |
| | 18377 | | } |
| | 18378 | | _child = element.Element(System.Xml.Linq.XName.Get("CopyCompletionTime", "")); |
| | 18379 | | if (_child != null) |
| | 18380 | | { |
| | 18381 | | _value.CopyCompletedOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.Inva |
| | 18382 | | } |
| | 18383 | | _child = element.Element(System.Xml.Linq.XName.Get("DeletedTime", "")); |
| | 18384 | | if (_child != null) |
| | 18385 | | { |
| | 18386 | | _value.DeletedOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.InvariantC |
| | 18387 | | } |
| | 18388 | | _child = element.Element(System.Xml.Linq.XName.Get("AccessTierChangeTime", "")); |
| | 18389 | | if (_child != null) |
| | 18390 | | { |
| | 18391 | | _value.AccessTierChangedOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo. |
| | 18392 | | } |
| | 18393 | | CustomizeFromXml(element, _value); |
| | 18394 | | return _value; |
| | 18395 | | } |
| | 18396 | |
|
| | 18397 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobItemProper |
| | 18398 | | } |
| | 18399 | |
|
| | 18400 | | /// <summary> |
| | 18401 | | /// BlobsModelFactory provides utilities for mocking. |
| | 18402 | | /// </summary> |
| | 18403 | | public static partial class BlobsModelFactory |
| | 18404 | | { |
| | 18405 | | /// <summary> |
| | 18406 | | /// Creates a new BlobItemProperties instance for mocking. |
| | 18407 | | /// </summary> |
| | 18408 | | public static BlobItemProperties BlobItemProperties( |
| | 18409 | | bool accessTierInferred, |
| | 18410 | | bool? serverEncrypted = default, |
| | 18411 | | string contentType = default, |
| | 18412 | | string contentEncoding = default, |
| | 18413 | | string contentLanguage = default, |
| | 18414 | | byte[] contentHash = default, |
| | 18415 | | string contentDisposition = default, |
| | 18416 | | string cacheControl = default, |
| | 18417 | | long? blobSequenceNumber = default, |
| | 18418 | | Azure.Storage.Blobs.Models.BlobType? blobType = default, |
| | 18419 | | Azure.Storage.Blobs.Models.LeaseStatus? leaseStatus = default, |
| | 18420 | | Azure.Storage.Blobs.Models.LeaseState? leaseState = default, |
| | 18421 | | Azure.Storage.Blobs.Models.LeaseDurationType? leaseDuration = default, |
| | 18422 | | string copyId = default, |
| | 18423 | | Azure.Storage.Blobs.Models.CopyStatus? copyStatus = default, |
| | 18424 | | System.Uri copySource = default, |
| | 18425 | | string copyProgress = default, |
| | 18426 | | string copyStatusDescription = default, |
| | 18427 | | long? contentLength = default, |
| | 18428 | | bool? incrementalCopy = default, |
| | 18429 | | string destinationSnapshot = default, |
| | 18430 | | int? remainingRetentionDays = default, |
| | 18431 | | Azure.Storage.Blobs.Models.AccessTier? accessTier = default, |
| | 18432 | | System.DateTimeOffset? lastModified = default, |
| | 18433 | | Azure.Storage.Blobs.Models.ArchiveStatus? archiveStatus = default, |
| | 18434 | | string customerProvidedKeySha256 = default, |
| | 18435 | | string encryptionScope = default, |
| | 18436 | | long? tagCount = default, |
| | 18437 | | System.DateTimeOffset? expiresOn = default, |
| | 18438 | | bool? isSealed = default, |
| | 18439 | | Azure.Storage.Blobs.Models.RehydratePriority? rehydratePriority = default, |
| | 18440 | | Azure.ETag? eTag = default, |
| | 18441 | | System.DateTimeOffset? createdOn = default, |
| | 18442 | | System.DateTimeOffset? copyCompletedOn = default, |
| | 18443 | | System.DateTimeOffset? deletedOn = default, |
| | 18444 | | System.DateTimeOffset? accessTierChangedOn = default) |
| | 18445 | | { |
| | 18446 | | return new BlobItemProperties() |
| | 18447 | | { |
| | 18448 | | AccessTierInferred = accessTierInferred, |
| | 18449 | | ServerEncrypted = serverEncrypted, |
| | 18450 | | ContentType = contentType, |
| | 18451 | | ContentEncoding = contentEncoding, |
| | 18452 | | ContentLanguage = contentLanguage, |
| | 18453 | | ContentHash = contentHash, |
| | 18454 | | ContentDisposition = contentDisposition, |
| | 18455 | | CacheControl = cacheControl, |
| | 18456 | | BlobSequenceNumber = blobSequenceNumber, |
| | 18457 | | BlobType = blobType, |
| | 18458 | | LeaseStatus = leaseStatus, |
| | 18459 | | LeaseState = leaseState, |
| | 18460 | | LeaseDuration = leaseDuration, |
| | 18461 | | CopyId = copyId, |
| | 18462 | | CopyStatus = copyStatus, |
| | 18463 | | CopySource = copySource, |
| | 18464 | | CopyProgress = copyProgress, |
| | 18465 | | CopyStatusDescription = copyStatusDescription, |
| | 18466 | | ContentLength = contentLength, |
| | 18467 | | IncrementalCopy = incrementalCopy, |
| | 18468 | | DestinationSnapshot = destinationSnapshot, |
| | 18469 | | RemainingRetentionDays = remainingRetentionDays, |
| | 18470 | | AccessTier = accessTier, |
| | 18471 | | LastModified = lastModified, |
| | 18472 | | ArchiveStatus = archiveStatus, |
| | 18473 | | CustomerProvidedKeySha256 = customerProvidedKeySha256, |
| | 18474 | | EncryptionScope = encryptionScope, |
| | 18475 | | TagCount = tagCount, |
| | 18476 | | ExpiresOn = expiresOn, |
| | 18477 | | IsSealed = isSealed, |
| | 18478 | | RehydratePriority = rehydratePriority, |
| | 18479 | | ETag = eTag, |
| | 18480 | | CreatedOn = createdOn, |
| | 18481 | | CopyCompletedOn = copyCompletedOn, |
| | 18482 | | DeletedOn = deletedOn, |
| | 18483 | | AccessTierChangedOn = accessTierChangedOn, |
| | 18484 | | }; |
| | 18485 | | } |
| | 18486 | | } |
| | 18487 | | } |
| | 18488 | | #endregion class BlobItemProperties |
| | 18489 | |
|
| | 18490 | | #region class BlobLease |
| | 18491 | | namespace Azure.Storage.Blobs.Models |
| | 18492 | | { |
| | 18493 | | /// <summary> |
| | 18494 | | /// BlobLease |
| | 18495 | | /// </summary> |
| | 18496 | | public partial class BlobLease |
| | 18497 | | { |
| | 18498 | | /// <summary> |
| | 18499 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 18500 | | /// </summary> |
| | 18501 | | public Azure.ETag ETag { get; internal set; } |
| | 18502 | |
|
| | 18503 | | /// <summary> |
| | 18504 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 18505 | | /// </summary> |
| | 18506 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 18507 | |
|
| | 18508 | | /// <summary> |
| | 18509 | | /// Uniquely identifies a container's or blob's lease |
| | 18510 | | /// </summary> |
| | 18511 | | public string LeaseId { get; internal set; } |
| | 18512 | |
|
| | 18513 | | /// <summary> |
| | 18514 | | /// Prevent direct instantiation of BlobLease instances. |
| | 18515 | | /// You can use BlobsModelFactory.BlobLease instead. |
| | 18516 | | /// </summary> |
| | 18517 | | internal BlobLease() { } |
| | 18518 | | } |
| | 18519 | |
|
| | 18520 | | /// <summary> |
| | 18521 | | /// BlobsModelFactory provides utilities for mocking. |
| | 18522 | | /// </summary> |
| | 18523 | | public static partial class BlobsModelFactory |
| | 18524 | | { |
| | 18525 | | /// <summary> |
| | 18526 | | /// Creates a new BlobLease instance for mocking. |
| | 18527 | | /// </summary> |
| | 18528 | | public static BlobLease BlobLease( |
| | 18529 | | Azure.ETag eTag, |
| | 18530 | | System.DateTimeOffset lastModified, |
| | 18531 | | string leaseId) |
| | 18532 | | { |
| | 18533 | | return new BlobLease() |
| | 18534 | | { |
| | 18535 | | ETag = eTag, |
| | 18536 | | LastModified = lastModified, |
| | 18537 | | LeaseId = leaseId, |
| | 18538 | | }; |
| | 18539 | | } |
| | 18540 | | } |
| | 18541 | | } |
| | 18542 | | #endregion class BlobLease |
| | 18543 | |
|
| | 18544 | | #region class BlobMetrics |
| | 18545 | | namespace Azure.Storage.Blobs.Models |
| | 18546 | | { |
| | 18547 | | /// <summary> |
| | 18548 | | /// a summary of request statistics grouped by API in hour or minute aggregates for blobs |
| | 18549 | | /// </summary> |
| | 18550 | | public partial class BlobMetrics |
| | 18551 | | { |
| | 18552 | | /// <summary> |
| | 18553 | | /// The version of Storage Analytics to configure. |
| | 18554 | | /// </summary> |
| | 18555 | | public string Version { get; set; } |
| | 18556 | |
|
| | 18557 | | /// <summary> |
| | 18558 | | /// Indicates whether metrics are enabled for the Blob service. |
| | 18559 | | /// </summary> |
| | 18560 | | public bool Enabled { get; set; } |
| | 18561 | |
|
| | 18562 | | /// <summary> |
| | 18563 | | /// the retention policy which determines how long the associated data should persist |
| | 18564 | | /// </summary> |
| | 18565 | | public Azure.Storage.Blobs.Models.BlobRetentionPolicy RetentionPolicy { get; set; } |
| | 18566 | |
|
| | 18567 | | /// <summary> |
| | 18568 | | /// Indicates whether metrics should generate summary statistics for called API operations. |
| | 18569 | | /// </summary> |
| | 18570 | | public bool? IncludeApis { get; set; } |
| | 18571 | |
|
| | 18572 | | /// <summary> |
| | 18573 | | /// Creates a new BlobMetrics instance |
| | 18574 | | /// </summary> |
| | 18575 | | public BlobMetrics() |
| | 18576 | | : this(false) |
| | 18577 | | { |
| | 18578 | | } |
| | 18579 | |
|
| | 18580 | | /// <summary> |
| | 18581 | | /// Creates a new BlobMetrics instance |
| | 18582 | | /// </summary> |
| | 18583 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 18584 | | internal BlobMetrics(bool skipInitialization) |
| | 18585 | | { |
| | 18586 | | if (!skipInitialization) |
| | 18587 | | { |
| | 18588 | | RetentionPolicy = new Azure.Storage.Blobs.Models.BlobRetentionPolicy(); |
| | 18589 | | } |
| | 18590 | | } |
| | 18591 | |
|
| | 18592 | | /// <summary> |
| | 18593 | | /// Serialize a BlobMetrics instance as XML. |
| | 18594 | | /// </summary> |
| | 18595 | | /// <param name="value">The BlobMetrics instance to serialize.</param> |
| | 18596 | | /// <param name="name">An optional name to use for the root element instead of "Metrics".</param> |
| | 18597 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 18598 | | /// <returns>The serialized XML element.</returns> |
| | 18599 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.BlobMetrics value, string name = "Metr |
| | 18600 | | { |
| | 18601 | | System.Diagnostics.Debug.Assert(value != null); |
| | 18602 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 18603 | | if (value.Version != null) |
| | 18604 | | { |
| | 18605 | | _element.Add(new System.Xml.Linq.XElement( |
| | 18606 | | System.Xml.Linq.XName.Get("Version", ""), |
| | 18607 | | value.Version)); |
| | 18608 | | } |
| | 18609 | | _element.Add(new System.Xml.Linq.XElement( |
| | 18610 | | System.Xml.Linq.XName.Get("Enabled", ""), |
| | 18611 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 18612 | | value.Enabled.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant())); |
| | 18613 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 18614 | | if (value.RetentionPolicy != null) |
| | 18615 | | { |
| | 18616 | | _element.Add(Azure.Storage.Blobs.Models.BlobRetentionPolicy.ToXml(value.RetentionPolicy, "RetentionPolic |
| | 18617 | | } |
| | 18618 | | if (value.IncludeApis != null) |
| | 18619 | | { |
| | 18620 | | _element.Add(new System.Xml.Linq.XElement( |
| | 18621 | | System.Xml.Linq.XName.Get("IncludeAPIs", ""), |
| | 18622 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 18623 | | value.IncludeApis.Value.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant |
| | 18624 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 18625 | | } |
| | 18626 | | return _element; |
| | 18627 | | } |
| | 18628 | |
|
| | 18629 | | /// <summary> |
| | 18630 | | /// Deserializes XML into a new BlobMetrics instance. |
| | 18631 | | /// </summary> |
| | 18632 | | /// <param name="element">The XML element to deserialize.</param> |
| | 18633 | | /// <returns>A deserialized BlobMetrics instance.</returns> |
| | 18634 | | internal static Azure.Storage.Blobs.Models.BlobMetrics FromXml(System.Xml.Linq.XElement element) |
| | 18635 | | { |
| | 18636 | | System.Diagnostics.Debug.Assert(element != null); |
| | 18637 | | System.Xml.Linq.XElement _child; |
| | 18638 | | Azure.Storage.Blobs.Models.BlobMetrics _value = new Azure.Storage.Blobs.Models.BlobMetrics(true); |
| | 18639 | | _child = element.Element(System.Xml.Linq.XName.Get("Version", "")); |
| | 18640 | | if (_child != null) |
| | 18641 | | { |
| | 18642 | | _value.Version = _child.Value; |
| | 18643 | | } |
| | 18644 | | _child = element.Element(System.Xml.Linq.XName.Get("Enabled", "")); |
| | 18645 | | if (_child != null) |
| | 18646 | | { |
| | 18647 | | _value.Enabled = bool.Parse(_child.Value); |
| | 18648 | | } |
| | 18649 | | _child = element.Element(System.Xml.Linq.XName.Get("RetentionPolicy", "")); |
| | 18650 | | if (_child != null) |
| | 18651 | | { |
| | 18652 | | _value.RetentionPolicy = Azure.Storage.Blobs.Models.BlobRetentionPolicy.FromXml(_child); |
| | 18653 | | } |
| | 18654 | | _child = element.Element(System.Xml.Linq.XName.Get("IncludeAPIs", "")); |
| | 18655 | | if (_child != null) |
| | 18656 | | { |
| | 18657 | | _value.IncludeApis = bool.Parse(_child.Value); |
| | 18658 | | } |
| | 18659 | | CustomizeFromXml(element, _value); |
| | 18660 | | return _value; |
| | 18661 | | } |
| | 18662 | |
|
| | 18663 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobMetrics va |
| | 18664 | | } |
| | 18665 | | } |
| | 18666 | | #endregion class BlobMetrics |
| | 18667 | |
|
| | 18668 | | #region class BlobPrefix |
| | 18669 | | namespace Azure.Storage.Blobs.Models |
| | 18670 | | { |
| | 18671 | | /// <summary> |
| | 18672 | | /// BlobPrefix |
| | 18673 | | /// </summary> |
| | 18674 | | internal partial class BlobPrefix |
| | 18675 | | { |
| | 18676 | | /// <summary> |
| | 18677 | | /// Name |
| | 18678 | | /// </summary> |
| | 18679 | | public string Name { get; internal set; } |
| | 18680 | |
|
| | 18681 | | /// <summary> |
| | 18682 | | /// Prevent direct instantiation of BlobPrefix instances. |
| | 18683 | | /// You can use BlobsModelFactory.BlobPrefix instead. |
| | 18684 | | /// </summary> |
| | 18685 | | internal BlobPrefix() { } |
| | 18686 | |
|
| | 18687 | | /// <summary> |
| | 18688 | | /// Deserializes XML into a new BlobPrefix instance. |
| | 18689 | | /// </summary> |
| | 18690 | | /// <param name="element">The XML element to deserialize.</param> |
| | 18691 | | /// <returns>A deserialized BlobPrefix instance.</returns> |
| | 18692 | | internal static Azure.Storage.Blobs.Models.BlobPrefix FromXml(System.Xml.Linq.XElement element) |
| | 18693 | | { |
| | 18694 | | System.Diagnostics.Debug.Assert(element != null); |
| | 18695 | | System.Xml.Linq.XElement _child; |
| | 18696 | | Azure.Storage.Blobs.Models.BlobPrefix _value = new Azure.Storage.Blobs.Models.BlobPrefix(); |
| | 18697 | | _child = element.Element(System.Xml.Linq.XName.Get("Name", "")); |
| | 18698 | | if (_child != null) |
| | 18699 | | { |
| | 18700 | | _value.Name = _child.Value; |
| | 18701 | | } |
| | 18702 | | CustomizeFromXml(element, _value); |
| | 18703 | | return _value; |
| | 18704 | | } |
| | 18705 | |
|
| | 18706 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobPrefix val |
| | 18707 | | } |
| | 18708 | | } |
| | 18709 | | #endregion class BlobPrefix |
| | 18710 | |
|
| | 18711 | | #region class BlobPropertiesInternal |
| | 18712 | | namespace Azure.Storage.Blobs.Models |
| | 18713 | | { |
| | 18714 | | /// <summary> |
| | 18715 | | /// BlobPropertiesInternal |
| | 18716 | | /// </summary> |
| | 18717 | | internal partial class BlobPropertiesInternal |
| | 18718 | | { |
| | 18719 | | /// <summary> |
| | 18720 | | /// Returns the date and time the blob was last modified. Any operation that modifies the blob, including an upd |
| | 18721 | | /// </summary> |
| | 18722 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 18723 | |
|
| | 18724 | | /// <summary> |
| | 18725 | | /// Returns the date and time the blob was created. |
| | 18726 | | /// </summary> |
| | 18727 | | public System.DateTimeOffset CreatedOn { get; internal set; } |
| | 18728 | |
|
| | 18729 | | /// <summary> |
| | 18730 | | /// x-ms-meta |
| | 18731 | | /// </summary> |
| | 18732 | | public System.Collections.Generic.IDictionary<string, string> Metadata { get; internal set; } |
| | 18733 | |
|
| | 18734 | | /// <summary> |
| | 18735 | | /// Optional. Only valid when Object Replication is enabled for the storage container and on the destination blo |
| | 18736 | | /// </summary> |
| | 18737 | | public string ObjectReplicationPolicyId { get; internal set; } |
| | 18738 | |
|
| | 18739 | | /// <summary> |
| | 18740 | | /// Optional. Only valid when Object Replication is enabled for the storage container and on the source blob of |
| | 18741 | | /// </summary> |
| | 18742 | | public System.Collections.Generic.IDictionary<string, string> ObjectReplicationRules { get; internal set; } |
| | 18743 | |
|
| | 18744 | | /// <summary> |
| | 18745 | | /// The blob's type. |
| | 18746 | | /// </summary> |
| | 18747 | | public Azure.Storage.Blobs.Models.BlobType BlobType { get; internal set; } |
| | 18748 | |
|
| | 18749 | | /// <summary> |
| | 18750 | | /// Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This val |
| | 18751 | | /// </summary> |
| | 18752 | | public System.DateTimeOffset CopyCompletedOn { get; internal set; } |
| | 18753 | |
|
| | 18754 | | /// <summary> |
| | 18755 | | /// Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal |
| | 18756 | | /// </summary> |
| | 18757 | | public string CopyStatusDescription { get; internal set; } |
| | 18758 | |
|
| | 18759 | | /// <summary> |
| | 18760 | | /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy ope |
| | 18761 | | /// </summary> |
| | 18762 | | public string CopyId { get; internal set; } |
| | 18763 | |
|
| | 18764 | | /// <summary> |
| | 18765 | | /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operat |
| | 18766 | | /// </summary> |
| | 18767 | | public string CopyProgress { get; internal set; } |
| | 18768 | |
|
| | 18769 | | /// <summary> |
| | 18770 | | /// URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operati |
| | 18771 | | /// </summary> |
| | 18772 | | public System.Uri CopySource { get; internal set; } |
| | 18773 | |
|
| | 18774 | | /// <summary> |
| | 18775 | | /// State of the copy operation identified by x-ms-copy-id. |
| | 18776 | | /// </summary> |
| | 18777 | | public Azure.Storage.Blobs.Models.CopyStatus CopyStatus { get; internal set; } |
| | 18778 | |
|
| | 18779 | | /// <summary> |
| | 18780 | | /// Included if the blob is incremental copy blob. |
| | 18781 | | /// </summary> |
| | 18782 | | public bool IsIncrementalCopy { get; internal set; } |
| | 18783 | |
|
| | 18784 | | /// <summary> |
| | 18785 | | /// Included if the blob is incremental copy blob or incremental copy snapshot, if x-ms-copy-status is success. |
| | 18786 | | /// </summary> |
| | 18787 | | public string DestinationSnapshot { get; internal set; } |
| | 18788 | |
|
| | 18789 | | /// <summary> |
| | 18790 | | /// When a blob is leased, specifies whether the lease is of infinite or fixed duration. |
| | 18791 | | /// </summary> |
| | 18792 | | public Azure.Storage.Blobs.Models.LeaseDurationType LeaseDuration { get; internal set; } |
| | 18793 | |
|
| | 18794 | | /// <summary> |
| | 18795 | | /// Lease state of the blob. |
| | 18796 | | /// </summary> |
| | 18797 | | public Azure.Storage.Blobs.Models.LeaseState LeaseState { get; internal set; } |
| | 18798 | |
|
| | 18799 | | /// <summary> |
| | 18800 | | /// The current lease status of the blob. |
| | 18801 | | /// </summary> |
| | 18802 | | public Azure.Storage.Blobs.Models.LeaseStatus LeaseStatus { get; internal set; } |
| | 18803 | |
|
| | 18804 | | /// <summary> |
| | 18805 | | /// The number of bytes present in the response body. |
| | 18806 | | /// </summary> |
| | 18807 | | public long ContentLength { get; internal set; } |
| | 18808 | |
|
| | 18809 | | /// <summary> |
| | 18810 | | /// The content type specified for the blob. The default content type is 'application/octet-stream' |
| | 18811 | | /// </summary> |
| | 18812 | | public string ContentType { get; internal set; } |
| | 18813 | |
|
| | 18814 | | /// <summary> |
| | 18815 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 18816 | | /// </summary> |
| | 18817 | | public Azure.ETag ETag { get; internal set; } |
| | 18818 | |
|
| | 18819 | | /// <summary> |
| | 18820 | | /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so |
| | 18821 | | /// </summary> |
| | 18822 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 18823 | | public byte[] ContentHash { get; internal set; } |
| | 18824 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 18825 | |
|
| | 18826 | | /// <summary> |
| | 18827 | | /// This header returns the value that was specified for the Content-Encoding request header |
| | 18828 | | /// </summary> |
| | 18829 | | public string ContentEncoding { get; internal set; } |
| | 18830 | |
|
| | 18831 | | /// <summary> |
| | 18832 | | /// This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content |
| | 18833 | | /// </summary> |
| | 18834 | | public string ContentDisposition { get; internal set; } |
| | 18835 | |
|
| | 18836 | | /// <summary> |
| | 18837 | | /// This header returns the value that was specified for the Content-Language request header. |
| | 18838 | | /// </summary> |
| | 18839 | | public string ContentLanguage { get; internal set; } |
| | 18840 | |
|
| | 18841 | | /// <summary> |
| | 18842 | | /// This header is returned if it was previously specified for the blob. |
| | 18843 | | /// </summary> |
| | 18844 | | public string CacheControl { get; internal set; } |
| | 18845 | |
|
| | 18846 | | /// <summary> |
| | 18847 | | /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs |
| | 18848 | | /// </summary> |
| | 18849 | | public long BlobSequenceNumber { get; internal set; } |
| | 18850 | |
|
| | 18851 | | /// <summary> |
| | 18852 | | /// Indicates that the service supports requests for partial blob content. |
| | 18853 | | /// </summary> |
| | 18854 | | public string AcceptRanges { get; internal set; } |
| | 18855 | |
|
| | 18856 | | /// <summary> |
| | 18857 | | /// The number of committed blocks present in the blob. This header is returned only for append blobs. |
| | 18858 | | /// </summary> |
| | 18859 | | public int BlobCommittedBlockCount { get; internal set; } |
| | 18860 | |
|
| | 18861 | | /// <summary> |
| | 18862 | | /// The value of this header is set to true if the blob data and application metadata are completely encrypted u |
| | 18863 | | /// </summary> |
| | 18864 | | public bool IsServerEncrypted { get; internal set; } |
| | 18865 | |
|
| | 18866 | | /// <summary> |
| | 18867 | | /// The SHA-256 hash of the encryption key used to encrypt the metadata. This header is only returned when the m |
| | 18868 | | /// </summary> |
| | 18869 | | public string EncryptionKeySha256 { get; internal set; } |
| | 18870 | |
|
| | 18871 | | /// <summary> |
| | 18872 | | /// Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note t |
| | 18873 | | /// </summary> |
| | 18874 | | public string EncryptionScope { get; internal set; } |
| | 18875 | |
|
| | 18876 | | /// <summary> |
| | 18877 | | /// The tier of page blob on a premium storage account or tier of block blob on blob storage LRS accounts. For a |
| | 18878 | | /// </summary> |
| | 18879 | | public string AccessTier { get; internal set; } |
| | 18880 | |
|
| | 18881 | | /// <summary> |
| | 18882 | | /// For page blobs on a premium storage account only. If the access tier is not explicitly set on the blob, the |
| | 18883 | | /// </summary> |
| | 18884 | | public bool AccessTierInferred { get; internal set; } |
| | 18885 | |
|
| | 18886 | | /// <summary> |
| | 18887 | | /// For blob storage LRS accounts, valid values are rehydrate-pending-to-hot/rehydrate-pending-to-cool. If the b |
| | 18888 | | /// </summary> |
| | 18889 | | public string ArchiveStatus { get; internal set; } |
| | 18890 | |
|
| | 18891 | | /// <summary> |
| | 18892 | | /// The time the tier was changed on the object. This is only returned if the tier on the block blob was ever se |
| | 18893 | | /// </summary> |
| | 18894 | | public System.DateTimeOffset AccessTierChangedOn { get; internal set; } |
| | 18895 | |
|
| | 18896 | | /// <summary> |
| | 18897 | | /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicat |
| | 18898 | | /// </summary> |
| | 18899 | | public string VersionId { get; internal set; } |
| | 18900 | |
|
| | 18901 | | /// <summary> |
| | 18902 | | /// The value of this header indicates whether version of this blob is a current version, see also x-ms-version- |
| | 18903 | | /// </summary> |
| | 18904 | | public bool IsCurrentVersion { get; internal set; } |
| | 18905 | |
|
| | 18906 | | /// <summary> |
| | 18907 | | /// The number of tags associated with the blob |
| | 18908 | | /// </summary> |
| | 18909 | | public long TagCount { get; internal set; } |
| | 18910 | |
|
| | 18911 | | /// <summary> |
| | 18912 | | /// The time this blob will expire. |
| | 18913 | | /// </summary> |
| | 18914 | | public System.DateTimeOffset ExpiresOn { get; internal set; } |
| | 18915 | |
|
| | 18916 | | /// <summary> |
| | 18917 | | /// If this blob has been sealed |
| | 18918 | | /// </summary> |
| | 18919 | | public bool IsSealed { get; internal set; } |
| | 18920 | |
|
| | 18921 | | /// <summary> |
| | 18922 | | /// If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid va |
| | 18923 | | /// </summary> |
| | 18924 | | public string RehydratePriority { get; internal set; } |
| | 18925 | |
|
| | 18926 | | /// <summary> |
| | 18927 | | /// Creates a new BlobPropertiesInternal instance |
| | 18928 | | /// </summary> |
| | 18929 | | public BlobPropertiesInternal() |
| | 18930 | | { |
| | 18931 | | Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgnoreCase |
| | 18932 | | ObjectReplicationRules = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.Ord |
| | 18933 | | } |
| | 18934 | | } |
| | 18935 | | } |
| | 18936 | | #endregion class BlobPropertiesInternal |
| | 18937 | |
|
| | 18938 | | #region class BlobRetentionPolicy |
| | 18939 | | namespace Azure.Storage.Blobs.Models |
| | 18940 | | { |
| | 18941 | | /// <summary> |
| | 18942 | | /// the retention policy which determines how long the associated data should persist |
| | 18943 | | /// </summary> |
| | 18944 | | public partial class BlobRetentionPolicy |
| | 18945 | | { |
| | 18946 | | /// <summary> |
| | 18947 | | /// Indicates whether a retention policy is enabled for the storage service |
| | 18948 | | /// </summary> |
| | 18949 | | public bool Enabled { get; set; } |
| | 18950 | |
|
| | 18951 | | /// <summary> |
| | 18952 | | /// Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older |
| | 18953 | | /// </summary> |
| | 18954 | | public int? Days { get; set; } |
| | 18955 | |
|
| | 18956 | | /// <summary> |
| | 18957 | | /// Creates a new BlobRetentionPolicy instance |
| | 18958 | | /// </summary> |
| | 18959 | | public BlobRetentionPolicy() { } |
| | 18960 | |
|
| | 18961 | | /// <summary> |
| | 18962 | | /// Serialize a BlobRetentionPolicy instance as XML. |
| | 18963 | | /// </summary> |
| | 18964 | | /// <param name="value">The BlobRetentionPolicy instance to serialize.</param> |
| | 18965 | | /// <param name="name">An optional name to use for the root element instead of "RetentionPolicy".</param> |
| | 18966 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 18967 | | /// <returns>The serialized XML element.</returns> |
| | 18968 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.BlobRetentionPolicy value, string name |
| | 18969 | | { |
| | 18970 | | System.Diagnostics.Debug.Assert(value != null); |
| | 18971 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 18972 | | _element.Add(new System.Xml.Linq.XElement( |
| | 18973 | | System.Xml.Linq.XName.Get("Enabled", ""), |
| | 18974 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 18975 | | value.Enabled.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant())); |
| | 18976 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 18977 | | if (value.Days != null) |
| | 18978 | | { |
| | 18979 | | _element.Add(new System.Xml.Linq.XElement( |
| | 18980 | | System.Xml.Linq.XName.Get("Days", ""), |
| | 18981 | | value.Days.Value.ToString(System.Globalization.CultureInfo.InvariantCulture))); |
| | 18982 | | } |
| | 18983 | | return _element; |
| | 18984 | | } |
| | 18985 | |
|
| | 18986 | | /// <summary> |
| | 18987 | | /// Deserializes XML into a new BlobRetentionPolicy instance. |
| | 18988 | | /// </summary> |
| | 18989 | | /// <param name="element">The XML element to deserialize.</param> |
| | 18990 | | /// <returns>A deserialized BlobRetentionPolicy instance.</returns> |
| | 18991 | | internal static Azure.Storage.Blobs.Models.BlobRetentionPolicy FromXml(System.Xml.Linq.XElement element) |
| | 18992 | | { |
| | 18993 | | System.Diagnostics.Debug.Assert(element != null); |
| | 18994 | | System.Xml.Linq.XElement _child; |
| | 18995 | | Azure.Storage.Blobs.Models.BlobRetentionPolicy _value = new Azure.Storage.Blobs.Models.BlobRetentionPolicy() |
| | 18996 | | _child = element.Element(System.Xml.Linq.XName.Get("Enabled", "")); |
| | 18997 | | if (_child != null) |
| | 18998 | | { |
| | 18999 | | _value.Enabled = bool.Parse(_child.Value); |
| | 19000 | | } |
| | 19001 | | _child = element.Element(System.Xml.Linq.XName.Get("Days", "")); |
| | 19002 | | if (_child != null) |
| | 19003 | | { |
| | 19004 | | _value.Days = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 19005 | | } |
| | 19006 | | CustomizeFromXml(element, _value); |
| | 19007 | | return _value; |
| | 19008 | | } |
| | 19009 | |
|
| | 19010 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobRetentionP |
| | 19011 | | } |
| | 19012 | | } |
| | 19013 | | #endregion class BlobRetentionPolicy |
| | 19014 | |
|
| | 19015 | | #region class BlobServiceProperties |
| | 19016 | | namespace Azure.Storage.Blobs.Models |
| | 19017 | | { |
| | 19018 | | /// <summary> |
| | 19019 | | /// Storage Service Properties. |
| | 19020 | | /// </summary> |
| | 19021 | | public partial class BlobServiceProperties |
| | 19022 | | { |
| | 19023 | | /// <summary> |
| | 19024 | | /// Azure Analytics Logging settings. |
| | 19025 | | /// </summary> |
| | 19026 | | public Azure.Storage.Blobs.Models.BlobAnalyticsLogging Logging { get; set; } |
| | 19027 | |
|
| | 19028 | | /// <summary> |
| | 19029 | | /// a summary of request statistics grouped by API in hour or minute aggregates for blobs |
| | 19030 | | /// </summary> |
| | 19031 | | public Azure.Storage.Blobs.Models.BlobMetrics HourMetrics { get; set; } |
| | 19032 | |
|
| | 19033 | | /// <summary> |
| | 19034 | | /// a summary of request statistics grouped by API in hour or minute aggregates for blobs |
| | 19035 | | /// </summary> |
| | 19036 | | public Azure.Storage.Blobs.Models.BlobMetrics MinuteMetrics { get; set; } |
| | 19037 | |
|
| | 19038 | | /// <summary> |
| | 19039 | | /// The set of CORS rules. |
| | 19040 | | /// </summary> |
| | 19041 | | public System.Collections.Generic.IList<Azure.Storage.Blobs.Models.BlobCorsRule> Cors { get; set; } |
| | 19042 | |
|
| | 19043 | | /// <summary> |
| | 19044 | | /// The default version to use for requests to the Blob service if an incoming request's version is not specifie |
| | 19045 | | /// </summary> |
| | 19046 | | public string DefaultServiceVersion { get; set; } |
| | 19047 | |
|
| | 19048 | | /// <summary> |
| | 19049 | | /// the retention policy which determines how long the associated data should persist |
| | 19050 | | /// </summary> |
| | 19051 | | public Azure.Storage.Blobs.Models.BlobRetentionPolicy DeleteRetentionPolicy { get; set; } |
| | 19052 | |
|
| | 19053 | | /// <summary> |
| | 19054 | | /// The properties that enable an account to host a static website |
| | 19055 | | /// </summary> |
| | 19056 | | public Azure.Storage.Blobs.Models.BlobStaticWebsite StaticWebsite { get; set; } |
| | 19057 | |
|
| | 19058 | | /// <summary> |
| | 19059 | | /// Creates a new BlobServiceProperties instance |
| | 19060 | | /// </summary> |
| | 19061 | | public BlobServiceProperties() |
| | 19062 | | : this(false) |
| | 19063 | | { |
| | 19064 | | } |
| | 19065 | |
|
| | 19066 | | /// <summary> |
| | 19067 | | /// Creates a new BlobServiceProperties instance |
| | 19068 | | /// </summary> |
| | 19069 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 19070 | | internal BlobServiceProperties(bool skipInitialization) |
| | 19071 | | { |
| | 19072 | | if (!skipInitialization) |
| | 19073 | | { |
| | 19074 | | Logging = new Azure.Storage.Blobs.Models.BlobAnalyticsLogging(); |
| | 19075 | | HourMetrics = new Azure.Storage.Blobs.Models.BlobMetrics(); |
| | 19076 | | MinuteMetrics = new Azure.Storage.Blobs.Models.BlobMetrics(); |
| | 19077 | | DeleteRetentionPolicy = new Azure.Storage.Blobs.Models.BlobRetentionPolicy(); |
| | 19078 | | StaticWebsite = new Azure.Storage.Blobs.Models.BlobStaticWebsite(); |
| | 19079 | | } |
| | 19080 | | } |
| | 19081 | |
|
| | 19082 | | /// <summary> |
| | 19083 | | /// Serialize a BlobServiceProperties instance as XML. |
| | 19084 | | /// </summary> |
| | 19085 | | /// <param name="value">The BlobServiceProperties instance to serialize.</param> |
| | 19086 | | /// <param name="name">An optional name to use for the root element instead of "StorageServiceProperties".</para |
| | 19087 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 19088 | | /// <returns>The serialized XML element.</returns> |
| | 19089 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.BlobServiceProperties value, string na |
| | 19090 | | { |
| | 19091 | | System.Diagnostics.Debug.Assert(value != null); |
| | 19092 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 19093 | | if (value.Logging != null) |
| | 19094 | | { |
| | 19095 | | _element.Add(Azure.Storage.Blobs.Models.BlobAnalyticsLogging.ToXml(value.Logging, "Logging", "")); |
| | 19096 | | } |
| | 19097 | | if (value.HourMetrics != null) |
| | 19098 | | { |
| | 19099 | | _element.Add(Azure.Storage.Blobs.Models.BlobMetrics.ToXml(value.HourMetrics, "HourMetrics", "")); |
| | 19100 | | } |
| | 19101 | | if (value.MinuteMetrics != null) |
| | 19102 | | { |
| | 19103 | | _element.Add(Azure.Storage.Blobs.Models.BlobMetrics.ToXml(value.MinuteMetrics, "MinuteMetrics", "")); |
| | 19104 | | } |
| | 19105 | | if (value.Cors != null) |
| | 19106 | | { |
| | 19107 | | System.Xml.Linq.XElement _elements = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get("Cors", "")) |
| | 19108 | | foreach (Azure.Storage.Blobs.Models.BlobCorsRule _child in value.Cors) |
| | 19109 | | { |
| | 19110 | | _elements.Add(Azure.Storage.Blobs.Models.BlobCorsRule.ToXml(_child)); |
| | 19111 | | } |
| | 19112 | | _element.Add(_elements); |
| | 19113 | | } |
| | 19114 | | if (value.DefaultServiceVersion != null) |
| | 19115 | | { |
| | 19116 | | _element.Add(new System.Xml.Linq.XElement( |
| | 19117 | | System.Xml.Linq.XName.Get("DefaultServiceVersion", ""), |
| | 19118 | | value.DefaultServiceVersion)); |
| | 19119 | | } |
| | 19120 | | if (value.DeleteRetentionPolicy != null) |
| | 19121 | | { |
| | 19122 | | _element.Add(Azure.Storage.Blobs.Models.BlobRetentionPolicy.ToXml(value.DeleteRetentionPolicy, "DeleteRe |
| | 19123 | | } |
| | 19124 | | if (value.StaticWebsite != null) |
| | 19125 | | { |
| | 19126 | | _element.Add(Azure.Storage.Blobs.Models.BlobStaticWebsite.ToXml(value.StaticWebsite, "StaticWebsite", "" |
| | 19127 | | } |
| | 19128 | | return _element; |
| | 19129 | | } |
| | 19130 | |
|
| | 19131 | | /// <summary> |
| | 19132 | | /// Deserializes XML into a new BlobServiceProperties instance. |
| | 19133 | | /// </summary> |
| | 19134 | | /// <param name="element">The XML element to deserialize.</param> |
| | 19135 | | /// <returns>A deserialized BlobServiceProperties instance.</returns> |
| | 19136 | | internal static Azure.Storage.Blobs.Models.BlobServiceProperties FromXml(System.Xml.Linq.XElement element) |
| | 19137 | | { |
| | 19138 | | System.Diagnostics.Debug.Assert(element != null); |
| | 19139 | | System.Xml.Linq.XElement _child; |
| | 19140 | | Azure.Storage.Blobs.Models.BlobServiceProperties _value = new Azure.Storage.Blobs.Models.BlobServiceProperti |
| | 19141 | | _child = element.Element(System.Xml.Linq.XName.Get("Logging", "")); |
| | 19142 | | if (_child != null) |
| | 19143 | | { |
| | 19144 | | _value.Logging = Azure.Storage.Blobs.Models.BlobAnalyticsLogging.FromXml(_child); |
| | 19145 | | } |
| | 19146 | | _child = element.Element(System.Xml.Linq.XName.Get("HourMetrics", "")); |
| | 19147 | | if (_child != null) |
| | 19148 | | { |
| | 19149 | | _value.HourMetrics = Azure.Storage.Blobs.Models.BlobMetrics.FromXml(_child); |
| | 19150 | | } |
| | 19151 | | _child = element.Element(System.Xml.Linq.XName.Get("MinuteMetrics", "")); |
| | 19152 | | if (_child != null) |
| | 19153 | | { |
| | 19154 | | _value.MinuteMetrics = Azure.Storage.Blobs.Models.BlobMetrics.FromXml(_child); |
| | 19155 | | } |
| | 19156 | | _child = element.Element(System.Xml.Linq.XName.Get("Cors", "")); |
| | 19157 | | if (_child != null) |
| | 19158 | | { |
| | 19159 | | _value.Cors = System.Linq.Enumerable.ToList( |
| | 19160 | | System.Linq.Enumerable.Select( |
| | 19161 | | _child.Elements(System.Xml.Linq.XName.Get("CorsRule", "")), |
| | 19162 | | e => Azure.Storage.Blobs.Models.BlobCorsRule.FromXml(e))); |
| | 19163 | | } |
| | 19164 | | else |
| | 19165 | | { |
| | 19166 | | _value.Cors = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobCorsRule>(); |
| | 19167 | | } |
| | 19168 | | _child = element.Element(System.Xml.Linq.XName.Get("DefaultServiceVersion", "")); |
| | 19169 | | if (_child != null) |
| | 19170 | | { |
| | 19171 | | _value.DefaultServiceVersion = _child.Value; |
| | 19172 | | } |
| | 19173 | | _child = element.Element(System.Xml.Linq.XName.Get("DeleteRetentionPolicy", "")); |
| | 19174 | | if (_child != null) |
| | 19175 | | { |
| | 19176 | | _value.DeleteRetentionPolicy = Azure.Storage.Blobs.Models.BlobRetentionPolicy.FromXml(_child); |
| | 19177 | | } |
| | 19178 | | _child = element.Element(System.Xml.Linq.XName.Get("StaticWebsite", "")); |
| | 19179 | | if (_child != null) |
| | 19180 | | { |
| | 19181 | | _value.StaticWebsite = Azure.Storage.Blobs.Models.BlobStaticWebsite.FromXml(_child); |
| | 19182 | | } |
| | 19183 | | CustomizeFromXml(element, _value); |
| | 19184 | | return _value; |
| | 19185 | | } |
| | 19186 | |
|
| | 19187 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobServicePro |
| | 19188 | | } |
| | 19189 | | } |
| | 19190 | | #endregion class BlobServiceProperties |
| | 19191 | |
|
| | 19192 | | #region class BlobServiceStatistics |
| | 19193 | | namespace Azure.Storage.Blobs.Models |
| | 19194 | | { |
| | 19195 | | /// <summary> |
| | 19196 | | /// Statistics for the storage service. |
| | 19197 | | /// </summary> |
| | 19198 | | public partial class BlobServiceStatistics |
| | 19199 | | { |
| | 19200 | | /// <summary> |
| | 19201 | | /// Geo-Replication information for the Secondary Storage Service |
| | 19202 | | /// </summary> |
| | 19203 | | public Azure.Storage.Blobs.Models.BlobGeoReplication GeoReplication { get; internal set; } |
| | 19204 | |
|
| | 19205 | | /// <summary> |
| | 19206 | | /// Creates a new BlobServiceStatistics instance |
| | 19207 | | /// </summary> |
| | 19208 | | internal BlobServiceStatistics() |
| | 19209 | | : this(false) |
| | 19210 | | { |
| | 19211 | | } |
| | 19212 | |
|
| | 19213 | | /// <summary> |
| | 19214 | | /// Creates a new BlobServiceStatistics instance |
| | 19215 | | /// </summary> |
| | 19216 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 19217 | | internal BlobServiceStatistics(bool skipInitialization) |
| | 19218 | | { |
| | 19219 | | if (!skipInitialization) |
| | 19220 | | { |
| | 19221 | | GeoReplication = new Azure.Storage.Blobs.Models.BlobGeoReplication(); |
| | 19222 | | } |
| | 19223 | | } |
| | 19224 | |
|
| | 19225 | | /// <summary> |
| | 19226 | | /// Deserializes XML into a new BlobServiceStatistics instance. |
| | 19227 | | /// </summary> |
| | 19228 | | /// <param name="element">The XML element to deserialize.</param> |
| | 19229 | | /// <returns>A deserialized BlobServiceStatistics instance.</returns> |
| | 19230 | | internal static Azure.Storage.Blobs.Models.BlobServiceStatistics FromXml(System.Xml.Linq.XElement element) |
| | 19231 | | { |
| | 19232 | | System.Diagnostics.Debug.Assert(element != null); |
| | 19233 | | System.Xml.Linq.XElement _child; |
| | 19234 | | Azure.Storage.Blobs.Models.BlobServiceStatistics _value = new Azure.Storage.Blobs.Models.BlobServiceStatisti |
| | 19235 | | _child = element.Element(System.Xml.Linq.XName.Get("GeoReplication", "")); |
| | 19236 | | if (_child != null) |
| | 19237 | | { |
| | 19238 | | _value.GeoReplication = Azure.Storage.Blobs.Models.BlobGeoReplication.FromXml(_child); |
| | 19239 | | } |
| | 19240 | | CustomizeFromXml(element, _value); |
| | 19241 | | return _value; |
| | 19242 | | } |
| | 19243 | |
|
| | 19244 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobServiceSta |
| | 19245 | | } |
| | 19246 | |
|
| | 19247 | | /// <summary> |
| | 19248 | | /// BlobsModelFactory provides utilities for mocking. |
| | 19249 | | /// </summary> |
| | 19250 | | public static partial class BlobsModelFactory |
| | 19251 | | { |
| | 19252 | | /// <summary> |
| | 19253 | | /// Creates a new BlobServiceStatistics instance for mocking. |
| | 19254 | | /// </summary> |
| | 19255 | | public static BlobServiceStatistics BlobServiceStatistics( |
| | 19256 | | Azure.Storage.Blobs.Models.BlobGeoReplication geoReplication = default) |
| | 19257 | | { |
| | 19258 | | return new BlobServiceStatistics() |
| | 19259 | | { |
| | 19260 | | GeoReplication = geoReplication, |
| | 19261 | | }; |
| | 19262 | | } |
| | 19263 | | } |
| | 19264 | | } |
| | 19265 | | #endregion class BlobServiceStatistics |
| | 19266 | |
|
| | 19267 | | #region class BlobSetExpiryInternal |
| | 19268 | | namespace Azure.Storage.Blobs.Models |
| | 19269 | | { |
| | 19270 | | /// <summary> |
| | 19271 | | /// BlobSetExpiryInternal |
| | 19272 | | /// </summary> |
| | 19273 | | internal partial class BlobSetExpiryInternal |
| | 19274 | | { |
| | 19275 | | /// <summary> |
| | 19276 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 19277 | | /// </summary> |
| | 19278 | | public Azure.ETag ETag { get; internal set; } |
| | 19279 | |
|
| | 19280 | | /// <summary> |
| | 19281 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 19282 | | /// </summary> |
| | 19283 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 19284 | |
|
| | 19285 | | /// <summary> |
| | 19286 | | /// Prevent direct instantiation of BlobSetExpiryInternal instances. |
| | 19287 | | /// You can use BlobsModelFactory.BlobSetExpiryInternal instead. |
| | 19288 | | /// </summary> |
| | 19289 | | internal BlobSetExpiryInternal() { } |
| | 19290 | | } |
| | 19291 | | } |
| | 19292 | | #endregion class BlobSetExpiryInternal |
| | 19293 | |
|
| | 19294 | | #region class BlobSignedIdentifier |
| | 19295 | | namespace Azure.Storage.Blobs.Models |
| | 19296 | | { |
| | 19297 | | /// <summary> |
| | 19298 | | /// signed identifier |
| | 19299 | | /// </summary> |
| | 19300 | | public partial class BlobSignedIdentifier |
| | 19301 | | { |
| | 19302 | | /// <summary> |
| | 19303 | | /// a unique id |
| | 19304 | | /// </summary> |
| | 19305 | | public string Id { get; set; } |
| | 19306 | |
|
| | 19307 | | /// <summary> |
| | 19308 | | /// An Access policy |
| | 19309 | | /// </summary> |
| | 19310 | | public Azure.Storage.Blobs.Models.BlobAccessPolicy AccessPolicy { get; set; } |
| | 19311 | |
|
| | 19312 | | /// <summary> |
| | 19313 | | /// Creates a new BlobSignedIdentifier instance |
| | 19314 | | /// </summary> |
| | 19315 | | public BlobSignedIdentifier() |
| | 19316 | | : this(false) |
| | 19317 | | { |
| | 19318 | | } |
| | 19319 | |
|
| | 19320 | | /// <summary> |
| | 19321 | | /// Creates a new BlobSignedIdentifier instance |
| | 19322 | | /// </summary> |
| | 19323 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 19324 | | internal BlobSignedIdentifier(bool skipInitialization) |
| | 19325 | | { |
| | 19326 | | if (!skipInitialization) |
| | 19327 | | { |
| | 19328 | | AccessPolicy = new Azure.Storage.Blobs.Models.BlobAccessPolicy(); |
| | 19329 | | } |
| | 19330 | | } |
| | 19331 | |
|
| | 19332 | | /// <summary> |
| | 19333 | | /// Serialize a BlobSignedIdentifier instance as XML. |
| | 19334 | | /// </summary> |
| | 19335 | | /// <param name="value">The BlobSignedIdentifier instance to serialize.</param> |
| | 19336 | | /// <param name="name">An optional name to use for the root element instead of "SignedIdentifier".</param> |
| | 19337 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 19338 | | /// <returns>The serialized XML element.</returns> |
| | 19339 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.BlobSignedIdentifier value, string nam |
| | 19340 | | { |
| | 19341 | | System.Diagnostics.Debug.Assert(value != null); |
| | 19342 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 19343 | | _element.Add(new System.Xml.Linq.XElement( |
| | 19344 | | System.Xml.Linq.XName.Get("Id", ""), |
| | 19345 | | value.Id)); |
| | 19346 | | _element.Add(Azure.Storage.Blobs.Models.BlobAccessPolicy.ToXml(value.AccessPolicy, "AccessPolicy", "")); |
| | 19347 | | return _element; |
| | 19348 | | } |
| | 19349 | |
|
| | 19350 | | /// <summary> |
| | 19351 | | /// Deserializes XML into a new BlobSignedIdentifier instance. |
| | 19352 | | /// </summary> |
| | 19353 | | /// <param name="element">The XML element to deserialize.</param> |
| | 19354 | | /// <returns>A deserialized BlobSignedIdentifier instance.</returns> |
| | 19355 | | internal static Azure.Storage.Blobs.Models.BlobSignedIdentifier FromXml(System.Xml.Linq.XElement element) |
| | 19356 | | { |
| | 19357 | | System.Diagnostics.Debug.Assert(element != null); |
| | 19358 | | System.Xml.Linq.XElement _child; |
| | 19359 | | Azure.Storage.Blobs.Models.BlobSignedIdentifier _value = new Azure.Storage.Blobs.Models.BlobSignedIdentifier |
| | 19360 | | _child = element.Element(System.Xml.Linq.XName.Get("Id", "")); |
| | 19361 | | if (_child != null) |
| | 19362 | | { |
| | 19363 | | _value.Id = _child.Value; |
| | 19364 | | } |
| | 19365 | | _child = element.Element(System.Xml.Linq.XName.Get("AccessPolicy", "")); |
| | 19366 | | if (_child != null) |
| | 19367 | | { |
| | 19368 | | _value.AccessPolicy = Azure.Storage.Blobs.Models.BlobAccessPolicy.FromXml(_child); |
| | 19369 | | } |
| | 19370 | | CustomizeFromXml(element, _value); |
| | 19371 | | return _value; |
| | 19372 | | } |
| | 19373 | |
|
| | 19374 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobSignedIden |
| | 19375 | | } |
| | 19376 | | } |
| | 19377 | | #endregion class BlobSignedIdentifier |
| | 19378 | |
|
| | 19379 | | #region class BlobSnapshotInfo |
| | 19380 | | namespace Azure.Storage.Blobs.Models |
| | 19381 | | { |
| | 19382 | | /// <summary> |
| | 19383 | | /// BlobSnapshotInfo |
| | 19384 | | /// </summary> |
| | 19385 | | public partial class BlobSnapshotInfo |
| | 19386 | | { |
| | 19387 | | /// <summary> |
| | 19388 | | /// Uniquely identifies the snapshot and indicates the snapshot version. It may be used in subsequent requests t |
| | 19389 | | /// </summary> |
| | 19390 | | public string Snapshot { get; internal set; } |
| | 19391 | |
|
| | 19392 | | /// <summary> |
| | 19393 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 19394 | | /// </summary> |
| | 19395 | | public Azure.ETag ETag { get; internal set; } |
| | 19396 | |
|
| | 19397 | | /// <summary> |
| | 19398 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 19399 | | /// </summary> |
| | 19400 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 19401 | |
|
| | 19402 | | /// <summary> |
| | 19403 | | /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicat |
| | 19404 | | /// </summary> |
| | 19405 | | public string VersionId { get; internal set; } |
| | 19406 | |
|
| | 19407 | | /// <summary> |
| | 19408 | | /// True if the contents of the request are successfully encrypted using the specified algorithm, and false othe |
| | 19409 | | /// </summary> |
| | 19410 | | public bool IsServerEncrypted { get; internal set; } |
| | 19411 | |
|
| | 19412 | | /// <summary> |
| | 19413 | | /// Prevent direct instantiation of BlobSnapshotInfo instances. |
| | 19414 | | /// You can use BlobsModelFactory.BlobSnapshotInfo instead. |
| | 19415 | | /// </summary> |
| | 19416 | | internal BlobSnapshotInfo() { } |
| | 19417 | | } |
| | 19418 | |
|
| | 19419 | | /// <summary> |
| | 19420 | | /// BlobsModelFactory provides utilities for mocking. |
| | 19421 | | /// </summary> |
| | 19422 | | public static partial class BlobsModelFactory |
| | 19423 | | { |
| | 19424 | | /// <summary> |
| | 19425 | | /// Creates a new BlobSnapshotInfo instance for mocking. |
| | 19426 | | /// </summary> |
| | 19427 | | public static BlobSnapshotInfo BlobSnapshotInfo( |
| | 19428 | | string snapshot, |
| | 19429 | | Azure.ETag eTag, |
| | 19430 | | System.DateTimeOffset lastModified, |
| | 19431 | | string versionId, |
| | 19432 | | bool isServerEncrypted) |
| | 19433 | | { |
| | 19434 | | return new BlobSnapshotInfo() |
| | 19435 | | { |
| | 19436 | | Snapshot = snapshot, |
| | 19437 | | ETag = eTag, |
| | 19438 | | LastModified = lastModified, |
| | 19439 | | VersionId = versionId, |
| | 19440 | | IsServerEncrypted = isServerEncrypted, |
| | 19441 | | }; |
| | 19442 | | } |
| | 19443 | | } |
| | 19444 | | } |
| | 19445 | | #endregion class BlobSnapshotInfo |
| | 19446 | |
|
| | 19447 | | #region class BlobStaticWebsite |
| | 19448 | | namespace Azure.Storage.Blobs.Models |
| | 19449 | | { |
| | 19450 | | /// <summary> |
| | 19451 | | /// The properties that enable an account to host a static website |
| | 19452 | | /// </summary> |
| | 19453 | | public partial class BlobStaticWebsite |
| | 19454 | | { |
| | 19455 | | /// <summary> |
| | 19456 | | /// Indicates whether this account is hosting a static website |
| | 19457 | | /// </summary> |
| | 19458 | | public bool Enabled { get; set; } |
| | 19459 | |
|
| | 19460 | | /// <summary> |
| | 19461 | | /// The default name of the index page under each directory |
| | 19462 | | /// </summary> |
| | 19463 | | public string IndexDocument { get; set; } |
| | 19464 | |
|
| | 19465 | | /// <summary> |
| | 19466 | | /// The absolute path of the custom 404 page |
| | 19467 | | /// </summary> |
| | 19468 | | public string ErrorDocument404Path { get; set; } |
| | 19469 | |
|
| | 19470 | | /// <summary> |
| | 19471 | | /// Absolute path of the default index page |
| | 19472 | | /// </summary> |
| | 19473 | | public string DefaultIndexDocumentPath { get; set; } |
| | 19474 | |
|
| | 19475 | | /// <summary> |
| | 19476 | | /// Creates a new BlobStaticWebsite instance |
| | 19477 | | /// </summary> |
| | 19478 | | public BlobStaticWebsite() { } |
| | 19479 | |
|
| | 19480 | | /// <summary> |
| | 19481 | | /// Serialize a BlobStaticWebsite instance as XML. |
| | 19482 | | /// </summary> |
| | 19483 | | /// <param name="value">The BlobStaticWebsite instance to serialize.</param> |
| | 19484 | | /// <param name="name">An optional name to use for the root element instead of "StaticWebsite".</param> |
| | 19485 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 19486 | | /// <returns>The serialized XML element.</returns> |
| | 19487 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.BlobStaticWebsite value, string name = |
| | 19488 | | { |
| | 19489 | | System.Diagnostics.Debug.Assert(value != null); |
| | 19490 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 19491 | | _element.Add(new System.Xml.Linq.XElement( |
| | 19492 | | System.Xml.Linq.XName.Get("Enabled", ""), |
| | 19493 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 19494 | | value.Enabled.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant())); |
| | 19495 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 19496 | | if (value.IndexDocument != null) |
| | 19497 | | { |
| | 19498 | | _element.Add(new System.Xml.Linq.XElement( |
| | 19499 | | System.Xml.Linq.XName.Get("IndexDocument", ""), |
| | 19500 | | value.IndexDocument)); |
| | 19501 | | } |
| | 19502 | | if (value.ErrorDocument404Path != null) |
| | 19503 | | { |
| | 19504 | | _element.Add(new System.Xml.Linq.XElement( |
| | 19505 | | System.Xml.Linq.XName.Get("ErrorDocument404Path", ""), |
| | 19506 | | value.ErrorDocument404Path)); |
| | 19507 | | } |
| | 19508 | | if (value.DefaultIndexDocumentPath != null) |
| | 19509 | | { |
| | 19510 | | _element.Add(new System.Xml.Linq.XElement( |
| | 19511 | | System.Xml.Linq.XName.Get("DefaultIndexDocumentPath", ""), |
| | 19512 | | value.DefaultIndexDocumentPath)); |
| | 19513 | | } |
| | 19514 | | return _element; |
| | 19515 | | } |
| | 19516 | |
|
| | 19517 | | /// <summary> |
| | 19518 | | /// Deserializes XML into a new BlobStaticWebsite instance. |
| | 19519 | | /// </summary> |
| | 19520 | | /// <param name="element">The XML element to deserialize.</param> |
| | 19521 | | /// <returns>A deserialized BlobStaticWebsite instance.</returns> |
| | 19522 | | internal static Azure.Storage.Blobs.Models.BlobStaticWebsite FromXml(System.Xml.Linq.XElement element) |
| | 19523 | | { |
| | 19524 | | System.Diagnostics.Debug.Assert(element != null); |
| | 19525 | | System.Xml.Linq.XElement _child; |
| | 19526 | | Azure.Storage.Blobs.Models.BlobStaticWebsite _value = new Azure.Storage.Blobs.Models.BlobStaticWebsite(); |
| | 19527 | | _child = element.Element(System.Xml.Linq.XName.Get("Enabled", "")); |
| | 19528 | | if (_child != null) |
| | 19529 | | { |
| | 19530 | | _value.Enabled = bool.Parse(_child.Value); |
| | 19531 | | } |
| | 19532 | | _child = element.Element(System.Xml.Linq.XName.Get("IndexDocument", "")); |
| | 19533 | | if (_child != null) |
| | 19534 | | { |
| | 19535 | | _value.IndexDocument = _child.Value; |
| | 19536 | | } |
| | 19537 | | _child = element.Element(System.Xml.Linq.XName.Get("ErrorDocument404Path", "")); |
| | 19538 | | if (_child != null) |
| | 19539 | | { |
| | 19540 | | _value.ErrorDocument404Path = _child.Value; |
| | 19541 | | } |
| | 19542 | | _child = element.Element(System.Xml.Linq.XName.Get("DefaultIndexDocumentPath", "")); |
| | 19543 | | if (_child != null) |
| | 19544 | | { |
| | 19545 | | _value.DefaultIndexDocumentPath = _child.Value; |
| | 19546 | | } |
| | 19547 | | CustomizeFromXml(element, _value); |
| | 19548 | | return _value; |
| | 19549 | | } |
| | 19550 | |
|
| | 19551 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobStaticWebs |
| | 19552 | | } |
| | 19553 | | } |
| | 19554 | | #endregion class BlobStaticWebsite |
| | 19555 | |
|
| | 19556 | | #region class BlobTag |
| | 19557 | | namespace Azure.Storage.Blobs.Models |
| | 19558 | | { |
| | 19559 | | /// <summary> |
| | 19560 | | /// BlobTag |
| | 19561 | | /// </summary> |
| | 19562 | | internal partial class BlobTag |
| | 19563 | | { |
| | 19564 | | /// <summary> |
| | 19565 | | /// Key |
| | 19566 | | /// </summary> |
| | 19567 | | public string Key { get; set; } |
| | 19568 | |
|
| | 19569 | | /// <summary> |
| | 19570 | | /// Value |
| | 19571 | | /// </summary> |
| | 19572 | | public string Value { get; set; } |
| | 19573 | |
|
| | 19574 | | /// <summary> |
| | 19575 | | /// Creates a new BlobTag instance |
| | 19576 | | /// </summary> |
| | 19577 | | public BlobTag() { } |
| | 19578 | |
|
| | 19579 | | /// <summary> |
| | 19580 | | /// Serialize a BlobTag instance as XML. |
| | 19581 | | /// </summary> |
| | 19582 | | /// <param name="value">The BlobTag instance to serialize.</param> |
| | 19583 | | /// <param name="name">An optional name to use for the root element instead of "Tag".</param> |
| | 19584 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 19585 | | /// <returns>The serialized XML element.</returns> |
| | 19586 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.BlobTag value, string name = "Tag", st |
| | 19587 | | { |
| | 19588 | | System.Diagnostics.Debug.Assert(value != null); |
| | 19589 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 19590 | | _element.Add(new System.Xml.Linq.XElement( |
| | 19591 | | System.Xml.Linq.XName.Get("Key", ""), |
| | 19592 | | value.Key)); |
| | 19593 | | _element.Add(new System.Xml.Linq.XElement( |
| | 19594 | | System.Xml.Linq.XName.Get("Value", ""), |
| | 19595 | | value.Value)); |
| | 19596 | | return _element; |
| | 19597 | | } |
| | 19598 | |
|
| | 19599 | | /// <summary> |
| | 19600 | | /// Deserializes XML into a new BlobTag instance. |
| | 19601 | | /// </summary> |
| | 19602 | | /// <param name="element">The XML element to deserialize.</param> |
| | 19603 | | /// <returns>A deserialized BlobTag instance.</returns> |
| | 19604 | | internal static Azure.Storage.Blobs.Models.BlobTag FromXml(System.Xml.Linq.XElement element) |
| | 19605 | | { |
| | 19606 | | System.Diagnostics.Debug.Assert(element != null); |
| | 19607 | | System.Xml.Linq.XElement _child; |
| | 19608 | | Azure.Storage.Blobs.Models.BlobTag _value = new Azure.Storage.Blobs.Models.BlobTag(); |
| | 19609 | | _child = element.Element(System.Xml.Linq.XName.Get("Key", "")); |
| | 19610 | | if (_child != null) |
| | 19611 | | { |
| | 19612 | | _value.Key = _child.Value; |
| | 19613 | | } |
| | 19614 | | _child = element.Element(System.Xml.Linq.XName.Get("Value", "")); |
| | 19615 | | if (_child != null) |
| | 19616 | | { |
| | 19617 | | _value.Value = _child.Value; |
| | 19618 | | } |
| | 19619 | | CustomizeFromXml(element, _value); |
| | 19620 | | return _value; |
| | 19621 | | } |
| | 19622 | |
|
| | 19623 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobTag value) |
| | 19624 | | } |
| | 19625 | | } |
| | 19626 | | #endregion class BlobTag |
| | 19627 | |
|
| | 19628 | | #region class BlobTags |
| | 19629 | | namespace Azure.Storage.Blobs.Models |
| | 19630 | | { |
| | 19631 | | /// <summary> |
| | 19632 | | /// Blob tags |
| | 19633 | | /// </summary> |
| | 19634 | | internal partial class BlobTags |
| | 19635 | | { |
| | 19636 | | /// <summary> |
| | 19637 | | /// BlobTagSet |
| | 19638 | | /// </summary> |
| | 19639 | | public System.Collections.Generic.IList<Azure.Storage.Blobs.Models.BlobTag> BlobTagSet { get; internal set; } |
| | 19640 | |
|
| | 19641 | | /// <summary> |
| | 19642 | | /// Creates a new BlobTags instance |
| | 19643 | | /// </summary> |
| | 19644 | | public BlobTags() |
| | 19645 | | : this(false) |
| | 19646 | | { |
| | 19647 | | } |
| | 19648 | |
|
| | 19649 | | /// <summary> |
| | 19650 | | /// Creates a new BlobTags instance |
| | 19651 | | /// </summary> |
| | 19652 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 19653 | | internal BlobTags(bool skipInitialization) |
| | 19654 | | { |
| | 19655 | | if (!skipInitialization) |
| | 19656 | | { |
| | 19657 | | BlobTagSet = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobTag>(); |
| | 19658 | | } |
| | 19659 | | } |
| | 19660 | |
|
| | 19661 | | /// <summary> |
| | 19662 | | /// Serialize a BlobTags instance as XML. |
| | 19663 | | /// </summary> |
| | 19664 | | /// <param name="value">The BlobTags instance to serialize.</param> |
| | 19665 | | /// <param name="name">An optional name to use for the root element instead of "Tags".</param> |
| | 19666 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 19667 | | /// <returns>The serialized XML element.</returns> |
| | 19668 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.BlobTags value, string name = "Tags", |
| | 19669 | | { |
| | 19670 | | System.Diagnostics.Debug.Assert(value != null); |
| | 19671 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 19672 | | System.Xml.Linq.XElement _elements = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get("TagSet", "")); |
| | 19673 | | foreach (Azure.Storage.Blobs.Models.BlobTag _child in value.BlobTagSet) |
| | 19674 | | { |
| | 19675 | | _elements.Add(Azure.Storage.Blobs.Models.BlobTag.ToXml(_child)); |
| | 19676 | | } |
| | 19677 | | _element.Add(_elements);return _element; |
| | 19678 | | } |
| | 19679 | |
|
| | 19680 | | /// <summary> |
| | 19681 | | /// Deserializes XML into a new BlobTags instance. |
| | 19682 | | /// </summary> |
| | 19683 | | /// <param name="element">The XML element to deserialize.</param> |
| | 19684 | | /// <returns>A deserialized BlobTags instance.</returns> |
| | 19685 | | internal static Azure.Storage.Blobs.Models.BlobTags FromXml(System.Xml.Linq.XElement element) |
| | 19686 | | { |
| | 19687 | | System.Diagnostics.Debug.Assert(element != null); |
| | 19688 | | System.Xml.Linq.XElement _child; |
| | 19689 | | Azure.Storage.Blobs.Models.BlobTags _value = new Azure.Storage.Blobs.Models.BlobTags(true); |
| | 19690 | | _child = element.Element(System.Xml.Linq.XName.Get("TagSet", "")); |
| | 19691 | | if (_child != null) |
| | 19692 | | { |
| | 19693 | | _value.BlobTagSet = System.Linq.Enumerable.ToList( |
| | 19694 | | System.Linq.Enumerable.Select( |
| | 19695 | | _child.Elements(System.Xml.Linq.XName.Get("Tag", "")), |
| | 19696 | | e => Azure.Storage.Blobs.Models.BlobTag.FromXml(e))); |
| | 19697 | | } |
| | 19698 | | else |
| | 19699 | | { |
| | 19700 | | _value.BlobTagSet = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobTag>(); |
| | 19701 | | } |
| | 19702 | | CustomizeFromXml(element, _value); |
| | 19703 | | return _value; |
| | 19704 | | } |
| | 19705 | |
|
| | 19706 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobTags value |
| | 19707 | | } |
| | 19708 | | } |
| | 19709 | | #endregion class BlobTags |
| | 19710 | |
|
| | 19711 | | #region enum BlobType |
| | 19712 | | namespace Azure.Storage.Blobs.Models |
| | 19713 | | { |
| | 19714 | | /// <summary> |
| | 19715 | | /// BlobType values |
| | 19716 | | /// </summary> |
| | 19717 | | public enum BlobType |
| | 19718 | | { |
| | 19719 | | /// <summary> |
| | 19720 | | /// BlockBlob |
| | 19721 | | /// </summary> |
| | 19722 | | Block, |
| | 19723 | |
|
| | 19724 | | /// <summary> |
| | 19725 | | /// PageBlob |
| | 19726 | | /// </summary> |
| | 19727 | | Page, |
| | 19728 | |
|
| | 19729 | | /// <summary> |
| | 19730 | | /// AppendBlob |
| | 19731 | | /// </summary> |
| | 19732 | | Append |
| | 19733 | | } |
| | 19734 | | } |
| | 19735 | |
|
| | 19736 | | namespace Azure.Storage.Blobs |
| | 19737 | | { |
| | 19738 | | internal static partial class BlobRestClient |
| | 19739 | | { |
| | 19740 | | public static partial class Serialization |
| | 19741 | | { |
| | 19742 | | public static string ToString(Azure.Storage.Blobs.Models.BlobType value) |
| | 19743 | | { |
| | 19744 | | return value switch |
| | 19745 | | { |
| | 19746 | | Azure.Storage.Blobs.Models.BlobType.Block => "BlockBlob", |
| | 19747 | | Azure.Storage.Blobs.Models.BlobType.Page => "PageBlob", |
| | 19748 | | Azure.Storage.Blobs.Models.BlobType.Append => "AppendBlob", |
| | 19749 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 19750 | | }; |
| | 19751 | | } |
| | 19752 | |
|
| | 19753 | | public static Azure.Storage.Blobs.Models.BlobType ParseBlobType(string value) |
| | 19754 | | { |
| | 19755 | | return value switch |
| | 19756 | | { |
| | 19757 | | "BlockBlob" => Azure.Storage.Blobs.Models.BlobType.Block, |
| | 19758 | | "PageBlob" => Azure.Storage.Blobs.Models.BlobType.Page, |
| | 19759 | | "AppendBlob" => Azure.Storage.Blobs.Models.BlobType.Append, |
| | 19760 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 19761 | | }; |
| | 19762 | | } |
| | 19763 | | } |
| | 19764 | | } |
| | 19765 | | } |
| | 19766 | | #endregion enum BlobType |
| | 19767 | |
|
| | 19768 | | #region class BlobsFlatSegment |
| | 19769 | | namespace Azure.Storage.Blobs.Models |
| | 19770 | | { |
| | 19771 | | /// <summary> |
| | 19772 | | /// An enumeration of blobs |
| | 19773 | | /// </summary> |
| | 19774 | | internal partial class BlobsFlatSegment |
| | 19775 | | { |
| | 19776 | | /// <summary> |
| | 19777 | | /// ServiceEndpoint |
| | 19778 | | /// </summary> |
| | 19779 | | public string ServiceEndpoint { get; internal set; } |
| | 19780 | |
|
| | 19781 | | /// <summary> |
| | 19782 | | /// ContainerName |
| | 19783 | | /// </summary> |
| | 19784 | | public string ContainerName { get; internal set; } |
| | 19785 | |
|
| | 19786 | | /// <summary> |
| | 19787 | | /// Prefix |
| | 19788 | | /// </summary> |
| | 19789 | | public string Prefix { get; internal set; } |
| | 19790 | |
|
| | 19791 | | /// <summary> |
| | 19792 | | /// Marker |
| | 19793 | | /// </summary> |
| | 19794 | | public string Marker { get; internal set; } |
| | 19795 | |
|
| | 19796 | | /// <summary> |
| | 19797 | | /// MaxResults |
| | 19798 | | /// </summary> |
| | 19799 | | public int? MaxResults { get; internal set; } |
| | 19800 | |
|
| | 19801 | | /// <summary> |
| | 19802 | | /// NextMarker |
| | 19803 | | /// </summary> |
| | 19804 | | public string NextMarker { get; internal set; } |
| | 19805 | |
|
| | 19806 | | /// <summary> |
| | 19807 | | /// BlobItems |
| | 19808 | | /// </summary> |
| | 19809 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobItemInternal> BlobItems { get; inte |
| | 19810 | |
|
| | 19811 | | /// <summary> |
| | 19812 | | /// Creates a new BlobsFlatSegment instance |
| | 19813 | | /// </summary> |
| | 19814 | | public BlobsFlatSegment() |
| | 19815 | | : this(false) |
| | 19816 | | { |
| | 19817 | | } |
| | 19818 | |
|
| | 19819 | | /// <summary> |
| | 19820 | | /// Creates a new BlobsFlatSegment instance |
| | 19821 | | /// </summary> |
| | 19822 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 19823 | | internal BlobsFlatSegment(bool skipInitialization) |
| | 19824 | | { |
| | 19825 | | if (!skipInitialization) |
| | 19826 | | { |
| | 19827 | | BlobItems = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobItemInternal>(); |
| | 19828 | | } |
| | 19829 | | } |
| | 19830 | |
|
| | 19831 | | /// <summary> |
| | 19832 | | /// Deserializes XML into a new BlobsFlatSegment instance. |
| | 19833 | | /// </summary> |
| | 19834 | | /// <param name="element">The XML element to deserialize.</param> |
| | 19835 | | /// <returns>A deserialized BlobsFlatSegment instance.</returns> |
| | 19836 | | internal static Azure.Storage.Blobs.Models.BlobsFlatSegment FromXml(System.Xml.Linq.XElement element) |
| | 19837 | | { |
| | 19838 | | System.Diagnostics.Debug.Assert(element != null); |
| | 19839 | | System.Xml.Linq.XElement _child; |
| | 19840 | | System.Xml.Linq.XAttribute _attribute; |
| | 19841 | | Azure.Storage.Blobs.Models.BlobsFlatSegment _value = new Azure.Storage.Blobs.Models.BlobsFlatSegment(true); |
| | 19842 | | _attribute = element.Attribute(System.Xml.Linq.XName.Get("ServiceEndpoint", "")); |
| | 19843 | | if (_attribute != null) |
| | 19844 | | { |
| | 19845 | | _value.ServiceEndpoint = _attribute.Value; |
| | 19846 | | } |
| | 19847 | | _attribute = element.Attribute(System.Xml.Linq.XName.Get("ContainerName", "")); |
| | 19848 | | if (_attribute != null) |
| | 19849 | | { |
| | 19850 | | _value.ContainerName = _attribute.Value; |
| | 19851 | | } |
| | 19852 | | _child = element.Element(System.Xml.Linq.XName.Get("Prefix", "")); |
| | 19853 | | if (_child != null) |
| | 19854 | | { |
| | 19855 | | _value.Prefix = _child.Value; |
| | 19856 | | } |
| | 19857 | | _child = element.Element(System.Xml.Linq.XName.Get("Marker", "")); |
| | 19858 | | if (_child != null) |
| | 19859 | | { |
| | 19860 | | _value.Marker = _child.Value; |
| | 19861 | | } |
| | 19862 | | _child = element.Element(System.Xml.Linq.XName.Get("MaxResults", "")); |
| | 19863 | | if (_child != null) |
| | 19864 | | { |
| | 19865 | | _value.MaxResults = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 19866 | | } |
| | 19867 | | _child = element.Element(System.Xml.Linq.XName.Get("NextMarker", "")); |
| | 19868 | | if (_child != null) |
| | 19869 | | { |
| | 19870 | | _value.NextMarker = _child.Value; |
| | 19871 | | } |
| | 19872 | | _child = element.Element(System.Xml.Linq.XName.Get("Blobs", "")); |
| | 19873 | | if (_child != null) |
| | 19874 | | { |
| | 19875 | | _value.BlobItems = System.Linq.Enumerable.ToList( |
| | 19876 | | System.Linq.Enumerable.Select( |
| | 19877 | | _child.Elements(System.Xml.Linq.XName.Get("Blob", "")), |
| | 19878 | | e => Azure.Storage.Blobs.Models.BlobItemInternal.FromXml(e))); |
| | 19879 | | } |
| | 19880 | | else |
| | 19881 | | { |
| | 19882 | | _value.BlobItems = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobItemInternal>(); |
| | 19883 | | } |
| | 19884 | | CustomizeFromXml(element, _value); |
| | 19885 | | return _value; |
| | 19886 | | } |
| | 19887 | |
|
| | 19888 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobsFlatSegme |
| | 19889 | | } |
| | 19890 | | } |
| | 19891 | | #endregion class BlobsFlatSegment |
| | 19892 | |
|
| | 19893 | | #region class BlobsHierarchySegment |
| | 19894 | | namespace Azure.Storage.Blobs.Models |
| | 19895 | | { |
| | 19896 | | /// <summary> |
| | 19897 | | /// An enumeration of blobs |
| | 19898 | | /// </summary> |
| | 19899 | | internal partial class BlobsHierarchySegment |
| | 19900 | | { |
| | 19901 | | /// <summary> |
| | 19902 | | /// ServiceEndpoint |
| | 19903 | | /// </summary> |
| | 19904 | | public string ServiceEndpoint { get; internal set; } |
| | 19905 | |
|
| | 19906 | | /// <summary> |
| | 19907 | | /// ContainerName |
| | 19908 | | /// </summary> |
| | 19909 | | public string ContainerName { get; internal set; } |
| | 19910 | |
|
| | 19911 | | /// <summary> |
| | 19912 | | /// Prefix |
| | 19913 | | /// </summary> |
| | 19914 | | public string Prefix { get; internal set; } |
| | 19915 | |
|
| | 19916 | | /// <summary> |
| | 19917 | | /// Marker |
| | 19918 | | /// </summary> |
| | 19919 | | public string Marker { get; internal set; } |
| | 19920 | |
|
| | 19921 | | /// <summary> |
| | 19922 | | /// MaxResults |
| | 19923 | | /// </summary> |
| | 19924 | | public int? MaxResults { get; internal set; } |
| | 19925 | |
|
| | 19926 | | /// <summary> |
| | 19927 | | /// Delimiter |
| | 19928 | | /// </summary> |
| | 19929 | | public string Delimiter { get; internal set; } |
| | 19930 | |
|
| | 19931 | | /// <summary> |
| | 19932 | | /// NextMarker |
| | 19933 | | /// </summary> |
| | 19934 | | public string NextMarker { get; internal set; } |
| | 19935 | |
|
| | 19936 | | /// <summary> |
| | 19937 | | /// BlobItems |
| | 19938 | | /// </summary> |
| | 19939 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobItemInternal> BlobItems { get; inte |
| | 19940 | |
|
| | 19941 | | /// <summary> |
| | 19942 | | /// BlobPrefixes |
| | 19943 | | /// </summary> |
| | 19944 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobPrefix> BlobPrefixes { get; interna |
| | 19945 | |
|
| | 19946 | | /// <summary> |
| | 19947 | | /// Creates a new BlobsHierarchySegment instance |
| | 19948 | | /// </summary> |
| | 19949 | | public BlobsHierarchySegment() |
| | 19950 | | : this(false) |
| | 19951 | | { |
| | 19952 | | } |
| | 19953 | |
|
| | 19954 | | /// <summary> |
| | 19955 | | /// Creates a new BlobsHierarchySegment instance |
| | 19956 | | /// </summary> |
| | 19957 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 19958 | | internal BlobsHierarchySegment(bool skipInitialization) |
| | 19959 | | { |
| | 19960 | | if (!skipInitialization) |
| | 19961 | | { |
| | 19962 | | BlobItems = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobItemInternal>(); |
| | 19963 | | BlobPrefixes = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobPrefix>(); |
| | 19964 | | } |
| | 19965 | | } |
| | 19966 | |
|
| | 19967 | | /// <summary> |
| | 19968 | | /// Deserializes XML into a new BlobsHierarchySegment instance. |
| | 19969 | | /// </summary> |
| | 19970 | | /// <param name="element">The XML element to deserialize.</param> |
| | 19971 | | /// <returns>A deserialized BlobsHierarchySegment instance.</returns> |
| | 19972 | | internal static Azure.Storage.Blobs.Models.BlobsHierarchySegment FromXml(System.Xml.Linq.XElement element) |
| | 19973 | | { |
| | 19974 | | System.Diagnostics.Debug.Assert(element != null); |
| | 19975 | | System.Xml.Linq.XElement _child; |
| | 19976 | | System.Xml.Linq.XAttribute _attribute; |
| | 19977 | | Azure.Storage.Blobs.Models.BlobsHierarchySegment _value = new Azure.Storage.Blobs.Models.BlobsHierarchySegme |
| | 19978 | | _attribute = element.Attribute(System.Xml.Linq.XName.Get("ServiceEndpoint", "")); |
| | 19979 | | if (_attribute != null) |
| | 19980 | | { |
| | 19981 | | _value.ServiceEndpoint = _attribute.Value; |
| | 19982 | | } |
| | 19983 | | _attribute = element.Attribute(System.Xml.Linq.XName.Get("ContainerName", "")); |
| | 19984 | | if (_attribute != null) |
| | 19985 | | { |
| | 19986 | | _value.ContainerName = _attribute.Value; |
| | 19987 | | } |
| | 19988 | | _child = element.Element(System.Xml.Linq.XName.Get("Prefix", "")); |
| | 19989 | | if (_child != null) |
| | 19990 | | { |
| | 19991 | | _value.Prefix = _child.Value; |
| | 19992 | | } |
| | 19993 | | _child = element.Element(System.Xml.Linq.XName.Get("Marker", "")); |
| | 19994 | | if (_child != null) |
| | 19995 | | { |
| | 19996 | | _value.Marker = _child.Value; |
| | 19997 | | } |
| | 19998 | | _child = element.Element(System.Xml.Linq.XName.Get("MaxResults", "")); |
| | 19999 | | if (_child != null) |
| | 20000 | | { |
| | 20001 | | _value.MaxResults = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 20002 | | } |
| | 20003 | | _child = element.Element(System.Xml.Linq.XName.Get("Delimiter", "")); |
| | 20004 | | if (_child != null) |
| | 20005 | | { |
| | 20006 | | _value.Delimiter = _child.Value; |
| | 20007 | | } |
| | 20008 | | _child = element.Element(System.Xml.Linq.XName.Get("NextMarker", "")); |
| | 20009 | | if (_child != null) |
| | 20010 | | { |
| | 20011 | | _value.NextMarker = _child.Value; |
| | 20012 | | } |
| | 20013 | | _child = element.Element(System.Xml.Linq.XName.Get("Blobs", "")); |
| | 20014 | | if (_child != null) |
| | 20015 | | { |
| | 20016 | | _value.BlobItems = System.Linq.Enumerable.ToList( |
| | 20017 | | System.Linq.Enumerable.Select( |
| | 20018 | | _child.Elements(System.Xml.Linq.XName.Get("Blob", "")), |
| | 20019 | | e => Azure.Storage.Blobs.Models.BlobItemInternal.FromXml(e))); |
| | 20020 | | } |
| | 20021 | | else |
| | 20022 | | { |
| | 20023 | | _value.BlobItems = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobItemInternal>(); |
| | 20024 | | } |
| | 20025 | | _child = element.Element(System.Xml.Linq.XName.Get("Blobs", "")); |
| | 20026 | | if (_child != null) |
| | 20027 | | { |
| | 20028 | | _value.BlobPrefixes = System.Linq.Enumerable.ToList( |
| | 20029 | | System.Linq.Enumerable.Select( |
| | 20030 | | _child.Elements(System.Xml.Linq.XName.Get("BlobPrefix", "")), |
| | 20031 | | e => Azure.Storage.Blobs.Models.BlobPrefix.FromXml(e))); |
| | 20032 | | } |
| | 20033 | | else |
| | 20034 | | { |
| | 20035 | | _value.BlobPrefixes = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobPrefix>(); |
| | 20036 | | } |
| | 20037 | | CustomizeFromXml(element, _value); |
| | 20038 | | return _value; |
| | 20039 | | } |
| | 20040 | |
|
| | 20041 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlobsHierarchy |
| | 20042 | | } |
| | 20043 | | } |
| | 20044 | | #endregion class BlobsHierarchySegment |
| | 20045 | |
|
| | 20046 | | #region class BlockInfo |
| | 20047 | | namespace Azure.Storage.Blobs.Models |
| | 20048 | | { |
| | 20049 | | /// <summary> |
| | 20050 | | /// BlockInfo |
| | 20051 | | /// </summary> |
| | 20052 | | public partial class BlockInfo |
| | 20053 | | { |
| | 20054 | | /// <summary> |
| | 20055 | | /// This header is returned so that the client can check for message content integrity. The value of this header |
| | 20056 | | /// </summary> |
| | 20057 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 20058 | | public byte[] ContentHash { get; internal set; } |
| | 20059 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 20060 | |
|
| | 20061 | | /// <summary> |
| | 20062 | | /// This header is returned so that the client can check for message content integrity. The value of this header |
| | 20063 | | /// </summary> |
| | 20064 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 20065 | | public byte[] ContentCrc64 { get; internal set; } |
| | 20066 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 20067 | |
|
| | 20068 | | /// <summary> |
| | 20069 | | /// The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the bloc |
| | 20070 | | /// </summary> |
| | 20071 | | public string EncryptionKeySha256 { get; internal set; } |
| | 20072 | |
|
| | 20073 | | /// <summary> |
| | 20074 | | /// Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note t |
| | 20075 | | /// </summary> |
| | 20076 | | public string EncryptionScope { get; internal set; } |
| | 20077 | |
|
| | 20078 | | /// <summary> |
| | 20079 | | /// Prevent direct instantiation of BlockInfo instances. |
| | 20080 | | /// You can use BlobsModelFactory.BlockInfo instead. |
| | 20081 | | /// </summary> |
| | 20082 | | internal BlockInfo() { } |
| | 20083 | | } |
| | 20084 | |
|
| | 20085 | | /// <summary> |
| | 20086 | | /// BlobsModelFactory provides utilities for mocking. |
| | 20087 | | /// </summary> |
| | 20088 | | public static partial class BlobsModelFactory |
| | 20089 | | { |
| | 20090 | | /// <summary> |
| | 20091 | | /// Creates a new BlockInfo instance for mocking. |
| | 20092 | | /// </summary> |
| | 20093 | | public static BlockInfo BlockInfo( |
| | 20094 | | byte[] contentHash, |
| | 20095 | | byte[] contentCrc64, |
| | 20096 | | string encryptionKeySha256, |
| | 20097 | | string encryptionScope) |
| | 20098 | | { |
| | 20099 | | return new BlockInfo() |
| | 20100 | | { |
| | 20101 | | ContentHash = contentHash, |
| | 20102 | | ContentCrc64 = contentCrc64, |
| | 20103 | | EncryptionKeySha256 = encryptionKeySha256, |
| | 20104 | | EncryptionScope = encryptionScope, |
| | 20105 | | }; |
| | 20106 | | } |
| | 20107 | | } |
| | 20108 | | } |
| | 20109 | | #endregion class BlockInfo |
| | 20110 | |
|
| | 20111 | | #region class BlockList |
| | 20112 | | namespace Azure.Storage.Blobs.Models |
| | 20113 | | { |
| | 20114 | | /// <summary> |
| | 20115 | | /// BlockList |
| | 20116 | | /// </summary> |
| | 20117 | | public partial class BlockList |
| | 20118 | | { |
| | 20119 | | /// <summary> |
| | 20120 | | /// CommittedBlocks |
| | 20121 | | /// </summary> |
| | 20122 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobBlock> CommittedBlocks { get; inter |
| | 20123 | |
|
| | 20124 | | /// <summary> |
| | 20125 | | /// UncommittedBlocks |
| | 20126 | | /// </summary> |
| | 20127 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobBlock> UncommittedBlocks { get; int |
| | 20128 | |
|
| | 20129 | | /// <summary> |
| | 20130 | | /// Creates a new BlockList instance |
| | 20131 | | /// </summary> |
| | 20132 | | internal BlockList() |
| | 20133 | | : this(false) |
| | 20134 | | { |
| | 20135 | | } |
| | 20136 | |
|
| | 20137 | | /// <summary> |
| | 20138 | | /// Creates a new BlockList instance |
| | 20139 | | /// </summary> |
| | 20140 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 20141 | | internal BlockList(bool skipInitialization) |
| | 20142 | | { |
| | 20143 | | if (!skipInitialization) |
| | 20144 | | { |
| | 20145 | | CommittedBlocks = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobBlock>(); |
| | 20146 | | UncommittedBlocks = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobBlock>(); |
| | 20147 | | } |
| | 20148 | | } |
| | 20149 | |
|
| | 20150 | | /// <summary> |
| | 20151 | | /// Deserializes XML into a new BlockList instance. |
| | 20152 | | /// </summary> |
| | 20153 | | /// <param name="element">The XML element to deserialize.</param> |
| | 20154 | | /// <returns>A deserialized BlockList instance.</returns> |
| | 20155 | | internal static Azure.Storage.Blobs.Models.BlockList FromXml(System.Xml.Linq.XElement element) |
| | 20156 | | { |
| | 20157 | | System.Diagnostics.Debug.Assert(element != null); |
| | 20158 | | System.Xml.Linq.XElement _child; |
| | 20159 | | Azure.Storage.Blobs.Models.BlockList _value = new Azure.Storage.Blobs.Models.BlockList(true); |
| | 20160 | | _child = element.Element(System.Xml.Linq.XName.Get("CommittedBlocks", "")); |
| | 20161 | | if (_child != null) |
| | 20162 | | { |
| | 20163 | | _value.CommittedBlocks = System.Linq.Enumerable.ToList( |
| | 20164 | | System.Linq.Enumerable.Select( |
| | 20165 | | _child.Elements(System.Xml.Linq.XName.Get("Block", "")), |
| | 20166 | | e => Azure.Storage.Blobs.Models.BlobBlock.FromXml(e))); |
| | 20167 | | } |
| | 20168 | | else |
| | 20169 | | { |
| | 20170 | | _value.CommittedBlocks = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobBlock>(); |
| | 20171 | | } |
| | 20172 | | _child = element.Element(System.Xml.Linq.XName.Get("UncommittedBlocks", "")); |
| | 20173 | | if (_child != null) |
| | 20174 | | { |
| | 20175 | | _value.UncommittedBlocks = System.Linq.Enumerable.ToList( |
| | 20176 | | System.Linq.Enumerable.Select( |
| | 20177 | | _child.Elements(System.Xml.Linq.XName.Get("Block", "")), |
| | 20178 | | e => Azure.Storage.Blobs.Models.BlobBlock.FromXml(e))); |
| | 20179 | | } |
| | 20180 | | else |
| | 20181 | | { |
| | 20182 | | _value.UncommittedBlocks = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.BlobBlock>(); |
| | 20183 | | } |
| | 20184 | | CustomizeFromXml(element, _value); |
| | 20185 | | return _value; |
| | 20186 | | } |
| | 20187 | |
|
| | 20188 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.BlockList valu |
| | 20189 | | } |
| | 20190 | |
|
| | 20191 | | /// <summary> |
| | 20192 | | /// BlobsModelFactory provides utilities for mocking. |
| | 20193 | | /// </summary> |
| | 20194 | | public static partial class BlobsModelFactory |
| | 20195 | | { |
| | 20196 | | /// <summary> |
| | 20197 | | /// Creates a new BlockList instance for mocking. |
| | 20198 | | /// </summary> |
| | 20199 | | public static BlockList BlockList( |
| | 20200 | | System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobBlock> committedBlocks = default, |
| | 20201 | | System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobBlock> uncommittedBlocks = default) |
| | 20202 | | { |
| | 20203 | | return new BlockList() |
| | 20204 | | { |
| | 20205 | | CommittedBlocks = committedBlocks, |
| | 20206 | | UncommittedBlocks = uncommittedBlocks, |
| | 20207 | | }; |
| | 20208 | | } |
| | 20209 | | } |
| | 20210 | | } |
| | 20211 | | #endregion class BlockList |
| | 20212 | |
|
| | 20213 | | #region enum BlockListType |
| | 20214 | | namespace Azure.Storage.Blobs.Models |
| | 20215 | | { |
| | 20216 | | /// <summary> |
| | 20217 | | /// Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together |
| | 20218 | | /// </summary> |
| | 20219 | | internal enum BlockListType |
| | 20220 | | { |
| | 20221 | | /// <summary> |
| | 20222 | | /// committed |
| | 20223 | | /// </summary> |
| | 20224 | | Committed, |
| | 20225 | |
|
| | 20226 | | /// <summary> |
| | 20227 | | /// uncommitted |
| | 20228 | | /// </summary> |
| | 20229 | | Uncommitted, |
| | 20230 | |
|
| | 20231 | | /// <summary> |
| | 20232 | | /// all |
| | 20233 | | /// </summary> |
| | 20234 | | All |
| | 20235 | | } |
| | 20236 | | } |
| | 20237 | |
|
| | 20238 | | namespace Azure.Storage.Blobs |
| | 20239 | | { |
| | 20240 | | internal static partial class BlobRestClient |
| | 20241 | | { |
| | 20242 | | public static partial class Serialization |
| | 20243 | | { |
| | 20244 | | public static string ToString(Azure.Storage.Blobs.Models.BlockListType value) |
| | 20245 | | { |
| | 20246 | | return value switch |
| | 20247 | | { |
| | 20248 | | Azure.Storage.Blobs.Models.BlockListType.Committed => "committed", |
| | 20249 | | Azure.Storage.Blobs.Models.BlockListType.Uncommitted => "uncommitted", |
| | 20250 | | Azure.Storage.Blobs.Models.BlockListType.All => "all", |
| | 20251 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 20252 | | }; |
| | 20253 | | } |
| | 20254 | |
|
| | 20255 | | public static Azure.Storage.Blobs.Models.BlockListType ParseBlockListType(string value) |
| | 20256 | | { |
| | 20257 | | return value switch |
| | 20258 | | { |
| | 20259 | | "committed" => Azure.Storage.Blobs.Models.BlockListType.Committed, |
| | 20260 | | "uncommitted" => Azure.Storage.Blobs.Models.BlockListType.Uncommitted, |
| | 20261 | | "all" => Azure.Storage.Blobs.Models.BlockListType.All, |
| | 20262 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 20263 | | }; |
| | 20264 | | } |
| | 20265 | | } |
| | 20266 | | } |
| | 20267 | | } |
| | 20268 | | #endregion enum BlockListType |
| | 20269 | |
|
| | 20270 | | #region class BlockLookupList |
| | 20271 | | namespace Azure.Storage.Blobs.Models |
| | 20272 | | { |
| | 20273 | | /// <summary> |
| | 20274 | | /// A list of block IDs split between the committed block list, in the uncommitted block list, or in the uncommitted |
| | 20275 | | /// </summary> |
| | 20276 | | internal partial class BlockLookupList |
| | 20277 | | { |
| | 20278 | | /// <summary> |
| | 20279 | | /// Committed |
| | 20280 | | /// </summary> |
| | 20281 | | public System.Collections.Generic.IList<string> Committed { get; internal set; } |
| | 20282 | |
|
| | 20283 | | /// <summary> |
| | 20284 | | /// Uncommitted |
| | 20285 | | /// </summary> |
| | 20286 | | public System.Collections.Generic.IList<string> Uncommitted { get; internal set; } |
| | 20287 | |
|
| | 20288 | | /// <summary> |
| | 20289 | | /// Latest |
| | 20290 | | /// </summary> |
| | 20291 | | public System.Collections.Generic.IList<string> Latest { get; internal set; } |
| | 20292 | |
|
| | 20293 | | /// <summary> |
| | 20294 | | /// Creates a new BlockLookupList instance |
| | 20295 | | /// </summary> |
| | 20296 | | public BlockLookupList() |
| | 20297 | | { |
| | 20298 | | Committed = new System.Collections.Generic.List<string>(); |
| | 20299 | | Uncommitted = new System.Collections.Generic.List<string>(); |
| | 20300 | | Latest = new System.Collections.Generic.List<string>(); |
| | 20301 | | } |
| | 20302 | |
|
| | 20303 | | /// <summary> |
| | 20304 | | /// Serialize a BlockLookupList instance as XML. |
| | 20305 | | /// </summary> |
| | 20306 | | /// <param name="value">The BlockLookupList instance to serialize.</param> |
| | 20307 | | /// <param name="name">An optional name to use for the root element instead of "BlockList".</param> |
| | 20308 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 20309 | | /// <returns>The serialized XML element.</returns> |
| | 20310 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.BlockLookupList value, string name = " |
| | 20311 | | { |
| | 20312 | | System.Diagnostics.Debug.Assert(value != null); |
| | 20313 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 20314 | | if (value.Committed != null) |
| | 20315 | | { |
| | 20316 | | foreach (string _child in value.Committed) |
| | 20317 | | { |
| | 20318 | | _element.Add(new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get("Committed", ""), _child)); |
| | 20319 | | } |
| | 20320 | | } |
| | 20321 | | if (value.Uncommitted != null) |
| | 20322 | | { |
| | 20323 | | foreach (string _child in value.Uncommitted) |
| | 20324 | | { |
| | 20325 | | _element.Add(new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get("Uncommitted", ""), _child)); |
| | 20326 | | } |
| | 20327 | | } |
| | 20328 | | if (value.Latest != null) |
| | 20329 | | { |
| | 20330 | | foreach (string _child in value.Latest) |
| | 20331 | | { |
| | 20332 | | _element.Add(new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get("Latest", ""), _child)); |
| | 20333 | | } |
| | 20334 | | } |
| | 20335 | | return _element; |
| | 20336 | | } |
| | 20337 | | } |
| | 20338 | | } |
| | 20339 | | #endregion class BlockLookupList |
| | 20340 | |
|
| | 20341 | | #region class BrokenLease |
| | 20342 | | namespace Azure.Storage.Blobs.Models |
| | 20343 | | { |
| | 20344 | | /// <summary> |
| | 20345 | | /// BrokenLease |
| | 20346 | | /// </summary> |
| | 20347 | | internal partial class BrokenLease |
| | 20348 | | { |
| | 20349 | | /// <summary> |
| | 20350 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 20351 | | /// </summary> |
| | 20352 | | public Azure.ETag ETag { get; internal set; } |
| | 20353 | |
|
| | 20354 | | /// <summary> |
| | 20355 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 20356 | | /// </summary> |
| | 20357 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 20358 | |
|
| | 20359 | | /// <summary> |
| | 20360 | | /// Approximate time remaining in the lease period, in seconds. |
| | 20361 | | /// </summary> |
| | 20362 | | public int LeaseTime { get; internal set; } |
| | 20363 | |
|
| | 20364 | | /// <summary> |
| | 20365 | | /// Prevent direct instantiation of BrokenLease instances. |
| | 20366 | | /// You can use BlobsModelFactory.BrokenLease instead. |
| | 20367 | | /// </summary> |
| | 20368 | | internal BrokenLease() { } |
| | 20369 | | } |
| | 20370 | | } |
| | 20371 | | #endregion class BrokenLease |
| | 20372 | |
|
| | 20373 | | #region class ClearRange |
| | 20374 | | namespace Azure.Storage.Blobs.Models |
| | 20375 | | { |
| | 20376 | | /// <summary> |
| | 20377 | | /// ClearRange |
| | 20378 | | /// </summary> |
| | 20379 | | internal partial class ClearRange |
| | 20380 | | { |
| | 20381 | | /// <summary> |
| | 20382 | | /// Start |
| | 20383 | | /// </summary> |
| | 20384 | | public long Start { get; internal set; } |
| | 20385 | |
|
| | 20386 | | /// <summary> |
| | 20387 | | /// End |
| | 20388 | | /// </summary> |
| | 20389 | | public long End { get; internal set; } |
| | 20390 | |
|
| | 20391 | | /// <summary> |
| | 20392 | | /// Prevent direct instantiation of ClearRange instances. |
| | 20393 | | /// You can use BlobsModelFactory.ClearRange instead. |
| | 20394 | | /// </summary> |
| | 20395 | | internal ClearRange() { } |
| | 20396 | |
|
| | 20397 | | /// <summary> |
| | 20398 | | /// Deserializes XML into a new ClearRange instance. |
| | 20399 | | /// </summary> |
| | 20400 | | /// <param name="element">The XML element to deserialize.</param> |
| | 20401 | | /// <returns>A deserialized ClearRange instance.</returns> |
| | 20402 | | internal static Azure.Storage.Blobs.Models.ClearRange FromXml(System.Xml.Linq.XElement element) |
| | 20403 | | { |
| | 20404 | | System.Diagnostics.Debug.Assert(element != null); |
| | 20405 | | System.Xml.Linq.XElement _child; |
| | 20406 | | Azure.Storage.Blobs.Models.ClearRange _value = new Azure.Storage.Blobs.Models.ClearRange(); |
| | 20407 | | _child = element.Element(System.Xml.Linq.XName.Get("Start", "")); |
| | 20408 | | if (_child != null) |
| | 20409 | | { |
| | 20410 | | _value.Start = long.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 20411 | | } |
| | 20412 | | _child = element.Element(System.Xml.Linq.XName.Get("End", "")); |
| | 20413 | | if (_child != null) |
| | 20414 | | { |
| | 20415 | | _value.End = long.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 20416 | | } |
| | 20417 | | CustomizeFromXml(element, _value); |
| | 20418 | | return _value; |
| | 20419 | | } |
| | 20420 | |
|
| | 20421 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.ClearRange val |
| | 20422 | | } |
| | 20423 | | } |
| | 20424 | | #endregion class ClearRange |
| | 20425 | |
|
| | 20426 | | #region class ConditionNotMetError |
| | 20427 | | namespace Azure.Storage.Blobs.Models |
| | 20428 | | { |
| | 20429 | | /// <summary> |
| | 20430 | | /// ConditionNotMetError |
| | 20431 | | /// </summary> |
| | 20432 | | internal partial class ConditionNotMetError |
| | 20433 | | { |
| | 20434 | | /// <summary> |
| | 20435 | | /// x-ms-error-code |
| | 20436 | | /// </summary> |
| | 20437 | | public string ErrorCode { get; internal set; } |
| | 20438 | |
|
| | 20439 | | /// <summary> |
| | 20440 | | /// Prevent direct instantiation of ConditionNotMetError instances. |
| | 20441 | | /// You can use BlobsModelFactory.ConditionNotMetError instead. |
| | 20442 | | /// </summary> |
| | 20443 | | internal ConditionNotMetError() { } |
| | 20444 | | } |
| | 20445 | | } |
| | 20446 | | #endregion class ConditionNotMetError |
| | 20447 | |
|
| | 20448 | | #region enum CopyStatus |
| | 20449 | | namespace Azure.Storage.Blobs.Models |
| | 20450 | | { |
| | 20451 | | /// <summary> |
| | 20452 | | /// CopyStatus values |
| | 20453 | | /// </summary> |
| | 20454 | | #pragma warning disable CA1717 // Only FlagsAttribute enums should have plural names |
| | 20455 | | public enum CopyStatus |
| | 20456 | | #pragma warning restore CA1717 // Only FlagsAttribute enums should have plural names |
| | 20457 | | { |
| | 20458 | | /// <summary> |
| | 20459 | | /// pending |
| | 20460 | | /// </summary> |
| | 20461 | | Pending, |
| | 20462 | |
|
| | 20463 | | /// <summary> |
| | 20464 | | /// success |
| | 20465 | | /// </summary> |
| | 20466 | | Success, |
| | 20467 | |
|
| | 20468 | | /// <summary> |
| | 20469 | | /// aborted |
| | 20470 | | /// </summary> |
| | 20471 | | Aborted, |
| | 20472 | |
|
| | 20473 | | /// <summary> |
| | 20474 | | /// failed |
| | 20475 | | /// </summary> |
| | 20476 | | Failed |
| | 20477 | | } |
| | 20478 | | } |
| | 20479 | |
|
| | 20480 | | namespace Azure.Storage.Blobs |
| | 20481 | | { |
| | 20482 | | internal static partial class BlobRestClient |
| | 20483 | | { |
| | 20484 | | public static partial class Serialization |
| | 20485 | | { |
| | 20486 | | public static string ToString(Azure.Storage.Blobs.Models.CopyStatus value) |
| | 20487 | | { |
| | 20488 | | return value switch |
| | 20489 | | { |
| | 20490 | | Azure.Storage.Blobs.Models.CopyStatus.Pending => "pending", |
| | 20491 | | Azure.Storage.Blobs.Models.CopyStatus.Success => "success", |
| | 20492 | | Azure.Storage.Blobs.Models.CopyStatus.Aborted => "aborted", |
| | 20493 | | Azure.Storage.Blobs.Models.CopyStatus.Failed => "failed", |
| | 20494 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 20495 | | }; |
| | 20496 | | } |
| | 20497 | |
|
| | 20498 | | public static Azure.Storage.Blobs.Models.CopyStatus ParseCopyStatus(string value) |
| | 20499 | | { |
| | 20500 | | return value switch |
| | 20501 | | { |
| | 20502 | | "pending" => Azure.Storage.Blobs.Models.CopyStatus.Pending, |
| | 20503 | | "success" => Azure.Storage.Blobs.Models.CopyStatus.Success, |
| | 20504 | | "aborted" => Azure.Storage.Blobs.Models.CopyStatus.Aborted, |
| | 20505 | | "failed" => Azure.Storage.Blobs.Models.CopyStatus.Failed, |
| | 20506 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 20507 | | }; |
| | 20508 | | } |
| | 20509 | | } |
| | 20510 | | } |
| | 20511 | | } |
| | 20512 | | #endregion enum CopyStatus |
| | 20513 | |
|
| | 20514 | | #region class DataLakeStorageError |
| | 20515 | | namespace Azure.Storage.Blobs.Models |
| | 20516 | | { |
| | 20517 | | /// <summary> |
| | 20518 | | /// DataLakeStorageError |
| | 20519 | | /// </summary> |
| | 20520 | | internal partial class DataLakeStorageError |
| | 20521 | | { |
| | 20522 | | /// <summary> |
| | 20523 | | /// The service error response object. |
| | 20524 | | /// </summary> |
| | 20525 | | public Azure.Storage.Blobs.Models.DataLakeStorageErrorDetails DataLakeStorageErrorDetails { get; internal set; } |
| | 20526 | |
|
| | 20527 | | /// <summary> |
| | 20528 | | /// Creates a new DataLakeStorageError instance |
| | 20529 | | /// </summary> |
| | 20530 | | public DataLakeStorageError() |
| | 20531 | | : this(false) |
| | 20532 | | { |
| | 20533 | | } |
| | 20534 | |
|
| | 20535 | | /// <summary> |
| | 20536 | | /// Creates a new DataLakeStorageError instance |
| | 20537 | | /// </summary> |
| | 20538 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 20539 | | internal DataLakeStorageError(bool skipInitialization) |
| | 20540 | | { |
| | 20541 | | if (!skipInitialization) |
| | 20542 | | { |
| | 20543 | | DataLakeStorageErrorDetails = new Azure.Storage.Blobs.Models.DataLakeStorageErrorDetails(); |
| | 20544 | | } |
| | 20545 | | } |
| | 20546 | |
|
| | 20547 | | /// <summary> |
| | 20548 | | /// Deserializes XML into a new DataLakeStorageError instance. |
| | 20549 | | /// </summary> |
| | 20550 | | /// <param name="element">The XML element to deserialize.</param> |
| | 20551 | | /// <returns>A deserialized DataLakeStorageError instance.</returns> |
| | 20552 | | internal static Azure.Storage.Blobs.Models.DataLakeStorageError FromXml(System.Xml.Linq.XElement element) |
| | 20553 | | { |
| | 20554 | | System.Diagnostics.Debug.Assert(element != null); |
| | 20555 | | System.Xml.Linq.XElement _child; |
| | 20556 | | Azure.Storage.Blobs.Models.DataLakeStorageError _value = new Azure.Storage.Blobs.Models.DataLakeStorageError |
| | 20557 | | _child = element.Element(System.Xml.Linq.XName.Get("error", "")); |
| | 20558 | | if (_child != null) |
| | 20559 | | { |
| | 20560 | | _value.DataLakeStorageErrorDetails = Azure.Storage.Blobs.Models.DataLakeStorageErrorDetails.FromXml(_chi |
| | 20561 | | } |
| | 20562 | | CustomizeFromXml(element, _value); |
| | 20563 | | return _value; |
| | 20564 | | } |
| | 20565 | |
|
| | 20566 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.DataLakeStorag |
| | 20567 | | } |
| | 20568 | | } |
| | 20569 | | #endregion class DataLakeStorageError |
| | 20570 | |
|
| | 20571 | | #region class DataLakeStorageErrorDetails |
| | 20572 | | namespace Azure.Storage.Blobs.Models |
| | 20573 | | { |
| | 20574 | | /// <summary> |
| | 20575 | | /// The service error response object. |
| | 20576 | | /// </summary> |
| | 20577 | | internal partial class DataLakeStorageErrorDetails |
| | 20578 | | { |
| | 20579 | | /// <summary> |
| | 20580 | | /// The service error code. |
| | 20581 | | /// </summary> |
| | 20582 | | public string Code { get; internal set; } |
| | 20583 | |
|
| | 20584 | | /// <summary> |
| | 20585 | | /// The service error message. |
| | 20586 | | /// </summary> |
| | 20587 | | public string Message { get; internal set; } |
| | 20588 | |
|
| | 20589 | | /// <summary> |
| | 20590 | | /// Prevent direct instantiation of DataLakeStorageErrorDetails instances. |
| | 20591 | | /// You can use BlobsModelFactory.DataLakeStorageErrorDetails instead. |
| | 20592 | | /// </summary> |
| | 20593 | | internal DataLakeStorageErrorDetails() { } |
| | 20594 | |
|
| | 20595 | | /// <summary> |
| | 20596 | | /// Deserializes XML into a new DataLakeStorageErrorDetails instance. |
| | 20597 | | /// </summary> |
| | 20598 | | /// <param name="element">The XML element to deserialize.</param> |
| | 20599 | | /// <returns>A deserialized DataLakeStorageErrorDetails instance.</returns> |
| | 20600 | | internal static Azure.Storage.Blobs.Models.DataLakeStorageErrorDetails FromXml(System.Xml.Linq.XElement element) |
| | 20601 | | { |
| | 20602 | | System.Diagnostics.Debug.Assert(element != null); |
| | 20603 | | System.Xml.Linq.XElement _child; |
| | 20604 | | Azure.Storage.Blobs.Models.DataLakeStorageErrorDetails _value = new Azure.Storage.Blobs.Models.DataLakeStora |
| | 20605 | | _child = element.Element(System.Xml.Linq.XName.Get("Code", "")); |
| | 20606 | | if (_child != null) |
| | 20607 | | { |
| | 20608 | | _value.Code = _child.Value; |
| | 20609 | | } |
| | 20610 | | _child = element.Element(System.Xml.Linq.XName.Get("Message", "")); |
| | 20611 | | if (_child != null) |
| | 20612 | | { |
| | 20613 | | _value.Message = _child.Value; |
| | 20614 | | } |
| | 20615 | | CustomizeFromXml(element, _value); |
| | 20616 | | return _value; |
| | 20617 | | } |
| | 20618 | |
|
| | 20619 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.DataLakeStorag |
| | 20620 | | } |
| | 20621 | | } |
| | 20622 | | #endregion class DataLakeStorageErrorDetails |
| | 20623 | |
|
| | 20624 | | #region enum DeleteSnapshotsOption |
| | 20625 | | namespace Azure.Storage.Blobs.Models |
| | 20626 | | { |
| | 20627 | | /// <summary> |
| | 20628 | | /// Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the bas |
| | 20629 | | /// </summary> |
| | 20630 | | public enum DeleteSnapshotsOption |
| | 20631 | | { |
| | 20632 | | /// <summary> |
| | 20633 | | /// none |
| | 20634 | | /// </summary> |
| | 20635 | | None, |
| | 20636 | |
|
| | 20637 | | /// <summary> |
| | 20638 | | /// include |
| | 20639 | | /// </summary> |
| | 20640 | | IncludeSnapshots, |
| | 20641 | |
|
| | 20642 | | /// <summary> |
| | 20643 | | /// only |
| | 20644 | | /// </summary> |
| | 20645 | | OnlySnapshots |
| | 20646 | | } |
| | 20647 | | } |
| | 20648 | |
|
| | 20649 | | namespace Azure.Storage.Blobs |
| | 20650 | | { |
| | 20651 | | internal static partial class BlobRestClient |
| | 20652 | | { |
| | 20653 | | public static partial class Serialization |
| | 20654 | | { |
| | 20655 | | public static string ToString(Azure.Storage.Blobs.Models.DeleteSnapshotsOption value) |
| | 20656 | | { |
| | 20657 | | return value switch |
| | 20658 | | { |
| | 20659 | | Azure.Storage.Blobs.Models.DeleteSnapshotsOption.None => null, |
| | 20660 | | Azure.Storage.Blobs.Models.DeleteSnapshotsOption.IncludeSnapshots => "include", |
| | 20661 | | Azure.Storage.Blobs.Models.DeleteSnapshotsOption.OnlySnapshots => "only", |
| | 20662 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 20663 | | }; |
| | 20664 | | } |
| | 20665 | |
|
| | 20666 | | public static Azure.Storage.Blobs.Models.DeleteSnapshotsOption ParseDeleteSnapshotsOption(string value) |
| | 20667 | | { |
| | 20668 | | return value switch |
| | 20669 | | { |
| | 20670 | | null => Azure.Storage.Blobs.Models.DeleteSnapshotsOption.None, |
| | 20671 | | "include" => Azure.Storage.Blobs.Models.DeleteSnapshotsOption.IncludeSnapshots, |
| | 20672 | | "only" => Azure.Storage.Blobs.Models.DeleteSnapshotsOption.OnlySnapshots, |
| | 20673 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 20674 | | }; |
| | 20675 | | } |
| | 20676 | | } |
| | 20677 | | } |
| | 20678 | | } |
| | 20679 | | #endregion enum DeleteSnapshotsOption |
| | 20680 | |
|
| | 20681 | | #region class DelimitedTextConfigurationInternal |
| | 20682 | | namespace Azure.Storage.Blobs.Models |
| | 20683 | | { |
| | 20684 | | /// <summary> |
| | 20685 | | /// delimited text configuration |
| | 20686 | | /// </summary> |
| | 20687 | | internal partial class DelimitedTextConfigurationInternal |
| | 20688 | | { |
| | 20689 | | /// <summary> |
| | 20690 | | /// column separator |
| | 20691 | | /// </summary> |
| | 20692 | | public string ColumnSeparator { get; set; } |
| | 20693 | |
|
| | 20694 | | /// <summary> |
| | 20695 | | /// field quote |
| | 20696 | | /// </summary> |
| | 20697 | | public string FieldQuote { get; set; } |
| | 20698 | |
|
| | 20699 | | /// <summary> |
| | 20700 | | /// record separator |
| | 20701 | | /// </summary> |
| | 20702 | | public string RecordSeparator { get; set; } |
| | 20703 | |
|
| | 20704 | | /// <summary> |
| | 20705 | | /// escape char |
| | 20706 | | /// </summary> |
| | 20707 | | public string EscapeChar { get; set; } |
| | 20708 | |
|
| | 20709 | | /// <summary> |
| | 20710 | | /// has headers |
| | 20711 | | /// </summary> |
| | 20712 | | public bool HeadersPresent { get; set; } |
| | 20713 | |
|
| | 20714 | | /// <summary> |
| | 20715 | | /// Creates a new DelimitedTextConfigurationInternal instance |
| | 20716 | | /// </summary> |
| | 20717 | | public DelimitedTextConfigurationInternal() { } |
| | 20718 | |
|
| | 20719 | | /// <summary> |
| | 20720 | | /// Serialize a DelimitedTextConfigurationInternal instance as XML. |
| | 20721 | | /// </summary> |
| | 20722 | | /// <param name="value">The DelimitedTextConfigurationInternal instance to serialize.</param> |
| | 20723 | | /// <param name="name">An optional name to use for the root element instead of "DelimitedTextConfiguration".</pa |
| | 20724 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 20725 | | /// <returns>The serialized XML element.</returns> |
| | 20726 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.DelimitedTextConfigurationInternal val |
| | 20727 | | { |
| | 20728 | | System.Diagnostics.Debug.Assert(value != null); |
| | 20729 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 20730 | | _element.Add(new System.Xml.Linq.XElement( |
| | 20731 | | System.Xml.Linq.XName.Get("ColumnSeparator", ""), |
| | 20732 | | value.ColumnSeparator)); |
| | 20733 | | _element.Add(new System.Xml.Linq.XElement( |
| | 20734 | | System.Xml.Linq.XName.Get("FieldQuote", ""), |
| | 20735 | | value.FieldQuote)); |
| | 20736 | | _element.Add(new System.Xml.Linq.XElement( |
| | 20737 | | System.Xml.Linq.XName.Get("RecordSeparator", ""), |
| | 20738 | | value.RecordSeparator)); |
| | 20739 | | _element.Add(new System.Xml.Linq.XElement( |
| | 20740 | | System.Xml.Linq.XName.Get("EscapeChar", ""), |
| | 20741 | | value.EscapeChar)); |
| | 20742 | | _element.Add(new System.Xml.Linq.XElement( |
| | 20743 | | System.Xml.Linq.XName.Get("HasHeaders", ""), |
| | 20744 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 20745 | | value.HeadersPresent.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant())); |
| | 20746 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 20747 | | return _element; |
| | 20748 | | } |
| | 20749 | | } |
| | 20750 | | } |
| | 20751 | | #endregion class DelimitedTextConfigurationInternal |
| | 20752 | |
|
| | 20753 | | #region class DirectoryCreateResult |
| | 20754 | | namespace Azure.Storage.Blobs.Models |
| | 20755 | | { |
| | 20756 | | /// <summary> |
| | 20757 | | /// Directory CreateResult |
| | 20758 | | /// </summary> |
| | 20759 | | internal partial class DirectoryCreateResult |
| | 20760 | | { |
| | 20761 | | /// <summary> |
| | 20762 | | /// An HTTP entity tag associated with the file or directory. |
| | 20763 | | /// </summary> |
| | 20764 | | public Azure.ETag ETag { get; internal set; } |
| | 20765 | |
|
| | 20766 | | /// <summary> |
| | 20767 | | /// The data and time the file or directory was last modified. Write operations on the file or directory update |
| | 20768 | | /// </summary> |
| | 20769 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 20770 | |
|
| | 20771 | | /// <summary> |
| | 20772 | | /// The size of the resource in bytes. |
| | 20773 | | /// </summary> |
| | 20774 | | public long ContentLength { get; internal set; } |
| | 20775 | |
|
| | 20776 | | /// <summary> |
| | 20777 | | /// Prevent direct instantiation of DirectoryCreateResult instances. |
| | 20778 | | /// You can use BlobsModelFactory.DirectoryCreateResult instead. |
| | 20779 | | /// </summary> |
| | 20780 | | internal DirectoryCreateResult() { } |
| | 20781 | | } |
| | 20782 | | } |
| | 20783 | | #endregion class DirectoryCreateResult |
| | 20784 | |
|
| | 20785 | | #region class DirectoryDeleteResult |
| | 20786 | | namespace Azure.Storage.Blobs.Models |
| | 20787 | | { |
| | 20788 | | /// <summary> |
| | 20789 | | /// Directory DeleteResult |
| | 20790 | | /// </summary> |
| | 20791 | | internal partial class DirectoryDeleteResult |
| | 20792 | | { |
| | 20793 | | /// <summary> |
| | 20794 | | /// When renaming a directory, the number of paths that are renamed with each invocation is limited. If the numb |
| | 20795 | | /// </summary> |
| | 20796 | | public string Marker { get; internal set; } |
| | 20797 | |
|
| | 20798 | | /// <summary> |
| | 20799 | | /// Prevent direct instantiation of DirectoryDeleteResult instances. |
| | 20800 | | /// You can use BlobsModelFactory.DirectoryDeleteResult instead. |
| | 20801 | | /// </summary> |
| | 20802 | | internal DirectoryDeleteResult() { } |
| | 20803 | | } |
| | 20804 | | } |
| | 20805 | | #endregion class DirectoryDeleteResult |
| | 20806 | |
|
| | 20807 | | #region class DirectoryGetAccessControlResult |
| | 20808 | | namespace Azure.Storage.Blobs.Models |
| | 20809 | | { |
| | 20810 | | /// <summary> |
| | 20811 | | /// Directory GetAccessControlResult |
| | 20812 | | /// </summary> |
| | 20813 | | internal partial class DirectoryGetAccessControlResult |
| | 20814 | | { |
| | 20815 | | /// <summary> |
| | 20816 | | /// An HTTP entity tag associated with the file or directory. |
| | 20817 | | /// </summary> |
| | 20818 | | public Azure.ETag ETag { get; internal set; } |
| | 20819 | |
|
| | 20820 | | /// <summary> |
| | 20821 | | /// The data and time the file or directory was last modified. Write operations on the file or directory update |
| | 20822 | | /// </summary> |
| | 20823 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 20824 | |
|
| | 20825 | | /// <summary> |
| | 20826 | | /// The owner of the file or directory. Included in the response if Hierarchical Namespace is enabled for the ac |
| | 20827 | | /// </summary> |
| | 20828 | | public string XMSOwner { get; internal set; } |
| | 20829 | |
|
| | 20830 | | /// <summary> |
| | 20831 | | /// The owning group of the file or directory. Included in the response if Hierarchical Namespace is enabled for |
| | 20832 | | /// </summary> |
| | 20833 | | public string XMSGroup { get; internal set; } |
| | 20834 | |
|
| | 20835 | | /// <summary> |
| | 20836 | | /// The POSIX access permissions for the file owner, the file owning group, and others. Included in the response |
| | 20837 | | /// </summary> |
| | 20838 | | public string XMSPermissions { get; internal set; } |
| | 20839 | |
|
| | 20840 | | /// <summary> |
| | 20841 | | /// The POSIX access control list for the file or directory. Included in the response only if the action is "ge |
| | 20842 | | /// </summary> |
| | 20843 | | public string XMSAcl { get; internal set; } |
| | 20844 | |
|
| | 20845 | | /// <summary> |
| | 20846 | | /// Prevent direct instantiation of DirectoryGetAccessControlResult instances. |
| | 20847 | | /// You can use BlobsModelFactory.DirectoryGetAccessControlResult instead. |
| | 20848 | | /// </summary> |
| | 20849 | | internal DirectoryGetAccessControlResult() { } |
| | 20850 | | } |
| | 20851 | | } |
| | 20852 | | #endregion class DirectoryGetAccessControlResult |
| | 20853 | |
|
| | 20854 | | #region class DirectoryRenameResult |
| | 20855 | | namespace Azure.Storage.Blobs.Models |
| | 20856 | | { |
| | 20857 | | /// <summary> |
| | 20858 | | /// Directory RenameResult |
| | 20859 | | /// </summary> |
| | 20860 | | internal partial class DirectoryRenameResult |
| | 20861 | | { |
| | 20862 | | /// <summary> |
| | 20863 | | /// When renaming a directory, the number of paths that are renamed with each invocation is limited. If the numb |
| | 20864 | | /// </summary> |
| | 20865 | | public string Marker { get; internal set; } |
| | 20866 | |
|
| | 20867 | | /// <summary> |
| | 20868 | | /// An HTTP entity tag associated with the file or directory. |
| | 20869 | | /// </summary> |
| | 20870 | | public Azure.ETag ETag { get; internal set; } |
| | 20871 | |
|
| | 20872 | | /// <summary> |
| | 20873 | | /// The data and time the file or directory was last modified. Write operations on the file or directory update |
| | 20874 | | /// </summary> |
| | 20875 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 20876 | |
|
| | 20877 | | /// <summary> |
| | 20878 | | /// The size of the resource in bytes. |
| | 20879 | | /// </summary> |
| | 20880 | | public long ContentLength { get; internal set; } |
| | 20881 | |
|
| | 20882 | | /// <summary> |
| | 20883 | | /// Prevent direct instantiation of DirectoryRenameResult instances. |
| | 20884 | | /// You can use BlobsModelFactory.DirectoryRenameResult instead. |
| | 20885 | | /// </summary> |
| | 20886 | | internal DirectoryRenameResult() { } |
| | 20887 | | } |
| | 20888 | | } |
| | 20889 | | #endregion class DirectoryRenameResult |
| | 20890 | |
|
| | 20891 | | #region class DirectorySetAccessControlResult |
| | 20892 | | namespace Azure.Storage.Blobs.Models |
| | 20893 | | { |
| | 20894 | | /// <summary> |
| | 20895 | | /// Directory SetAccessControlResult |
| | 20896 | | /// </summary> |
| | 20897 | | internal partial class DirectorySetAccessControlResult |
| | 20898 | | { |
| | 20899 | | /// <summary> |
| | 20900 | | /// An HTTP entity tag associated with the file or directory. |
| | 20901 | | /// </summary> |
| | 20902 | | public Azure.ETag ETag { get; internal set; } |
| | 20903 | |
|
| | 20904 | | /// <summary> |
| | 20905 | | /// The data and time the file or directory was last modified. Write operations on the file or directory update |
| | 20906 | | /// </summary> |
| | 20907 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 20908 | |
|
| | 20909 | | /// <summary> |
| | 20910 | | /// Prevent direct instantiation of DirectorySetAccessControlResult instances. |
| | 20911 | | /// You can use BlobsModelFactory.DirectorySetAccessControlResult instead. |
| | 20912 | | /// </summary> |
| | 20913 | | internal DirectorySetAccessControlResult() { } |
| | 20914 | | } |
| | 20915 | | } |
| | 20916 | | #endregion class DirectorySetAccessControlResult |
| | 20917 | |
|
| | 20918 | | #region enum EncryptionAlgorithmType |
| | 20919 | | namespace Azure.Storage.Blobs.Models |
| | 20920 | | { |
| | 20921 | | /// <summary> |
| | 20922 | | /// The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be p |
| | 20923 | | /// </summary> |
| | 20924 | | public enum EncryptionAlgorithmType |
| | 20925 | | { |
| | 20926 | | /// <summary> |
| | 20927 | | /// AES256 |
| | 20928 | | /// </summary> |
| | 20929 | | Aes256 |
| | 20930 | | } |
| | 20931 | | } |
| | 20932 | |
|
| | 20933 | | namespace Azure.Storage.Blobs |
| | 20934 | | { |
| | 20935 | | internal static partial class BlobRestClient |
| | 20936 | | { |
| | 20937 | | public static partial class Serialization |
| | 20938 | | { |
| | 20939 | | public static string ToString(Azure.Storage.Blobs.Models.EncryptionAlgorithmType value) |
| | 20940 | | { |
| | 20941 | | return value switch |
| | 20942 | | { |
| | 20943 | | Azure.Storage.Blobs.Models.EncryptionAlgorithmType.Aes256 => "AES256", |
| | 20944 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 20945 | | }; |
| | 20946 | | } |
| | 20947 | |
|
| | 20948 | | public static Azure.Storage.Blobs.Models.EncryptionAlgorithmType ParseEncryptionAlgorithmType(string value) |
| | 20949 | | { |
| | 20950 | | return value switch |
| | 20951 | | { |
| | 20952 | | "AES256" => Azure.Storage.Blobs.Models.EncryptionAlgorithmType.Aes256, |
| | 20953 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 20954 | | }; |
| | 20955 | | } |
| | 20956 | | } |
| | 20957 | | } |
| | 20958 | | } |
| | 20959 | | #endregion enum EncryptionAlgorithmType |
| | 20960 | |
|
| | 20961 | | #region class FailureNoContent |
| | 20962 | | namespace Azure.Storage.Blobs.Models |
| | 20963 | | { |
| | 20964 | | /// <summary> |
| | 20965 | | /// FailureNoContent |
| | 20966 | | /// </summary> |
| | 20967 | | internal partial class FailureNoContent |
| | 20968 | | { |
| | 20969 | | /// <summary> |
| | 20970 | | /// x-ms-error-code |
| | 20971 | | /// </summary> |
| | 20972 | | public string ErrorCode { get; internal set; } |
| | 20973 | |
|
| | 20974 | | /// <summary> |
| | 20975 | | /// Prevent direct instantiation of FailureNoContent instances. |
| | 20976 | | /// You can use BlobsModelFactory.FailureNoContent instead. |
| | 20977 | | /// </summary> |
| | 20978 | | internal FailureNoContent() { } |
| | 20979 | | } |
| | 20980 | | } |
| | 20981 | | #endregion class FailureNoContent |
| | 20982 | |
|
| | 20983 | | #region class FilterBlobItem |
| | 20984 | | namespace Azure.Storage.Blobs.Models |
| | 20985 | | { |
| | 20986 | | /// <summary> |
| | 20987 | | /// Blob info from a Filter Blobs API call |
| | 20988 | | /// </summary> |
| | 20989 | | internal partial class FilterBlobItem |
| | 20990 | | { |
| | 20991 | | /// <summary> |
| | 20992 | | /// Name |
| | 20993 | | /// </summary> |
| | 20994 | | public string BlobName { get; internal set; } |
| | 20995 | |
|
| | 20996 | | /// <summary> |
| | 20997 | | /// ContainerName |
| | 20998 | | /// </summary> |
| | 20999 | | public string BlobContainerName { get; internal set; } |
| | 21000 | |
|
| | 21001 | | /// <summary> |
| | 21002 | | /// Prevent direct instantiation of FilterBlobItem instances. |
| | 21003 | | /// You can use BlobsModelFactory.FilterBlobItem instead. |
| | 21004 | | /// </summary> |
| | 21005 | | internal FilterBlobItem() { } |
| | 21006 | |
|
| | 21007 | | /// <summary> |
| | 21008 | | /// Deserializes XML into a new FilterBlobItem instance. |
| | 21009 | | /// </summary> |
| | 21010 | | /// <param name="element">The XML element to deserialize.</param> |
| | 21011 | | /// <returns>A deserialized FilterBlobItem instance.</returns> |
| | 21012 | | internal static Azure.Storage.Blobs.Models.FilterBlobItem FromXml(System.Xml.Linq.XElement element) |
| | 21013 | | { |
| | 21014 | | System.Diagnostics.Debug.Assert(element != null); |
| | 21015 | | System.Xml.Linq.XElement _child; |
| | 21016 | | Azure.Storage.Blobs.Models.FilterBlobItem _value = new Azure.Storage.Blobs.Models.FilterBlobItem(); |
| | 21017 | | _child = element.Element(System.Xml.Linq.XName.Get("Name", "")); |
| | 21018 | | if (_child != null) |
| | 21019 | | { |
| | 21020 | | _value.BlobName = _child.Value; |
| | 21021 | | } |
| | 21022 | | _child = element.Element(System.Xml.Linq.XName.Get("ContainerName", "")); |
| | 21023 | | if (_child != null) |
| | 21024 | | { |
| | 21025 | | _value.BlobContainerName = _child.Value; |
| | 21026 | | } |
| | 21027 | | CustomizeFromXml(element, _value); |
| | 21028 | | return _value; |
| | 21029 | | } |
| | 21030 | |
|
| | 21031 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.FilterBlobItem |
| | 21032 | | } |
| | 21033 | | } |
| | 21034 | | #endregion class FilterBlobItem |
| | 21035 | |
|
| | 21036 | | #region class FilterBlobSegment |
| | 21037 | | namespace Azure.Storage.Blobs.Models |
| | 21038 | | { |
| | 21039 | | /// <summary> |
| | 21040 | | /// The result of a Filter Blobs API call |
| | 21041 | | /// </summary> |
| | 21042 | | internal partial class FilterBlobSegment |
| | 21043 | | { |
| | 21044 | | /// <summary> |
| | 21045 | | /// ServiceEndpoint |
| | 21046 | | /// </summary> |
| | 21047 | | public string ServiceEndpoint { get; internal set; } |
| | 21048 | |
|
| | 21049 | | /// <summary> |
| | 21050 | | /// Where |
| | 21051 | | /// </summary> |
| | 21052 | | public string Where { get; internal set; } |
| | 21053 | |
|
| | 21054 | | /// <summary> |
| | 21055 | | /// Blobs |
| | 21056 | | /// </summary> |
| | 21057 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.FilterBlobItem> Blobs { get; internal s |
| | 21058 | |
|
| | 21059 | | /// <summary> |
| | 21060 | | /// NextMarker |
| | 21061 | | /// </summary> |
| | 21062 | | public string NextMarker { get; internal set; } |
| | 21063 | |
|
| | 21064 | | /// <summary> |
| | 21065 | | /// Creates a new FilterBlobSegment instance |
| | 21066 | | /// </summary> |
| | 21067 | | public FilterBlobSegment() |
| | 21068 | | : this(false) |
| | 21069 | | { |
| | 21070 | | } |
| | 21071 | |
|
| | 21072 | | /// <summary> |
| | 21073 | | /// Creates a new FilterBlobSegment instance |
| | 21074 | | /// </summary> |
| | 21075 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 21076 | | internal FilterBlobSegment(bool skipInitialization) |
| | 21077 | | { |
| | 21078 | | if (!skipInitialization) |
| | 21079 | | { |
| | 21080 | | Blobs = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.FilterBlobItem>(); |
| | 21081 | | } |
| | 21082 | | } |
| | 21083 | |
|
| | 21084 | | /// <summary> |
| | 21085 | | /// Deserializes XML into a new FilterBlobSegment instance. |
| | 21086 | | /// </summary> |
| | 21087 | | /// <param name="element">The XML element to deserialize.</param> |
| | 21088 | | /// <returns>A deserialized FilterBlobSegment instance.</returns> |
| | 21089 | | internal static Azure.Storage.Blobs.Models.FilterBlobSegment FromXml(System.Xml.Linq.XElement element) |
| | 21090 | | { |
| | 21091 | | System.Diagnostics.Debug.Assert(element != null); |
| | 21092 | | System.Xml.Linq.XElement _child; |
| | 21093 | | System.Xml.Linq.XAttribute _attribute; |
| | 21094 | | Azure.Storage.Blobs.Models.FilterBlobSegment _value = new Azure.Storage.Blobs.Models.FilterBlobSegment(true) |
| | 21095 | | _attribute = element.Attribute(System.Xml.Linq.XName.Get("ServiceEndpoint", "")); |
| | 21096 | | if (_attribute != null) |
| | 21097 | | { |
| | 21098 | | _value.ServiceEndpoint = _attribute.Value; |
| | 21099 | | } |
| | 21100 | | _child = element.Element(System.Xml.Linq.XName.Get("Where", "")); |
| | 21101 | | if (_child != null) |
| | 21102 | | { |
| | 21103 | | _value.Where = _child.Value; |
| | 21104 | | } |
| | 21105 | | _child = element.Element(System.Xml.Linq.XName.Get("Blobs", "")); |
| | 21106 | | if (_child != null) |
| | 21107 | | { |
| | 21108 | | _value.Blobs = System.Linq.Enumerable.ToList( |
| | 21109 | | System.Linq.Enumerable.Select( |
| | 21110 | | _child.Elements(System.Xml.Linq.XName.Get("Blob", "")), |
| | 21111 | | e => Azure.Storage.Blobs.Models.FilterBlobItem.FromXml(e))); |
| | 21112 | | } |
| | 21113 | | else |
| | 21114 | | { |
| | 21115 | | _value.Blobs = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.FilterBlobItem>(); |
| | 21116 | | } |
| | 21117 | | _child = element.Element(System.Xml.Linq.XName.Get("NextMarker", "")); |
| | 21118 | | if (_child != null) |
| | 21119 | | { |
| | 21120 | | _value.NextMarker = _child.Value; |
| | 21121 | | } |
| | 21122 | | CustomizeFromXml(element, _value); |
| | 21123 | | return _value; |
| | 21124 | | } |
| | 21125 | |
|
| | 21126 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.FilterBlobSegm |
| | 21127 | | } |
| | 21128 | | } |
| | 21129 | | #endregion class FilterBlobSegment |
| | 21130 | |
|
| | 21131 | | #region class FlattenedContainerItem |
| | 21132 | | namespace Azure.Storage.Blobs.Models |
| | 21133 | | { |
| | 21134 | | /// <summary> |
| | 21135 | | /// FlattenedContainerItem |
| | 21136 | | /// </summary> |
| | 21137 | | internal partial class FlattenedContainerItem |
| | 21138 | | { |
| | 21139 | | /// <summary> |
| | 21140 | | /// x-ms-meta |
| | 21141 | | /// </summary> |
| | 21142 | | public System.Collections.Generic.IDictionary<string, string> Metadata { get; internal set; } |
| | 21143 | |
|
| | 21144 | | /// <summary> |
| | 21145 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 21146 | | /// </summary> |
| | 21147 | | public Azure.ETag ETag { get; internal set; } |
| | 21148 | |
|
| | 21149 | | /// <summary> |
| | 21150 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 21151 | | /// </summary> |
| | 21152 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 21153 | |
|
| | 21154 | | /// <summary> |
| | 21155 | | /// When a blob is leased, specifies whether the lease is of infinite or fixed duration. |
| | 21156 | | /// </summary> |
| | 21157 | | public Azure.Storage.Blobs.Models.LeaseDurationType LeaseDuration { get; internal set; } |
| | 21158 | |
|
| | 21159 | | /// <summary> |
| | 21160 | | /// Lease state of the blob. |
| | 21161 | | /// </summary> |
| | 21162 | | public Azure.Storage.Blobs.Models.LeaseState LeaseState { get; internal set; } |
| | 21163 | |
|
| | 21164 | | /// <summary> |
| | 21165 | | /// The current lease status of the blob. |
| | 21166 | | /// </summary> |
| | 21167 | | public Azure.Storage.Blobs.Models.LeaseStatus LeaseStatus { get; internal set; } |
| | 21168 | |
|
| | 21169 | | /// <summary> |
| | 21170 | | /// Indicated whether data in the container may be accessed publicly and the level of access |
| | 21171 | | /// </summary> |
| | 21172 | | public Azure.Storage.Blobs.Models.PublicAccessType BlobPublicAccess { get; internal set; } |
| | 21173 | |
|
| | 21174 | | /// <summary> |
| | 21175 | | /// Indicates whether the container has an immutability policy set on it. |
| | 21176 | | /// </summary> |
| | 21177 | | public bool HasImmutabilityPolicy { get; internal set; } |
| | 21178 | |
|
| | 21179 | | /// <summary> |
| | 21180 | | /// Indicates whether the container has a legal hold. |
| | 21181 | | /// </summary> |
| | 21182 | | public bool HasLegalHold { get; internal set; } |
| | 21183 | |
|
| | 21184 | | /// <summary> |
| | 21185 | | /// The default encryption scope for the container. |
| | 21186 | | /// </summary> |
| | 21187 | | public string DefaultEncryptionScope { get; internal set; } |
| | 21188 | |
|
| | 21189 | | /// <summary> |
| | 21190 | | /// Indicates whether the container's default encryption scope can be overriden. |
| | 21191 | | /// </summary> |
| | 21192 | | public bool DenyEncryptionScopeOverride { get; internal set; } |
| | 21193 | |
|
| | 21194 | | /// <summary> |
| | 21195 | | /// Creates a new FlattenedContainerItem instance |
| | 21196 | | /// </summary> |
| | 21197 | | public FlattenedContainerItem() |
| | 21198 | | { |
| | 21199 | | Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgnoreCase |
| | 21200 | | } |
| | 21201 | | } |
| | 21202 | | } |
| | 21203 | | #endregion class FlattenedContainerItem |
| | 21204 | |
|
| | 21205 | | #region class FlattenedDownloadProperties |
| | 21206 | | namespace Azure.Storage.Blobs.Models |
| | 21207 | | { |
| | 21208 | | /// <summary> |
| | 21209 | | /// FlattenedDownloadProperties |
| | 21210 | | /// </summary> |
| | 21211 | | internal partial class FlattenedDownloadProperties |
| | 21212 | | { |
| | 21213 | | /// <summary> |
| | 21214 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 21215 | | /// </summary> |
| | 21216 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 21217 | |
|
| | 21218 | | /// <summary> |
| | 21219 | | /// x-ms-meta |
| | 21220 | | /// </summary> |
| | 21221 | | public System.Collections.Generic.IDictionary<string, string> Metadata { get; internal set; } |
| | 21222 | |
|
| | 21223 | | /// <summary> |
| | 21224 | | /// Optional. Only valid when Object Replication is enabled for the storage container and on the destination blo |
| | 21225 | | /// </summary> |
| | 21226 | | public string ObjectReplicationPolicyId { get; internal set; } |
| | 21227 | |
|
| | 21228 | | /// <summary> |
| | 21229 | | /// Optional. Only valid when Object Replication is enabled for the storage container and on the source blob of |
| | 21230 | | /// </summary> |
| | 21231 | | public System.Collections.Generic.IDictionary<string, string> ObjectReplicationRules { get; internal set; } |
| | 21232 | |
|
| | 21233 | | /// <summary> |
| | 21234 | | /// The number of bytes present in the response body. |
| | 21235 | | /// </summary> |
| | 21236 | | public long ContentLength { get; internal set; } |
| | 21237 | |
|
| | 21238 | | /// <summary> |
| | 21239 | | /// The media type of the body of the response. For Download Blob this is 'application/octet-stream' |
| | 21240 | | /// </summary> |
| | 21241 | | public string ContentType { get; internal set; } |
| | 21242 | |
|
| | 21243 | | /// <summary> |
| | 21244 | | /// Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting |
| | 21245 | | /// </summary> |
| | 21246 | | public string ContentRange { get; internal set; } |
| | 21247 | |
|
| | 21248 | | /// <summary> |
| | 21249 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 21250 | | /// </summary> |
| | 21251 | | public Azure.ETag ETag { get; internal set; } |
| | 21252 | |
|
| | 21253 | | /// <summary> |
| | 21254 | | /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so |
| | 21255 | | /// </summary> |
| | 21256 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 21257 | | public byte[] ContentHash { get; internal set; } |
| | 21258 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 21259 | |
|
| | 21260 | | /// <summary> |
| | 21261 | | /// This header returns the value that was specified for the Content-Encoding request header |
| | 21262 | | /// </summary> |
| | 21263 | | public string ContentEncoding { get; internal set; } |
| | 21264 | |
|
| | 21265 | | /// <summary> |
| | 21266 | | /// This header is returned if it was previously specified for the blob. |
| | 21267 | | /// </summary> |
| | 21268 | | public string CacheControl { get; internal set; } |
| | 21269 | |
|
| | 21270 | | /// <summary> |
| | 21271 | | /// This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content |
| | 21272 | | /// </summary> |
| | 21273 | | public string ContentDisposition { get; internal set; } |
| | 21274 | |
|
| | 21275 | | /// <summary> |
| | 21276 | | /// This header returns the value that was specified for the Content-Language request header. |
| | 21277 | | /// </summary> |
| | 21278 | | public string ContentLanguage { get; internal set; } |
| | 21279 | |
|
| | 21280 | | /// <summary> |
| | 21281 | | /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs |
| | 21282 | | /// </summary> |
| | 21283 | | public long BlobSequenceNumber { get; internal set; } |
| | 21284 | |
|
| | 21285 | | /// <summary> |
| | 21286 | | /// The blob's type. |
| | 21287 | | /// </summary> |
| | 21288 | | public Azure.Storage.Blobs.Models.BlobType BlobType { get; internal set; } |
| | 21289 | |
|
| | 21290 | | /// <summary> |
| | 21291 | | /// If the request is to read a specified range and the x-ms-range-get-content-crc64 is set to true, then the re |
| | 21292 | | /// </summary> |
| | 21293 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 21294 | | public byte[] ContentCrc64 { get; internal set; } |
| | 21295 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 21296 | |
|
| | 21297 | | /// <summary> |
| | 21298 | | /// Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This val |
| | 21299 | | /// </summary> |
| | 21300 | | public System.DateTimeOffset CopyCompletionTime { get; internal set; } |
| | 21301 | |
|
| | 21302 | | /// <summary> |
| | 21303 | | /// Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal |
| | 21304 | | /// </summary> |
| | 21305 | | public string CopyStatusDescription { get; internal set; } |
| | 21306 | |
|
| | 21307 | | /// <summary> |
| | 21308 | | /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy ope |
| | 21309 | | /// </summary> |
| | 21310 | | public string CopyId { get; internal set; } |
| | 21311 | |
|
| | 21312 | | /// <summary> |
| | 21313 | | /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operat |
| | 21314 | | /// </summary> |
| | 21315 | | public string CopyProgress { get; internal set; } |
| | 21316 | |
|
| | 21317 | | /// <summary> |
| | 21318 | | /// URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operati |
| | 21319 | | /// </summary> |
| | 21320 | | public System.Uri CopySource { get; internal set; } |
| | 21321 | |
|
| | 21322 | | /// <summary> |
| | 21323 | | /// State of the copy operation identified by x-ms-copy-id. |
| | 21324 | | /// </summary> |
| | 21325 | | public Azure.Storage.Blobs.Models.CopyStatus CopyStatus { get; internal set; } |
| | 21326 | |
|
| | 21327 | | /// <summary> |
| | 21328 | | /// When a blob is leased, specifies whether the lease is of infinite or fixed duration. |
| | 21329 | | /// </summary> |
| | 21330 | | public Azure.Storage.Blobs.Models.LeaseDurationType LeaseDuration { get; internal set; } |
| | 21331 | |
|
| | 21332 | | /// <summary> |
| | 21333 | | /// Lease state of the blob. |
| | 21334 | | /// </summary> |
| | 21335 | | public Azure.Storage.Blobs.Models.LeaseState LeaseState { get; internal set; } |
| | 21336 | |
|
| | 21337 | | /// <summary> |
| | 21338 | | /// The current lease status of the blob. |
| | 21339 | | /// </summary> |
| | 21340 | | public Azure.Storage.Blobs.Models.LeaseStatus LeaseStatus { get; internal set; } |
| | 21341 | |
|
| | 21342 | | /// <summary> |
| | 21343 | | /// Indicates that the service supports requests for partial blob content. |
| | 21344 | | /// </summary> |
| | 21345 | | public string AcceptRanges { get; internal set; } |
| | 21346 | |
|
| | 21347 | | /// <summary> |
| | 21348 | | /// The number of committed blocks present in the blob. This header is returned only for append blobs. |
| | 21349 | | /// </summary> |
| | 21350 | | public int BlobCommittedBlockCount { get; internal set; } |
| | 21351 | |
|
| | 21352 | | /// <summary> |
| | 21353 | | /// The value of this header is set to true if the blob data and application metadata are completely encrypted u |
| | 21354 | | /// </summary> |
| | 21355 | | public bool IsServerEncrypted { get; internal set; } |
| | 21356 | |
|
| | 21357 | | /// <summary> |
| | 21358 | | /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob |
| | 21359 | | /// </summary> |
| | 21360 | | public string EncryptionKeySha256 { get; internal set; } |
| | 21361 | |
|
| | 21362 | | /// <summary> |
| | 21363 | | /// Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note t |
| | 21364 | | /// </summary> |
| | 21365 | | public string EncryptionScope { get; internal set; } |
| | 21366 | |
|
| | 21367 | | /// <summary> |
| | 21368 | | /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header |
| | 21369 | | /// </summary> |
| | 21370 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 21371 | | public byte[] BlobContentHash { get; internal set; } |
| | 21372 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 21373 | |
|
| | 21374 | | /// <summary> |
| | 21375 | | /// The number of tags associated with the blob |
| | 21376 | | /// </summary> |
| | 21377 | | public long TagCount { get; internal set; } |
| | 21378 | |
|
| | 21379 | | /// <summary> |
| | 21380 | | /// If this blob has been sealed |
| | 21381 | | /// </summary> |
| | 21382 | | public bool IsSealed { get; internal set; } |
| | 21383 | |
|
| | 21384 | | /// <summary> |
| | 21385 | | /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicat |
| | 21386 | | /// </summary> |
| | 21387 | | public string VersionId { get; internal set; } |
| | 21388 | |
|
| | 21389 | | /// <summary> |
| | 21390 | | /// Content |
| | 21391 | | /// </summary> |
| | 21392 | | public System.IO.Stream Content { get; internal set; } |
| | 21393 | |
|
| | 21394 | | /// <summary> |
| | 21395 | | /// Creates a new FlattenedDownloadProperties instance |
| | 21396 | | /// </summary> |
| | 21397 | | public FlattenedDownloadProperties() |
| | 21398 | | { |
| | 21399 | | Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgnoreCase |
| | 21400 | | ObjectReplicationRules = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.Ord |
| | 21401 | | } |
| | 21402 | | } |
| | 21403 | | } |
| | 21404 | | #endregion class FlattenedDownloadProperties |
| | 21405 | |
|
| | 21406 | | #region class GetBlockListOperation |
| | 21407 | | namespace Azure.Storage.Blobs.Models |
| | 21408 | | { |
| | 21409 | | /// <summary> |
| | 21410 | | /// GetBlockListOperation |
| | 21411 | | /// </summary> |
| | 21412 | | internal partial class GetBlockListOperation |
| | 21413 | | { |
| | 21414 | | /// <summary> |
| | 21415 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 21416 | | /// </summary> |
| | 21417 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 21418 | |
|
| | 21419 | | /// <summary> |
| | 21420 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 21421 | | /// </summary> |
| | 21422 | | public Azure.ETag ETag { get; internal set; } |
| | 21423 | |
|
| | 21424 | | /// <summary> |
| | 21425 | | /// The media type of the body of the response. For Get Block List this is 'application/xml' |
| | 21426 | | /// </summary> |
| | 21427 | | public string ContentType { get; internal set; } |
| | 21428 | |
|
| | 21429 | | /// <summary> |
| | 21430 | | /// The size of the blob in bytes. |
| | 21431 | | /// </summary> |
| | 21432 | | public long BlobContentLength { get; internal set; } |
| | 21433 | |
|
| | 21434 | | /// <summary> |
| | 21435 | | /// Body |
| | 21436 | | /// </summary> |
| | 21437 | | public Azure.Storage.Blobs.Models.BlockList Body { get; internal set; } |
| | 21438 | |
|
| | 21439 | | /// <summary> |
| | 21440 | | /// Creates a new GetBlockListOperation instance |
| | 21441 | | /// </summary> |
| | 21442 | | public GetBlockListOperation() |
| | 21443 | | { |
| | 21444 | | Body = new Azure.Storage.Blobs.Models.BlockList(); |
| | 21445 | | } |
| | 21446 | | } |
| | 21447 | | } |
| | 21448 | | #endregion class GetBlockListOperation |
| | 21449 | |
|
| | 21450 | | #region class JsonTextConfigurationInternal |
| | 21451 | | namespace Azure.Storage.Blobs.Models |
| | 21452 | | { |
| | 21453 | | /// <summary> |
| | 21454 | | /// json text configuration |
| | 21455 | | /// </summary> |
| | 21456 | | internal partial class JsonTextConfigurationInternal |
| | 21457 | | { |
| | 21458 | | /// <summary> |
| | 21459 | | /// record separator |
| | 21460 | | /// </summary> |
| | 21461 | | public string RecordSeparator { get; set; } |
| | 21462 | |
|
| | 21463 | | /// <summary> |
| | 21464 | | /// Creates a new JsonTextConfigurationInternal instance |
| | 21465 | | /// </summary> |
| | 21466 | | public JsonTextConfigurationInternal() { } |
| | 21467 | |
|
| | 21468 | | /// <summary> |
| | 21469 | | /// Serialize a JsonTextConfigurationInternal instance as XML. |
| | 21470 | | /// </summary> |
| | 21471 | | /// <param name="value">The JsonTextConfigurationInternal instance to serialize.</param> |
| | 21472 | | /// <param name="name">An optional name to use for the root element instead of "JsonTextConfiguration".</param> |
| | 21473 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 21474 | | /// <returns>The serialized XML element.</returns> |
| | 21475 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.JsonTextConfigurationInternal value, s |
| | 21476 | | { |
| | 21477 | | System.Diagnostics.Debug.Assert(value != null); |
| | 21478 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 21479 | | _element.Add(new System.Xml.Linq.XElement( |
| | 21480 | | System.Xml.Linq.XName.Get("RecordSeparator", ""), |
| | 21481 | | value.RecordSeparator)); |
| | 21482 | | return _element; |
| | 21483 | | } |
| | 21484 | | } |
| | 21485 | | } |
| | 21486 | | #endregion class JsonTextConfigurationInternal |
| | 21487 | |
|
| | 21488 | | #region class KeyInfo |
| | 21489 | | namespace Azure.Storage.Blobs.Models |
| | 21490 | | { |
| | 21491 | | /// <summary> |
| | 21492 | | /// Key information |
| | 21493 | | /// </summary> |
| | 21494 | | internal partial class KeyInfo |
| | 21495 | | { |
| | 21496 | | /// <summary> |
| | 21497 | | /// The date-time the key is active in ISO 8601 UTC time |
| | 21498 | | /// </summary> |
| | 21499 | | public System.DateTimeOffset? StartsOn { get; set; } |
| | 21500 | |
|
| | 21501 | | /// <summary> |
| | 21502 | | /// The date-time the key expires in ISO 8601 UTC time |
| | 21503 | | /// </summary> |
| | 21504 | | public System.DateTimeOffset ExpiresOn { get; set; } |
| | 21505 | |
|
| | 21506 | | /// <summary> |
| | 21507 | | /// Creates a new KeyInfo instance |
| | 21508 | | /// </summary> |
| | 21509 | | public KeyInfo() { } |
| | 21510 | |
|
| | 21511 | | /// <summary> |
| | 21512 | | /// Serialize a KeyInfo instance as XML. |
| | 21513 | | /// </summary> |
| | 21514 | | /// <param name="value">The KeyInfo instance to serialize.</param> |
| | 21515 | | /// <param name="name">An optional name to use for the root element instead of "KeyInfo".</param> |
| | 21516 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 21517 | | /// <returns>The serialized XML element.</returns> |
| | 21518 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.KeyInfo value, string name = "KeyInfo" |
| | 21519 | | { |
| | 21520 | | System.Diagnostics.Debug.Assert(value != null); |
| | 21521 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 21522 | | if (value.StartsOn != null) |
| | 21523 | | { |
| | 21524 | | _element.Add(new System.Xml.Linq.XElement( |
| | 21525 | | System.Xml.Linq.XName.Get("Start", ""), |
| | 21526 | | value.StartsOn.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ssZ", System.Globalization.CultureInfo.Inv |
| | 21527 | | } |
| | 21528 | | _element.Add(new System.Xml.Linq.XElement( |
| | 21529 | | System.Xml.Linq.XName.Get("Expiry", ""), |
| | 21530 | | value.ExpiresOn.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ssZ", System.Globalization.CultureInfo.InvariantCul |
| | 21531 | | return _element; |
| | 21532 | | } |
| | 21533 | | } |
| | 21534 | | } |
| | 21535 | | #endregion class KeyInfo |
| | 21536 | |
|
| | 21537 | | #region enum LeaseDurationType |
| | 21538 | | namespace Azure.Storage.Blobs.Models |
| | 21539 | | { |
| | 21540 | | /// <summary> |
| | 21541 | | /// LeaseDurationType values |
| | 21542 | | /// </summary> |
| | 21543 | | public enum LeaseDurationType |
| | 21544 | | { |
| | 21545 | | /// <summary> |
| | 21546 | | /// infinite |
| | 21547 | | /// </summary> |
| | 21548 | | Infinite, |
| | 21549 | |
|
| | 21550 | | /// <summary> |
| | 21551 | | /// fixed |
| | 21552 | | /// </summary> |
| | 21553 | | Fixed |
| | 21554 | | } |
| | 21555 | | } |
| | 21556 | |
|
| | 21557 | | namespace Azure.Storage.Blobs |
| | 21558 | | { |
| | 21559 | | internal static partial class BlobRestClient |
| | 21560 | | { |
| | 21561 | | public static partial class Serialization |
| | 21562 | | { |
| | 21563 | | public static string ToString(Azure.Storage.Blobs.Models.LeaseDurationType value) |
| | 21564 | | { |
| | 21565 | | return value switch |
| | 21566 | | { |
| | 21567 | | Azure.Storage.Blobs.Models.LeaseDurationType.Infinite => "infinite", |
| | 21568 | | Azure.Storage.Blobs.Models.LeaseDurationType.Fixed => "fixed", |
| | 21569 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 21570 | | }; |
| | 21571 | | } |
| | 21572 | |
|
| | 21573 | | public static Azure.Storage.Blobs.Models.LeaseDurationType ParseLeaseDurationType(string value) |
| | 21574 | | { |
| | 21575 | | return value switch |
| | 21576 | | { |
| | 21577 | | "infinite" => Azure.Storage.Blobs.Models.LeaseDurationType.Infinite, |
| | 21578 | | "fixed" => Azure.Storage.Blobs.Models.LeaseDurationType.Fixed, |
| | 21579 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 21580 | | }; |
| | 21581 | | } |
| | 21582 | | } |
| | 21583 | | } |
| | 21584 | | } |
| | 21585 | | #endregion enum LeaseDurationType |
| | 21586 | |
|
| | 21587 | | #region enum LeaseState |
| | 21588 | | namespace Azure.Storage.Blobs.Models |
| | 21589 | | { |
| | 21590 | | /// <summary> |
| | 21591 | | /// LeaseState values |
| | 21592 | | /// </summary> |
| | 21593 | | public enum LeaseState |
| | 21594 | | { |
| | 21595 | | /// <summary> |
| | 21596 | | /// available |
| | 21597 | | /// </summary> |
| | 21598 | | Available, |
| | 21599 | |
|
| | 21600 | | /// <summary> |
| | 21601 | | /// leased |
| | 21602 | | /// </summary> |
| | 21603 | | Leased, |
| | 21604 | |
|
| | 21605 | | /// <summary> |
| | 21606 | | /// expired |
| | 21607 | | /// </summary> |
| | 21608 | | Expired, |
| | 21609 | |
|
| | 21610 | | /// <summary> |
| | 21611 | | /// breaking |
| | 21612 | | /// </summary> |
| | 21613 | | Breaking, |
| | 21614 | |
|
| | 21615 | | /// <summary> |
| | 21616 | | /// broken |
| | 21617 | | /// </summary> |
| | 21618 | | Broken |
| | 21619 | | } |
| | 21620 | | } |
| | 21621 | |
|
| | 21622 | | namespace Azure.Storage.Blobs |
| | 21623 | | { |
| | 21624 | | internal static partial class BlobRestClient |
| | 21625 | | { |
| | 21626 | | public static partial class Serialization |
| | 21627 | | { |
| | 21628 | | public static string ToString(Azure.Storage.Blobs.Models.LeaseState value) |
| | 21629 | | { |
| | 21630 | | return value switch |
| | 21631 | | { |
| | 21632 | | Azure.Storage.Blobs.Models.LeaseState.Available => "available", |
| | 21633 | | Azure.Storage.Blobs.Models.LeaseState.Leased => "leased", |
| | 21634 | | Azure.Storage.Blobs.Models.LeaseState.Expired => "expired", |
| | 21635 | | Azure.Storage.Blobs.Models.LeaseState.Breaking => "breaking", |
| | 21636 | | Azure.Storage.Blobs.Models.LeaseState.Broken => "broken", |
| | 21637 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 21638 | | }; |
| | 21639 | | } |
| | 21640 | |
|
| | 21641 | | public static Azure.Storage.Blobs.Models.LeaseState ParseLeaseState(string value) |
| | 21642 | | { |
| | 21643 | | return value switch |
| | 21644 | | { |
| | 21645 | | "available" => Azure.Storage.Blobs.Models.LeaseState.Available, |
| | 21646 | | "leased" => Azure.Storage.Blobs.Models.LeaseState.Leased, |
| | 21647 | | "expired" => Azure.Storage.Blobs.Models.LeaseState.Expired, |
| | 21648 | | "breaking" => Azure.Storage.Blobs.Models.LeaseState.Breaking, |
| | 21649 | | "broken" => Azure.Storage.Blobs.Models.LeaseState.Broken, |
| | 21650 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 21651 | | }; |
| | 21652 | | } |
| | 21653 | | } |
| | 21654 | | } |
| | 21655 | | } |
| | 21656 | | #endregion enum LeaseState |
| | 21657 | |
|
| | 21658 | | #region enum LeaseStatus |
| | 21659 | | namespace Azure.Storage.Blobs.Models |
| | 21660 | | { |
| | 21661 | | /// <summary> |
| | 21662 | | /// LeaseStatus values |
| | 21663 | | /// </summary> |
| | 21664 | | #pragma warning disable CA1717 // Only FlagsAttribute enums should have plural names |
| | 21665 | | public enum LeaseStatus |
| | 21666 | | #pragma warning restore CA1717 // Only FlagsAttribute enums should have plural names |
| | 21667 | | { |
| | 21668 | | /// <summary> |
| | 21669 | | /// locked |
| | 21670 | | /// </summary> |
| | 21671 | | Locked, |
| | 21672 | |
|
| | 21673 | | /// <summary> |
| | 21674 | | /// unlocked |
| | 21675 | | /// </summary> |
| | 21676 | | Unlocked |
| | 21677 | | } |
| | 21678 | | } |
| | 21679 | |
|
| | 21680 | | namespace Azure.Storage.Blobs |
| | 21681 | | { |
| | 21682 | | internal static partial class BlobRestClient |
| | 21683 | | { |
| | 21684 | | public static partial class Serialization |
| | 21685 | | { |
| | 21686 | | public static string ToString(Azure.Storage.Blobs.Models.LeaseStatus value) |
| | 21687 | | { |
| | 21688 | | return value switch |
| | 21689 | | { |
| | 21690 | | Azure.Storage.Blobs.Models.LeaseStatus.Locked => "locked", |
| | 21691 | | Azure.Storage.Blobs.Models.LeaseStatus.Unlocked => "unlocked", |
| | 21692 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 21693 | | }; |
| | 21694 | | } |
| | 21695 | |
|
| | 21696 | | public static Azure.Storage.Blobs.Models.LeaseStatus ParseLeaseStatus(string value) |
| | 21697 | | { |
| | 21698 | | return value switch |
| | 21699 | | { |
| | 21700 | | "locked" => Azure.Storage.Blobs.Models.LeaseStatus.Locked, |
| | 21701 | | "unlocked" => Azure.Storage.Blobs.Models.LeaseStatus.Unlocked, |
| | 21702 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 21703 | | }; |
| | 21704 | | } |
| | 21705 | | } |
| | 21706 | | } |
| | 21707 | | } |
| | 21708 | | #endregion enum LeaseStatus |
| | 21709 | |
|
| | 21710 | | #region enum ListBlobsIncludeItem |
| | 21711 | | namespace Azure.Storage.Blobs.Models |
| | 21712 | | { |
| | 21713 | | /// <summary> |
| | 21714 | | /// ListBlobsIncludeItem values |
| | 21715 | | /// </summary> |
| | 21716 | | internal enum ListBlobsIncludeItem |
| | 21717 | | { |
| | 21718 | | /// <summary> |
| | 21719 | | /// copy |
| | 21720 | | /// </summary> |
| | 21721 | | Copy, |
| | 21722 | |
|
| | 21723 | | /// <summary> |
| | 21724 | | /// deleted |
| | 21725 | | /// </summary> |
| | 21726 | | Deleted, |
| | 21727 | |
|
| | 21728 | | /// <summary> |
| | 21729 | | /// metadata |
| | 21730 | | /// </summary> |
| | 21731 | | Metadata, |
| | 21732 | |
|
| | 21733 | | /// <summary> |
| | 21734 | | /// snapshots |
| | 21735 | | /// </summary> |
| | 21736 | | Snapshots, |
| | 21737 | |
|
| | 21738 | | /// <summary> |
| | 21739 | | /// uncommittedblobs |
| | 21740 | | /// </summary> |
| | 21741 | | Uncommittedblobs, |
| | 21742 | |
|
| | 21743 | | /// <summary> |
| | 21744 | | /// versions |
| | 21745 | | /// </summary> |
| | 21746 | | Versions, |
| | 21747 | |
|
| | 21748 | | /// <summary> |
| | 21749 | | /// tags |
| | 21750 | | /// </summary> |
| | 21751 | | Tags |
| | 21752 | | } |
| | 21753 | | } |
| | 21754 | |
|
| | 21755 | | namespace Azure.Storage.Blobs |
| | 21756 | | { |
| | 21757 | | internal static partial class BlobRestClient |
| | 21758 | | { |
| | 21759 | | public static partial class Serialization |
| | 21760 | | { |
| | 21761 | | public static string ToString(Azure.Storage.Blobs.Models.ListBlobsIncludeItem value) |
| | 21762 | | { |
| | 21763 | | return value switch |
| | 21764 | | { |
| | 21765 | | Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Copy => "copy", |
| | 21766 | | Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Deleted => "deleted", |
| | 21767 | | Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Metadata => "metadata", |
| | 21768 | | Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Snapshots => "snapshots", |
| | 21769 | | Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Uncommittedblobs => "uncommittedblobs", |
| | 21770 | | Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Versions => "versions", |
| | 21771 | | Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Tags => "tags", |
| | 21772 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 21773 | | }; |
| | 21774 | | } |
| | 21775 | |
|
| | 21776 | | public static Azure.Storage.Blobs.Models.ListBlobsIncludeItem ParseListBlobsIncludeItem(string value) |
| | 21777 | | { |
| | 21778 | | return value switch |
| | 21779 | | { |
| | 21780 | | "copy" => Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Copy, |
| | 21781 | | "deleted" => Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Deleted, |
| | 21782 | | "metadata" => Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Metadata, |
| | 21783 | | "snapshots" => Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Snapshots, |
| | 21784 | | "uncommittedblobs" => Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Uncommittedblobs, |
| | 21785 | | "versions" => Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Versions, |
| | 21786 | | "tags" => Azure.Storage.Blobs.Models.ListBlobsIncludeItem.Tags, |
| | 21787 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 21788 | | }; |
| | 21789 | | } |
| | 21790 | | } |
| | 21791 | | } |
| | 21792 | | } |
| | 21793 | | #endregion enum ListBlobsIncludeItem |
| | 21794 | |
|
| | 21795 | | #region enum ListContainersIncludeType |
| | 21796 | | namespace Azure.Storage.Blobs.Models |
| | 21797 | | { |
| | 21798 | | /// <summary> |
| | 21799 | | /// ListContainersIncludeType values |
| | 21800 | | /// </summary> |
| | 21801 | | internal enum ListContainersIncludeType |
| | 21802 | | { |
| | 21803 | | /// <summary> |
| | 21804 | | /// metadata |
| | 21805 | | /// </summary> |
| | 21806 | | Metadata, |
| | 21807 | |
|
| | 21808 | | /// <summary> |
| | 21809 | | /// deleted |
| | 21810 | | /// </summary> |
| | 21811 | | Deleted |
| | 21812 | | } |
| | 21813 | | } |
| | 21814 | |
|
| | 21815 | | namespace Azure.Storage.Blobs |
| | 21816 | | { |
| | 21817 | | internal static partial class BlobRestClient |
| | 21818 | | { |
| | 21819 | | public static partial class Serialization |
| | 21820 | | { |
| | 21821 | | public static string ToString(Azure.Storage.Blobs.Models.ListContainersIncludeType value) |
| | 21822 | | { |
| | 21823 | | return value switch |
| | 21824 | | { |
| | 21825 | | Azure.Storage.Blobs.Models.ListContainersIncludeType.Metadata => "metadata", |
| | 21826 | | Azure.Storage.Blobs.Models.ListContainersIncludeType.Deleted => "deleted", |
| | 21827 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 21828 | | }; |
| | 21829 | | } |
| | 21830 | |
|
| | 21831 | | public static Azure.Storage.Blobs.Models.ListContainersIncludeType ParseListContainersIncludeType(string val |
| | 21832 | | { |
| | 21833 | | return value switch |
| | 21834 | | { |
| | 21835 | | "metadata" => Azure.Storage.Blobs.Models.ListContainersIncludeType.Metadata, |
| | 21836 | | "deleted" => Azure.Storage.Blobs.Models.ListContainersIncludeType.Deleted, |
| | 21837 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 21838 | | }; |
| | 21839 | | } |
| | 21840 | | } |
| | 21841 | | } |
| | 21842 | | } |
| | 21843 | | #endregion enum ListContainersIncludeType |
| | 21844 | |
|
| | 21845 | | #region class PageBlobInfo |
| | 21846 | | namespace Azure.Storage.Blobs.Models |
| | 21847 | | { |
| | 21848 | | /// <summary> |
| | 21849 | | /// PageBlobInfo |
| | 21850 | | /// </summary> |
| | 21851 | | public partial class PageBlobInfo |
| | 21852 | | { |
| | 21853 | | /// <summary> |
| | 21854 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 21855 | | /// </summary> |
| | 21856 | | public Azure.ETag ETag { get; internal set; } |
| | 21857 | |
|
| | 21858 | | /// <summary> |
| | 21859 | | /// Returns the date and time the blob was last modified. Any operation that modifies the blob, including an upd |
| | 21860 | | /// </summary> |
| | 21861 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 21862 | |
|
| | 21863 | | /// <summary> |
| | 21864 | | /// The current sequence number for the page blob. This is only returned for page blobs. |
| | 21865 | | /// </summary> |
| | 21866 | | public long BlobSequenceNumber { get; internal set; } |
| | 21867 | |
|
| | 21868 | | /// <summary> |
| | 21869 | | /// Prevent direct instantiation of PageBlobInfo instances. |
| | 21870 | | /// You can use BlobsModelFactory.PageBlobInfo instead. |
| | 21871 | | /// </summary> |
| | 21872 | | internal PageBlobInfo() { } |
| | 21873 | | } |
| | 21874 | |
|
| | 21875 | | /// <summary> |
| | 21876 | | /// BlobsModelFactory provides utilities for mocking. |
| | 21877 | | /// </summary> |
| | 21878 | | public static partial class BlobsModelFactory |
| | 21879 | | { |
| | 21880 | | /// <summary> |
| | 21881 | | /// Creates a new PageBlobInfo instance for mocking. |
| | 21882 | | /// </summary> |
| | 21883 | | public static PageBlobInfo PageBlobInfo( |
| | 21884 | | Azure.ETag eTag, |
| | 21885 | | System.DateTimeOffset lastModified, |
| | 21886 | | long blobSequenceNumber) |
| | 21887 | | { |
| | 21888 | | return new PageBlobInfo() |
| | 21889 | | { |
| | 21890 | | ETag = eTag, |
| | 21891 | | LastModified = lastModified, |
| | 21892 | | BlobSequenceNumber = blobSequenceNumber, |
| | 21893 | | }; |
| | 21894 | | } |
| | 21895 | | } |
| | 21896 | | } |
| | 21897 | | #endregion class PageBlobInfo |
| | 21898 | |
|
| | 21899 | | #region class PageInfo |
| | 21900 | | namespace Azure.Storage.Blobs.Models |
| | 21901 | | { |
| | 21902 | | /// <summary> |
| | 21903 | | /// PageInfo |
| | 21904 | | /// </summary> |
| | 21905 | | public partial class PageInfo |
| | 21906 | | { |
| | 21907 | | /// <summary> |
| | 21908 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 21909 | | /// </summary> |
| | 21910 | | public Azure.ETag ETag { get; internal set; } |
| | 21911 | |
|
| | 21912 | | /// <summary> |
| | 21913 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 21914 | | /// </summary> |
| | 21915 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 21916 | |
|
| | 21917 | | /// <summary> |
| | 21918 | | /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so |
| | 21919 | | /// </summary> |
| | 21920 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 21921 | | public byte[] ContentHash { get; internal set; } |
| | 21922 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 21923 | |
|
| | 21924 | | /// <summary> |
| | 21925 | | /// This header is returned so that the client can check for message content integrity. The value of this header |
| | 21926 | | /// </summary> |
| | 21927 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 21928 | | public byte[] ContentCrc64 { get; internal set; } |
| | 21929 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 21930 | |
|
| | 21931 | | /// <summary> |
| | 21932 | | /// The current sequence number for the page blob. This is only returned for page blobs. |
| | 21933 | | /// </summary> |
| | 21934 | | public long BlobSequenceNumber { get; internal set; } |
| | 21935 | |
|
| | 21936 | | /// <summary> |
| | 21937 | | /// The SHA-256 hash of the encryption key used to encrypt the pages. This header is only returned when the page |
| | 21938 | | /// </summary> |
| | 21939 | | public string EncryptionKeySha256 { get; internal set; } |
| | 21940 | |
|
| | 21941 | | /// <summary> |
| | 21942 | | /// Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note t |
| | 21943 | | /// </summary> |
| | 21944 | | public string EncryptionScope { get; internal set; } |
| | 21945 | |
|
| | 21946 | | /// <summary> |
| | 21947 | | /// Prevent direct instantiation of PageInfo instances. |
| | 21948 | | /// You can use BlobsModelFactory.PageInfo instead. |
| | 21949 | | /// </summary> |
| | 21950 | | internal PageInfo() { } |
| | 21951 | | } |
| | 21952 | |
|
| | 21953 | | /// <summary> |
| | 21954 | | /// BlobsModelFactory provides utilities for mocking. |
| | 21955 | | /// </summary> |
| | 21956 | | public static partial class BlobsModelFactory |
| | 21957 | | { |
| | 21958 | | /// <summary> |
| | 21959 | | /// Creates a new PageInfo instance for mocking. |
| | 21960 | | /// </summary> |
| | 21961 | | public static PageInfo PageInfo( |
| | 21962 | | Azure.ETag eTag, |
| | 21963 | | System.DateTimeOffset lastModified, |
| | 21964 | | byte[] contentHash, |
| | 21965 | | byte[] contentCrc64, |
| | 21966 | | long blobSequenceNumber, |
| | 21967 | | string encryptionKeySha256, |
| | 21968 | | string encryptionScope) |
| | 21969 | | { |
| | 21970 | | return new PageInfo() |
| | 21971 | | { |
| | 21972 | | ETag = eTag, |
| | 21973 | | LastModified = lastModified, |
| | 21974 | | ContentHash = contentHash, |
| | 21975 | | ContentCrc64 = contentCrc64, |
| | 21976 | | BlobSequenceNumber = blobSequenceNumber, |
| | 21977 | | EncryptionKeySha256 = encryptionKeySha256, |
| | 21978 | | EncryptionScope = encryptionScope, |
| | 21979 | | }; |
| | 21980 | | } |
| | 21981 | | } |
| | 21982 | | } |
| | 21983 | | #endregion class PageInfo |
| | 21984 | |
|
| | 21985 | | #region class PageList |
| | 21986 | | namespace Azure.Storage.Blobs.Models |
| | 21987 | | { |
| | 21988 | | /// <summary> |
| | 21989 | | /// the list of pages |
| | 21990 | | /// </summary> |
| | 21991 | | internal partial class PageList |
| | 21992 | | { |
| | 21993 | | /// <summary> |
| | 21994 | | /// PageRange |
| | 21995 | | /// </summary> |
| | 21996 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.PageRange> PageRange { get; internal se |
| | 21997 | |
|
| | 21998 | | /// <summary> |
| | 21999 | | /// ClearRange |
| | 22000 | | /// </summary> |
| | 22001 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.ClearRange> ClearRange { get; internal |
| | 22002 | |
|
| | 22003 | | /// <summary> |
| | 22004 | | /// Creates a new PageList instance |
| | 22005 | | /// </summary> |
| | 22006 | | public PageList() |
| | 22007 | | : this(false) |
| | 22008 | | { |
| | 22009 | | } |
| | 22010 | |
|
| | 22011 | | /// <summary> |
| | 22012 | | /// Creates a new PageList instance |
| | 22013 | | /// </summary> |
| | 22014 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 22015 | | internal PageList(bool skipInitialization) |
| | 22016 | | { |
| | 22017 | | if (!skipInitialization) |
| | 22018 | | { |
| | 22019 | | PageRange = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.PageRange>(); |
| | 22020 | | ClearRange = new System.Collections.Generic.List<Azure.Storage.Blobs.Models.ClearRange>(); |
| | 22021 | | } |
| | 22022 | | } |
| | 22023 | |
|
| | 22024 | | /// <summary> |
| | 22025 | | /// Deserializes XML into a new PageList instance. |
| | 22026 | | /// </summary> |
| | 22027 | | /// <param name="element">The XML element to deserialize.</param> |
| | 22028 | | /// <returns>A deserialized PageList instance.</returns> |
| | 22029 | | internal static Azure.Storage.Blobs.Models.PageList FromXml(System.Xml.Linq.XElement element) |
| | 22030 | | { |
| | 22031 | | System.Diagnostics.Debug.Assert(element != null); |
| | 22032 | | Azure.Storage.Blobs.Models.PageList _value = new Azure.Storage.Blobs.Models.PageList(true); |
| | 22033 | | _value.PageRange = System.Linq.Enumerable.ToList( |
| | 22034 | | System.Linq.Enumerable.Select( |
| | 22035 | | element.Elements(System.Xml.Linq.XName.Get("PageRange", "")), |
| | 22036 | | e => Azure.Storage.Blobs.Models.PageRange.FromXml(e))); |
| | 22037 | | _value.ClearRange = System.Linq.Enumerable.ToList( |
| | 22038 | | System.Linq.Enumerable.Select( |
| | 22039 | | element.Elements(System.Xml.Linq.XName.Get("ClearRange", "")), |
| | 22040 | | e => Azure.Storage.Blobs.Models.ClearRange.FromXml(e))); |
| | 22041 | | CustomizeFromXml(element, _value); |
| | 22042 | | return _value; |
| | 22043 | | } |
| | 22044 | |
|
| | 22045 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.PageList value |
| | 22046 | | } |
| | 22047 | | } |
| | 22048 | | #endregion class PageList |
| | 22049 | |
|
| | 22050 | | #region struct PageRange |
| | 22051 | | namespace Azure.Storage.Blobs.Models |
| | 22052 | | { |
| | 22053 | | /// <summary> |
| | 22054 | | /// PageRange |
| | 22055 | | /// </summary> |
| | 22056 | | internal readonly partial struct PageRange: System.IEquatable<PageRange> |
| | 22057 | | { |
| | 22058 | | /// <summary> |
| | 22059 | | /// Start |
| | 22060 | | /// </summary> |
| | 22061 | | public long Start { get; } |
| | 22062 | |
|
| | 22063 | | /// <summary> |
| | 22064 | | /// End |
| | 22065 | | /// </summary> |
| | 22066 | | public long End { get; } |
| | 22067 | |
|
| | 22068 | | /// <summary> |
| | 22069 | | /// Prevent direct instantiation of PageRange instances. |
| | 22070 | | /// You can use BlobsModelFactory.PageRange instead. |
| | 22071 | | /// </summary> |
| | 22072 | | internal PageRange( |
| | 22073 | | long start, |
| | 22074 | | long end) |
| | 22075 | | { |
| | 22076 | | Start = start; |
| | 22077 | | End = end; |
| | 22078 | | } |
| | 22079 | |
|
| | 22080 | | /// <summary> |
| | 22081 | | /// Check if two PageRange instances are equal. |
| | 22082 | | /// </summary> |
| | 22083 | | /// <param name="other">The instance to compare to.</param> |
| | 22084 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 22085 | | [System.ComponentModel.EditorBrowsable((System.ComponentModel.EditorBrowsableState.Never))] |
| | 22086 | | public bool Equals(PageRange other) |
| | 22087 | | { |
| | 22088 | | if (!Start.Equals(other.Start)) |
| | 22089 | | { |
| | 22090 | | return false; |
| | 22091 | | } |
| | 22092 | | if (!End.Equals(other.End)) |
| | 22093 | | { |
| | 22094 | | return false; |
| | 22095 | | } |
| | 22096 | |
|
| | 22097 | | return true; |
| | 22098 | | } |
| | 22099 | |
|
| | 22100 | | /// <summary> |
| | 22101 | | /// Check if two PageRange instances are equal. |
| | 22102 | | /// </summary> |
| | 22103 | | /// <param name="obj">The instance to compare to.</param> |
| | 22104 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 22105 | | [System.ComponentModel.EditorBrowsable((System.ComponentModel.EditorBrowsableState.Never))] |
| | 22106 | | public override bool Equals(object obj) => obj is PageRange && Equals((PageRange)obj); |
| | 22107 | |
|
| | 22108 | | /// <summary> |
| | 22109 | | /// Get a hash code for the PageRange. |
| | 22110 | | /// </summary> |
| | 22111 | | [System.ComponentModel.EditorBrowsable((System.ComponentModel.EditorBrowsableState.Never))] |
| | 22112 | | public override int GetHashCode() |
| | 22113 | | { |
| | 22114 | | var hashCode = new Azure.Core.HashCodeBuilder(); |
| | 22115 | | hashCode.Add(Start); |
| | 22116 | | hashCode.Add(End); |
| | 22117 | |
|
| | 22118 | | return hashCode.ToHashCode(); |
| | 22119 | | } |
| | 22120 | |
|
| | 22121 | | /// <summary> |
| | 22122 | | /// Deserializes XML into a new PageRange instance. |
| | 22123 | | /// </summary> |
| | 22124 | | /// <param name="element">The XML element to deserialize.</param> |
| | 22125 | | /// <returns>A deserialized PageRange instance.</returns> |
| | 22126 | | internal static Azure.Storage.Blobs.Models.PageRange FromXml(System.Xml.Linq.XElement element) |
| | 22127 | | { |
| | 22128 | | System.Diagnostics.Debug.Assert(element != null); |
| | 22129 | | System.Xml.Linq.XElement _child; |
| | 22130 | | long start = default; |
| | 22131 | | long end = default; |
| | 22132 | | _child = element.Element(System.Xml.Linq.XName.Get("Start", "")); |
| | 22133 | | if (_child != null) |
| | 22134 | | { |
| | 22135 | | start = long.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 22136 | | } |
| | 22137 | | _child = element.Element(System.Xml.Linq.XName.Get("End", "")); |
| | 22138 | | if (_child != null) |
| | 22139 | | { |
| | 22140 | | end = long.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 22141 | | } |
| | 22142 | | Azure.Storage.Blobs.Models.PageRange _value = new Azure.Storage.Blobs.Models.PageRange(start, end); |
| | 22143 | | CustomizeFromXml(element, _value); |
| | 22144 | | return _value; |
| | 22145 | | } |
| | 22146 | |
|
| | 22147 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.PageRange valu |
| | 22148 | | } |
| | 22149 | | } |
| | 22150 | | #endregion struct PageRange |
| | 22151 | |
|
| | 22152 | | #region class PageRangesInfoInternal |
| | 22153 | | namespace Azure.Storage.Blobs.Models |
| | 22154 | | { |
| | 22155 | | /// <summary> |
| | 22156 | | /// PageRangesInfoInternal |
| | 22157 | | /// </summary> |
| | 22158 | | internal partial class PageRangesInfoInternal |
| | 22159 | | { |
| | 22160 | | /// <summary> |
| | 22161 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 22162 | | /// </summary> |
| | 22163 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 22164 | |
|
| | 22165 | | /// <summary> |
| | 22166 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 22167 | | /// </summary> |
| | 22168 | | public Azure.ETag ETag { get; internal set; } |
| | 22169 | |
|
| | 22170 | | /// <summary> |
| | 22171 | | /// The size of the blob in bytes. |
| | 22172 | | /// </summary> |
| | 22173 | | public long BlobContentLength { get; internal set; } |
| | 22174 | |
|
| | 22175 | | /// <summary> |
| | 22176 | | /// the list of pages |
| | 22177 | | /// </summary> |
| | 22178 | | public Azure.Storage.Blobs.Models.PageList Body { get; internal set; } |
| | 22179 | |
|
| | 22180 | | /// <summary> |
| | 22181 | | /// Creates a new PageRangesInfoInternal instance |
| | 22182 | | /// </summary> |
| | 22183 | | public PageRangesInfoInternal() |
| | 22184 | | { |
| | 22185 | | Body = new Azure.Storage.Blobs.Models.PageList(); |
| | 22186 | | } |
| | 22187 | | } |
| | 22188 | | } |
| | 22189 | | #endregion class PageRangesInfoInternal |
| | 22190 | |
|
| | 22191 | | #region enum PathRenameMode |
| | 22192 | | namespace Azure.Storage.Blobs.Models |
| | 22193 | | { |
| | 22194 | | /// <summary> |
| | 22195 | | /// Determines the behavior of the rename operation |
| | 22196 | | /// </summary> |
| | 22197 | | public enum PathRenameMode |
| | 22198 | | { |
| | 22199 | | /// <summary> |
| | 22200 | | /// legacy |
| | 22201 | | /// </summary> |
| | 22202 | | Legacy, |
| | 22203 | |
|
| | 22204 | | /// <summary> |
| | 22205 | | /// posix |
| | 22206 | | /// </summary> |
| | 22207 | | Posix |
| | 22208 | | } |
| | 22209 | | } |
| | 22210 | |
|
| | 22211 | | namespace Azure.Storage.Blobs |
| | 22212 | | { |
| | 22213 | | internal static partial class BlobRestClient |
| | 22214 | | { |
| | 22215 | | public static partial class Serialization |
| | 22216 | | { |
| | 22217 | | public static string ToString(Azure.Storage.Blobs.Models.PathRenameMode value) |
| | 22218 | | { |
| | 22219 | | return value switch |
| | 22220 | | { |
| | 22221 | | Azure.Storage.Blobs.Models.PathRenameMode.Legacy => "legacy", |
| | 22222 | | Azure.Storage.Blobs.Models.PathRenameMode.Posix => "posix", |
| | 22223 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 22224 | | }; |
| | 22225 | | } |
| | 22226 | |
|
| | 22227 | | public static Azure.Storage.Blobs.Models.PathRenameMode ParsePathRenameMode(string value) |
| | 22228 | | { |
| | 22229 | | return value switch |
| | 22230 | | { |
| | 22231 | | "legacy" => Azure.Storage.Blobs.Models.PathRenameMode.Legacy, |
| | 22232 | | "posix" => Azure.Storage.Blobs.Models.PathRenameMode.Posix, |
| | 22233 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 22234 | | }; |
| | 22235 | | } |
| | 22236 | | } |
| | 22237 | | } |
| | 22238 | | } |
| | 22239 | | #endregion enum PathRenameMode |
| | 22240 | |
|
| | 22241 | | #region enum PublicAccessType |
| | 22242 | | namespace Azure.Storage.Blobs.Models |
| | 22243 | | { |
| | 22244 | | /// <summary> |
| | 22245 | | /// Specifies whether data in the container may be accessed publicly and the level of access |
| | 22246 | | /// </summary> |
| | 22247 | | public enum PublicAccessType |
| | 22248 | | { |
| | 22249 | | /// <summary> |
| | 22250 | | /// none |
| | 22251 | | /// </summary> |
| | 22252 | | None, |
| | 22253 | |
|
| | 22254 | | /// <summary> |
| | 22255 | | /// container |
| | 22256 | | /// </summary> |
| | 22257 | | BlobContainer, |
| | 22258 | |
|
| | 22259 | | /// <summary> |
| | 22260 | | /// blob |
| | 22261 | | /// </summary> |
| | 22262 | | Blob |
| | 22263 | | } |
| | 22264 | | } |
| | 22265 | |
|
| | 22266 | | namespace Azure.Storage.Blobs |
| | 22267 | | { |
| | 22268 | | internal static partial class BlobRestClient |
| | 22269 | | { |
| | 22270 | | public static partial class Serialization |
| | 22271 | | { |
| | 22272 | | public static string ToString(Azure.Storage.Blobs.Models.PublicAccessType value) |
| | 22273 | | { |
| | 22274 | | return value switch |
| | 22275 | | { |
| | 22276 | | Azure.Storage.Blobs.Models.PublicAccessType.None => null, |
| | 22277 | | Azure.Storage.Blobs.Models.PublicAccessType.BlobContainer => "container", |
| | 22278 | | Azure.Storage.Blobs.Models.PublicAccessType.Blob => "blob", |
| | 22279 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 22280 | | }; |
| | 22281 | | } |
| | 22282 | |
|
| | 22283 | | public static Azure.Storage.Blobs.Models.PublicAccessType ParsePublicAccessType(string value) |
| | 22284 | | { |
| | 22285 | | return value switch |
| | 22286 | | { |
| | 22287 | | null => Azure.Storage.Blobs.Models.PublicAccessType.None, |
| | 22288 | | "container" => Azure.Storage.Blobs.Models.PublicAccessType.BlobContainer, |
| | 22289 | | "blob" => Azure.Storage.Blobs.Models.PublicAccessType.Blob, |
| | 22290 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 22291 | | }; |
| | 22292 | | } |
| | 22293 | | } |
| | 22294 | | } |
| | 22295 | | } |
| | 22296 | | #endregion enum PublicAccessType |
| | 22297 | |
|
| | 22298 | | #region class QueryFormat |
| | 22299 | | namespace Azure.Storage.Blobs.Models |
| | 22300 | | { |
| | 22301 | | /// <summary> |
| | 22302 | | /// QueryFormat |
| | 22303 | | /// </summary> |
| | 22304 | | internal partial class QueryFormat |
| | 22305 | | { |
| | 22306 | | /// <summary> |
| | 22307 | | /// The quick query format type. |
| | 22308 | | /// </summary> |
| | 22309 | | public Azure.Storage.Blobs.Models.QueryFormatType? Type { get; set; } |
| | 22310 | |
|
| | 22311 | | /// <summary> |
| | 22312 | | /// delimited text configuration |
| | 22313 | | /// </summary> |
| | 22314 | | public Azure.Storage.Blobs.Models.DelimitedTextConfigurationInternal DelimitedTextConfiguration { get; set; } |
| | 22315 | |
|
| | 22316 | | /// <summary> |
| | 22317 | | /// json text configuration |
| | 22318 | | /// </summary> |
| | 22319 | | public Azure.Storage.Blobs.Models.JsonTextConfigurationInternal JsonTextConfiguration { get; set; } |
| | 22320 | |
|
| | 22321 | | /// <summary> |
| | 22322 | | /// Creates a new QueryFormat instance |
| | 22323 | | /// </summary> |
| | 22324 | | public QueryFormat() |
| | 22325 | | { |
| | 22326 | | DelimitedTextConfiguration = new Azure.Storage.Blobs.Models.DelimitedTextConfigurationInternal(); |
| | 22327 | | JsonTextConfiguration = new Azure.Storage.Blobs.Models.JsonTextConfigurationInternal(); |
| | 22328 | | } |
| | 22329 | |
|
| | 22330 | | /// <summary> |
| | 22331 | | /// Serialize a QueryFormat instance as XML. |
| | 22332 | | /// </summary> |
| | 22333 | | /// <param name="value">The QueryFormat instance to serialize.</param> |
| | 22334 | | /// <param name="name">An optional name to use for the root element instead of "QueryFormat".</param> |
| | 22335 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 22336 | | /// <returns>The serialized XML element.</returns> |
| | 22337 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.QueryFormat value, string name = "Quer |
| | 22338 | | { |
| | 22339 | | System.Diagnostics.Debug.Assert(value != null); |
| | 22340 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 22341 | | if (value.Type != null) |
| | 22342 | | { |
| | 22343 | | _element.Add(new System.Xml.Linq.XElement( |
| | 22344 | | System.Xml.Linq.XName.Get("Type", ""), |
| | 22345 | | Azure.Storage.Blobs.BlobRestClient.Serialization.ToString(value.Type.Value))); |
| | 22346 | | } |
| | 22347 | | if (value.DelimitedTextConfiguration != null) |
| | 22348 | | { |
| | 22349 | | _element.Add(Azure.Storage.Blobs.Models.DelimitedTextConfigurationInternal.ToXml(value.DelimitedTextConf |
| | 22350 | | } |
| | 22351 | | if (value.JsonTextConfiguration != null) |
| | 22352 | | { |
| | 22353 | | _element.Add(Azure.Storage.Blobs.Models.JsonTextConfigurationInternal.ToXml(value.JsonTextConfiguration, |
| | 22354 | | } |
| | 22355 | | return _element; |
| | 22356 | | } |
| | 22357 | | } |
| | 22358 | | } |
| | 22359 | | #endregion class QueryFormat |
| | 22360 | |
|
| | 22361 | | #region enum QueryFormatType |
| | 22362 | | namespace Azure.Storage.Blobs.Models |
| | 22363 | | { |
| | 22364 | | /// <summary> |
| | 22365 | | /// The quick query format type. |
| | 22366 | | /// </summary> |
| | 22367 | | internal enum QueryFormatType |
| | 22368 | | { |
| | 22369 | | /// <summary> |
| | 22370 | | /// delimited |
| | 22371 | | /// </summary> |
| | 22372 | | Delimited, |
| | 22373 | |
|
| | 22374 | | /// <summary> |
| | 22375 | | /// json |
| | 22376 | | /// </summary> |
| | 22377 | | Json |
| | 22378 | | } |
| | 22379 | | } |
| | 22380 | |
|
| | 22381 | | namespace Azure.Storage.Blobs |
| | 22382 | | { |
| | 22383 | | internal static partial class BlobRestClient |
| | 22384 | | { |
| | 22385 | | public static partial class Serialization |
| | 22386 | | { |
| | 22387 | | public static string ToString(Azure.Storage.Blobs.Models.QueryFormatType value) |
| | 22388 | | { |
| | 22389 | | return value switch |
| | 22390 | | { |
| | 22391 | | Azure.Storage.Blobs.Models.QueryFormatType.Delimited => "delimited", |
| | 22392 | | Azure.Storage.Blobs.Models.QueryFormatType.Json => "json", |
| | 22393 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 22394 | | }; |
| | 22395 | | } |
| | 22396 | |
|
| | 22397 | | public static Azure.Storage.Blobs.Models.QueryFormatType ParseQueryFormatType(string value) |
| | 22398 | | { |
| | 22399 | | return value switch |
| | 22400 | | { |
| | 22401 | | "delimited" => Azure.Storage.Blobs.Models.QueryFormatType.Delimited, |
| | 22402 | | "json" => Azure.Storage.Blobs.Models.QueryFormatType.Json, |
| | 22403 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 22404 | | }; |
| | 22405 | | } |
| | 22406 | | } |
| | 22407 | | } |
| | 22408 | | } |
| | 22409 | | #endregion enum QueryFormatType |
| | 22410 | |
|
| | 22411 | | #region class QueryRequest |
| | 22412 | | namespace Azure.Storage.Blobs.Models |
| | 22413 | | { |
| | 22414 | | /// <summary> |
| | 22415 | | /// the quick query body |
| | 22416 | | /// </summary> |
| | 22417 | | internal partial class QueryRequest |
| | 22418 | | { |
| | 22419 | | /// <summary> |
| | 22420 | | /// the query type |
| | 22421 | | /// </summary> |
| | 22422 | | public string QueryType { get; set; } |
| | 22423 | |
|
| | 22424 | | /// <summary> |
| | 22425 | | /// a query statement |
| | 22426 | | /// </summary> |
| | 22427 | | public string Expression { get; set; } |
| | 22428 | |
|
| | 22429 | | /// <summary> |
| | 22430 | | /// InputSerialization |
| | 22431 | | /// </summary> |
| | 22432 | | public Azure.Storage.Blobs.Models.QuerySerialization InputSerialization { get; set; } |
| | 22433 | |
|
| | 22434 | | /// <summary> |
| | 22435 | | /// OutputSerialization |
| | 22436 | | /// </summary> |
| | 22437 | | public Azure.Storage.Blobs.Models.QuerySerialization OutputSerialization { get; set; } |
| | 22438 | |
|
| | 22439 | | /// <summary> |
| | 22440 | | /// Creates a new QueryRequest instance |
| | 22441 | | /// </summary> |
| | 22442 | | public QueryRequest() |
| | 22443 | | { |
| | 22444 | | InputSerialization = new Azure.Storage.Blobs.Models.QuerySerialization(); |
| | 22445 | | OutputSerialization = new Azure.Storage.Blobs.Models.QuerySerialization(); |
| | 22446 | | } |
| | 22447 | |
|
| | 22448 | | /// <summary> |
| | 22449 | | /// Serialize a QueryRequest instance as XML. |
| | 22450 | | /// </summary> |
| | 22451 | | /// <param name="value">The QueryRequest instance to serialize.</param> |
| | 22452 | | /// <param name="name">An optional name to use for the root element instead of "QueryRequest".</param> |
| | 22453 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 22454 | | /// <returns>The serialized XML element.</returns> |
| | 22455 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.QueryRequest value, string name = "Que |
| | 22456 | | { |
| | 22457 | | System.Diagnostics.Debug.Assert(value != null); |
| | 22458 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 22459 | | _element.Add(new System.Xml.Linq.XElement( |
| | 22460 | | System.Xml.Linq.XName.Get("QueryType", ""), |
| | 22461 | | value.QueryType)); |
| | 22462 | | _element.Add(new System.Xml.Linq.XElement( |
| | 22463 | | System.Xml.Linq.XName.Get("Expression", ""), |
| | 22464 | | value.Expression)); |
| | 22465 | | if (value.InputSerialization != null) |
| | 22466 | | { |
| | 22467 | | _element.Add(Azure.Storage.Blobs.Models.QuerySerialization.ToXml(value.InputSerialization, "InputSeriali |
| | 22468 | | } |
| | 22469 | | if (value.OutputSerialization != null) |
| | 22470 | | { |
| | 22471 | | _element.Add(Azure.Storage.Blobs.Models.QuerySerialization.ToXml(value.OutputSerialization, "OutputSeria |
| | 22472 | | } |
| | 22473 | | return _element; |
| | 22474 | | } |
| | 22475 | | } |
| | 22476 | | } |
| | 22477 | | #endregion class QueryRequest |
| | 22478 | |
|
| | 22479 | | #region class QuerySerialization |
| | 22480 | | namespace Azure.Storage.Blobs.Models |
| | 22481 | | { |
| | 22482 | | /// <summary> |
| | 22483 | | /// QuerySerialization |
| | 22484 | | /// </summary> |
| | 22485 | | internal partial class QuerySerialization |
| | 22486 | | { |
| | 22487 | | /// <summary> |
| | 22488 | | /// Format |
| | 22489 | | /// </summary> |
| | 22490 | | public Azure.Storage.Blobs.Models.QueryFormat Format { get; set; } |
| | 22491 | |
|
| | 22492 | | /// <summary> |
| | 22493 | | /// Creates a new QuerySerialization instance |
| | 22494 | | /// </summary> |
| | 22495 | | public QuerySerialization() |
| | 22496 | | { |
| | 22497 | | Format = new Azure.Storage.Blobs.Models.QueryFormat(); |
| | 22498 | | } |
| | 22499 | |
|
| | 22500 | | /// <summary> |
| | 22501 | | /// Serialize a QuerySerialization instance as XML. |
| | 22502 | | /// </summary> |
| | 22503 | | /// <param name="value">The QuerySerialization instance to serialize.</param> |
| | 22504 | | /// <param name="name">An optional name to use for the root element instead of "QuerySerialization".</param> |
| | 22505 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 22506 | | /// <returns>The serialized XML element.</returns> |
| | 22507 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Blobs.Models.QuerySerialization value, string name |
| | 22508 | | { |
| | 22509 | | System.Diagnostics.Debug.Assert(value != null); |
| | 22510 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 22511 | | _element.Add(Azure.Storage.Blobs.Models.QueryFormat.ToXml(value.Format, "Format", "")); |
| | 22512 | | return _element; |
| | 22513 | | } |
| | 22514 | | } |
| | 22515 | | } |
| | 22516 | | #endregion class QuerySerialization |
| | 22517 | |
|
| | 22518 | | #region enum RehydratePriority |
| | 22519 | | namespace Azure.Storage.Blobs.Models |
| | 22520 | | { |
| | 22521 | | /// <summary> |
| | 22522 | | /// Optional: Indicates the priority with which to rehydrate an archived blob. |
| | 22523 | | /// </summary> |
| | 22524 | | public enum RehydratePriority |
| | 22525 | | { |
| | 22526 | | /// <summary> |
| | 22527 | | /// High |
| | 22528 | | /// </summary> |
| | 22529 | | High, |
| | 22530 | |
|
| | 22531 | | /// <summary> |
| | 22532 | | /// Standard |
| | 22533 | | /// </summary> |
| | 22534 | | Standard |
| | 22535 | | } |
| | 22536 | | } |
| | 22537 | | #endregion enum RehydratePriority |
| | 22538 | |
|
| | 22539 | | #region enum SequenceNumberAction |
| | 22540 | | namespace Azure.Storage.Blobs.Models |
| | 22541 | | { |
| | 22542 | | /// <summary> |
| | 22543 | | /// Required if the x-ms-blob-sequence-number header is set for the request. This property applies to page blobs onl |
| | 22544 | | /// </summary> |
| | 22545 | | public enum SequenceNumberAction |
| | 22546 | | { |
| | 22547 | | /// <summary> |
| | 22548 | | /// max |
| | 22549 | | /// </summary> |
| | 22550 | | Max, |
| | 22551 | |
|
| | 22552 | | /// <summary> |
| | 22553 | | /// update |
| | 22554 | | /// </summary> |
| | 22555 | | Update, |
| | 22556 | |
|
| | 22557 | | /// <summary> |
| | 22558 | | /// increment |
| | 22559 | | /// </summary> |
| | 22560 | | Increment |
| | 22561 | | } |
| | 22562 | | } |
| | 22563 | |
|
| | 22564 | | namespace Azure.Storage.Blobs |
| | 22565 | | { |
| | 22566 | | internal static partial class BlobRestClient |
| | 22567 | | { |
| | 22568 | | public static partial class Serialization |
| | 22569 | | { |
| | 22570 | | public static string ToString(Azure.Storage.Blobs.Models.SequenceNumberAction value) |
| | 22571 | | { |
| | 22572 | | return value switch |
| | 22573 | | { |
| | 22574 | | Azure.Storage.Blobs.Models.SequenceNumberAction.Max => "max", |
| | 22575 | | Azure.Storage.Blobs.Models.SequenceNumberAction.Update => "update", |
| | 22576 | | Azure.Storage.Blobs.Models.SequenceNumberAction.Increment => "increment", |
| | 22577 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 22578 | | }; |
| | 22579 | | } |
| | 22580 | |
|
| | 22581 | | public static Azure.Storage.Blobs.Models.SequenceNumberAction ParseSequenceNumberAction(string value) |
| | 22582 | | { |
| | 22583 | | return value switch |
| | 22584 | | { |
| | 22585 | | "max" => Azure.Storage.Blobs.Models.SequenceNumberAction.Max, |
| | 22586 | | "update" => Azure.Storage.Blobs.Models.SequenceNumberAction.Update, |
| | 22587 | | "increment" => Azure.Storage.Blobs.Models.SequenceNumberAction.Increment, |
| | 22588 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 22589 | | }; |
| | 22590 | | } |
| | 22591 | | } |
| | 22592 | | } |
| | 22593 | | } |
| | 22594 | | #endregion enum SequenceNumberAction |
| | 22595 | |
|
| | 22596 | | #region class SetHttpHeadersOperation |
| | 22597 | | namespace Azure.Storage.Blobs.Models |
| | 22598 | | { |
| | 22599 | | /// <summary> |
| | 22600 | | /// SetHttpHeadersOperation |
| | 22601 | | /// </summary> |
| | 22602 | | internal partial class SetHttpHeadersOperation |
| | 22603 | | { |
| | 22604 | | /// <summary> |
| | 22605 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 22606 | | /// </summary> |
| | 22607 | | public Azure.ETag ETag { get; internal set; } |
| | 22608 | |
|
| | 22609 | | /// <summary> |
| | 22610 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 22611 | | /// </summary> |
| | 22612 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 22613 | |
|
| | 22614 | | /// <summary> |
| | 22615 | | /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs |
| | 22616 | | /// </summary> |
| | 22617 | | public long BlobSequenceNumber { get; internal set; } |
| | 22618 | |
|
| | 22619 | | /// <summary> |
| | 22620 | | /// Prevent direct instantiation of SetHttpHeadersOperation instances. |
| | 22621 | | /// You can use BlobsModelFactory.SetHttpHeadersOperation instead. |
| | 22622 | | /// </summary> |
| | 22623 | | internal SetHttpHeadersOperation() { } |
| | 22624 | | } |
| | 22625 | | } |
| | 22626 | | #endregion class SetHttpHeadersOperation |
| | 22627 | |
|
| | 22628 | | #region class SetMetadataOperation |
| | 22629 | | namespace Azure.Storage.Blobs.Models |
| | 22630 | | { |
| | 22631 | | /// <summary> |
| | 22632 | | /// SetMetadataOperation |
| | 22633 | | /// </summary> |
| | 22634 | | internal partial class SetMetadataOperation |
| | 22635 | | { |
| | 22636 | | /// <summary> |
| | 22637 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 22638 | | /// </summary> |
| | 22639 | | public Azure.ETag ETag { get; internal set; } |
| | 22640 | |
|
| | 22641 | | /// <summary> |
| | 22642 | | /// Returns the date and time the container was last modified. Any operation that modifies the blob, including a |
| | 22643 | | /// </summary> |
| | 22644 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 22645 | |
|
| | 22646 | | /// <summary> |
| | 22647 | | /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicat |
| | 22648 | | /// </summary> |
| | 22649 | | public string VersionId { get; internal set; } |
| | 22650 | |
|
| | 22651 | | /// <summary> |
| | 22652 | | /// The value of this header is set to true if the contents of the request are successfully encrypted using the |
| | 22653 | | /// </summary> |
| | 22654 | | public bool IsServerEncrypted { get; internal set; } |
| | 22655 | |
|
| | 22656 | | /// <summary> |
| | 22657 | | /// The SHA-256 hash of the encryption key used to encrypt the metadata. This header is only returned when the m |
| | 22658 | | /// </summary> |
| | 22659 | | public string EncryptionKeySha256 { get; internal set; } |
| | 22660 | |
|
| | 22661 | | /// <summary> |
| | 22662 | | /// Returns the name of the encryption scope used to encrypt the blob contents and application metadata. Note t |
| | 22663 | | /// </summary> |
| | 22664 | | public string EncryptionScope { get; internal set; } |
| | 22665 | |
|
| | 22666 | | /// <summary> |
| | 22667 | | /// Prevent direct instantiation of SetMetadataOperation instances. |
| | 22668 | | /// You can use BlobsModelFactory.SetMetadataOperation instead. |
| | 22669 | | /// </summary> |
| | 22670 | | internal SetMetadataOperation() { } |
| | 22671 | | } |
| | 22672 | | } |
| | 22673 | | #endregion class SetMetadataOperation |
| | 22674 | |
|
| | 22675 | | #region enum SkuName |
| | 22676 | | namespace Azure.Storage.Blobs.Models |
| | 22677 | | { |
| | 22678 | | /// <summary> |
| | 22679 | | /// Identifies the sku name of the account |
| | 22680 | | /// </summary> |
| | 22681 | | public enum SkuName |
| | 22682 | | { |
| | 22683 | | /// <summary> |
| | 22684 | | /// Standard_LRS |
| | 22685 | | /// </summary> |
| | 22686 | | StandardLrs, |
| | 22687 | |
|
| | 22688 | | /// <summary> |
| | 22689 | | /// Standard_GRS |
| | 22690 | | /// </summary> |
| | 22691 | | StandardGrs, |
| | 22692 | |
|
| | 22693 | | /// <summary> |
| | 22694 | | /// Standard_RAGRS |
| | 22695 | | /// </summary> |
| | 22696 | | StandardRagrs, |
| | 22697 | |
|
| | 22698 | | /// <summary> |
| | 22699 | | /// Standard_ZRS |
| | 22700 | | /// </summary> |
| | 22701 | | StandardZrs, |
| | 22702 | |
|
| | 22703 | | /// <summary> |
| | 22704 | | /// Premium_LRS |
| | 22705 | | /// </summary> |
| | 22706 | | PremiumLrs |
| | 22707 | | } |
| | 22708 | | } |
| | 22709 | |
|
| | 22710 | | namespace Azure.Storage.Blobs |
| | 22711 | | { |
| | 22712 | | internal static partial class BlobRestClient |
| | 22713 | | { |
| | 22714 | | public static partial class Serialization |
| | 22715 | | { |
| | 22716 | | public static string ToString(Azure.Storage.Blobs.Models.SkuName value) |
| | 22717 | | { |
| | 22718 | | return value switch |
| | 22719 | | { |
| | 22720 | | Azure.Storage.Blobs.Models.SkuName.StandardLrs => "Standard_LRS", |
| | 22721 | | Azure.Storage.Blobs.Models.SkuName.StandardGrs => "Standard_GRS", |
| | 22722 | | Azure.Storage.Blobs.Models.SkuName.StandardRagrs => "Standard_RAGRS", |
| | 22723 | | Azure.Storage.Blobs.Models.SkuName.StandardZrs => "Standard_ZRS", |
| | 22724 | | Azure.Storage.Blobs.Models.SkuName.PremiumLrs => "Premium_LRS", |
| | 22725 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 22726 | | }; |
| | 22727 | | } |
| | 22728 | |
|
| | 22729 | | public static Azure.Storage.Blobs.Models.SkuName ParseSkuName(string value) |
| | 22730 | | { |
| | 22731 | | return value switch |
| | 22732 | | { |
| | 22733 | | "Standard_LRS" => Azure.Storage.Blobs.Models.SkuName.StandardLrs, |
| | 22734 | | "Standard_GRS" => Azure.Storage.Blobs.Models.SkuName.StandardGrs, |
| | 22735 | | "Standard_RAGRS" => Azure.Storage.Blobs.Models.SkuName.StandardRagrs, |
| | 22736 | | "Standard_ZRS" => Azure.Storage.Blobs.Models.SkuName.StandardZrs, |
| | 22737 | | "Premium_LRS" => Azure.Storage.Blobs.Models.SkuName.PremiumLrs, |
| | 22738 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Blobs |
| | 22739 | | }; |
| | 22740 | | } |
| | 22741 | | } |
| | 22742 | | } |
| | 22743 | | } |
| | 22744 | | #endregion enum SkuName |
| | 22745 | |
|
| | 22746 | | #region class StorageError |
| | 22747 | | namespace Azure.Storage.Blobs.Models |
| | 22748 | | { |
| | 22749 | | /// <summary> |
| | 22750 | | /// StorageError |
| | 22751 | | /// </summary> |
| | 22752 | | internal partial class StorageError |
| | 22753 | | { |
| | 22754 | | /// <summary> |
| | 22755 | | /// Message |
| | 22756 | | /// </summary> |
| | 22757 | | public string Message { get; internal set; } |
| | 22758 | |
|
| | 22759 | | /// <summary> |
| | 22760 | | /// Code |
| | 22761 | | /// </summary> |
| | 22762 | | public string Code { get; internal set; } |
| | 22763 | |
|
| | 22764 | | /// <summary> |
| | 22765 | | /// Prevent direct instantiation of StorageError instances. |
| | 22766 | | /// You can use BlobsModelFactory.StorageError instead. |
| | 22767 | | /// </summary> |
| | 22768 | | internal StorageError() { } |
| | 22769 | |
|
| | 22770 | | /// <summary> |
| | 22771 | | /// Deserializes XML into a new StorageError instance. |
| | 22772 | | /// </summary> |
| | 22773 | | /// <param name="element">The XML element to deserialize.</param> |
| | 22774 | | /// <returns>A deserialized StorageError instance.</returns> |
| | 22775 | | internal static Azure.Storage.Blobs.Models.StorageError FromXml(System.Xml.Linq.XElement element) |
| | 22776 | | { |
| | 22777 | | System.Diagnostics.Debug.Assert(element != null); |
| | 22778 | | System.Xml.Linq.XElement _child; |
| | 22779 | | Azure.Storage.Blobs.Models.StorageError _value = new Azure.Storage.Blobs.Models.StorageError(); |
| | 22780 | | _child = element.Element(System.Xml.Linq.XName.Get("Message", "")); |
| | 22781 | | if (_child != null) |
| | 22782 | | { |
| | 22783 | | _value.Message = _child.Value; |
| | 22784 | | } |
| | 22785 | | _child = element.Element(System.Xml.Linq.XName.Get("Code", "")); |
| | 22786 | | if (_child != null) |
| | 22787 | | { |
| | 22788 | | _value.Code = _child.Value; |
| | 22789 | | } |
| | 22790 | | CustomizeFromXml(element, _value); |
| | 22791 | | return _value; |
| | 22792 | | } |
| | 22793 | |
|
| | 22794 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.StorageError v |
| | 22795 | | } |
| | 22796 | | } |
| | 22797 | | #endregion class StorageError |
| | 22798 | |
|
| | 22799 | | #region class UserDelegationKey |
| | 22800 | | namespace Azure.Storage.Blobs.Models |
| | 22801 | | { |
| | 22802 | | /// <summary> |
| | 22803 | | /// A user delegation key |
| | 22804 | | /// </summary> |
| | 22805 | | public partial class UserDelegationKey |
| | 22806 | | { |
| | 22807 | | /// <summary> |
| | 22808 | | /// The Azure Active Directory object ID in GUID format. |
| | 22809 | | /// </summary> |
| | 22810 | | public string SignedObjectId { get; internal set; } |
| | 22811 | |
|
| | 22812 | | /// <summary> |
| | 22813 | | /// The Azure Active Directory tenant ID in GUID format |
| | 22814 | | /// </summary> |
| | 22815 | | public string SignedTenantId { get; internal set; } |
| | 22816 | |
|
| | 22817 | | /// <summary> |
| | 22818 | | /// Abbreviation of the Azure Storage service that accepts the key |
| | 22819 | | /// </summary> |
| | 22820 | | public string SignedService { get; internal set; } |
| | 22821 | |
|
| | 22822 | | /// <summary> |
| | 22823 | | /// The service version that created the key |
| | 22824 | | /// </summary> |
| | 22825 | | public string SignedVersion { get; internal set; } |
| | 22826 | |
|
| | 22827 | | /// <summary> |
| | 22828 | | /// The key as a base64 string |
| | 22829 | | /// </summary> |
| | 22830 | | public string Value { get; internal set; } |
| | 22831 | |
|
| | 22832 | | /// <summary> |
| | 22833 | | /// The date-time the key expires |
| | 22834 | | /// </summary> |
| | 22835 | | public System.DateTimeOffset SignedExpiresOn { get; internal set; } |
| | 22836 | |
|
| | 22837 | | /// <summary> |
| | 22838 | | /// The date-time the key is active |
| | 22839 | | /// </summary> |
| | 22840 | | public System.DateTimeOffset SignedStartsOn { get; internal set; } |
| | 22841 | |
|
| | 22842 | | /// <summary> |
| | 22843 | | /// Prevent direct instantiation of UserDelegationKey instances. |
| | 22844 | | /// You can use BlobsModelFactory.UserDelegationKey instead. |
| | 22845 | | /// </summary> |
| | 22846 | | internal UserDelegationKey() { } |
| | 22847 | |
|
| | 22848 | | /// <summary> |
| | 22849 | | /// Deserializes XML into a new UserDelegationKey instance. |
| | 22850 | | /// </summary> |
| | 22851 | | /// <param name="element">The XML element to deserialize.</param> |
| | 22852 | | /// <returns>A deserialized UserDelegationKey instance.</returns> |
| | 22853 | | internal static Azure.Storage.Blobs.Models.UserDelegationKey FromXml(System.Xml.Linq.XElement element) |
| | 22854 | | { |
| | 22855 | | System.Diagnostics.Debug.Assert(element != null); |
| | 22856 | | System.Xml.Linq.XElement _child; |
| | 22857 | | Azure.Storage.Blobs.Models.UserDelegationKey _value = new Azure.Storage.Blobs.Models.UserDelegationKey(); |
| | 22858 | | _child = element.Element(System.Xml.Linq.XName.Get("SignedOid", "")); |
| | 22859 | | if (_child != null) |
| | 22860 | | { |
| | 22861 | | _value.SignedObjectId = _child.Value; |
| | 22862 | | } |
| | 22863 | | _child = element.Element(System.Xml.Linq.XName.Get("SignedTid", "")); |
| | 22864 | | if (_child != null) |
| | 22865 | | { |
| | 22866 | | _value.SignedTenantId = _child.Value; |
| | 22867 | | } |
| | 22868 | | _child = element.Element(System.Xml.Linq.XName.Get("SignedService", "")); |
| | 22869 | | if (_child != null) |
| | 22870 | | { |
| | 22871 | | _value.SignedService = _child.Value; |
| | 22872 | | } |
| | 22873 | | _child = element.Element(System.Xml.Linq.XName.Get("SignedVersion", "")); |
| | 22874 | | if (_child != null) |
| | 22875 | | { |
| | 22876 | | _value.SignedVersion = _child.Value; |
| | 22877 | | } |
| | 22878 | | _child = element.Element(System.Xml.Linq.XName.Get("Value", "")); |
| | 22879 | | if (_child != null) |
| | 22880 | | { |
| | 22881 | | _value.Value = _child.Value; |
| | 22882 | | } |
| | 22883 | | _child = element.Element(System.Xml.Linq.XName.Get("SignedExpiry", "")); |
| | 22884 | | if (_child != null) |
| | 22885 | | { |
| | 22886 | | _value.SignedExpiresOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.Inva |
| | 22887 | | } |
| | 22888 | | _child = element.Element(System.Xml.Linq.XName.Get("SignedStart", "")); |
| | 22889 | | if (_child != null) |
| | 22890 | | { |
| | 22891 | | _value.SignedStartsOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.Invar |
| | 22892 | | } |
| | 22893 | | CustomizeFromXml(element, _value); |
| | 22894 | | return _value; |
| | 22895 | | } |
| | 22896 | |
|
| | 22897 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Blobs.Models.UserDelegation |
| | 22898 | | } |
| | 22899 | |
|
| | 22900 | | /// <summary> |
| | 22901 | | /// BlobsModelFactory provides utilities for mocking. |
| | 22902 | | /// </summary> |
| | 22903 | | public static partial class BlobsModelFactory |
| | 22904 | | { |
| | 22905 | | /// <summary> |
| | 22906 | | /// Creates a new UserDelegationKey instance for mocking. |
| | 22907 | | /// </summary> |
| | 22908 | | public static UserDelegationKey UserDelegationKey( |
| | 22909 | | string signedObjectId, |
| | 22910 | | string signedTenantId, |
| | 22911 | | string signedService, |
| | 22912 | | string signedVersion, |
| | 22913 | | string value, |
| | 22914 | | System.DateTimeOffset signedExpiresOn, |
| | 22915 | | System.DateTimeOffset signedStartsOn) |
| | 22916 | | { |
| | 22917 | | return new UserDelegationKey() |
| | 22918 | | { |
| | 22919 | | SignedObjectId = signedObjectId, |
| | 22920 | | SignedTenantId = signedTenantId, |
| | 22921 | | SignedService = signedService, |
| | 22922 | | SignedVersion = signedVersion, |
| | 22923 | | Value = value, |
| | 22924 | | SignedExpiresOn = signedExpiresOn, |
| | 22925 | | SignedStartsOn = signedStartsOn, |
| | 22926 | | }; |
| | 22927 | | } |
| | 22928 | | } |
| | 22929 | | } |
| | 22930 | | #endregion class UserDelegationKey |
| | 22931 | | #endregion Models |
| | 22932 | |
|