| | 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.Files.Shares |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// Azure File Storage |
| | 16 | | /// </summary> |
| | 17 | | internal static partial class FileRestClient |
| | 18 | | { |
| | 19 | | #region Service operations |
| | 20 | | /// <summary> |
| | 21 | | /// Service operations for Azure File Storage |
| | 22 | | /// </summary> |
| | 23 | | public static partial class Service |
| | 24 | | { |
| | 25 | | #region Service.SetPropertiesAsync |
| | 26 | | /// <summary> |
| | 27 | | /// Sets properties for a storage account's File 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, share, directory or file that is the target of |
| | 32 | | /// <param name="properties">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="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 36 | | /// <param name="operationName">Operation name.</param> |
| | 37 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 38 | | /// <returns>Azure.Response</returns> |
| | 39 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> SetPropertiesAsync( |
| | 40 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 41 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 42 | | System.Uri resourceUri, |
| | 43 | | Azure.Storage.Files.Shares.Models.ShareServiceProperties properties, |
| | 44 | | string version, |
| | 45 | | int? timeout = default, |
| | 46 | | bool async = true, |
| | 47 | | string operationName = "ServiceClient.SetProperties", |
| | 48 | | System.Threading.CancellationToken cancellationToken = default) |
| | 49 | | { |
| | 50 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 51 | | try |
| | 52 | | { |
| | 53 | | _scope.AddAttribute("url", resourceUri); |
| | 54 | | _scope.Start(); |
| | 55 | | using (Azure.Core.HttpMessage _message = SetPropertiesAsync_CreateMessage( |
| | 56 | | pipeline, |
| | 57 | | resourceUri, |
| | 58 | | properties, |
| | 59 | | version, |
| | 60 | | timeout)) |
| | 61 | | { |
| | 62 | | if (async) |
| | 63 | | { |
| | 64 | | // Send the request asynchronously if we're being called via an async path |
| | 65 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 66 | | } |
| | 67 | | else |
| | 68 | | { |
| | 69 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 70 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 71 | | pipeline.Send(_message, cancellationToken); |
| | 72 | | } |
| | 73 | | Azure.Response _response = _message.Response; |
| | 74 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 75 | | return SetPropertiesAsync_CreateResponse(clientDiagnostics, _response); |
| | 76 | | } |
| | 77 | | } |
| | 78 | | catch (System.Exception ex) |
| | 79 | | { |
| | 80 | | _scope.Failed(ex); |
| | 81 | | throw; |
| | 82 | | } |
| | 83 | | finally |
| | 84 | | { |
| | 85 | | _scope.Dispose(); |
| | 86 | | } |
| | 87 | | } |
| | 88 | |
|
| | 89 | | /// <summary> |
| | 90 | | /// Create the Service.SetPropertiesAsync request. |
| | 91 | | /// </summary> |
| | 92 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 93 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 94 | | /// <param name="properties">The StorageService properties.</param> |
| | 95 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 96 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 97 | | /// <returns>The Service.SetPropertiesAsync Message.</returns> |
| | 98 | | internal static Azure.Core.HttpMessage SetPropertiesAsync_CreateMessage( |
| | 99 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 100 | | System.Uri resourceUri, |
| | 101 | | Azure.Storage.Files.Shares.Models.ShareServiceProperties properties, |
| | 102 | | string version, |
| | 103 | | int? timeout = default) |
| | 104 | | { |
| | 105 | | // Validation |
| | 106 | | if (resourceUri == null) |
| | 107 | | { |
| | 108 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 109 | | } |
| | 110 | | if (properties == null) |
| | 111 | | { |
| | 112 | | throw new System.ArgumentNullException(nameof(properties)); |
| | 113 | | } |
| | 114 | | if (version == null) |
| | 115 | | { |
| | 116 | | throw new System.ArgumentNullException(nameof(version)); |
| | 117 | | } |
| | 118 | |
|
| | 119 | | // Create the request |
| | 120 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 121 | | Azure.Core.Request _request = _message.Request; |
| | 122 | |
|
| | 123 | | // Set the endpoint |
| | 124 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 125 | | _request.Uri.Reset(resourceUri); |
| | 126 | | _request.Uri.AppendQuery("restype", "service", escapeValue: false); |
| | 127 | | _request.Uri.AppendQuery("comp", "properties", escapeValue: false); |
| | 128 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 129 | |
|
| | 130 | | // Add request headers |
| | 131 | | _request.Headers.SetValue("x-ms-version", version); |
| | 132 | |
|
| | 133 | | // Create the body |
| | 134 | | System.Xml.Linq.XElement _body = Azure.Storage.Files.Shares.Models.ShareServiceProperties.ToXml(properti |
| | 135 | | string _text = _body.ToString(System.Xml.Linq.SaveOptions.DisableFormatting); |
| | 136 | | _request.Headers.SetValue("Content-Type", "application/xml"); |
| | 137 | | _request.Headers.SetValue("Content-Length", _text.Length.ToString(System.Globalization.CultureInfo.Invar |
| | 138 | | _request.Content = Azure.Core.RequestContent.Create(System.Text.Encoding.UTF8.GetBytes(_text)); |
| | 139 | |
|
| | 140 | | return _message; |
| | 141 | | } |
| | 142 | |
|
| | 143 | | /// <summary> |
| | 144 | | /// Create the Service.SetPropertiesAsync response or throw a failure exception. |
| | 145 | | /// </summary> |
| | 146 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 147 | | /// <param name="response">The raw Response.</param> |
| | 148 | | /// <returns>The Service.SetPropertiesAsync Azure.Response.</returns> |
| | 149 | | internal static Azure.Response SetPropertiesAsync_CreateResponse( |
| | 150 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 151 | | Azure.Response response) |
| | 152 | | { |
| | 153 | | // Process the response |
| | 154 | | switch (response.Status) |
| | 155 | | { |
| | 156 | | case 202: |
| | 157 | | { |
| | 158 | | return response; |
| | 159 | | } |
| | 160 | | default: |
| | 161 | | { |
| | 162 | | // Create the result |
| | 163 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 164 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 165 | |
|
| | 166 | | throw _value.CreateException(clientDiagnostics, response); |
| | 167 | | } |
| | 168 | | } |
| | 169 | | } |
| | 170 | | #endregion Service.SetPropertiesAsync |
| | 171 | |
|
| | 172 | | #region Service.GetPropertiesAsync |
| | 173 | | /// <summary> |
| | 174 | | /// Gets the properties of a storage account's File service, including properties for Storage Analytics metr |
| | 175 | | /// </summary> |
| | 176 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 177 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 178 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 179 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 180 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 181 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 182 | | /// <param name="operationName">Operation name.</param> |
| | 183 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 184 | | /// <returns>Storage service properties.</returns> |
| | 185 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareS |
| | 186 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 187 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 188 | | System.Uri resourceUri, |
| | 189 | | string version, |
| | 190 | | int? timeout = default, |
| | 191 | | bool async = true, |
| | 192 | | string operationName = "ServiceClient.GetProperties", |
| | 193 | | System.Threading.CancellationToken cancellationToken = default) |
| | 194 | | { |
| | 195 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 196 | | try |
| | 197 | | { |
| | 198 | | _scope.AddAttribute("url", resourceUri); |
| | 199 | | _scope.Start(); |
| | 200 | | using (Azure.Core.HttpMessage _message = GetPropertiesAsync_CreateMessage( |
| | 201 | | pipeline, |
| | 202 | | resourceUri, |
| | 203 | | version, |
| | 204 | | timeout)) |
| | 205 | | { |
| | 206 | | if (async) |
| | 207 | | { |
| | 208 | | // Send the request asynchronously if we're being called via an async path |
| | 209 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 210 | | } |
| | 211 | | else |
| | 212 | | { |
| | 213 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 214 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 215 | | pipeline.Send(_message, cancellationToken); |
| | 216 | | } |
| | 217 | | Azure.Response _response = _message.Response; |
| | 218 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 219 | | return GetPropertiesAsync_CreateResponse(clientDiagnostics, _response); |
| | 220 | | } |
| | 221 | | } |
| | 222 | | catch (System.Exception ex) |
| | 223 | | { |
| | 224 | | _scope.Failed(ex); |
| | 225 | | throw; |
| | 226 | | } |
| | 227 | | finally |
| | 228 | | { |
| | 229 | | _scope.Dispose(); |
| | 230 | | } |
| | 231 | | } |
| | 232 | |
|
| | 233 | | /// <summary> |
| | 234 | | /// Create the Service.GetPropertiesAsync request. |
| | 235 | | /// </summary> |
| | 236 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 237 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 238 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 239 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 240 | | /// <returns>The Service.GetPropertiesAsync Message.</returns> |
| | 241 | | internal static Azure.Core.HttpMessage GetPropertiesAsync_CreateMessage( |
| | 242 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 243 | | System.Uri resourceUri, |
| | 244 | | string version, |
| | 245 | | int? timeout = default) |
| | 246 | | { |
| | 247 | | // Validation |
| | 248 | | if (resourceUri == null) |
| | 249 | | { |
| | 250 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 251 | | } |
| | 252 | | if (version == null) |
| | 253 | | { |
| | 254 | | throw new System.ArgumentNullException(nameof(version)); |
| | 255 | | } |
| | 256 | |
|
| | 257 | | // Create the request |
| | 258 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 259 | | Azure.Core.Request _request = _message.Request; |
| | 260 | |
|
| | 261 | | // Set the endpoint |
| | 262 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 263 | | _request.Uri.Reset(resourceUri); |
| | 264 | | _request.Uri.AppendQuery("restype", "service", escapeValue: false); |
| | 265 | | _request.Uri.AppendQuery("comp", "properties", escapeValue: false); |
| | 266 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 267 | |
|
| | 268 | | // Add request headers |
| | 269 | | _request.Headers.SetValue("x-ms-version", version); |
| | 270 | |
|
| | 271 | | return _message; |
| | 272 | | } |
| | 273 | |
|
| | 274 | | /// <summary> |
| | 275 | | /// Create the Service.GetPropertiesAsync response or throw a failure exception. |
| | 276 | | /// </summary> |
| | 277 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 278 | | /// <param name="response">The raw Response.</param> |
| | 279 | | /// <returns>The Service.GetPropertiesAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareServicePro |
| | 280 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareServiceProperties> GetPropertiesAsync_ |
| | 281 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 282 | | Azure.Response response) |
| | 283 | | { |
| | 284 | | // Process the response |
| | 285 | | switch (response.Status) |
| | 286 | | { |
| | 287 | | case 200: |
| | 288 | | { |
| | 289 | | // Create the result |
| | 290 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 291 | | Azure.Storage.Files.Shares.Models.ShareServiceProperties _value = Azure.Storage.Files.Shares.Mod |
| | 292 | |
|
| | 293 | | // Create the response |
| | 294 | | return Response.FromValue(_value, response); |
| | 295 | | } |
| | 296 | | case 304: |
| | 297 | | { |
| | 298 | | return new Azure.NoBodyResponse<Azure.Storage.Files.Shares.Models.ShareServiceProperties>(respon |
| | 299 | | } |
| | 300 | | default: |
| | 301 | | { |
| | 302 | | // Create the result |
| | 303 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 304 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 305 | |
|
| | 306 | | throw _value.CreateException(clientDiagnostics, response); |
| | 307 | | } |
| | 308 | | } |
| | 309 | | } |
| | 310 | | #endregion Service.GetPropertiesAsync |
| | 311 | |
|
| | 312 | | #region Service.ListSharesSegmentAsync |
| | 313 | | /// <summary> |
| | 314 | | /// The List Shares Segment operation returns a list of the shares and share snapshots under the specified a |
| | 315 | | /// </summary> |
| | 316 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 317 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 318 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 319 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 320 | | /// <param name="prefix">Filters the results to return only entries whose name begins with the specified pre |
| | 321 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 322 | | /// <param name="maxresults">Specifies the maximum number of entries to return. If the request does not spec |
| | 323 | | /// <param name="include">Include this parameter to specify one or more datasets to include in the response. |
| | 324 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 325 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 326 | | /// <param name="operationName">Operation name.</param> |
| | 327 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 328 | | /// <returns>An enumeration of shares.</returns> |
| | 329 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.Shares |
| | 330 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 331 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 332 | | System.Uri resourceUri, |
| | 333 | | string version, |
| | 334 | | string prefix = default, |
| | 335 | | string marker = default, |
| | 336 | | int? maxresults = default, |
| | 337 | | System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.ListSharesIncludeType> include |
| | 338 | | int? timeout = default, |
| | 339 | | bool async = true, |
| | 340 | | string operationName = "ServiceClient.ListSharesSegment", |
| | 341 | | System.Threading.CancellationToken cancellationToken = default) |
| | 342 | | { |
| | 343 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 344 | | try |
| | 345 | | { |
| | 346 | | _scope.AddAttribute("url", resourceUri); |
| | 347 | | _scope.Start(); |
| | 348 | | using (Azure.Core.HttpMessage _message = ListSharesSegmentAsync_CreateMessage( |
| | 349 | | pipeline, |
| | 350 | | resourceUri, |
| | 351 | | version, |
| | 352 | | prefix, |
| | 353 | | marker, |
| | 354 | | maxresults, |
| | 355 | | include, |
| | 356 | | timeout)) |
| | 357 | | { |
| | 358 | | if (async) |
| | 359 | | { |
| | 360 | | // Send the request asynchronously if we're being called via an async path |
| | 361 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 362 | | } |
| | 363 | | else |
| | 364 | | { |
| | 365 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 366 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 367 | | pipeline.Send(_message, cancellationToken); |
| | 368 | | } |
| | 369 | | Azure.Response _response = _message.Response; |
| | 370 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 371 | | return ListSharesSegmentAsync_CreateResponse(clientDiagnostics, _response); |
| | 372 | | } |
| | 373 | | } |
| | 374 | | catch (System.Exception ex) |
| | 375 | | { |
| | 376 | | _scope.Failed(ex); |
| | 377 | | throw; |
| | 378 | | } |
| | 379 | | finally |
| | 380 | | { |
| | 381 | | _scope.Dispose(); |
| | 382 | | } |
| | 383 | | } |
| | 384 | |
|
| | 385 | | /// <summary> |
| | 386 | | /// Create the Service.ListSharesSegmentAsync request. |
| | 387 | | /// </summary> |
| | 388 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 389 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 390 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 391 | | /// <param name="prefix">Filters the results to return only entries whose name begins with the specified pre |
| | 392 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 393 | | /// <param name="maxresults">Specifies the maximum number of entries to return. If the request does not spec |
| | 394 | | /// <param name="include">Include this parameter to specify one or more datasets to include in the response. |
| | 395 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 396 | | /// <returns>The Service.ListSharesSegmentAsync Message.</returns> |
| | 397 | | internal static Azure.Core.HttpMessage ListSharesSegmentAsync_CreateMessage( |
| | 398 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 399 | | System.Uri resourceUri, |
| | 400 | | string version, |
| | 401 | | string prefix = default, |
| | 402 | | string marker = default, |
| | 403 | | int? maxresults = default, |
| | 404 | | System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.ListSharesIncludeType> include |
| | 405 | | int? timeout = default) |
| | 406 | | { |
| | 407 | | // Validation |
| | 408 | | if (resourceUri == null) |
| | 409 | | { |
| | 410 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 411 | | } |
| | 412 | | if (version == null) |
| | 413 | | { |
| | 414 | | throw new System.ArgumentNullException(nameof(version)); |
| | 415 | | } |
| | 416 | |
|
| | 417 | | // Create the request |
| | 418 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 419 | | Azure.Core.Request _request = _message.Request; |
| | 420 | |
|
| | 421 | | // Set the endpoint |
| | 422 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 423 | | _request.Uri.Reset(resourceUri); |
| | 424 | | _request.Uri.AppendQuery("comp", "list", escapeValue: false); |
| | 425 | | if (prefix != null) { _request.Uri.AppendQuery("prefix", prefix); } |
| | 426 | | if (marker != null) { _request.Uri.AppendQuery("marker", marker); } |
| | 427 | | if (maxresults != null) { _request.Uri.AppendQuery("maxresults", maxresults.Value.ToString(System.Global |
| | 428 | | if (include != null) { _request.Uri.AppendQuery("include", string.Join(",", System.Linq.Enumerable.Selec |
| | 429 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 430 | |
|
| | 431 | | // Add request headers |
| | 432 | | _request.Headers.SetValue("x-ms-version", version); |
| | 433 | |
|
| | 434 | | return _message; |
| | 435 | | } |
| | 436 | |
|
| | 437 | | /// <summary> |
| | 438 | | /// Create the Service.ListSharesSegmentAsync response or throw a failure exception. |
| | 439 | | /// </summary> |
| | 440 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 441 | | /// <param name="response">The raw Response.</param> |
| | 442 | | /// <returns>The Service.ListSharesSegmentAsync Azure.Response{Azure.Storage.Files.Shares.Models.SharesSegme |
| | 443 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.SharesSegment> ListSharesSegmentAsync_Creat |
| | 444 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 445 | | Azure.Response response) |
| | 446 | | { |
| | 447 | | // Process the response |
| | 448 | | switch (response.Status) |
| | 449 | | { |
| | 450 | | case 200: |
| | 451 | | { |
| | 452 | | // Create the result |
| | 453 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 454 | | Azure.Storage.Files.Shares.Models.SharesSegment _value = Azure.Storage.Files.Shares.Models.Share |
| | 455 | |
|
| | 456 | | // Create the response |
| | 457 | | return Response.FromValue(_value, response); |
| | 458 | | } |
| | 459 | | case 304: |
| | 460 | | { |
| | 461 | | return new Azure.NoBodyResponse<Azure.Storage.Files.Shares.Models.SharesSegment>(response); |
| | 462 | | } |
| | 463 | | default: |
| | 464 | | { |
| | 465 | | // Create the result |
| | 466 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 467 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 468 | |
|
| | 469 | | throw _value.CreateException(clientDiagnostics, response); |
| | 470 | | } |
| | 471 | | } |
| | 472 | | } |
| | 473 | | #endregion Service.ListSharesSegmentAsync |
| | 474 | | } |
| | 475 | | #endregion Service operations |
| | 476 | |
|
| | 477 | | #region Share operations |
| | 478 | | /// <summary> |
| | 479 | | /// Share operations for Azure File Storage |
| | 480 | | /// </summary> |
| | 481 | | public static partial class Share |
| | 482 | | { |
| | 483 | | #region Share.CreateAsync |
| | 484 | | /// <summary> |
| | 485 | | /// Creates a new share under the specified account. If the share with the same name already exists, the ope |
| | 486 | | /// </summary> |
| | 487 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 488 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 489 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 490 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 491 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 492 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 493 | | /// <param name="quotaInGB">Specifies the maximum size of the share, in gigabytes.</param> |
| | 494 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 495 | | /// <param name="operationName">Operation name.</param> |
| | 496 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 497 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.ShareInfo}</returns> |
| | 498 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareI |
| | 499 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 500 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 501 | | System.Uri resourceUri, |
| | 502 | | string version, |
| | 503 | | int? timeout = default, |
| | 504 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 505 | | int? quotaInGB = default, |
| | 506 | | bool async = true, |
| | 507 | | string operationName = "ShareClient.Create", |
| | 508 | | System.Threading.CancellationToken cancellationToken = default) |
| | 509 | | { |
| | 510 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 511 | | try |
| | 512 | | { |
| | 513 | | _scope.AddAttribute("url", resourceUri); |
| | 514 | | _scope.Start(); |
| | 515 | | using (Azure.Core.HttpMessage _message = CreateAsync_CreateMessage( |
| | 516 | | pipeline, |
| | 517 | | resourceUri, |
| | 518 | | version, |
| | 519 | | timeout, |
| | 520 | | metadata, |
| | 521 | | quotaInGB)) |
| | 522 | | { |
| | 523 | | if (async) |
| | 524 | | { |
| | 525 | | // Send the request asynchronously if we're being called via an async path |
| | 526 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 527 | | } |
| | 528 | | else |
| | 529 | | { |
| | 530 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 531 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 532 | | pipeline.Send(_message, cancellationToken); |
| | 533 | | } |
| | 534 | | Azure.Response _response = _message.Response; |
| | 535 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 536 | | return CreateAsync_CreateResponse(clientDiagnostics, _response); |
| | 537 | | } |
| | 538 | | } |
| | 539 | | catch (System.Exception ex) |
| | 540 | | { |
| | 541 | | _scope.Failed(ex); |
| | 542 | | throw; |
| | 543 | | } |
| | 544 | | finally |
| | 545 | | { |
| | 546 | | _scope.Dispose(); |
| | 547 | | } |
| | 548 | | } |
| | 549 | |
|
| | 550 | | /// <summary> |
| | 551 | | /// Create the Share.CreateAsync request. |
| | 552 | | /// </summary> |
| | 553 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 554 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 555 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 556 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 557 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 558 | | /// <param name="quotaInGB">Specifies the maximum size of the share, in gigabytes.</param> |
| | 559 | | /// <returns>The Share.CreateAsync Message.</returns> |
| | 560 | | internal static Azure.Core.HttpMessage CreateAsync_CreateMessage( |
| | 561 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 562 | | System.Uri resourceUri, |
| | 563 | | string version, |
| | 564 | | int? timeout = default, |
| | 565 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 566 | | int? quotaInGB = default) |
| | 567 | | { |
| | 568 | | // Validation |
| | 569 | | if (resourceUri == null) |
| | 570 | | { |
| | 571 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 572 | | } |
| | 573 | | if (version == null) |
| | 574 | | { |
| | 575 | | throw new System.ArgumentNullException(nameof(version)); |
| | 576 | | } |
| | 577 | |
|
| | 578 | | // Create the request |
| | 579 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 580 | | Azure.Core.Request _request = _message.Request; |
| | 581 | |
|
| | 582 | | // Set the endpoint |
| | 583 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 584 | | _request.Uri.Reset(resourceUri); |
| | 585 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 586 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 587 | |
|
| | 588 | | // Add request headers |
| | 589 | | _request.Headers.SetValue("x-ms-version", version); |
| | 590 | | if (metadata != null) { |
| | 591 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 592 | | { |
| | 593 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 594 | | } |
| | 595 | | } |
| | 596 | | if (quotaInGB != null) { _request.Headers.SetValue("x-ms-share-quota", quotaInGB.Value.ToString(System.G |
| | 597 | |
|
| | 598 | | return _message; |
| | 599 | | } |
| | 600 | |
|
| | 601 | | /// <summary> |
| | 602 | | /// Create the Share.CreateAsync 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 Share.CreateAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareInfo}.</returns> |
| | 607 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareInfo> CreateAsync_CreateResponse( |
| | 608 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 609 | | Azure.Response response) |
| | 610 | | { |
| | 611 | | // Process the response |
| | 612 | | switch (response.Status) |
| | 613 | | { |
| | 614 | | case 201: |
| | 615 | | { |
| | 616 | | // Create the result |
| | 617 | | Azure.Storage.Files.Shares.Models.ShareInfo _value = new Azure.Storage.Files.Shares.Models.Share |
| | 618 | |
|
| | 619 | | // Get response headers |
| | 620 | | string _header; |
| | 621 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 622 | | { |
| | 623 | | _value.ETag = new Azure.ETag(_header); |
| | 624 | | } |
| | 625 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 626 | | { |
| | 627 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 628 | | } |
| | 629 | |
|
| | 630 | | // Create the response |
| | 631 | | return Response.FromValue(_value, response); |
| | 632 | | } |
| | 633 | | default: |
| | 634 | | { |
| | 635 | | // Create the result |
| | 636 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 637 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 638 | |
|
| | 639 | | throw _value.CreateException(clientDiagnostics, response); |
| | 640 | | } |
| | 641 | | } |
| | 642 | | } |
| | 643 | | #endregion Share.CreateAsync |
| | 644 | |
|
| | 645 | | #region Share.GetPropertiesAsync |
| | 646 | | /// <summary> |
| | 647 | | /// Returns all user-defined metadata and system properties for the specified share or share snapshot. The d |
| | 648 | | /// </summary> |
| | 649 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 650 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 651 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 652 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 653 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 654 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 655 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 656 | | /// <param name="operationName">Operation name.</param> |
| | 657 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 658 | | /// <returns>Properties of a share.</returns> |
| | 659 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareP |
| | 660 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 661 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 662 | | System.Uri resourceUri, |
| | 663 | | string version, |
| | 664 | | string sharesnapshot = default, |
| | 665 | | int? timeout = default, |
| | 666 | | bool async = true, |
| | 667 | | string operationName = "ShareClient.GetProperties", |
| | 668 | | System.Threading.CancellationToken cancellationToken = default) |
| | 669 | | { |
| | 670 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 671 | | try |
| | 672 | | { |
| | 673 | | _scope.AddAttribute("url", resourceUri); |
| | 674 | | _scope.Start(); |
| | 675 | | using (Azure.Core.HttpMessage _message = GetPropertiesAsync_CreateMessage( |
| | 676 | | pipeline, |
| | 677 | | resourceUri, |
| | 678 | | version, |
| | 679 | | sharesnapshot, |
| | 680 | | timeout)) |
| | 681 | | { |
| | 682 | | if (async) |
| | 683 | | { |
| | 684 | | // Send the request asynchronously if we're being called via an async path |
| | 685 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 686 | | } |
| | 687 | | else |
| | 688 | | { |
| | 689 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 690 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 691 | | pipeline.Send(_message, cancellationToken); |
| | 692 | | } |
| | 693 | | Azure.Response _response = _message.Response; |
| | 694 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 695 | | return GetPropertiesAsync_CreateResponse(clientDiagnostics, _response); |
| | 696 | | } |
| | 697 | | } |
| | 698 | | catch (System.Exception ex) |
| | 699 | | { |
| | 700 | | _scope.Failed(ex); |
| | 701 | | throw; |
| | 702 | | } |
| | 703 | | finally |
| | 704 | | { |
| | 705 | | _scope.Dispose(); |
| | 706 | | } |
| | 707 | | } |
| | 708 | |
|
| | 709 | | /// <summary> |
| | 710 | | /// Create the Share.GetPropertiesAsync request. |
| | 711 | | /// </summary> |
| | 712 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 713 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 714 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 715 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 716 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 717 | | /// <returns>The Share.GetPropertiesAsync Message.</returns> |
| | 718 | | internal static Azure.Core.HttpMessage GetPropertiesAsync_CreateMessage( |
| | 719 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 720 | | System.Uri resourceUri, |
| | 721 | | string version, |
| | 722 | | string sharesnapshot = default, |
| | 723 | | int? timeout = default) |
| | 724 | | { |
| | 725 | | // Validation |
| | 726 | | if (resourceUri == null) |
| | 727 | | { |
| | 728 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 729 | | } |
| | 730 | | if (version == null) |
| | 731 | | { |
| | 732 | | throw new System.ArgumentNullException(nameof(version)); |
| | 733 | | } |
| | 734 | |
|
| | 735 | | // Create the request |
| | 736 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 737 | | Azure.Core.Request _request = _message.Request; |
| | 738 | |
|
| | 739 | | // Set the endpoint |
| | 740 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 741 | | _request.Uri.Reset(resourceUri); |
| | 742 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 743 | | if (sharesnapshot != null) { _request.Uri.AppendQuery("sharesnapshot", sharesnapshot); } |
| | 744 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 745 | |
|
| | 746 | | // Add request headers |
| | 747 | | _request.Headers.SetValue("x-ms-version", version); |
| | 748 | |
|
| | 749 | | return _message; |
| | 750 | | } |
| | 751 | |
|
| | 752 | | /// <summary> |
| | 753 | | /// Create the Share.GetPropertiesAsync response or throw a failure exception. |
| | 754 | | /// </summary> |
| | 755 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 756 | | /// <param name="response">The raw Response.</param> |
| | 757 | | /// <returns>The Share.GetPropertiesAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareProperties}. |
| | 758 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareProperties> GetPropertiesAsync_CreateR |
| | 759 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 760 | | Azure.Response response) |
| | 761 | | { |
| | 762 | | // Process the response |
| | 763 | | switch (response.Status) |
| | 764 | | { |
| | 765 | | case 200: |
| | 766 | | { |
| | 767 | | // Create the result |
| | 768 | | Azure.Storage.Files.Shares.Models.ShareProperties _value = new Azure.Storage.Files.Shares.Models |
| | 769 | |
|
| | 770 | | // Get response headers |
| | 771 | | string _header; |
| | 772 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompare |
| | 773 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 774 | | { |
| | 775 | | if (_headerPair.Name.StartsWith("x-ms-meta-", System.StringComparison.InvariantCulture)) |
| | 776 | | { |
| | 777 | | _value.Metadata[_headerPair.Name.Substring(10)] = _headerPair.Value; |
| | 778 | | } |
| | 779 | | } |
| | 780 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 781 | | { |
| | 782 | | _value.ETag = new Azure.ETag(_header); |
| | 783 | | } |
| | 784 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 785 | | { |
| | 786 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 787 | | } |
| | 788 | | if (response.Headers.TryGetValue("x-ms-share-quota", out _header)) |
| | 789 | | { |
| | 790 | | _value.QuotaInGB = int.Parse(_header, System.Globalization.CultureInfo.InvariantCulture); |
| | 791 | | } |
| | 792 | | if (response.Headers.TryGetValue("x-ms-share-provisioned-iops", out _header)) |
| | 793 | | { |
| | 794 | | _value.ProvisionedIops = int.Parse(_header, System.Globalization.CultureInfo.InvariantCultur |
| | 795 | | } |
| | 796 | | if (response.Headers.TryGetValue("x-ms-share-provisioned-ingress-mbps", out _header)) |
| | 797 | | { |
| | 798 | | _value.ProvisionedIngressMBps = int.Parse(_header, System.Globalization.CultureInfo.Invarian |
| | 799 | | } |
| | 800 | | if (response.Headers.TryGetValue("x-ms-share-provisioned-egress-mbps", out _header)) |
| | 801 | | { |
| | 802 | | _value.ProvisionedEgressMBps = int.Parse(_header, System.Globalization.CultureInfo.Invariant |
| | 803 | | } |
| | 804 | | if (response.Headers.TryGetValue("x-ms-share-next-allowed-quota-downgrade-time", out _header)) |
| | 805 | | { |
| | 806 | | _value.NextAllowedQuotaDowngradeTime = System.DateTimeOffset.Parse(_header, System.Globaliza |
| | 807 | | } |
| | 808 | |
|
| | 809 | | // Create the response |
| | 810 | | return Response.FromValue(_value, response); |
| | 811 | | } |
| | 812 | | case 304: |
| | 813 | | { |
| | 814 | | return new Azure.NoBodyResponse<Azure.Storage.Files.Shares.Models.ShareProperties>(response); |
| | 815 | | } |
| | 816 | | default: |
| | 817 | | { |
| | 818 | | // Create the result |
| | 819 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 820 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 821 | |
|
| | 822 | | throw _value.CreateException(clientDiagnostics, response); |
| | 823 | | } |
| | 824 | | } |
| | 825 | | } |
| | 826 | | #endregion Share.GetPropertiesAsync |
| | 827 | |
|
| | 828 | | #region Share.DeleteAsync |
| | 829 | | /// <summary> |
| | 830 | | /// Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any |
| | 831 | | /// </summary> |
| | 832 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 833 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 834 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 835 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 836 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 837 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 838 | | /// <param name="deleteSnapshots">Specifies the option include to delete the base share and all of its snaps |
| | 839 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 840 | | /// <param name="operationName">Operation name.</param> |
| | 841 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 842 | | /// <returns>Azure.Response</returns> |
| | 843 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> DeleteAsync( |
| | 844 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 845 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 846 | | System.Uri resourceUri, |
| | 847 | | string version, |
| | 848 | | string sharesnapshot = default, |
| | 849 | | int? timeout = default, |
| | 850 | | Azure.Storage.Files.Shares.Models.DeleteSnapshotsOptionType? deleteSnapshots = default, |
| | 851 | | bool async = true, |
| | 852 | | string operationName = "ShareClient.Delete", |
| | 853 | | System.Threading.CancellationToken cancellationToken = default) |
| | 854 | | { |
| | 855 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 856 | | try |
| | 857 | | { |
| | 858 | | _scope.AddAttribute("url", resourceUri); |
| | 859 | | _scope.Start(); |
| | 860 | | using (Azure.Core.HttpMessage _message = DeleteAsync_CreateMessage( |
| | 861 | | pipeline, |
| | 862 | | resourceUri, |
| | 863 | | version, |
| | 864 | | sharesnapshot, |
| | 865 | | timeout, |
| | 866 | | deleteSnapshots)) |
| | 867 | | { |
| | 868 | | if (async) |
| | 869 | | { |
| | 870 | | // Send the request asynchronously if we're being called via an async path |
| | 871 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 872 | | } |
| | 873 | | else |
| | 874 | | { |
| | 875 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 876 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 877 | | pipeline.Send(_message, cancellationToken); |
| | 878 | | } |
| | 879 | | Azure.Response _response = _message.Response; |
| | 880 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 881 | | return DeleteAsync_CreateResponse(clientDiagnostics, _response); |
| | 882 | | } |
| | 883 | | } |
| | 884 | | catch (System.Exception ex) |
| | 885 | | { |
| | 886 | | _scope.Failed(ex); |
| | 887 | | throw; |
| | 888 | | } |
| | 889 | | finally |
| | 890 | | { |
| | 891 | | _scope.Dispose(); |
| | 892 | | } |
| | 893 | | } |
| | 894 | |
|
| | 895 | | /// <summary> |
| | 896 | | /// Create the Share.DeleteAsync request. |
| | 897 | | /// </summary> |
| | 898 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 899 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 900 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 901 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 902 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 903 | | /// <param name="deleteSnapshots">Specifies the option include to delete the base share and all of its snaps |
| | 904 | | /// <returns>The Share.DeleteAsync Message.</returns> |
| | 905 | | internal static Azure.Core.HttpMessage DeleteAsync_CreateMessage( |
| | 906 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 907 | | System.Uri resourceUri, |
| | 908 | | string version, |
| | 909 | | string sharesnapshot = default, |
| | 910 | | int? timeout = default, |
| | 911 | | Azure.Storage.Files.Shares.Models.DeleteSnapshotsOptionType? deleteSnapshots = default) |
| | 912 | | { |
| | 913 | | // Validation |
| | 914 | | if (resourceUri == null) |
| | 915 | | { |
| | 916 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 917 | | } |
| | 918 | | if (version == null) |
| | 919 | | { |
| | 920 | | throw new System.ArgumentNullException(nameof(version)); |
| | 921 | | } |
| | 922 | |
|
| | 923 | | // Create the request |
| | 924 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 925 | | Azure.Core.Request _request = _message.Request; |
| | 926 | |
|
| | 927 | | // Set the endpoint |
| | 928 | | _request.Method = Azure.Core.RequestMethod.Delete; |
| | 929 | | _request.Uri.Reset(resourceUri); |
| | 930 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 931 | | if (sharesnapshot != null) { _request.Uri.AppendQuery("sharesnapshot", sharesnapshot); } |
| | 932 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 933 | |
|
| | 934 | | // Add request headers |
| | 935 | | _request.Headers.SetValue("x-ms-version", version); |
| | 936 | | if (deleteSnapshots != null) { _request.Headers.SetValue("x-ms-delete-snapshots", Azure.Storage.Files.Sh |
| | 937 | |
|
| | 938 | | return _message; |
| | 939 | | } |
| | 940 | |
|
| | 941 | | /// <summary> |
| | 942 | | /// Create the Share.DeleteAsync response or throw a failure exception. |
| | 943 | | /// </summary> |
| | 944 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 945 | | /// <param name="response">The raw Response.</param> |
| | 946 | | /// <returns>The Share.DeleteAsync Azure.Response.</returns> |
| | 947 | | internal static Azure.Response DeleteAsync_CreateResponse( |
| | 948 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 949 | | Azure.Response response) |
| | 950 | | { |
| | 951 | | // Process the response |
| | 952 | | switch (response.Status) |
| | 953 | | { |
| | 954 | | case 202: |
| | 955 | | { |
| | 956 | | return response; |
| | 957 | | } |
| | 958 | | default: |
| | 959 | | { |
| | 960 | | // Create the result |
| | 961 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 962 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 963 | |
|
| | 964 | | throw _value.CreateException(clientDiagnostics, response); |
| | 965 | | } |
| | 966 | | } |
| | 967 | | } |
| | 968 | | #endregion Share.DeleteAsync |
| | 969 | |
|
| | 970 | | #region Share.CreateSnapshotAsync |
| | 971 | | /// <summary> |
| | 972 | | /// Creates a read-only snapshot of a share. |
| | 973 | | /// </summary> |
| | 974 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 975 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 976 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 977 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 978 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 979 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 980 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 981 | | /// <param name="operationName">Operation name.</param> |
| | 982 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 983 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.ShareSnapshotInfo}</returns> |
| | 984 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareS |
| | 985 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 986 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 987 | | System.Uri resourceUri, |
| | 988 | | string version, |
| | 989 | | int? timeout = default, |
| | 990 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 991 | | bool async = true, |
| | 992 | | string operationName = "ShareClient.CreateSnapshot", |
| | 993 | | System.Threading.CancellationToken cancellationToken = default) |
| | 994 | | { |
| | 995 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 996 | | try |
| | 997 | | { |
| | 998 | | _scope.AddAttribute("url", resourceUri); |
| | 999 | | _scope.Start(); |
| | 1000 | | using (Azure.Core.HttpMessage _message = CreateSnapshotAsync_CreateMessage( |
| | 1001 | | pipeline, |
| | 1002 | | resourceUri, |
| | 1003 | | version, |
| | 1004 | | timeout, |
| | 1005 | | metadata)) |
| | 1006 | | { |
| | 1007 | | if (async) |
| | 1008 | | { |
| | 1009 | | // Send the request asynchronously if we're being called via an async path |
| | 1010 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1011 | | } |
| | 1012 | | else |
| | 1013 | | { |
| | 1014 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1015 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1016 | | pipeline.Send(_message, cancellationToken); |
| | 1017 | | } |
| | 1018 | | Azure.Response _response = _message.Response; |
| | 1019 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1020 | | return CreateSnapshotAsync_CreateResponse(clientDiagnostics, _response); |
| | 1021 | | } |
| | 1022 | | } |
| | 1023 | | catch (System.Exception ex) |
| | 1024 | | { |
| | 1025 | | _scope.Failed(ex); |
| | 1026 | | throw; |
| | 1027 | | } |
| | 1028 | | finally |
| | 1029 | | { |
| | 1030 | | _scope.Dispose(); |
| | 1031 | | } |
| | 1032 | | } |
| | 1033 | |
|
| | 1034 | | /// <summary> |
| | 1035 | | /// Create the Share.CreateSnapshotAsync request. |
| | 1036 | | /// </summary> |
| | 1037 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1038 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1039 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1040 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1041 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 1042 | | /// <returns>The Share.CreateSnapshotAsync Message.</returns> |
| | 1043 | | internal static Azure.Core.HttpMessage CreateSnapshotAsync_CreateMessage( |
| | 1044 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1045 | | System.Uri resourceUri, |
| | 1046 | | string version, |
| | 1047 | | int? timeout = default, |
| | 1048 | | System.Collections.Generic.IDictionary<string, string> metadata = default) |
| | 1049 | | { |
| | 1050 | | // Validation |
| | 1051 | | if (resourceUri == null) |
| | 1052 | | { |
| | 1053 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1054 | | } |
| | 1055 | | if (version == null) |
| | 1056 | | { |
| | 1057 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1058 | | } |
| | 1059 | |
|
| | 1060 | | // Create the request |
| | 1061 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1062 | | Azure.Core.Request _request = _message.Request; |
| | 1063 | |
|
| | 1064 | | // Set the endpoint |
| | 1065 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 1066 | | _request.Uri.Reset(resourceUri); |
| | 1067 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 1068 | | _request.Uri.AppendQuery("comp", "snapshot", escapeValue: false); |
| | 1069 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1070 | |
|
| | 1071 | | // Add request headers |
| | 1072 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1073 | | if (metadata != null) { |
| | 1074 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 1075 | | { |
| | 1076 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 1077 | | } |
| | 1078 | | } |
| | 1079 | |
|
| | 1080 | | return _message; |
| | 1081 | | } |
| | 1082 | |
|
| | 1083 | | /// <summary> |
| | 1084 | | /// Create the Share.CreateSnapshotAsync response or throw a failure exception. |
| | 1085 | | /// </summary> |
| | 1086 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1087 | | /// <param name="response">The raw Response.</param> |
| | 1088 | | /// <returns>The Share.CreateSnapshotAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareSnapshotInf |
| | 1089 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareSnapshotInfo> CreateSnapshotAsync_Crea |
| | 1090 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1091 | | Azure.Response response) |
| | 1092 | | { |
| | 1093 | | // Process the response |
| | 1094 | | switch (response.Status) |
| | 1095 | | { |
| | 1096 | | case 201: |
| | 1097 | | { |
| | 1098 | | // Create the result |
| | 1099 | | Azure.Storage.Files.Shares.Models.ShareSnapshotInfo _value = new Azure.Storage.Files.Shares.Mode |
| | 1100 | |
|
| | 1101 | | // Get response headers |
| | 1102 | | string _header; |
| | 1103 | | if (response.Headers.TryGetValue("x-ms-snapshot", out _header)) |
| | 1104 | | { |
| | 1105 | | _value.Snapshot = _header; |
| | 1106 | | } |
| | 1107 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 1108 | | { |
| | 1109 | | _value.ETag = new Azure.ETag(_header); |
| | 1110 | | } |
| | 1111 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 1112 | | { |
| | 1113 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 1114 | | } |
| | 1115 | |
|
| | 1116 | | // Create the response |
| | 1117 | | return Response.FromValue(_value, response); |
| | 1118 | | } |
| | 1119 | | default: |
| | 1120 | | { |
| | 1121 | | // Create the result |
| | 1122 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1123 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 1124 | |
|
| | 1125 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1126 | | } |
| | 1127 | | } |
| | 1128 | | } |
| | 1129 | | #endregion Share.CreateSnapshotAsync |
| | 1130 | |
|
| | 1131 | | #region Share.CreatePermissionAsync |
| | 1132 | | /// <summary> |
| | 1133 | | /// Create a permission (a security descriptor). |
| | 1134 | | /// </summary> |
| | 1135 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 1136 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1137 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1138 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1139 | | /// <param name="sharePermissionJson">A permission (a security descriptor) at the share level.</param> |
| | 1140 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1141 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 1142 | | /// <param name="operationName">Operation name.</param> |
| | 1143 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 1144 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.PermissionInfo}</returns> |
| | 1145 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.Permis |
| | 1146 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1147 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1148 | | System.Uri resourceUri, |
| | 1149 | | string version, |
| | 1150 | | string sharePermissionJson, |
| | 1151 | | int? timeout = default, |
| | 1152 | | bool async = true, |
| | 1153 | | string operationName = "ShareClient.CreatePermission", |
| | 1154 | | System.Threading.CancellationToken cancellationToken = default) |
| | 1155 | | { |
| | 1156 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 1157 | | try |
| | 1158 | | { |
| | 1159 | | _scope.AddAttribute("url", resourceUri); |
| | 1160 | | _scope.Start(); |
| | 1161 | | using (Azure.Core.HttpMessage _message = CreatePermissionAsync_CreateMessage( |
| | 1162 | | pipeline, |
| | 1163 | | resourceUri, |
| | 1164 | | version, |
| | 1165 | | sharePermissionJson, |
| | 1166 | | timeout)) |
| | 1167 | | { |
| | 1168 | | if (async) |
| | 1169 | | { |
| | 1170 | | // Send the request asynchronously if we're being called via an async path |
| | 1171 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1172 | | } |
| | 1173 | | else |
| | 1174 | | { |
| | 1175 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1176 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1177 | | pipeline.Send(_message, cancellationToken); |
| | 1178 | | } |
| | 1179 | | Azure.Response _response = _message.Response; |
| | 1180 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1181 | | return CreatePermissionAsync_CreateResponse(clientDiagnostics, _response); |
| | 1182 | | } |
| | 1183 | | } |
| | 1184 | | catch (System.Exception ex) |
| | 1185 | | { |
| | 1186 | | _scope.Failed(ex); |
| | 1187 | | throw; |
| | 1188 | | } |
| | 1189 | | finally |
| | 1190 | | { |
| | 1191 | | _scope.Dispose(); |
| | 1192 | | } |
| | 1193 | | } |
| | 1194 | |
|
| | 1195 | | /// <summary> |
| | 1196 | | /// Create the Share.CreatePermissionAsync request. |
| | 1197 | | /// </summary> |
| | 1198 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1199 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1200 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1201 | | /// <param name="sharePermissionJson">A permission (a security descriptor) at the share level.</param> |
| | 1202 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1203 | | /// <returns>The Share.CreatePermissionAsync Message.</returns> |
| | 1204 | | internal static Azure.Core.HttpMessage CreatePermissionAsync_CreateMessage( |
| | 1205 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1206 | | System.Uri resourceUri, |
| | 1207 | | string version, |
| | 1208 | | string sharePermissionJson, |
| | 1209 | | int? timeout = default) |
| | 1210 | | { |
| | 1211 | | // Validation |
| | 1212 | | if (resourceUri == null) |
| | 1213 | | { |
| | 1214 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1215 | | } |
| | 1216 | | if (version == null) |
| | 1217 | | { |
| | 1218 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1219 | | } |
| | 1220 | | if (sharePermissionJson == null) |
| | 1221 | | { |
| | 1222 | | throw new System.ArgumentNullException(nameof(sharePermissionJson)); |
| | 1223 | | } |
| | 1224 | |
|
| | 1225 | | // Create the request |
| | 1226 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1227 | | Azure.Core.Request _request = _message.Request; |
| | 1228 | |
|
| | 1229 | | // Set the endpoint |
| | 1230 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 1231 | | _request.Uri.Reset(resourceUri); |
| | 1232 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 1233 | | _request.Uri.AppendQuery("comp", "filepermission", escapeValue: false); |
| | 1234 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1235 | |
|
| | 1236 | | // Add request headers |
| | 1237 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1238 | |
|
| | 1239 | | // Create the body |
| | 1240 | | string _text = sharePermissionJson; |
| | 1241 | | _request.Headers.SetValue("Content-Type", "application/json"); |
| | 1242 | | _request.Headers.SetValue("Content-Length", _text.Length.ToString(System.Globalization.CultureInfo.Invar |
| | 1243 | | _request.Content = Azure.Core.RequestContent.Create(System.Text.Encoding.UTF8.GetBytes(_text)); |
| | 1244 | |
|
| | 1245 | | return _message; |
| | 1246 | | } |
| | 1247 | |
|
| | 1248 | | /// <summary> |
| | 1249 | | /// Create the Share.CreatePermissionAsync response or throw a failure exception. |
| | 1250 | | /// </summary> |
| | 1251 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1252 | | /// <param name="response">The raw Response.</param> |
| | 1253 | | /// <returns>The Share.CreatePermissionAsync Azure.Response{Azure.Storage.Files.Shares.Models.PermissionInfo |
| | 1254 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.PermissionInfo> CreatePermissionAsync_Creat |
| | 1255 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1256 | | Azure.Response response) |
| | 1257 | | { |
| | 1258 | | // Process the response |
| | 1259 | | switch (response.Status) |
| | 1260 | | { |
| | 1261 | | case 201: |
| | 1262 | | { |
| | 1263 | | // Create the result |
| | 1264 | | Azure.Storage.Files.Shares.Models.PermissionInfo _value = new Azure.Storage.Files.Shares.Models. |
| | 1265 | |
|
| | 1266 | | // Get response headers |
| | 1267 | | string _header; |
| | 1268 | | if (response.Headers.TryGetValue("x-ms-file-permission-key", out _header)) |
| | 1269 | | { |
| | 1270 | | _value.FilePermissionKey = _header; |
| | 1271 | | } |
| | 1272 | |
|
| | 1273 | | // Create the response |
| | 1274 | | return Response.FromValue(_value, response); |
| | 1275 | | } |
| | 1276 | | default: |
| | 1277 | | { |
| | 1278 | | // Create the result |
| | 1279 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1280 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 1281 | |
|
| | 1282 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1283 | | } |
| | 1284 | | } |
| | 1285 | | } |
| | 1286 | | #endregion Share.CreatePermissionAsync |
| | 1287 | |
|
| | 1288 | | #region Share.GetPermissionAsync |
| | 1289 | | /// <summary> |
| | 1290 | | /// Returns the permission (security descriptor) for a given key |
| | 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, share, directory or file that is the target of |
| | 1295 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file.</param> |
| | 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="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 1299 | | /// <param name="operationName">Operation name.</param> |
| | 1300 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 1301 | | /// <returns>A permission (a security descriptor) at the share level.</returns> |
| | 1302 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<string>> GetPermissionAsync( |
| | 1303 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1304 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1305 | | System.Uri resourceUri, |
| | 1306 | | string filePermissionKey, |
| | 1307 | | string version, |
| | 1308 | | int? timeout = default, |
| | 1309 | | bool async = true, |
| | 1310 | | string operationName = "ShareClient.GetPermission", |
| | 1311 | | System.Threading.CancellationToken cancellationToken = default) |
| | 1312 | | { |
| | 1313 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 1314 | | try |
| | 1315 | | { |
| | 1316 | | _scope.AddAttribute("url", resourceUri); |
| | 1317 | | _scope.Start(); |
| | 1318 | | using (Azure.Core.HttpMessage _message = GetPermissionAsync_CreateMessage( |
| | 1319 | | pipeline, |
| | 1320 | | resourceUri, |
| | 1321 | | filePermissionKey, |
| | 1322 | | version, |
| | 1323 | | timeout)) |
| | 1324 | | { |
| | 1325 | | if (async) |
| | 1326 | | { |
| | 1327 | | // Send the request asynchronously if we're being called via an async path |
| | 1328 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1329 | | } |
| | 1330 | | else |
| | 1331 | | { |
| | 1332 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1333 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1334 | | pipeline.Send(_message, cancellationToken); |
| | 1335 | | } |
| | 1336 | | Azure.Response _response = _message.Response; |
| | 1337 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1338 | | return GetPermissionAsync_CreateResponse(clientDiagnostics, _response); |
| | 1339 | | } |
| | 1340 | | } |
| | 1341 | | catch (System.Exception ex) |
| | 1342 | | { |
| | 1343 | | _scope.Failed(ex); |
| | 1344 | | throw; |
| | 1345 | | } |
| | 1346 | | finally |
| | 1347 | | { |
| | 1348 | | _scope.Dispose(); |
| | 1349 | | } |
| | 1350 | | } |
| | 1351 | |
|
| | 1352 | | /// <summary> |
| | 1353 | | /// Create the Share.GetPermissionAsync request. |
| | 1354 | | /// </summary> |
| | 1355 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1356 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1357 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file.</param> |
| | 1358 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1359 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1360 | | /// <returns>The Share.GetPermissionAsync Message.</returns> |
| | 1361 | | internal static Azure.Core.HttpMessage GetPermissionAsync_CreateMessage( |
| | 1362 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1363 | | System.Uri resourceUri, |
| | 1364 | | string filePermissionKey, |
| | 1365 | | string version, |
| | 1366 | | int? timeout = default) |
| | 1367 | | { |
| | 1368 | | // Validation |
| | 1369 | | if (resourceUri == null) |
| | 1370 | | { |
| | 1371 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1372 | | } |
| | 1373 | | if (filePermissionKey == null) |
| | 1374 | | { |
| | 1375 | | throw new System.ArgumentNullException(nameof(filePermissionKey)); |
| | 1376 | | } |
| | 1377 | | if (version == null) |
| | 1378 | | { |
| | 1379 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1380 | | } |
| | 1381 | |
|
| | 1382 | | // Create the request |
| | 1383 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1384 | | Azure.Core.Request _request = _message.Request; |
| | 1385 | |
|
| | 1386 | | // Set the endpoint |
| | 1387 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 1388 | | _request.Uri.Reset(resourceUri); |
| | 1389 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 1390 | | _request.Uri.AppendQuery("comp", "filepermission", escapeValue: false); |
| | 1391 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1392 | |
|
| | 1393 | | // Add request headers |
| | 1394 | | _request.Headers.SetValue("x-ms-file-permission-key", filePermissionKey); |
| | 1395 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1396 | |
|
| | 1397 | | return _message; |
| | 1398 | | } |
| | 1399 | |
|
| | 1400 | | /// <summary> |
| | 1401 | | /// Create the Share.GetPermissionAsync response or throw a failure exception. |
| | 1402 | | /// </summary> |
| | 1403 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1404 | | /// <param name="response">The raw Response.</param> |
| | 1405 | | /// <returns>The Share.GetPermissionAsync Azure.Response{string}.</returns> |
| | 1406 | | internal static Azure.Response<string> GetPermissionAsync_CreateResponse( |
| | 1407 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1408 | | Azure.Response response) |
| | 1409 | | { |
| | 1410 | | // Process the response |
| | 1411 | | switch (response.Status) |
| | 1412 | | { |
| | 1413 | | case 200: |
| | 1414 | | { |
| | 1415 | | // Create the result |
| | 1416 | | string _value; |
| | 1417 | | using (System.IO.StreamReader _streamReader = new System.IO.StreamReader(response.ContentStream) |
| | 1418 | | { |
| | 1419 | | _value = _streamReader.ReadToEnd(); |
| | 1420 | | } |
| | 1421 | |
|
| | 1422 | | // Create the response |
| | 1423 | | return Response.FromValue(_value, response); |
| | 1424 | | } |
| | 1425 | | case 304: |
| | 1426 | | { |
| | 1427 | | return new Azure.NoBodyResponse<string>(response); |
| | 1428 | | } |
| | 1429 | | default: |
| | 1430 | | { |
| | 1431 | | // Create the result |
| | 1432 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1433 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 1434 | |
|
| | 1435 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1436 | | } |
| | 1437 | | } |
| | 1438 | | } |
| | 1439 | | #endregion Share.GetPermissionAsync |
| | 1440 | |
|
| | 1441 | | #region Share.SetQuotaAsync |
| | 1442 | | /// <summary> |
| | 1443 | | /// Sets quota for the specified share. |
| | 1444 | | /// </summary> |
| | 1445 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 1446 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1447 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1448 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1449 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1450 | | /// <param name="quotaInGB">Specifies the maximum size of the share, in gigabytes.</param> |
| | 1451 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 1452 | | /// <param name="operationName">Operation name.</param> |
| | 1453 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 1454 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.ShareInfo}</returns> |
| | 1455 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareI |
| | 1456 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1457 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1458 | | System.Uri resourceUri, |
| | 1459 | | string version, |
| | 1460 | | int? timeout = default, |
| | 1461 | | int? quotaInGB = default, |
| | 1462 | | bool async = true, |
| | 1463 | | string operationName = "ShareClient.SetQuota", |
| | 1464 | | System.Threading.CancellationToken cancellationToken = default) |
| | 1465 | | { |
| | 1466 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 1467 | | try |
| | 1468 | | { |
| | 1469 | | _scope.AddAttribute("url", resourceUri); |
| | 1470 | | _scope.Start(); |
| | 1471 | | using (Azure.Core.HttpMessage _message = SetQuotaAsync_CreateMessage( |
| | 1472 | | pipeline, |
| | 1473 | | resourceUri, |
| | 1474 | | version, |
| | 1475 | | timeout, |
| | 1476 | | quotaInGB)) |
| | 1477 | | { |
| | 1478 | | if (async) |
| | 1479 | | { |
| | 1480 | | // Send the request asynchronously if we're being called via an async path |
| | 1481 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1482 | | } |
| | 1483 | | else |
| | 1484 | | { |
| | 1485 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1486 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1487 | | pipeline.Send(_message, cancellationToken); |
| | 1488 | | } |
| | 1489 | | Azure.Response _response = _message.Response; |
| | 1490 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1491 | | return SetQuotaAsync_CreateResponse(clientDiagnostics, _response); |
| | 1492 | | } |
| | 1493 | | } |
| | 1494 | | catch (System.Exception ex) |
| | 1495 | | { |
| | 1496 | | _scope.Failed(ex); |
| | 1497 | | throw; |
| | 1498 | | } |
| | 1499 | | finally |
| | 1500 | | { |
| | 1501 | | _scope.Dispose(); |
| | 1502 | | } |
| | 1503 | | } |
| | 1504 | |
|
| | 1505 | | /// <summary> |
| | 1506 | | /// Create the Share.SetQuotaAsync request. |
| | 1507 | | /// </summary> |
| | 1508 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1509 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1510 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1511 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1512 | | /// <param name="quotaInGB">Specifies the maximum size of the share, in gigabytes.</param> |
| | 1513 | | /// <returns>The Share.SetQuotaAsync Message.</returns> |
| | 1514 | | internal static Azure.Core.HttpMessage SetQuotaAsync_CreateMessage( |
| | 1515 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1516 | | System.Uri resourceUri, |
| | 1517 | | string version, |
| | 1518 | | int? timeout = default, |
| | 1519 | | int? quotaInGB = default) |
| | 1520 | | { |
| | 1521 | | // Validation |
| | 1522 | | if (resourceUri == null) |
| | 1523 | | { |
| | 1524 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1525 | | } |
| | 1526 | | if (version == null) |
| | 1527 | | { |
| | 1528 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1529 | | } |
| | 1530 | |
|
| | 1531 | | // Create the request |
| | 1532 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1533 | | Azure.Core.Request _request = _message.Request; |
| | 1534 | |
|
| | 1535 | | // Set the endpoint |
| | 1536 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 1537 | | _request.Uri.Reset(resourceUri); |
| | 1538 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 1539 | | _request.Uri.AppendQuery("comp", "properties", escapeValue: false); |
| | 1540 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1541 | |
|
| | 1542 | | // Add request headers |
| | 1543 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1544 | | if (quotaInGB != null) { _request.Headers.SetValue("x-ms-share-quota", quotaInGB.Value.ToString(System.G |
| | 1545 | |
|
| | 1546 | | return _message; |
| | 1547 | | } |
| | 1548 | |
|
| | 1549 | | /// <summary> |
| | 1550 | | /// Create the Share.SetQuotaAsync response or throw a failure exception. |
| | 1551 | | /// </summary> |
| | 1552 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1553 | | /// <param name="response">The raw Response.</param> |
| | 1554 | | /// <returns>The Share.SetQuotaAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareInfo}.</returns> |
| | 1555 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareInfo> SetQuotaAsync_CreateResponse( |
| | 1556 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1557 | | Azure.Response response) |
| | 1558 | | { |
| | 1559 | | // Process the response |
| | 1560 | | switch (response.Status) |
| | 1561 | | { |
| | 1562 | | case 200: |
| | 1563 | | { |
| | 1564 | | // Create the result |
| | 1565 | | Azure.Storage.Files.Shares.Models.ShareInfo _value = new Azure.Storage.Files.Shares.Models.Share |
| | 1566 | |
|
| | 1567 | | // Get response headers |
| | 1568 | | string _header; |
| | 1569 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 1570 | | { |
| | 1571 | | _value.ETag = new Azure.ETag(_header); |
| | 1572 | | } |
| | 1573 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 1574 | | { |
| | 1575 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 1576 | | } |
| | 1577 | |
|
| | 1578 | | // Create the response |
| | 1579 | | return Response.FromValue(_value, response); |
| | 1580 | | } |
| | 1581 | | default: |
| | 1582 | | { |
| | 1583 | | // Create the result |
| | 1584 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1585 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 1586 | |
|
| | 1587 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1588 | | } |
| | 1589 | | } |
| | 1590 | | } |
| | 1591 | | #endregion Share.SetQuotaAsync |
| | 1592 | |
|
| | 1593 | | #region Share.SetMetadataAsync |
| | 1594 | | /// <summary> |
| | 1595 | | /// Sets one or more user-defined name-value pairs for the specified share. |
| | 1596 | | /// </summary> |
| | 1597 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 1598 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1599 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1600 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1601 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1602 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 1603 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 1604 | | /// <param name="operationName">Operation name.</param> |
| | 1605 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 1606 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.ShareInfo}</returns> |
| | 1607 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareI |
| | 1608 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1609 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1610 | | System.Uri resourceUri, |
| | 1611 | | string version, |
| | 1612 | | int? timeout = default, |
| | 1613 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 1614 | | bool async = true, |
| | 1615 | | string operationName = "ShareClient.SetMetadata", |
| | 1616 | | System.Threading.CancellationToken cancellationToken = default) |
| | 1617 | | { |
| | 1618 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 1619 | | try |
| | 1620 | | { |
| | 1621 | | _scope.AddAttribute("url", resourceUri); |
| | 1622 | | _scope.Start(); |
| | 1623 | | using (Azure.Core.HttpMessage _message = SetMetadataAsync_CreateMessage( |
| | 1624 | | pipeline, |
| | 1625 | | resourceUri, |
| | 1626 | | version, |
| | 1627 | | timeout, |
| | 1628 | | metadata)) |
| | 1629 | | { |
| | 1630 | | if (async) |
| | 1631 | | { |
| | 1632 | | // Send the request asynchronously if we're being called via an async path |
| | 1633 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1634 | | } |
| | 1635 | | else |
| | 1636 | | { |
| | 1637 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1638 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1639 | | pipeline.Send(_message, cancellationToken); |
| | 1640 | | } |
| | 1641 | | Azure.Response _response = _message.Response; |
| | 1642 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1643 | | return SetMetadataAsync_CreateResponse(clientDiagnostics, _response); |
| | 1644 | | } |
| | 1645 | | } |
| | 1646 | | catch (System.Exception ex) |
| | 1647 | | { |
| | 1648 | | _scope.Failed(ex); |
| | 1649 | | throw; |
| | 1650 | | } |
| | 1651 | | finally |
| | 1652 | | { |
| | 1653 | | _scope.Dispose(); |
| | 1654 | | } |
| | 1655 | | } |
| | 1656 | |
|
| | 1657 | | /// <summary> |
| | 1658 | | /// Create the Share.SetMetadataAsync request. |
| | 1659 | | /// </summary> |
| | 1660 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1661 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1662 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1663 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1664 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 1665 | | /// <returns>The Share.SetMetadataAsync Message.</returns> |
| | 1666 | | internal static Azure.Core.HttpMessage SetMetadataAsync_CreateMessage( |
| | 1667 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1668 | | System.Uri resourceUri, |
| | 1669 | | string version, |
| | 1670 | | int? timeout = default, |
| | 1671 | | System.Collections.Generic.IDictionary<string, string> metadata = default) |
| | 1672 | | { |
| | 1673 | | // Validation |
| | 1674 | | if (resourceUri == null) |
| | 1675 | | { |
| | 1676 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1677 | | } |
| | 1678 | | if (version == null) |
| | 1679 | | { |
| | 1680 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1681 | | } |
| | 1682 | |
|
| | 1683 | | // Create the request |
| | 1684 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1685 | | Azure.Core.Request _request = _message.Request; |
| | 1686 | |
|
| | 1687 | | // Set the endpoint |
| | 1688 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 1689 | | _request.Uri.Reset(resourceUri); |
| | 1690 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 1691 | | _request.Uri.AppendQuery("comp", "metadata", escapeValue: false); |
| | 1692 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1693 | |
|
| | 1694 | | // Add request headers |
| | 1695 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1696 | | if (metadata != null) { |
| | 1697 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 1698 | | { |
| | 1699 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 1700 | | } |
| | 1701 | | } |
| | 1702 | |
|
| | 1703 | | return _message; |
| | 1704 | | } |
| | 1705 | |
|
| | 1706 | | /// <summary> |
| | 1707 | | /// Create the Share.SetMetadataAsync response or throw a failure exception. |
| | 1708 | | /// </summary> |
| | 1709 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1710 | | /// <param name="response">The raw Response.</param> |
| | 1711 | | /// <returns>The Share.SetMetadataAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareInfo}.</return |
| | 1712 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareInfo> SetMetadataAsync_CreateResponse( |
| | 1713 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1714 | | Azure.Response response) |
| | 1715 | | { |
| | 1716 | | // Process the response |
| | 1717 | | switch (response.Status) |
| | 1718 | | { |
| | 1719 | | case 200: |
| | 1720 | | { |
| | 1721 | | // Create the result |
| | 1722 | | Azure.Storage.Files.Shares.Models.ShareInfo _value = new Azure.Storage.Files.Shares.Models.Share |
| | 1723 | |
|
| | 1724 | | // Get response headers |
| | 1725 | | string _header; |
| | 1726 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 1727 | | { |
| | 1728 | | _value.ETag = new Azure.ETag(_header); |
| | 1729 | | } |
| | 1730 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 1731 | | { |
| | 1732 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 1733 | | } |
| | 1734 | |
|
| | 1735 | | // Create the response |
| | 1736 | | return Response.FromValue(_value, response); |
| | 1737 | | } |
| | 1738 | | default: |
| | 1739 | | { |
| | 1740 | | // Create the result |
| | 1741 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1742 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 1743 | |
|
| | 1744 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1745 | | } |
| | 1746 | | } |
| | 1747 | | } |
| | 1748 | | #endregion Share.SetMetadataAsync |
| | 1749 | |
|
| | 1750 | | #region Share.GetAccessPolicyAsync |
| | 1751 | | /// <summary> |
| | 1752 | | /// Returns information about stored access policies specified on the share. |
| | 1753 | | /// </summary> |
| | 1754 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 1755 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1756 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1757 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1758 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1759 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 1760 | | /// <param name="operationName">Operation name.</param> |
| | 1761 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 1762 | | /// <returns>A collection of signed identifiers.</returns> |
| | 1763 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<System.Collections.Generic.IEnumerable<A |
| | 1764 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1765 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1766 | | System.Uri resourceUri, |
| | 1767 | | string version, |
| | 1768 | | int? timeout = default, |
| | 1769 | | bool async = true, |
| | 1770 | | string operationName = "ShareClient.GetAccessPolicy", |
| | 1771 | | System.Threading.CancellationToken cancellationToken = default) |
| | 1772 | | { |
| | 1773 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 1774 | | try |
| | 1775 | | { |
| | 1776 | | _scope.AddAttribute("url", resourceUri); |
| | 1777 | | _scope.Start(); |
| | 1778 | | using (Azure.Core.HttpMessage _message = GetAccessPolicyAsync_CreateMessage( |
| | 1779 | | pipeline, |
| | 1780 | | resourceUri, |
| | 1781 | | version, |
| | 1782 | | timeout)) |
| | 1783 | | { |
| | 1784 | | if (async) |
| | 1785 | | { |
| | 1786 | | // Send the request asynchronously if we're being called via an async path |
| | 1787 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1788 | | } |
| | 1789 | | else |
| | 1790 | | { |
| | 1791 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1792 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1793 | | pipeline.Send(_message, cancellationToken); |
| | 1794 | | } |
| | 1795 | | Azure.Response _response = _message.Response; |
| | 1796 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1797 | | return GetAccessPolicyAsync_CreateResponse(clientDiagnostics, _response); |
| | 1798 | | } |
| | 1799 | | } |
| | 1800 | | catch (System.Exception ex) |
| | 1801 | | { |
| | 1802 | | _scope.Failed(ex); |
| | 1803 | | throw; |
| | 1804 | | } |
| | 1805 | | finally |
| | 1806 | | { |
| | 1807 | | _scope.Dispose(); |
| | 1808 | | } |
| | 1809 | | } |
| | 1810 | |
|
| | 1811 | | /// <summary> |
| | 1812 | | /// Create the Share.GetAccessPolicyAsync request. |
| | 1813 | | /// </summary> |
| | 1814 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1815 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1816 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1817 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1818 | | /// <returns>The Share.GetAccessPolicyAsync Message.</returns> |
| | 1819 | | internal static Azure.Core.HttpMessage GetAccessPolicyAsync_CreateMessage( |
| | 1820 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1821 | | System.Uri resourceUri, |
| | 1822 | | string version, |
| | 1823 | | int? timeout = default) |
| | 1824 | | { |
| | 1825 | | // Validation |
| | 1826 | | if (resourceUri == null) |
| | 1827 | | { |
| | 1828 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1829 | | } |
| | 1830 | | if (version == null) |
| | 1831 | | { |
| | 1832 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1833 | | } |
| | 1834 | |
|
| | 1835 | | // Create the request |
| | 1836 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1837 | | Azure.Core.Request _request = _message.Request; |
| | 1838 | |
|
| | 1839 | | // Set the endpoint |
| | 1840 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 1841 | | _request.Uri.Reset(resourceUri); |
| | 1842 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 1843 | | _request.Uri.AppendQuery("comp", "acl", escapeValue: false); |
| | 1844 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1845 | |
|
| | 1846 | | // Add request headers |
| | 1847 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1848 | |
|
| | 1849 | | return _message; |
| | 1850 | | } |
| | 1851 | |
|
| | 1852 | | /// <summary> |
| | 1853 | | /// Create the Share.GetAccessPolicyAsync response or throw a failure exception. |
| | 1854 | | /// </summary> |
| | 1855 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 1856 | | /// <param name="response">The raw Response.</param> |
| | 1857 | | /// <returns>The Share.GetAccessPolicyAsync Azure.Response{System.Collections.Generic.IEnumerable{Azure.Stor |
| | 1858 | | internal static Azure.Response<System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.Shar |
| | 1859 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1860 | | Azure.Response response) |
| | 1861 | | { |
| | 1862 | | // Process the response |
| | 1863 | | switch (response.Status) |
| | 1864 | | { |
| | 1865 | | case 200: |
| | 1866 | | { |
| | 1867 | | // Create the result |
| | 1868 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1869 | | System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.ShareSignedIdentifier> |
| | 1870 | | System.Linq.Enumerable.ToList( |
| | 1871 | | System.Linq.Enumerable.Select( |
| | 1872 | | _xml.Element(System.Xml.Linq.XName.Get("SignedIdentifiers", "")).Elements(System.Xml |
| | 1873 | | Azure.Storage.Files.Shares.Models.ShareSignedIdentifier.FromXml)); |
| | 1874 | |
|
| | 1875 | | // Create the response |
| | 1876 | | return Response.FromValue(_value, response); |
| | 1877 | | } |
| | 1878 | | case 304: |
| | 1879 | | { |
| | 1880 | | return new Azure.NoBodyResponse<System.Collections.Generic.IEnumerable<Azure.Storage.Files.Share |
| | 1881 | | } |
| | 1882 | | default: |
| | 1883 | | { |
| | 1884 | | // Create the result |
| | 1885 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 1886 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 1887 | |
|
| | 1888 | | throw _value.CreateException(clientDiagnostics, response); |
| | 1889 | | } |
| | 1890 | | } |
| | 1891 | | } |
| | 1892 | | #endregion Share.GetAccessPolicyAsync |
| | 1893 | |
|
| | 1894 | | #region Share.SetAccessPolicyAsync |
| | 1895 | | /// <summary> |
| | 1896 | | /// Sets a stored access policy for use with shared access signatures. |
| | 1897 | | /// </summary> |
| | 1898 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 1899 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1900 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1901 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1902 | | /// <param name="permissions">The ACL for the share.</param> |
| | 1903 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1904 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 1905 | | /// <param name="operationName">Operation name.</param> |
| | 1906 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 1907 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.ShareInfo}</returns> |
| | 1908 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareI |
| | 1909 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 1910 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1911 | | System.Uri resourceUri, |
| | 1912 | | string version, |
| | 1913 | | System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.ShareSignedIdentifier> permissi |
| | 1914 | | int? timeout = default, |
| | 1915 | | bool async = true, |
| | 1916 | | string operationName = "ShareClient.SetAccessPolicy", |
| | 1917 | | System.Threading.CancellationToken cancellationToken = default) |
| | 1918 | | { |
| | 1919 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 1920 | | try |
| | 1921 | | { |
| | 1922 | | _scope.AddAttribute("url", resourceUri); |
| | 1923 | | _scope.Start(); |
| | 1924 | | using (Azure.Core.HttpMessage _message = SetAccessPolicyAsync_CreateMessage( |
| | 1925 | | pipeline, |
| | 1926 | | resourceUri, |
| | 1927 | | version, |
| | 1928 | | permissions, |
| | 1929 | | timeout)) |
| | 1930 | | { |
| | 1931 | | if (async) |
| | 1932 | | { |
| | 1933 | | // Send the request asynchronously if we're being called via an async path |
| | 1934 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 1935 | | } |
| | 1936 | | else |
| | 1937 | | { |
| | 1938 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 1939 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 1940 | | pipeline.Send(_message, cancellationToken); |
| | 1941 | | } |
| | 1942 | | Azure.Response _response = _message.Response; |
| | 1943 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 1944 | | return SetAccessPolicyAsync_CreateResponse(clientDiagnostics, _response); |
| | 1945 | | } |
| | 1946 | | } |
| | 1947 | | catch (System.Exception ex) |
| | 1948 | | { |
| | 1949 | | _scope.Failed(ex); |
| | 1950 | | throw; |
| | 1951 | | } |
| | 1952 | | finally |
| | 1953 | | { |
| | 1954 | | _scope.Dispose(); |
| | 1955 | | } |
| | 1956 | | } |
| | 1957 | |
|
| | 1958 | | /// <summary> |
| | 1959 | | /// Create the Share.SetAccessPolicyAsync request. |
| | 1960 | | /// </summary> |
| | 1961 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 1962 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 1963 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 1964 | | /// <param name="permissions">The ACL for the share.</param> |
| | 1965 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 1966 | | /// <returns>The Share.SetAccessPolicyAsync Message.</returns> |
| | 1967 | | internal static Azure.Core.HttpMessage SetAccessPolicyAsync_CreateMessage( |
| | 1968 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 1969 | | System.Uri resourceUri, |
| | 1970 | | string version, |
| | 1971 | | System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.ShareSignedIdentifier> permissi |
| | 1972 | | int? timeout = default) |
| | 1973 | | { |
| | 1974 | | // Validation |
| | 1975 | | if (resourceUri == null) |
| | 1976 | | { |
| | 1977 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 1978 | | } |
| | 1979 | | if (version == null) |
| | 1980 | | { |
| | 1981 | | throw new System.ArgumentNullException(nameof(version)); |
| | 1982 | | } |
| | 1983 | |
|
| | 1984 | | // Create the request |
| | 1985 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 1986 | | Azure.Core.Request _request = _message.Request; |
| | 1987 | |
|
| | 1988 | | // Set the endpoint |
| | 1989 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 1990 | | _request.Uri.Reset(resourceUri); |
| | 1991 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 1992 | | _request.Uri.AppendQuery("comp", "acl", escapeValue: false); |
| | 1993 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 1994 | |
|
| | 1995 | | // Add request headers |
| | 1996 | | _request.Headers.SetValue("x-ms-version", version); |
| | 1997 | |
|
| | 1998 | | // Create the body |
| | 1999 | | System.Xml.Linq.XElement _body = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get("SignedIdentifie |
| | 2000 | | if (permissions != null) |
| | 2001 | | { |
| | 2002 | | foreach (Azure.Storage.Files.Shares.Models.ShareSignedIdentifier _child in permissions) |
| | 2003 | | { |
| | 2004 | | _body.Add(Azure.Storage.Files.Shares.Models.ShareSignedIdentifier.ToXml(_child)); |
| | 2005 | | } |
| | 2006 | | } |
| | 2007 | | string _text = _body.ToString(System.Xml.Linq.SaveOptions.DisableFormatting); |
| | 2008 | | _request.Headers.SetValue("Content-Type", "application/xml"); |
| | 2009 | | _request.Headers.SetValue("Content-Length", _text.Length.ToString(System.Globalization.CultureInfo.Invar |
| | 2010 | | _request.Content = Azure.Core.RequestContent.Create(System.Text.Encoding.UTF8.GetBytes(_text)); |
| | 2011 | |
|
| | 2012 | | return _message; |
| | 2013 | | } |
| | 2014 | |
|
| | 2015 | | /// <summary> |
| | 2016 | | /// Create the Share.SetAccessPolicyAsync response or throw a failure exception. |
| | 2017 | | /// </summary> |
| | 2018 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 2019 | | /// <param name="response">The raw Response.</param> |
| | 2020 | | /// <returns>The Share.SetAccessPolicyAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareInfo}.</re |
| | 2021 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareInfo> SetAccessPolicyAsync_CreateRespo |
| | 2022 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2023 | | Azure.Response response) |
| | 2024 | | { |
| | 2025 | | // Process the response |
| | 2026 | | switch (response.Status) |
| | 2027 | | { |
| | 2028 | | case 200: |
| | 2029 | | { |
| | 2030 | | // Create the result |
| | 2031 | | Azure.Storage.Files.Shares.Models.ShareInfo _value = new Azure.Storage.Files.Shares.Models.Share |
| | 2032 | |
|
| | 2033 | | // Get response headers |
| | 2034 | | string _header; |
| | 2035 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 2036 | | { |
| | 2037 | | _value.ETag = new Azure.ETag(_header); |
| | 2038 | | } |
| | 2039 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 2040 | | { |
| | 2041 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 2042 | | } |
| | 2043 | |
|
| | 2044 | | // Create the response |
| | 2045 | | return Response.FromValue(_value, response); |
| | 2046 | | } |
| | 2047 | | default: |
| | 2048 | | { |
| | 2049 | | // Create the result |
| | 2050 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2051 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 2052 | |
|
| | 2053 | | throw _value.CreateException(clientDiagnostics, response); |
| | 2054 | | } |
| | 2055 | | } |
| | 2056 | | } |
| | 2057 | | #endregion Share.SetAccessPolicyAsync |
| | 2058 | |
|
| | 2059 | | #region Share.GetStatisticsAsync |
| | 2060 | | /// <summary> |
| | 2061 | | /// Retrieves statistics related to the share. |
| | 2062 | | /// </summary> |
| | 2063 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2064 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2065 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 2066 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2067 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2068 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2069 | | /// <param name="operationName">Operation name.</param> |
| | 2070 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2071 | | /// <returns>Stats for the share.</returns> |
| | 2072 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareS |
| | 2073 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2074 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2075 | | System.Uri resourceUri, |
| | 2076 | | string version, |
| | 2077 | | int? timeout = default, |
| | 2078 | | bool async = true, |
| | 2079 | | string operationName = "ShareClient.GetStatistics", |
| | 2080 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2081 | | { |
| | 2082 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2083 | | try |
| | 2084 | | { |
| | 2085 | | _scope.AddAttribute("url", resourceUri); |
| | 2086 | | _scope.Start(); |
| | 2087 | | using (Azure.Core.HttpMessage _message = GetStatisticsAsync_CreateMessage( |
| | 2088 | | pipeline, |
| | 2089 | | resourceUri, |
| | 2090 | | version, |
| | 2091 | | timeout)) |
| | 2092 | | { |
| | 2093 | | if (async) |
| | 2094 | | { |
| | 2095 | | // Send the request asynchronously if we're being called via an async path |
| | 2096 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2097 | | } |
| | 2098 | | else |
| | 2099 | | { |
| | 2100 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2101 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2102 | | pipeline.Send(_message, cancellationToken); |
| | 2103 | | } |
| | 2104 | | Azure.Response _response = _message.Response; |
| | 2105 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2106 | | return GetStatisticsAsync_CreateResponse(clientDiagnostics, _response); |
| | 2107 | | } |
| | 2108 | | } |
| | 2109 | | catch (System.Exception ex) |
| | 2110 | | { |
| | 2111 | | _scope.Failed(ex); |
| | 2112 | | throw; |
| | 2113 | | } |
| | 2114 | | finally |
| | 2115 | | { |
| | 2116 | | _scope.Dispose(); |
| | 2117 | | } |
| | 2118 | | } |
| | 2119 | |
|
| | 2120 | | /// <summary> |
| | 2121 | | /// Create the Share.GetStatisticsAsync request. |
| | 2122 | | /// </summary> |
| | 2123 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2124 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 2125 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2126 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2127 | | /// <returns>The Share.GetStatisticsAsync Message.</returns> |
| | 2128 | | internal static Azure.Core.HttpMessage GetStatisticsAsync_CreateMessage( |
| | 2129 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2130 | | System.Uri resourceUri, |
| | 2131 | | string version, |
| | 2132 | | int? timeout = default) |
| | 2133 | | { |
| | 2134 | | // Validation |
| | 2135 | | if (resourceUri == null) |
| | 2136 | | { |
| | 2137 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 2138 | | } |
| | 2139 | | if (version == null) |
| | 2140 | | { |
| | 2141 | | throw new System.ArgumentNullException(nameof(version)); |
| | 2142 | | } |
| | 2143 | |
|
| | 2144 | | // Create the request |
| | 2145 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 2146 | | Azure.Core.Request _request = _message.Request; |
| | 2147 | |
|
| | 2148 | | // Set the endpoint |
| | 2149 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 2150 | | _request.Uri.Reset(resourceUri); |
| | 2151 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 2152 | | _request.Uri.AppendQuery("comp", "stats", escapeValue: false); |
| | 2153 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 2154 | |
|
| | 2155 | | // Add request headers |
| | 2156 | | _request.Headers.SetValue("x-ms-version", version); |
| | 2157 | |
|
| | 2158 | | return _message; |
| | 2159 | | } |
| | 2160 | |
|
| | 2161 | | /// <summary> |
| | 2162 | | /// Create the Share.GetStatisticsAsync response or throw a failure exception. |
| | 2163 | | /// </summary> |
| | 2164 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 2165 | | /// <param name="response">The raw Response.</param> |
| | 2166 | | /// <returns>The Share.GetStatisticsAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareStatistics}. |
| | 2167 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareStatistics> GetStatisticsAsync_CreateR |
| | 2168 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2169 | | Azure.Response response) |
| | 2170 | | { |
| | 2171 | | // Process the response |
| | 2172 | | switch (response.Status) |
| | 2173 | | { |
| | 2174 | | case 200: |
| | 2175 | | { |
| | 2176 | | // Create the result |
| | 2177 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2178 | | Azure.Storage.Files.Shares.Models.ShareStatistics _value = Azure.Storage.Files.Shares.Models.Sha |
| | 2179 | |
|
| | 2180 | | // Create the response |
| | 2181 | | return Response.FromValue(_value, response); |
| | 2182 | | } |
| | 2183 | | case 304: |
| | 2184 | | { |
| | 2185 | | return new Azure.NoBodyResponse<Azure.Storage.Files.Shares.Models.ShareStatistics>(response); |
| | 2186 | | } |
| | 2187 | | default: |
| | 2188 | | { |
| | 2189 | | // Create the result |
| | 2190 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2191 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 2192 | |
|
| | 2193 | | throw _value.CreateException(clientDiagnostics, response); |
| | 2194 | | } |
| | 2195 | | } |
| | 2196 | | } |
| | 2197 | | #endregion Share.GetStatisticsAsync |
| | 2198 | |
|
| | 2199 | | #region Share.RestoreAsync |
| | 2200 | | /// <summary> |
| | 2201 | | /// Restores a previously deleted Share. |
| | 2202 | | /// </summary> |
| | 2203 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2204 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2205 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 2206 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2207 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2208 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2209 | | /// <param name="deletedShareName">Specifies the name of the preivously-deleted share.</param> |
| | 2210 | | /// <param name="deletedShareVersion">Specifies the version of the preivously-deleted share.</param> |
| | 2211 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2212 | | /// <param name="operationName">Operation name.</param> |
| | 2213 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2214 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.ShareInfo}</returns> |
| | 2215 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareI |
| | 2216 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2217 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2218 | | System.Uri resourceUri, |
| | 2219 | | string version, |
| | 2220 | | int? timeout = default, |
| | 2221 | | string requestId = default, |
| | 2222 | | string deletedShareName = default, |
| | 2223 | | string deletedShareVersion = default, |
| | 2224 | | bool async = true, |
| | 2225 | | string operationName = "ShareClient.Restore", |
| | 2226 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2227 | | { |
| | 2228 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2229 | | try |
| | 2230 | | { |
| | 2231 | | _scope.AddAttribute("url", resourceUri); |
| | 2232 | | _scope.Start(); |
| | 2233 | | using (Azure.Core.HttpMessage _message = RestoreAsync_CreateMessage( |
| | 2234 | | pipeline, |
| | 2235 | | resourceUri, |
| | 2236 | | version, |
| | 2237 | | timeout, |
| | 2238 | | requestId, |
| | 2239 | | deletedShareName, |
| | 2240 | | deletedShareVersion)) |
| | 2241 | | { |
| | 2242 | | if (async) |
| | 2243 | | { |
| | 2244 | | // Send the request asynchronously if we're being called via an async path |
| | 2245 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2246 | | } |
| | 2247 | | else |
| | 2248 | | { |
| | 2249 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2250 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2251 | | pipeline.Send(_message, cancellationToken); |
| | 2252 | | } |
| | 2253 | | Azure.Response _response = _message.Response; |
| | 2254 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2255 | | return RestoreAsync_CreateResponse(clientDiagnostics, _response); |
| | 2256 | | } |
| | 2257 | | } |
| | 2258 | | catch (System.Exception ex) |
| | 2259 | | { |
| | 2260 | | _scope.Failed(ex); |
| | 2261 | | throw; |
| | 2262 | | } |
| | 2263 | | finally |
| | 2264 | | { |
| | 2265 | | _scope.Dispose(); |
| | 2266 | | } |
| | 2267 | | } |
| | 2268 | |
|
| | 2269 | | /// <summary> |
| | 2270 | | /// Create the Share.RestoreAsync request. |
| | 2271 | | /// </summary> |
| | 2272 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2273 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 2274 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2275 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2276 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 2277 | | /// <param name="deletedShareName">Specifies the name of the preivously-deleted share.</param> |
| | 2278 | | /// <param name="deletedShareVersion">Specifies the version of the preivously-deleted share.</param> |
| | 2279 | | /// <returns>The Share.RestoreAsync Message.</returns> |
| | 2280 | | internal static Azure.Core.HttpMessage RestoreAsync_CreateMessage( |
| | 2281 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2282 | | System.Uri resourceUri, |
| | 2283 | | string version, |
| | 2284 | | int? timeout = default, |
| | 2285 | | string requestId = default, |
| | 2286 | | string deletedShareName = default, |
| | 2287 | | string deletedShareVersion = default) |
| | 2288 | | { |
| | 2289 | | // Validation |
| | 2290 | | if (resourceUri == null) |
| | 2291 | | { |
| | 2292 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 2293 | | } |
| | 2294 | | if (version == null) |
| | 2295 | | { |
| | 2296 | | throw new System.ArgumentNullException(nameof(version)); |
| | 2297 | | } |
| | 2298 | |
|
| | 2299 | | // Create the request |
| | 2300 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 2301 | | Azure.Core.Request _request = _message.Request; |
| | 2302 | |
|
| | 2303 | | // Set the endpoint |
| | 2304 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 2305 | | _request.Uri.Reset(resourceUri); |
| | 2306 | | _request.Uri.AppendQuery("restype", "share", escapeValue: false); |
| | 2307 | | _request.Uri.AppendQuery("comp", "undelete", escapeValue: false); |
| | 2308 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 2309 | |
|
| | 2310 | | // Add request headers |
| | 2311 | | _request.Headers.SetValue("x-ms-version", version); |
| | 2312 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 2313 | | if (deletedShareName != null) { _request.Headers.SetValue("x-ms-deleted-share-name", deletedShareName); |
| | 2314 | | if (deletedShareVersion != null) { _request.Headers.SetValue("x-ms-deleted-share-version", deletedShareV |
| | 2315 | |
|
| | 2316 | | return _message; |
| | 2317 | | } |
| | 2318 | |
|
| | 2319 | | /// <summary> |
| | 2320 | | /// Create the Share.RestoreAsync response or throw a failure exception. |
| | 2321 | | /// </summary> |
| | 2322 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 2323 | | /// <param name="response">The raw Response.</param> |
| | 2324 | | /// <returns>The Share.RestoreAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareInfo}.</returns> |
| | 2325 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareInfo> RestoreAsync_CreateResponse( |
| | 2326 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2327 | | Azure.Response response) |
| | 2328 | | { |
| | 2329 | | // Process the response |
| | 2330 | | switch (response.Status) |
| | 2331 | | { |
| | 2332 | | case 201: |
| | 2333 | | { |
| | 2334 | | // Create the result |
| | 2335 | | Azure.Storage.Files.Shares.Models.ShareInfo _value = new Azure.Storage.Files.Shares.Models.Share |
| | 2336 | |
|
| | 2337 | | // Get response headers |
| | 2338 | | string _header; |
| | 2339 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 2340 | | { |
| | 2341 | | _value.ETag = new Azure.ETag(_header); |
| | 2342 | | } |
| | 2343 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 2344 | | { |
| | 2345 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 2346 | | } |
| | 2347 | |
|
| | 2348 | | // Create the response |
| | 2349 | | return Response.FromValue(_value, response); |
| | 2350 | | } |
| | 2351 | | default: |
| | 2352 | | { |
| | 2353 | | // Create the result |
| | 2354 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2355 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 2356 | |
|
| | 2357 | | throw _value.CreateException(clientDiagnostics, response); |
| | 2358 | | } |
| | 2359 | | } |
| | 2360 | | } |
| | 2361 | | #endregion Share.RestoreAsync |
| | 2362 | | } |
| | 2363 | | #endregion Share operations |
| | 2364 | |
|
| | 2365 | | #region Directory operations |
| | 2366 | | /// <summary> |
| | 2367 | | /// Directory operations for Azure File Storage |
| | 2368 | | /// </summary> |
| | 2369 | | public static partial class Directory |
| | 2370 | | { |
| | 2371 | | #region Directory.CreateAsync |
| | 2372 | | /// <summary> |
| | 2373 | | /// Creates a new directory under the specified share or parent directory. |
| | 2374 | | /// </summary> |
| | 2375 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2376 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2377 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 2378 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2379 | | /// <param name="fileAttributes">If specified, the provided file attributes shall be set. Default value: ‘Ar |
| | 2380 | | /// <param name="fileCreationTime">Creation time for the file/directory. Default value: Now.</param> |
| | 2381 | | /// <param name="fileLastWriteTime">Last write time for the file/directory. Default value: Now.</param> |
| | 2382 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2383 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 2384 | | /// <param name="filePermission">If specified the permission (security descriptor) shall be set for the dire |
| | 2385 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file. Note: Only one o |
| | 2386 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2387 | | /// <param name="operationName">Operation name.</param> |
| | 2388 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2389 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageDirectoryInfo}</returns> |
| | 2390 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.RawSto |
| | 2391 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2392 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2393 | | System.Uri resourceUri, |
| | 2394 | | string version, |
| | 2395 | | string fileAttributes, |
| | 2396 | | string fileCreationTime, |
| | 2397 | | string fileLastWriteTime, |
| | 2398 | | int? timeout = default, |
| | 2399 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 2400 | | string filePermission = default, |
| | 2401 | | string filePermissionKey = default, |
| | 2402 | | bool async = true, |
| | 2403 | | string operationName = "DirectoryClient.Create", |
| | 2404 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2405 | | { |
| | 2406 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2407 | | try |
| | 2408 | | { |
| | 2409 | | _scope.AddAttribute("url", resourceUri); |
| | 2410 | | _scope.Start(); |
| | 2411 | | using (Azure.Core.HttpMessage _message = CreateAsync_CreateMessage( |
| | 2412 | | pipeline, |
| | 2413 | | resourceUri, |
| | 2414 | | version, |
| | 2415 | | fileAttributes, |
| | 2416 | | fileCreationTime, |
| | 2417 | | fileLastWriteTime, |
| | 2418 | | timeout, |
| | 2419 | | metadata, |
| | 2420 | | filePermission, |
| | 2421 | | filePermissionKey)) |
| | 2422 | | { |
| | 2423 | | if (async) |
| | 2424 | | { |
| | 2425 | | // Send the request asynchronously if we're being called via an async path |
| | 2426 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2427 | | } |
| | 2428 | | else |
| | 2429 | | { |
| | 2430 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2431 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2432 | | pipeline.Send(_message, cancellationToken); |
| | 2433 | | } |
| | 2434 | | Azure.Response _response = _message.Response; |
| | 2435 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2436 | | return CreateAsync_CreateResponse(clientDiagnostics, _response); |
| | 2437 | | } |
| | 2438 | | } |
| | 2439 | | catch (System.Exception ex) |
| | 2440 | | { |
| | 2441 | | _scope.Failed(ex); |
| | 2442 | | throw; |
| | 2443 | | } |
| | 2444 | | finally |
| | 2445 | | { |
| | 2446 | | _scope.Dispose(); |
| | 2447 | | } |
| | 2448 | | } |
| | 2449 | |
|
| | 2450 | | /// <summary> |
| | 2451 | | /// Create the Directory.CreateAsync request. |
| | 2452 | | /// </summary> |
| | 2453 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2454 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 2455 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2456 | | /// <param name="fileAttributes">If specified, the provided file attributes shall be set. Default value: ‘Ar |
| | 2457 | | /// <param name="fileCreationTime">Creation time for the file/directory. Default value: Now.</param> |
| | 2458 | | /// <param name="fileLastWriteTime">Last write time for the file/directory. Default value: Now.</param> |
| | 2459 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2460 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 2461 | | /// <param name="filePermission">If specified the permission (security descriptor) shall be set for the dire |
| | 2462 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file. Note: Only one o |
| | 2463 | | /// <returns>The Directory.CreateAsync Message.</returns> |
| | 2464 | | internal static Azure.Core.HttpMessage CreateAsync_CreateMessage( |
| | 2465 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2466 | | System.Uri resourceUri, |
| | 2467 | | string version, |
| | 2468 | | string fileAttributes, |
| | 2469 | | string fileCreationTime, |
| | 2470 | | string fileLastWriteTime, |
| | 2471 | | int? timeout = default, |
| | 2472 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 2473 | | string filePermission = default, |
| | 2474 | | string filePermissionKey = default) |
| | 2475 | | { |
| | 2476 | | // Validation |
| | 2477 | | if (resourceUri == null) |
| | 2478 | | { |
| | 2479 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 2480 | | } |
| | 2481 | | if (version == null) |
| | 2482 | | { |
| | 2483 | | throw new System.ArgumentNullException(nameof(version)); |
| | 2484 | | } |
| | 2485 | | if (fileAttributes == null) |
| | 2486 | | { |
| | 2487 | | throw new System.ArgumentNullException(nameof(fileAttributes)); |
| | 2488 | | } |
| | 2489 | | if (fileCreationTime == null) |
| | 2490 | | { |
| | 2491 | | throw new System.ArgumentNullException(nameof(fileCreationTime)); |
| | 2492 | | } |
| | 2493 | | if (fileLastWriteTime == null) |
| | 2494 | | { |
| | 2495 | | throw new System.ArgumentNullException(nameof(fileLastWriteTime)); |
| | 2496 | | } |
| | 2497 | |
|
| | 2498 | | // Create the request |
| | 2499 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 2500 | | Azure.Core.Request _request = _message.Request; |
| | 2501 | |
|
| | 2502 | | // Set the endpoint |
| | 2503 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 2504 | | _request.Uri.Reset(resourceUri); |
| | 2505 | | _request.Uri.AppendQuery("restype", "directory", escapeValue: false); |
| | 2506 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 2507 | |
|
| | 2508 | | // Add request headers |
| | 2509 | | _request.Headers.SetValue("x-ms-version", version); |
| | 2510 | | _request.Headers.SetValue("x-ms-file-attributes", fileAttributes); |
| | 2511 | | _request.Headers.SetValue("x-ms-file-creation-time", fileCreationTime); |
| | 2512 | | _request.Headers.SetValue("x-ms-file-last-write-time", fileLastWriteTime); |
| | 2513 | | if (metadata != null) { |
| | 2514 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 2515 | | { |
| | 2516 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 2517 | | } |
| | 2518 | | } |
| | 2519 | | if (filePermission != null) { _request.Headers.SetValue("x-ms-file-permission", filePermission); } |
| | 2520 | | if (filePermissionKey != null) { _request.Headers.SetValue("x-ms-file-permission-key", filePermissionKey |
| | 2521 | |
|
| | 2522 | | return _message; |
| | 2523 | | } |
| | 2524 | |
|
| | 2525 | | /// <summary> |
| | 2526 | | /// Create the Directory.CreateAsync response or throw a failure exception. |
| | 2527 | | /// </summary> |
| | 2528 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 2529 | | /// <param name="response">The raw Response.</param> |
| | 2530 | | /// <returns>The Directory.CreateAsync Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageDirectoryI |
| | 2531 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.RawStorageDirectoryInfo> CreateAsync_Create |
| | 2532 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2533 | | Azure.Response response) |
| | 2534 | | { |
| | 2535 | | // Process the response |
| | 2536 | | switch (response.Status) |
| | 2537 | | { |
| | 2538 | | case 201: |
| | 2539 | | { |
| | 2540 | | // Create the result |
| | 2541 | | Azure.Storage.Files.Shares.Models.RawStorageDirectoryInfo _value = new Azure.Storage.Files.Share |
| | 2542 | |
|
| | 2543 | | // Get response headers |
| | 2544 | | string _header; |
| | 2545 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 2546 | | { |
| | 2547 | | _value.ETag = new Azure.ETag(_header); |
| | 2548 | | } |
| | 2549 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 2550 | | { |
| | 2551 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 2552 | | } |
| | 2553 | | if (response.Headers.TryGetValue("x-ms-file-permission-key", out _header)) |
| | 2554 | | { |
| | 2555 | | _value.FilePermissionKey = _header; |
| | 2556 | | } |
| | 2557 | | if (response.Headers.TryGetValue("x-ms-file-attributes", out _header)) |
| | 2558 | | { |
| | 2559 | | _value.FileAttributes = _header; |
| | 2560 | | } |
| | 2561 | | if (response.Headers.TryGetValue("x-ms-file-creation-time", out _header)) |
| | 2562 | | { |
| | 2563 | | _value.FileCreationTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureI |
| | 2564 | | } |
| | 2565 | | if (response.Headers.TryGetValue("x-ms-file-last-write-time", out _header)) |
| | 2566 | | { |
| | 2567 | | _value.FileLastWriteTime = System.DateTimeOffset.Parse(_header, System.Globalization.Culture |
| | 2568 | | } |
| | 2569 | | if (response.Headers.TryGetValue("x-ms-file-change-time", out _header)) |
| | 2570 | | { |
| | 2571 | | _value.FileChangeTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInf |
| | 2572 | | } |
| | 2573 | | if (response.Headers.TryGetValue("x-ms-file-id", out _header)) |
| | 2574 | | { |
| | 2575 | | _value.FileId = _header; |
| | 2576 | | } |
| | 2577 | | if (response.Headers.TryGetValue("x-ms-file-parent-id", out _header)) |
| | 2578 | | { |
| | 2579 | | _value.FileParentId = _header; |
| | 2580 | | } |
| | 2581 | |
|
| | 2582 | | // Create the response |
| | 2583 | | return Response.FromValue(_value, response); |
| | 2584 | | } |
| | 2585 | | default: |
| | 2586 | | { |
| | 2587 | | // Create the result |
| | 2588 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2589 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 2590 | |
|
| | 2591 | | throw _value.CreateException(clientDiagnostics, response); |
| | 2592 | | } |
| | 2593 | | } |
| | 2594 | | } |
| | 2595 | | #endregion Directory.CreateAsync |
| | 2596 | |
|
| | 2597 | | #region Directory.GetPropertiesAsync |
| | 2598 | | /// <summary> |
| | 2599 | | /// Returns all system properties for the specified directory, and can also be used to check the existence o |
| | 2600 | | /// </summary> |
| | 2601 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2602 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2603 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 2604 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2605 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 2606 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2607 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2608 | | /// <param name="operationName">Operation name.</param> |
| | 2609 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2610 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageDirectoryProperties}</returns> |
| | 2611 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.RawSto |
| | 2612 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2613 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2614 | | System.Uri resourceUri, |
| | 2615 | | string version, |
| | 2616 | | string sharesnapshot = default, |
| | 2617 | | int? timeout = default, |
| | 2618 | | bool async = true, |
| | 2619 | | string operationName = "DirectoryClient.GetProperties", |
| | 2620 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2621 | | { |
| | 2622 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2623 | | try |
| | 2624 | | { |
| | 2625 | | _scope.AddAttribute("url", resourceUri); |
| | 2626 | | _scope.Start(); |
| | 2627 | | using (Azure.Core.HttpMessage _message = GetPropertiesAsync_CreateMessage( |
| | 2628 | | pipeline, |
| | 2629 | | resourceUri, |
| | 2630 | | version, |
| | 2631 | | sharesnapshot, |
| | 2632 | | timeout)) |
| | 2633 | | { |
| | 2634 | | if (async) |
| | 2635 | | { |
| | 2636 | | // Send the request asynchronously if we're being called via an async path |
| | 2637 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2638 | | } |
| | 2639 | | else |
| | 2640 | | { |
| | 2641 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2642 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2643 | | pipeline.Send(_message, cancellationToken); |
| | 2644 | | } |
| | 2645 | | Azure.Response _response = _message.Response; |
| | 2646 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2647 | | return GetPropertiesAsync_CreateResponse(clientDiagnostics, _response); |
| | 2648 | | } |
| | 2649 | | } |
| | 2650 | | catch (System.Exception ex) |
| | 2651 | | { |
| | 2652 | | _scope.Failed(ex); |
| | 2653 | | throw; |
| | 2654 | | } |
| | 2655 | | finally |
| | 2656 | | { |
| | 2657 | | _scope.Dispose(); |
| | 2658 | | } |
| | 2659 | | } |
| | 2660 | |
|
| | 2661 | | /// <summary> |
| | 2662 | | /// Create the Directory.GetPropertiesAsync request. |
| | 2663 | | /// </summary> |
| | 2664 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2665 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 2666 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2667 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 2668 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2669 | | /// <returns>The Directory.GetPropertiesAsync Message.</returns> |
| | 2670 | | internal static Azure.Core.HttpMessage GetPropertiesAsync_CreateMessage( |
| | 2671 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2672 | | System.Uri resourceUri, |
| | 2673 | | string version, |
| | 2674 | | string sharesnapshot = default, |
| | 2675 | | int? timeout = default) |
| | 2676 | | { |
| | 2677 | | // Validation |
| | 2678 | | if (resourceUri == null) |
| | 2679 | | { |
| | 2680 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 2681 | | } |
| | 2682 | | if (version == null) |
| | 2683 | | { |
| | 2684 | | throw new System.ArgumentNullException(nameof(version)); |
| | 2685 | | } |
| | 2686 | |
|
| | 2687 | | // Create the request |
| | 2688 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 2689 | | Azure.Core.Request _request = _message.Request; |
| | 2690 | |
|
| | 2691 | | // Set the endpoint |
| | 2692 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 2693 | | _request.Uri.Reset(resourceUri); |
| | 2694 | | _request.Uri.AppendQuery("restype", "directory", escapeValue: false); |
| | 2695 | | if (sharesnapshot != null) { _request.Uri.AppendQuery("sharesnapshot", sharesnapshot); } |
| | 2696 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 2697 | |
|
| | 2698 | | // Add request headers |
| | 2699 | | _request.Headers.SetValue("x-ms-version", version); |
| | 2700 | |
|
| | 2701 | | return _message; |
| | 2702 | | } |
| | 2703 | |
|
| | 2704 | | /// <summary> |
| | 2705 | | /// Create the Directory.GetPropertiesAsync response or throw a failure exception. |
| | 2706 | | /// </summary> |
| | 2707 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 2708 | | /// <param name="response">The raw Response.</param> |
| | 2709 | | /// <returns>The Directory.GetPropertiesAsync Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageDir |
| | 2710 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.RawStorageDirectoryProperties> GetPropertie |
| | 2711 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2712 | | Azure.Response response) |
| | 2713 | | { |
| | 2714 | | // Process the response |
| | 2715 | | switch (response.Status) |
| | 2716 | | { |
| | 2717 | | case 200: |
| | 2718 | | { |
| | 2719 | | // Create the result |
| | 2720 | | Azure.Storage.Files.Shares.Models.RawStorageDirectoryProperties _value = new Azure.Storage.Files |
| | 2721 | |
|
| | 2722 | | // Get response headers |
| | 2723 | | string _header; |
| | 2724 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompare |
| | 2725 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 2726 | | { |
| | 2727 | | if (_headerPair.Name.StartsWith("x-ms-meta-", System.StringComparison.InvariantCulture)) |
| | 2728 | | { |
| | 2729 | | _value.Metadata[_headerPair.Name.Substring(10)] = _headerPair.Value; |
| | 2730 | | } |
| | 2731 | | } |
| | 2732 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 2733 | | { |
| | 2734 | | _value.ETag = new Azure.ETag(_header); |
| | 2735 | | } |
| | 2736 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 2737 | | { |
| | 2738 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 2739 | | } |
| | 2740 | | if (response.Headers.TryGetValue("x-ms-server-encrypted", out _header)) |
| | 2741 | | { |
| | 2742 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 2743 | | } |
| | 2744 | | if (response.Headers.TryGetValue("x-ms-file-attributes", out _header)) |
| | 2745 | | { |
| | 2746 | | _value.FileAttributes = _header; |
| | 2747 | | } |
| | 2748 | | if (response.Headers.TryGetValue("x-ms-file-creation-time", out _header)) |
| | 2749 | | { |
| | 2750 | | _value.FileCreationTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureI |
| | 2751 | | } |
| | 2752 | | if (response.Headers.TryGetValue("x-ms-file-last-write-time", out _header)) |
| | 2753 | | { |
| | 2754 | | _value.FileLastWriteTime = System.DateTimeOffset.Parse(_header, System.Globalization.Culture |
| | 2755 | | } |
| | 2756 | | if (response.Headers.TryGetValue("x-ms-file-change-time", out _header)) |
| | 2757 | | { |
| | 2758 | | _value.FileChangeTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInf |
| | 2759 | | } |
| | 2760 | | if (response.Headers.TryGetValue("x-ms-file-permission-key", out _header)) |
| | 2761 | | { |
| | 2762 | | _value.FilePermissionKey = _header; |
| | 2763 | | } |
| | 2764 | | if (response.Headers.TryGetValue("x-ms-file-id", out _header)) |
| | 2765 | | { |
| | 2766 | | _value.FileId = _header; |
| | 2767 | | } |
| | 2768 | | if (response.Headers.TryGetValue("x-ms-file-parent-id", out _header)) |
| | 2769 | | { |
| | 2770 | | _value.FileParentId = _header; |
| | 2771 | | } |
| | 2772 | |
|
| | 2773 | | // Create the response |
| | 2774 | | return Response.FromValue(_value, response); |
| | 2775 | | } |
| | 2776 | | case 304: |
| | 2777 | | { |
| | 2778 | | return new Azure.NoBodyResponse<Azure.Storage.Files.Shares.Models.RawStorageDirectoryProperties> |
| | 2779 | | } |
| | 2780 | | default: |
| | 2781 | | { |
| | 2782 | | // Create the result |
| | 2783 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2784 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 2785 | |
|
| | 2786 | | throw _value.CreateException(clientDiagnostics, response); |
| | 2787 | | } |
| | 2788 | | } |
| | 2789 | | } |
| | 2790 | | #endregion Directory.GetPropertiesAsync |
| | 2791 | |
|
| | 2792 | | #region Directory.DeleteAsync |
| | 2793 | | /// <summary> |
| | 2794 | | /// Removes the specified empty directory. Note that the directory must be empty before it can be deleted. |
| | 2795 | | /// </summary> |
| | 2796 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2797 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2798 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 2799 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2800 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2801 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2802 | | /// <param name="operationName">Operation name.</param> |
| | 2803 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2804 | | /// <returns>Azure.Response</returns> |
| | 2805 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> DeleteAsync( |
| | 2806 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2807 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2808 | | System.Uri resourceUri, |
| | 2809 | | string version, |
| | 2810 | | int? timeout = default, |
| | 2811 | | bool async = true, |
| | 2812 | | string operationName = "DirectoryClient.Delete", |
| | 2813 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2814 | | { |
| | 2815 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2816 | | try |
| | 2817 | | { |
| | 2818 | | _scope.AddAttribute("url", resourceUri); |
| | 2819 | | _scope.Start(); |
| | 2820 | | using (Azure.Core.HttpMessage _message = DeleteAsync_CreateMessage( |
| | 2821 | | pipeline, |
| | 2822 | | resourceUri, |
| | 2823 | | version, |
| | 2824 | | timeout)) |
| | 2825 | | { |
| | 2826 | | if (async) |
| | 2827 | | { |
| | 2828 | | // Send the request asynchronously if we're being called via an async path |
| | 2829 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2830 | | } |
| | 2831 | | else |
| | 2832 | | { |
| | 2833 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2834 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2835 | | pipeline.Send(_message, cancellationToken); |
| | 2836 | | } |
| | 2837 | | Azure.Response _response = _message.Response; |
| | 2838 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2839 | | return DeleteAsync_CreateResponse(clientDiagnostics, _response); |
| | 2840 | | } |
| | 2841 | | } |
| | 2842 | | catch (System.Exception ex) |
| | 2843 | | { |
| | 2844 | | _scope.Failed(ex); |
| | 2845 | | throw; |
| | 2846 | | } |
| | 2847 | | finally |
| | 2848 | | { |
| | 2849 | | _scope.Dispose(); |
| | 2850 | | } |
| | 2851 | | } |
| | 2852 | |
|
| | 2853 | | /// <summary> |
| | 2854 | | /// Create the Directory.DeleteAsync request. |
| | 2855 | | /// </summary> |
| | 2856 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2857 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 2858 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2859 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2860 | | /// <returns>The Directory.DeleteAsync Message.</returns> |
| | 2861 | | internal static Azure.Core.HttpMessage DeleteAsync_CreateMessage( |
| | 2862 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2863 | | System.Uri resourceUri, |
| | 2864 | | string version, |
| | 2865 | | int? timeout = default) |
| | 2866 | | { |
| | 2867 | | // Validation |
| | 2868 | | if (resourceUri == null) |
| | 2869 | | { |
| | 2870 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 2871 | | } |
| | 2872 | | if (version == null) |
| | 2873 | | { |
| | 2874 | | throw new System.ArgumentNullException(nameof(version)); |
| | 2875 | | } |
| | 2876 | |
|
| | 2877 | | // Create the request |
| | 2878 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 2879 | | Azure.Core.Request _request = _message.Request; |
| | 2880 | |
|
| | 2881 | | // Set the endpoint |
| | 2882 | | _request.Method = Azure.Core.RequestMethod.Delete; |
| | 2883 | | _request.Uri.Reset(resourceUri); |
| | 2884 | | _request.Uri.AppendQuery("restype", "directory", escapeValue: false); |
| | 2885 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 2886 | |
|
| | 2887 | | // Add request headers |
| | 2888 | | _request.Headers.SetValue("x-ms-version", version); |
| | 2889 | |
|
| | 2890 | | return _message; |
| | 2891 | | } |
| | 2892 | |
|
| | 2893 | | /// <summary> |
| | 2894 | | /// Create the Directory.DeleteAsync response or throw a failure exception. |
| | 2895 | | /// </summary> |
| | 2896 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 2897 | | /// <param name="response">The raw Response.</param> |
| | 2898 | | /// <returns>The Directory.DeleteAsync Azure.Response.</returns> |
| | 2899 | | internal static Azure.Response DeleteAsync_CreateResponse( |
| | 2900 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2901 | | Azure.Response response) |
| | 2902 | | { |
| | 2903 | | // Process the response |
| | 2904 | | switch (response.Status) |
| | 2905 | | { |
| | 2906 | | case 202: |
| | 2907 | | { |
| | 2908 | | return response; |
| | 2909 | | } |
| | 2910 | | default: |
| | 2911 | | { |
| | 2912 | | // Create the result |
| | 2913 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 2914 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 2915 | |
|
| | 2916 | | throw _value.CreateException(clientDiagnostics, response); |
| | 2917 | | } |
| | 2918 | | } |
| | 2919 | | } |
| | 2920 | | #endregion Directory.DeleteAsync |
| | 2921 | |
|
| | 2922 | | #region Directory.SetPropertiesAsync |
| | 2923 | | /// <summary> |
| | 2924 | | /// Sets properties on the directory. |
| | 2925 | | /// </summary> |
| | 2926 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 2927 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 2928 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 2929 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 2930 | | /// <param name="fileAttributes">If specified, the provided file attributes shall be set. Default value: ‘Ar |
| | 2931 | | /// <param name="fileCreationTime">Creation time for the file/directory. Default value: Now.</param> |
| | 2932 | | /// <param name="fileLastWriteTime">Last write time for the file/directory. Default value: Now.</param> |
| | 2933 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 2934 | | /// <param name="filePermission">If specified the permission (security descriptor) shall be set for the dire |
| | 2935 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file. Note: Only one o |
| | 2936 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 2937 | | /// <param name="operationName">Operation name.</param> |
| | 2938 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 2939 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageDirectoryInfo}</returns> |
| | 2940 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.RawSto |
| | 2941 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 2942 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 2943 | | System.Uri resourceUri, |
| | 2944 | | string version, |
| | 2945 | | string fileAttributes, |
| | 2946 | | string fileCreationTime, |
| | 2947 | | string fileLastWriteTime, |
| | 2948 | | int? timeout = default, |
| | 2949 | | string filePermission = default, |
| | 2950 | | string filePermissionKey = default, |
| | 2951 | | bool async = true, |
| | 2952 | | string operationName = "DirectoryClient.SetProperties", |
| | 2953 | | System.Threading.CancellationToken cancellationToken = default) |
| | 2954 | | { |
| | 2955 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 2956 | | try |
| | 2957 | | { |
| | 2958 | | _scope.AddAttribute("url", resourceUri); |
| | 2959 | | _scope.Start(); |
| | 2960 | | using (Azure.Core.HttpMessage _message = SetPropertiesAsync_CreateMessage( |
| | 2961 | | pipeline, |
| | 2962 | | resourceUri, |
| | 2963 | | version, |
| | 2964 | | fileAttributes, |
| | 2965 | | fileCreationTime, |
| | 2966 | | fileLastWriteTime, |
| | 2967 | | timeout, |
| | 2968 | | filePermission, |
| | 2969 | | filePermissionKey)) |
| | 2970 | | { |
| | 2971 | | if (async) |
| | 2972 | | { |
| | 2973 | | // Send the request asynchronously if we're being called via an async path |
| | 2974 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 2975 | | } |
| | 2976 | | else |
| | 2977 | | { |
| | 2978 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 2979 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 2980 | | pipeline.Send(_message, cancellationToken); |
| | 2981 | | } |
| | 2982 | | Azure.Response _response = _message.Response; |
| | 2983 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 2984 | | return SetPropertiesAsync_CreateResponse(clientDiagnostics, _response); |
| | 2985 | | } |
| | 2986 | | } |
| | 2987 | | catch (System.Exception ex) |
| | 2988 | | { |
| | 2989 | | _scope.Failed(ex); |
| | 2990 | | throw; |
| | 2991 | | } |
| | 2992 | | finally |
| | 2993 | | { |
| | 2994 | | _scope.Dispose(); |
| | 2995 | | } |
| | 2996 | | } |
| | 2997 | |
|
| | 2998 | | /// <summary> |
| | 2999 | | /// Create the Directory.SetPropertiesAsync request. |
| | 3000 | | /// </summary> |
| | 3001 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3002 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 3003 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3004 | | /// <param name="fileAttributes">If specified, the provided file attributes shall be set. Default value: ‘Ar |
| | 3005 | | /// <param name="fileCreationTime">Creation time for the file/directory. Default value: Now.</param> |
| | 3006 | | /// <param name="fileLastWriteTime">Last write time for the file/directory. Default value: Now.</param> |
| | 3007 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3008 | | /// <param name="filePermission">If specified the permission (security descriptor) shall be set for the dire |
| | 3009 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file. Note: Only one o |
| | 3010 | | /// <returns>The Directory.SetPropertiesAsync Message.</returns> |
| | 3011 | | internal static Azure.Core.HttpMessage SetPropertiesAsync_CreateMessage( |
| | 3012 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3013 | | System.Uri resourceUri, |
| | 3014 | | string version, |
| | 3015 | | string fileAttributes, |
| | 3016 | | string fileCreationTime, |
| | 3017 | | string fileLastWriteTime, |
| | 3018 | | int? timeout = default, |
| | 3019 | | string filePermission = default, |
| | 3020 | | string filePermissionKey = default) |
| | 3021 | | { |
| | 3022 | | // Validation |
| | 3023 | | if (resourceUri == null) |
| | 3024 | | { |
| | 3025 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 3026 | | } |
| | 3027 | | if (version == null) |
| | 3028 | | { |
| | 3029 | | throw new System.ArgumentNullException(nameof(version)); |
| | 3030 | | } |
| | 3031 | | if (fileAttributes == null) |
| | 3032 | | { |
| | 3033 | | throw new System.ArgumentNullException(nameof(fileAttributes)); |
| | 3034 | | } |
| | 3035 | | if (fileCreationTime == null) |
| | 3036 | | { |
| | 3037 | | throw new System.ArgumentNullException(nameof(fileCreationTime)); |
| | 3038 | | } |
| | 3039 | | if (fileLastWriteTime == null) |
| | 3040 | | { |
| | 3041 | | throw new System.ArgumentNullException(nameof(fileLastWriteTime)); |
| | 3042 | | } |
| | 3043 | |
|
| | 3044 | | // Create the request |
| | 3045 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 3046 | | Azure.Core.Request _request = _message.Request; |
| | 3047 | |
|
| | 3048 | | // Set the endpoint |
| | 3049 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 3050 | | _request.Uri.Reset(resourceUri); |
| | 3051 | | _request.Uri.AppendQuery("restype", "directory", escapeValue: false); |
| | 3052 | | _request.Uri.AppendQuery("comp", "properties", escapeValue: false); |
| | 3053 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 3054 | |
|
| | 3055 | | // Add request headers |
| | 3056 | | _request.Headers.SetValue("x-ms-version", version); |
| | 3057 | | _request.Headers.SetValue("x-ms-file-attributes", fileAttributes); |
| | 3058 | | _request.Headers.SetValue("x-ms-file-creation-time", fileCreationTime); |
| | 3059 | | _request.Headers.SetValue("x-ms-file-last-write-time", fileLastWriteTime); |
| | 3060 | | if (filePermission != null) { _request.Headers.SetValue("x-ms-file-permission", filePermission); } |
| | 3061 | | if (filePermissionKey != null) { _request.Headers.SetValue("x-ms-file-permission-key", filePermissionKey |
| | 3062 | |
|
| | 3063 | | return _message; |
| | 3064 | | } |
| | 3065 | |
|
| | 3066 | | /// <summary> |
| | 3067 | | /// Create the Directory.SetPropertiesAsync response or throw a failure exception. |
| | 3068 | | /// </summary> |
| | 3069 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 3070 | | /// <param name="response">The raw Response.</param> |
| | 3071 | | /// <returns>The Directory.SetPropertiesAsync Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageDir |
| | 3072 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.RawStorageDirectoryInfo> SetPropertiesAsync |
| | 3073 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3074 | | Azure.Response response) |
| | 3075 | | { |
| | 3076 | | // Process the response |
| | 3077 | | switch (response.Status) |
| | 3078 | | { |
| | 3079 | | case 200: |
| | 3080 | | { |
| | 3081 | | // Create the result |
| | 3082 | | Azure.Storage.Files.Shares.Models.RawStorageDirectoryInfo _value = new Azure.Storage.Files.Share |
| | 3083 | |
|
| | 3084 | | // Get response headers |
| | 3085 | | string _header; |
| | 3086 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 3087 | | { |
| | 3088 | | _value.ETag = new Azure.ETag(_header); |
| | 3089 | | } |
| | 3090 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 3091 | | { |
| | 3092 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 3093 | | } |
| | 3094 | | if (response.Headers.TryGetValue("x-ms-file-permission-key", out _header)) |
| | 3095 | | { |
| | 3096 | | _value.FilePermissionKey = _header; |
| | 3097 | | } |
| | 3098 | | if (response.Headers.TryGetValue("x-ms-file-attributes", out _header)) |
| | 3099 | | { |
| | 3100 | | _value.FileAttributes = _header; |
| | 3101 | | } |
| | 3102 | | if (response.Headers.TryGetValue("x-ms-file-creation-time", out _header)) |
| | 3103 | | { |
| | 3104 | | _value.FileCreationTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureI |
| | 3105 | | } |
| | 3106 | | if (response.Headers.TryGetValue("x-ms-file-last-write-time", out _header)) |
| | 3107 | | { |
| | 3108 | | _value.FileLastWriteTime = System.DateTimeOffset.Parse(_header, System.Globalization.Culture |
| | 3109 | | } |
| | 3110 | | if (response.Headers.TryGetValue("x-ms-file-change-time", out _header)) |
| | 3111 | | { |
| | 3112 | | _value.FileChangeTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInf |
| | 3113 | | } |
| | 3114 | | if (response.Headers.TryGetValue("x-ms-file-id", out _header)) |
| | 3115 | | { |
| | 3116 | | _value.FileId = _header; |
| | 3117 | | } |
| | 3118 | | if (response.Headers.TryGetValue("x-ms-file-parent-id", out _header)) |
| | 3119 | | { |
| | 3120 | | _value.FileParentId = _header; |
| | 3121 | | } |
| | 3122 | |
|
| | 3123 | | // Create the response |
| | 3124 | | return Response.FromValue(_value, response); |
| | 3125 | | } |
| | 3126 | | default: |
| | 3127 | | { |
| | 3128 | | // Create the result |
| | 3129 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3130 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 3131 | |
|
| | 3132 | | throw _value.CreateException(clientDiagnostics, response); |
| | 3133 | | } |
| | 3134 | | } |
| | 3135 | | } |
| | 3136 | | #endregion Directory.SetPropertiesAsync |
| | 3137 | |
|
| | 3138 | | #region Directory.SetMetadataAsync |
| | 3139 | | /// <summary> |
| | 3140 | | /// Updates user defined metadata for the specified directory. |
| | 3141 | | /// </summary> |
| | 3142 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 3143 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3144 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 3145 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3146 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3147 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 3148 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 3149 | | /// <param name="operationName">Operation name.</param> |
| | 3150 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 3151 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageDirectoryInfo}</returns> |
| | 3152 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.RawSto |
| | 3153 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3154 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3155 | | System.Uri resourceUri, |
| | 3156 | | string version, |
| | 3157 | | int? timeout = default, |
| | 3158 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 3159 | | bool async = true, |
| | 3160 | | string operationName = "DirectoryClient.SetMetadata", |
| | 3161 | | System.Threading.CancellationToken cancellationToken = default) |
| | 3162 | | { |
| | 3163 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 3164 | | try |
| | 3165 | | { |
| | 3166 | | _scope.AddAttribute("url", resourceUri); |
| | 3167 | | _scope.Start(); |
| | 3168 | | using (Azure.Core.HttpMessage _message = SetMetadataAsync_CreateMessage( |
| | 3169 | | pipeline, |
| | 3170 | | resourceUri, |
| | 3171 | | version, |
| | 3172 | | timeout, |
| | 3173 | | metadata)) |
| | 3174 | | { |
| | 3175 | | if (async) |
| | 3176 | | { |
| | 3177 | | // Send the request asynchronously if we're being called via an async path |
| | 3178 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 3179 | | } |
| | 3180 | | else |
| | 3181 | | { |
| | 3182 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 3183 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 3184 | | pipeline.Send(_message, cancellationToken); |
| | 3185 | | } |
| | 3186 | | Azure.Response _response = _message.Response; |
| | 3187 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 3188 | | return SetMetadataAsync_CreateResponse(clientDiagnostics, _response); |
| | 3189 | | } |
| | 3190 | | } |
| | 3191 | | catch (System.Exception ex) |
| | 3192 | | { |
| | 3193 | | _scope.Failed(ex); |
| | 3194 | | throw; |
| | 3195 | | } |
| | 3196 | | finally |
| | 3197 | | { |
| | 3198 | | _scope.Dispose(); |
| | 3199 | | } |
| | 3200 | | } |
| | 3201 | |
|
| | 3202 | | /// <summary> |
| | 3203 | | /// Create the Directory.SetMetadataAsync request. |
| | 3204 | | /// </summary> |
| | 3205 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3206 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 3207 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3208 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3209 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 3210 | | /// <returns>The Directory.SetMetadataAsync Message.</returns> |
| | 3211 | | internal static Azure.Core.HttpMessage SetMetadataAsync_CreateMessage( |
| | 3212 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3213 | | System.Uri resourceUri, |
| | 3214 | | string version, |
| | 3215 | | int? timeout = default, |
| | 3216 | | System.Collections.Generic.IDictionary<string, string> metadata = default) |
| | 3217 | | { |
| | 3218 | | // Validation |
| | 3219 | | if (resourceUri == null) |
| | 3220 | | { |
| | 3221 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 3222 | | } |
| | 3223 | | if (version == null) |
| | 3224 | | { |
| | 3225 | | throw new System.ArgumentNullException(nameof(version)); |
| | 3226 | | } |
| | 3227 | |
|
| | 3228 | | // Create the request |
| | 3229 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 3230 | | Azure.Core.Request _request = _message.Request; |
| | 3231 | |
|
| | 3232 | | // Set the endpoint |
| | 3233 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 3234 | | _request.Uri.Reset(resourceUri); |
| | 3235 | | _request.Uri.AppendQuery("restype", "directory", escapeValue: false); |
| | 3236 | | _request.Uri.AppendQuery("comp", "metadata", escapeValue: false); |
| | 3237 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 3238 | |
|
| | 3239 | | // Add request headers |
| | 3240 | | _request.Headers.SetValue("x-ms-version", version); |
| | 3241 | | if (metadata != null) { |
| | 3242 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 3243 | | { |
| | 3244 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 3245 | | } |
| | 3246 | | } |
| | 3247 | |
|
| | 3248 | | return _message; |
| | 3249 | | } |
| | 3250 | |
|
| | 3251 | | /// <summary> |
| | 3252 | | /// Create the Directory.SetMetadataAsync response or throw a failure exception. |
| | 3253 | | /// </summary> |
| | 3254 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 3255 | | /// <param name="response">The raw Response.</param> |
| | 3256 | | /// <returns>The Directory.SetMetadataAsync Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageDirec |
| | 3257 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.RawStorageDirectoryInfo> SetMetadataAsync_C |
| | 3258 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3259 | | Azure.Response response) |
| | 3260 | | { |
| | 3261 | | // Process the response |
| | 3262 | | switch (response.Status) |
| | 3263 | | { |
| | 3264 | | case 200: |
| | 3265 | | { |
| | 3266 | | // Create the result |
| | 3267 | | Azure.Storage.Files.Shares.Models.RawStorageDirectoryInfo _value = new Azure.Storage.Files.Share |
| | 3268 | |
|
| | 3269 | | // Get response headers |
| | 3270 | | string _header; |
| | 3271 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 3272 | | { |
| | 3273 | | _value.ETag = new Azure.ETag(_header); |
| | 3274 | | } |
| | 3275 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 3276 | | { |
| | 3277 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 3278 | | } |
| | 3279 | |
|
| | 3280 | | // Create the response |
| | 3281 | | return Response.FromValue(_value, response); |
| | 3282 | | } |
| | 3283 | | default: |
| | 3284 | | { |
| | 3285 | | // Create the result |
| | 3286 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3287 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 3288 | |
|
| | 3289 | | throw _value.CreateException(clientDiagnostics, response); |
| | 3290 | | } |
| | 3291 | | } |
| | 3292 | | } |
| | 3293 | | #endregion Directory.SetMetadataAsync |
| | 3294 | |
|
| | 3295 | | #region Directory.ListFilesAndDirectoriesSegmentAsync |
| | 3296 | | /// <summary> |
| | 3297 | | /// Returns a list of files or directories under the specified share or directory. It lists the contents onl |
| | 3298 | | /// </summary> |
| | 3299 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 3300 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3301 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 3302 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3303 | | /// <param name="prefix">Filters the results to return only entries whose name begins with the specified pre |
| | 3304 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 3305 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 3306 | | /// <param name="maxresults">Specifies the maximum number of entries to return. If the request does not spec |
| | 3307 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3308 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 3309 | | /// <param name="operationName">Operation name.</param> |
| | 3310 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 3311 | | /// <returns>An enumeration of directories and files.</returns> |
| | 3312 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.FilesA |
| | 3313 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3314 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3315 | | System.Uri resourceUri, |
| | 3316 | | string version, |
| | 3317 | | string prefix = default, |
| | 3318 | | string sharesnapshot = default, |
| | 3319 | | string marker = default, |
| | 3320 | | int? maxresults = default, |
| | 3321 | | int? timeout = default, |
| | 3322 | | bool async = true, |
| | 3323 | | string operationName = "DirectoryClient.ListFilesAndDirectoriesSegment", |
| | 3324 | | System.Threading.CancellationToken cancellationToken = default) |
| | 3325 | | { |
| | 3326 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 3327 | | try |
| | 3328 | | { |
| | 3329 | | _scope.AddAttribute("url", resourceUri); |
| | 3330 | | _scope.Start(); |
| | 3331 | | using (Azure.Core.HttpMessage _message = ListFilesAndDirectoriesSegmentAsync_CreateMessage( |
| | 3332 | | pipeline, |
| | 3333 | | resourceUri, |
| | 3334 | | version, |
| | 3335 | | prefix, |
| | 3336 | | sharesnapshot, |
| | 3337 | | marker, |
| | 3338 | | maxresults, |
| | 3339 | | timeout)) |
| | 3340 | | { |
| | 3341 | | if (async) |
| | 3342 | | { |
| | 3343 | | // Send the request asynchronously if we're being called via an async path |
| | 3344 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 3345 | | } |
| | 3346 | | else |
| | 3347 | | { |
| | 3348 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 3349 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 3350 | | pipeline.Send(_message, cancellationToken); |
| | 3351 | | } |
| | 3352 | | Azure.Response _response = _message.Response; |
| | 3353 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 3354 | | return ListFilesAndDirectoriesSegmentAsync_CreateResponse(clientDiagnostics, _response); |
| | 3355 | | } |
| | 3356 | | } |
| | 3357 | | catch (System.Exception ex) |
| | 3358 | | { |
| | 3359 | | _scope.Failed(ex); |
| | 3360 | | throw; |
| | 3361 | | } |
| | 3362 | | finally |
| | 3363 | | { |
| | 3364 | | _scope.Dispose(); |
| | 3365 | | } |
| | 3366 | | } |
| | 3367 | |
|
| | 3368 | | /// <summary> |
| | 3369 | | /// Create the Directory.ListFilesAndDirectoriesSegmentAsync request. |
| | 3370 | | /// </summary> |
| | 3371 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3372 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 3373 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3374 | | /// <param name="prefix">Filters the results to return only entries whose name begins with the specified pre |
| | 3375 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 3376 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 3377 | | /// <param name="maxresults">Specifies the maximum number of entries to return. If the request does not spec |
| | 3378 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3379 | | /// <returns>The Directory.ListFilesAndDirectoriesSegmentAsync Message.</returns> |
| | 3380 | | internal static Azure.Core.HttpMessage ListFilesAndDirectoriesSegmentAsync_CreateMessage( |
| | 3381 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3382 | | System.Uri resourceUri, |
| | 3383 | | string version, |
| | 3384 | | string prefix = default, |
| | 3385 | | string sharesnapshot = default, |
| | 3386 | | string marker = default, |
| | 3387 | | int? maxresults = default, |
| | 3388 | | int? timeout = default) |
| | 3389 | | { |
| | 3390 | | // Validation |
| | 3391 | | if (resourceUri == null) |
| | 3392 | | { |
| | 3393 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 3394 | | } |
| | 3395 | | if (version == null) |
| | 3396 | | { |
| | 3397 | | throw new System.ArgumentNullException(nameof(version)); |
| | 3398 | | } |
| | 3399 | |
|
| | 3400 | | // Create the request |
| | 3401 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 3402 | | Azure.Core.Request _request = _message.Request; |
| | 3403 | |
|
| | 3404 | | // Set the endpoint |
| | 3405 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 3406 | | _request.Uri.Reset(resourceUri); |
| | 3407 | | _request.Uri.AppendQuery("restype", "directory", escapeValue: false); |
| | 3408 | | _request.Uri.AppendQuery("comp", "list", escapeValue: false); |
| | 3409 | | if (prefix != null) { _request.Uri.AppendQuery("prefix", prefix); } |
| | 3410 | | if (sharesnapshot != null) { _request.Uri.AppendQuery("sharesnapshot", sharesnapshot); } |
| | 3411 | | if (marker != null) { _request.Uri.AppendQuery("marker", marker); } |
| | 3412 | | if (maxresults != null) { _request.Uri.AppendQuery("maxresults", maxresults.Value.ToString(System.Global |
| | 3413 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 3414 | |
|
| | 3415 | | // Add request headers |
| | 3416 | | _request.Headers.SetValue("x-ms-version", version); |
| | 3417 | |
|
| | 3418 | | return _message; |
| | 3419 | | } |
| | 3420 | |
|
| | 3421 | | /// <summary> |
| | 3422 | | /// Create the Directory.ListFilesAndDirectoriesSegmentAsync response or throw a failure exception. |
| | 3423 | | /// </summary> |
| | 3424 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 3425 | | /// <param name="response">The raw Response.</param> |
| | 3426 | | /// <returns>The Directory.ListFilesAndDirectoriesSegmentAsync Azure.Response{Azure.Storage.Files.Shares.Mod |
| | 3427 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.FilesAndDirectoriesSegment> ListFilesAndDir |
| | 3428 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3429 | | Azure.Response response) |
| | 3430 | | { |
| | 3431 | | // Process the response |
| | 3432 | | switch (response.Status) |
| | 3433 | | { |
| | 3434 | | case 200: |
| | 3435 | | { |
| | 3436 | | // Create the result |
| | 3437 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3438 | | Azure.Storage.Files.Shares.Models.FilesAndDirectoriesSegment _value = Azure.Storage.Files.Shares |
| | 3439 | |
|
| | 3440 | | // Create the response |
| | 3441 | | return Response.FromValue(_value, response); |
| | 3442 | | } |
| | 3443 | | case 304: |
| | 3444 | | { |
| | 3445 | | return new Azure.NoBodyResponse<Azure.Storage.Files.Shares.Models.FilesAndDirectoriesSegment>(re |
| | 3446 | | } |
| | 3447 | | default: |
| | 3448 | | { |
| | 3449 | | // Create the result |
| | 3450 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3451 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 3452 | |
|
| | 3453 | | throw _value.CreateException(clientDiagnostics, response); |
| | 3454 | | } |
| | 3455 | | } |
| | 3456 | | } |
| | 3457 | | #endregion Directory.ListFilesAndDirectoriesSegmentAsync |
| | 3458 | |
|
| | 3459 | | #region Directory.ListHandlesAsync |
| | 3460 | | /// <summary> |
| | 3461 | | /// Lists handles for directory. |
| | 3462 | | /// </summary> |
| | 3463 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 3464 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3465 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 3466 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3467 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 3468 | | /// <param name="maxresults">Specifies the maximum number of entries to return. If the request does not spec |
| | 3469 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3470 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 3471 | | /// <param name="recursive">Specifies operation should apply to the directory specified in the URI, its file |
| | 3472 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 3473 | | /// <param name="operationName">Operation name.</param> |
| | 3474 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 3475 | | /// <returns>An enumeration of handles.</returns> |
| | 3476 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.Storag |
| | 3477 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3478 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3479 | | System.Uri resourceUri, |
| | 3480 | | string version, |
| | 3481 | | string marker = default, |
| | 3482 | | int? maxresults = default, |
| | 3483 | | int? timeout = default, |
| | 3484 | | string sharesnapshot = default, |
| | 3485 | | bool? recursive = default, |
| | 3486 | | bool async = true, |
| | 3487 | | string operationName = "DirectoryClient.ListHandles", |
| | 3488 | | System.Threading.CancellationToken cancellationToken = default) |
| | 3489 | | { |
| | 3490 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 3491 | | try |
| | 3492 | | { |
| | 3493 | | _scope.AddAttribute("url", resourceUri); |
| | 3494 | | _scope.Start(); |
| | 3495 | | using (Azure.Core.HttpMessage _message = ListHandlesAsync_CreateMessage( |
| | 3496 | | pipeline, |
| | 3497 | | resourceUri, |
| | 3498 | | version, |
| | 3499 | | marker, |
| | 3500 | | maxresults, |
| | 3501 | | timeout, |
| | 3502 | | sharesnapshot, |
| | 3503 | | recursive)) |
| | 3504 | | { |
| | 3505 | | if (async) |
| | 3506 | | { |
| | 3507 | | // Send the request asynchronously if we're being called via an async path |
| | 3508 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 3509 | | } |
| | 3510 | | else |
| | 3511 | | { |
| | 3512 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 3513 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 3514 | | pipeline.Send(_message, cancellationToken); |
| | 3515 | | } |
| | 3516 | | Azure.Response _response = _message.Response; |
| | 3517 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 3518 | | return ListHandlesAsync_CreateResponse(clientDiagnostics, _response); |
| | 3519 | | } |
| | 3520 | | } |
| | 3521 | | catch (System.Exception ex) |
| | 3522 | | { |
| | 3523 | | _scope.Failed(ex); |
| | 3524 | | throw; |
| | 3525 | | } |
| | 3526 | | finally |
| | 3527 | | { |
| | 3528 | | _scope.Dispose(); |
| | 3529 | | } |
| | 3530 | | } |
| | 3531 | |
|
| | 3532 | | /// <summary> |
| | 3533 | | /// Create the Directory.ListHandlesAsync request. |
| | 3534 | | /// </summary> |
| | 3535 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3536 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 3537 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3538 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 3539 | | /// <param name="maxresults">Specifies the maximum number of entries to return. If the request does not spec |
| | 3540 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3541 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 3542 | | /// <param name="recursive">Specifies operation should apply to the directory specified in the URI, its file |
| | 3543 | | /// <returns>The Directory.ListHandlesAsync Message.</returns> |
| | 3544 | | internal static Azure.Core.HttpMessage ListHandlesAsync_CreateMessage( |
| | 3545 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3546 | | System.Uri resourceUri, |
| | 3547 | | string version, |
| | 3548 | | string marker = default, |
| | 3549 | | int? maxresults = default, |
| | 3550 | | int? timeout = default, |
| | 3551 | | string sharesnapshot = default, |
| | 3552 | | bool? recursive = default) |
| | 3553 | | { |
| | 3554 | | // Validation |
| | 3555 | | if (resourceUri == null) |
| | 3556 | | { |
| | 3557 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 3558 | | } |
| | 3559 | | if (version == null) |
| | 3560 | | { |
| | 3561 | | throw new System.ArgumentNullException(nameof(version)); |
| | 3562 | | } |
| | 3563 | |
|
| | 3564 | | // Create the request |
| | 3565 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 3566 | | Azure.Core.Request _request = _message.Request; |
| | 3567 | |
|
| | 3568 | | // Set the endpoint |
| | 3569 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 3570 | | _request.Uri.Reset(resourceUri); |
| | 3571 | | _request.Uri.AppendQuery("comp", "listhandles", escapeValue: false); |
| | 3572 | | if (marker != null) { _request.Uri.AppendQuery("marker", marker); } |
| | 3573 | | if (maxresults != null) { _request.Uri.AppendQuery("maxresults", maxresults.Value.ToString(System.Global |
| | 3574 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 3575 | | if (sharesnapshot != null) { _request.Uri.AppendQuery("sharesnapshot", sharesnapshot); } |
| | 3576 | |
|
| | 3577 | | // Add request headers |
| | 3578 | | _request.Headers.SetValue("x-ms-version", version); |
| | 3579 | | if (recursive != null) { |
| | 3580 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 3581 | | _request.Headers.SetValue("x-ms-recursive", recursive.Value.ToString(System.Globalization.CultureInfo.In |
| | 3582 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 3583 | | } |
| | 3584 | |
|
| | 3585 | | return _message; |
| | 3586 | | } |
| | 3587 | |
|
| | 3588 | | /// <summary> |
| | 3589 | | /// Create the Directory.ListHandlesAsync response or throw a failure exception. |
| | 3590 | | /// </summary> |
| | 3591 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 3592 | | /// <param name="response">The raw Response.</param> |
| | 3593 | | /// <returns>The Directory.ListHandlesAsync Azure.Response{Azure.Storage.Files.Shares.Models.StorageHandlesS |
| | 3594 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.StorageHandlesSegment> ListHandlesAsync_Cre |
| | 3595 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3596 | | Azure.Response response) |
| | 3597 | | { |
| | 3598 | | // Process the response |
| | 3599 | | switch (response.Status) |
| | 3600 | | { |
| | 3601 | | case 200: |
| | 3602 | | { |
| | 3603 | | // Create the result |
| | 3604 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3605 | | Azure.Storage.Files.Shares.Models.StorageHandlesSegment _value = Azure.Storage.Files.Shares.Mode |
| | 3606 | |
|
| | 3607 | | // Create the response |
| | 3608 | | return Response.FromValue(_value, response); |
| | 3609 | | } |
| | 3610 | | case 304: |
| | 3611 | | { |
| | 3612 | | return new Azure.NoBodyResponse<Azure.Storage.Files.Shares.Models.StorageHandlesSegment>(respons |
| | 3613 | | } |
| | 3614 | | default: |
| | 3615 | | { |
| | 3616 | | // Create the result |
| | 3617 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3618 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 3619 | |
|
| | 3620 | | throw _value.CreateException(clientDiagnostics, response); |
| | 3621 | | } |
| | 3622 | | } |
| | 3623 | | } |
| | 3624 | | #endregion Directory.ListHandlesAsync |
| | 3625 | |
|
| | 3626 | | #region Directory.ForceCloseHandlesAsync |
| | 3627 | | /// <summary> |
| | 3628 | | /// Closes all handles open for given directory. |
| | 3629 | | /// </summary> |
| | 3630 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 3631 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3632 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 3633 | | /// <param name="handleId">Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) |
| | 3634 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3635 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3636 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 3637 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 3638 | | /// <param name="recursive">Specifies operation should apply to the directory specified in the URI, its file |
| | 3639 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 3640 | | /// <param name="operationName">Operation name.</param> |
| | 3641 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 3642 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.StorageClosedHandlesSegment}</returns> |
| | 3643 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.Storag |
| | 3644 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3645 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3646 | | System.Uri resourceUri, |
| | 3647 | | string handleId, |
| | 3648 | | string version, |
| | 3649 | | int? timeout = default, |
| | 3650 | | string marker = default, |
| | 3651 | | string sharesnapshot = default, |
| | 3652 | | bool? recursive = default, |
| | 3653 | | bool async = true, |
| | 3654 | | string operationName = "DirectoryClient.ForceCloseHandles", |
| | 3655 | | System.Threading.CancellationToken cancellationToken = default) |
| | 3656 | | { |
| | 3657 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 3658 | | try |
| | 3659 | | { |
| | 3660 | | _scope.AddAttribute("url", resourceUri); |
| | 3661 | | _scope.Start(); |
| | 3662 | | using (Azure.Core.HttpMessage _message = ForceCloseHandlesAsync_CreateMessage( |
| | 3663 | | pipeline, |
| | 3664 | | resourceUri, |
| | 3665 | | handleId, |
| | 3666 | | version, |
| | 3667 | | timeout, |
| | 3668 | | marker, |
| | 3669 | | sharesnapshot, |
| | 3670 | | recursive)) |
| | 3671 | | { |
| | 3672 | | if (async) |
| | 3673 | | { |
| | 3674 | | // Send the request asynchronously if we're being called via an async path |
| | 3675 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 3676 | | } |
| | 3677 | | else |
| | 3678 | | { |
| | 3679 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 3680 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 3681 | | pipeline.Send(_message, cancellationToken); |
| | 3682 | | } |
| | 3683 | | Azure.Response _response = _message.Response; |
| | 3684 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 3685 | | return ForceCloseHandlesAsync_CreateResponse(clientDiagnostics, _response); |
| | 3686 | | } |
| | 3687 | | } |
| | 3688 | | catch (System.Exception ex) |
| | 3689 | | { |
| | 3690 | | _scope.Failed(ex); |
| | 3691 | | throw; |
| | 3692 | | } |
| | 3693 | | finally |
| | 3694 | | { |
| | 3695 | | _scope.Dispose(); |
| | 3696 | | } |
| | 3697 | | } |
| | 3698 | |
|
| | 3699 | | /// <summary> |
| | 3700 | | /// Create the Directory.ForceCloseHandlesAsync request. |
| | 3701 | | /// </summary> |
| | 3702 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3703 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 3704 | | /// <param name="handleId">Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) |
| | 3705 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3706 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3707 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 3708 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 3709 | | /// <param name="recursive">Specifies operation should apply to the directory specified in the URI, its file |
| | 3710 | | /// <returns>The Directory.ForceCloseHandlesAsync Message.</returns> |
| | 3711 | | internal static Azure.Core.HttpMessage ForceCloseHandlesAsync_CreateMessage( |
| | 3712 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3713 | | System.Uri resourceUri, |
| | 3714 | | string handleId, |
| | 3715 | | string version, |
| | 3716 | | int? timeout = default, |
| | 3717 | | string marker = default, |
| | 3718 | | string sharesnapshot = default, |
| | 3719 | | bool? recursive = default) |
| | 3720 | | { |
| | 3721 | | // Validation |
| | 3722 | | if (resourceUri == null) |
| | 3723 | | { |
| | 3724 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 3725 | | } |
| | 3726 | | if (handleId == null) |
| | 3727 | | { |
| | 3728 | | throw new System.ArgumentNullException(nameof(handleId)); |
| | 3729 | | } |
| | 3730 | | if (version == null) |
| | 3731 | | { |
| | 3732 | | throw new System.ArgumentNullException(nameof(version)); |
| | 3733 | | } |
| | 3734 | |
|
| | 3735 | | // Create the request |
| | 3736 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 3737 | | Azure.Core.Request _request = _message.Request; |
| | 3738 | |
|
| | 3739 | | // Set the endpoint |
| | 3740 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 3741 | | _request.Uri.Reset(resourceUri); |
| | 3742 | | _request.Uri.AppendQuery("comp", "forceclosehandles", escapeValue: false); |
| | 3743 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 3744 | | if (marker != null) { _request.Uri.AppendQuery("marker", marker); } |
| | 3745 | | if (sharesnapshot != null) { _request.Uri.AppendQuery("sharesnapshot", sharesnapshot); } |
| | 3746 | |
|
| | 3747 | | // Add request headers |
| | 3748 | | _request.Headers.SetValue("x-ms-handle-id", handleId); |
| | 3749 | | _request.Headers.SetValue("x-ms-version", version); |
| | 3750 | | if (recursive != null) { |
| | 3751 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 3752 | | _request.Headers.SetValue("x-ms-recursive", recursive.Value.ToString(System.Globalization.CultureInfo.In |
| | 3753 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 3754 | | } |
| | 3755 | |
|
| | 3756 | | return _message; |
| | 3757 | | } |
| | 3758 | |
|
| | 3759 | | /// <summary> |
| | 3760 | | /// Create the Directory.ForceCloseHandlesAsync response or throw a failure exception. |
| | 3761 | | /// </summary> |
| | 3762 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 3763 | | /// <param name="response">The raw Response.</param> |
| | 3764 | | /// <returns>The Directory.ForceCloseHandlesAsync Azure.Response{Azure.Storage.Files.Shares.Models.StorageCl |
| | 3765 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.StorageClosedHandlesSegment> ForceCloseHand |
| | 3766 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3767 | | Azure.Response response) |
| | 3768 | | { |
| | 3769 | | // Process the response |
| | 3770 | | switch (response.Status) |
| | 3771 | | { |
| | 3772 | | case 200: |
| | 3773 | | { |
| | 3774 | | // Create the result |
| | 3775 | | Azure.Storage.Files.Shares.Models.StorageClosedHandlesSegment _value = new Azure.Storage.Files.S |
| | 3776 | |
|
| | 3777 | | // Get response headers |
| | 3778 | | string _header; |
| | 3779 | | if (response.Headers.TryGetValue("x-ms-marker", out _header)) |
| | 3780 | | { |
| | 3781 | | _value.Marker = _header; |
| | 3782 | | } |
| | 3783 | | if (response.Headers.TryGetValue("x-ms-number-of-handles-closed", out _header)) |
| | 3784 | | { |
| | 3785 | | _value.NumberOfHandlesClosed = int.Parse(_header, System.Globalization.CultureInfo.Invariant |
| | 3786 | | } |
| | 3787 | | if (response.Headers.TryGetValue("x-ms-number-of-handles-failed", out _header)) |
| | 3788 | | { |
| | 3789 | | _value.NumberOfHandlesFailedToClose = int.Parse(_header, System.Globalization.CultureInfo.In |
| | 3790 | | } |
| | 3791 | |
|
| | 3792 | | // Create the response |
| | 3793 | | return Response.FromValue(_value, response); |
| | 3794 | | } |
| | 3795 | | default: |
| | 3796 | | { |
| | 3797 | | // Create the result |
| | 3798 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 3799 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 3800 | |
|
| | 3801 | | throw _value.CreateException(clientDiagnostics, response); |
| | 3802 | | } |
| | 3803 | | } |
| | 3804 | | } |
| | 3805 | | #endregion Directory.ForceCloseHandlesAsync |
| | 3806 | | } |
| | 3807 | | #endregion Directory operations |
| | 3808 | |
|
| | 3809 | | #region File operations |
| | 3810 | | /// <summary> |
| | 3811 | | /// File operations for Azure File Storage |
| | 3812 | | /// </summary> |
| | 3813 | | public static partial class File |
| | 3814 | | { |
| | 3815 | | #region File.CreateAsync |
| | 3816 | | /// <summary> |
| | 3817 | | /// Creates a new file or replaces a file. Note it only initializes the file with no content. |
| | 3818 | | /// </summary> |
| | 3819 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 3820 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3821 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 3822 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3823 | | /// <param name="fileContentLength">Specifies the maximum size for the file, up to 1 TB.</param> |
| | 3824 | | /// <param name="fileAttributes">If specified, the provided file attributes shall be set. Default value: ‘Ar |
| | 3825 | | /// <param name="fileCreationTime">Creation time for the file/directory. Default value: Now.</param> |
| | 3826 | | /// <param name="fileLastWriteTime">Last write time for the file/directory. Default value: Now.</param> |
| | 3827 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3828 | | /// <param name="fileContentType">Sets the MIME content type of the file. The default type is 'application/o |
| | 3829 | | /// <param name="fileContentEncoding">Specifies which content encodings have been applied to the file.</para |
| | 3830 | | /// <param name="fileContentLanguage">Specifies the natural languages used by this resource.</param> |
| | 3831 | | /// <param name="fileCacheControl">Sets the file's cache control. The File service stores this value but doe |
| | 3832 | | /// <param name="fileContentHash">Sets the file's MD5 hash.</param> |
| | 3833 | | /// <param name="fileContentDisposition">Sets the file's Content-Disposition header.</param> |
| | 3834 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 3835 | | /// <param name="filePermission">If specified the permission (security descriptor) shall be set for the dire |
| | 3836 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file. Note: Only one o |
| | 3837 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 3838 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 3839 | | /// <param name="operationName">Operation name.</param> |
| | 3840 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 3841 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageFileInfo}</returns> |
| | 3842 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.RawSto |
| | 3843 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 3844 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3845 | | System.Uri resourceUri, |
| | 3846 | | string version, |
| | 3847 | | long fileContentLength, |
| | 3848 | | string fileAttributes, |
| | 3849 | | string fileCreationTime, |
| | 3850 | | string fileLastWriteTime, |
| | 3851 | | int? timeout = default, |
| | 3852 | | string fileContentType = default, |
| | 3853 | | System.Collections.Generic.IEnumerable<string> fileContentEncoding = default, |
| | 3854 | | System.Collections.Generic.IEnumerable<string> fileContentLanguage = default, |
| | 3855 | | string fileCacheControl = default, |
| | 3856 | | byte[] fileContentHash = default, |
| | 3857 | | string fileContentDisposition = default, |
| | 3858 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 3859 | | string filePermission = default, |
| | 3860 | | string filePermissionKey = default, |
| | 3861 | | string leaseId = default, |
| | 3862 | | bool async = true, |
| | 3863 | | string operationName = "FileClient.Create", |
| | 3864 | | System.Threading.CancellationToken cancellationToken = default) |
| | 3865 | | { |
| | 3866 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 3867 | | try |
| | 3868 | | { |
| | 3869 | | _scope.AddAttribute("url", resourceUri); |
| | 3870 | | _scope.Start(); |
| | 3871 | | using (Azure.Core.HttpMessage _message = CreateAsync_CreateMessage( |
| | 3872 | | pipeline, |
| | 3873 | | resourceUri, |
| | 3874 | | version, |
| | 3875 | | fileContentLength, |
| | 3876 | | fileAttributes, |
| | 3877 | | fileCreationTime, |
| | 3878 | | fileLastWriteTime, |
| | 3879 | | timeout, |
| | 3880 | | fileContentType, |
| | 3881 | | fileContentEncoding, |
| | 3882 | | fileContentLanguage, |
| | 3883 | | fileCacheControl, |
| | 3884 | | fileContentHash, |
| | 3885 | | fileContentDisposition, |
| | 3886 | | metadata, |
| | 3887 | | filePermission, |
| | 3888 | | filePermissionKey, |
| | 3889 | | leaseId)) |
| | 3890 | | { |
| | 3891 | | if (async) |
| | 3892 | | { |
| | 3893 | | // Send the request asynchronously if we're being called via an async path |
| | 3894 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 3895 | | } |
| | 3896 | | else |
| | 3897 | | { |
| | 3898 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 3899 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 3900 | | pipeline.Send(_message, cancellationToken); |
| | 3901 | | } |
| | 3902 | | Azure.Response _response = _message.Response; |
| | 3903 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 3904 | | return CreateAsync_CreateResponse(clientDiagnostics, _response); |
| | 3905 | | } |
| | 3906 | | } |
| | 3907 | | catch (System.Exception ex) |
| | 3908 | | { |
| | 3909 | | _scope.Failed(ex); |
| | 3910 | | throw; |
| | 3911 | | } |
| | 3912 | | finally |
| | 3913 | | { |
| | 3914 | | _scope.Dispose(); |
| | 3915 | | } |
| | 3916 | | } |
| | 3917 | |
|
| | 3918 | | /// <summary> |
| | 3919 | | /// Create the File.CreateAsync request. |
| | 3920 | | /// </summary> |
| | 3921 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 3922 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 3923 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 3924 | | /// <param name="fileContentLength">Specifies the maximum size for the file, up to 1 TB.</param> |
| | 3925 | | /// <param name="fileAttributes">If specified, the provided file attributes shall be set. Default value: ‘Ar |
| | 3926 | | /// <param name="fileCreationTime">Creation time for the file/directory. Default value: Now.</param> |
| | 3927 | | /// <param name="fileLastWriteTime">Last write time for the file/directory. Default value: Now.</param> |
| | 3928 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 3929 | | /// <param name="fileContentType">Sets the MIME content type of the file. The default type is 'application/o |
| | 3930 | | /// <param name="fileContentEncoding">Specifies which content encodings have been applied to the file.</para |
| | 3931 | | /// <param name="fileContentLanguage">Specifies the natural languages used by this resource.</param> |
| | 3932 | | /// <param name="fileCacheControl">Sets the file's cache control. The File service stores this value but doe |
| | 3933 | | /// <param name="fileContentHash">Sets the file's MD5 hash.</param> |
| | 3934 | | /// <param name="fileContentDisposition">Sets the file's Content-Disposition header.</param> |
| | 3935 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 3936 | | /// <param name="filePermission">If specified the permission (security descriptor) shall be set for the dire |
| | 3937 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file. Note: Only one o |
| | 3938 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 3939 | | /// <returns>The File.CreateAsync Message.</returns> |
| | 3940 | | internal static Azure.Core.HttpMessage CreateAsync_CreateMessage( |
| | 3941 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 3942 | | System.Uri resourceUri, |
| | 3943 | | string version, |
| | 3944 | | long fileContentLength, |
| | 3945 | | string fileAttributes, |
| | 3946 | | string fileCreationTime, |
| | 3947 | | string fileLastWriteTime, |
| | 3948 | | int? timeout = default, |
| | 3949 | | string fileContentType = default, |
| | 3950 | | System.Collections.Generic.IEnumerable<string> fileContentEncoding = default, |
| | 3951 | | System.Collections.Generic.IEnumerable<string> fileContentLanguage = default, |
| | 3952 | | string fileCacheControl = default, |
| | 3953 | | byte[] fileContentHash = default, |
| | 3954 | | string fileContentDisposition = default, |
| | 3955 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 3956 | | string filePermission = default, |
| | 3957 | | string filePermissionKey = default, |
| | 3958 | | string leaseId = default) |
| | 3959 | | { |
| | 3960 | | // Validation |
| | 3961 | | if (resourceUri == null) |
| | 3962 | | { |
| | 3963 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 3964 | | } |
| | 3965 | | if (version == null) |
| | 3966 | | { |
| | 3967 | | throw new System.ArgumentNullException(nameof(version)); |
| | 3968 | | } |
| | 3969 | | if (fileAttributes == null) |
| | 3970 | | { |
| | 3971 | | throw new System.ArgumentNullException(nameof(fileAttributes)); |
| | 3972 | | } |
| | 3973 | | if (fileCreationTime == null) |
| | 3974 | | { |
| | 3975 | | throw new System.ArgumentNullException(nameof(fileCreationTime)); |
| | 3976 | | } |
| | 3977 | | if (fileLastWriteTime == null) |
| | 3978 | | { |
| | 3979 | | throw new System.ArgumentNullException(nameof(fileLastWriteTime)); |
| | 3980 | | } |
| | 3981 | |
|
| | 3982 | | // Create the request |
| | 3983 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 3984 | | Azure.Core.Request _request = _message.Request; |
| | 3985 | |
|
| | 3986 | | // Set the endpoint |
| | 3987 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 3988 | | _request.Uri.Reset(resourceUri); |
| | 3989 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 3990 | |
|
| | 3991 | | // Add request headers |
| | 3992 | | _request.Headers.SetValue("x-ms-version", version); |
| | 3993 | | _request.Headers.SetValue("x-ms-content-length", fileContentLength.ToString(System.Globalization.Culture |
| | 3994 | | _request.Headers.SetValue("x-ms-type", "file"); |
| | 3995 | | _request.Headers.SetValue("x-ms-file-attributes", fileAttributes); |
| | 3996 | | _request.Headers.SetValue("x-ms-file-creation-time", fileCreationTime); |
| | 3997 | | _request.Headers.SetValue("x-ms-file-last-write-time", fileLastWriteTime); |
| | 3998 | | if (fileContentType != null) { _request.Headers.SetValue("x-ms-content-type", fileContentType); } |
| | 3999 | | if (fileContentEncoding != null) { |
| | 4000 | | foreach (string _item in fileContentEncoding) |
| | 4001 | | { |
| | 4002 | | _request.Headers.SetValue("x-ms-content-encoding", _item); |
| | 4003 | | } |
| | 4004 | | } |
| | 4005 | | if (fileContentLanguage != null) { |
| | 4006 | | foreach (string _item in fileContentLanguage) |
| | 4007 | | { |
| | 4008 | | _request.Headers.SetValue("x-ms-content-language", _item); |
| | 4009 | | } |
| | 4010 | | } |
| | 4011 | | if (fileCacheControl != null) { _request.Headers.SetValue("x-ms-cache-control", fileCacheControl); } |
| | 4012 | | if (fileContentHash != null) { _request.Headers.SetValue("x-ms-content-md5", System.Convert.ToBase64Stri |
| | 4013 | | if (fileContentDisposition != null) { _request.Headers.SetValue("x-ms-content-disposition", fileContentD |
| | 4014 | | if (metadata != null) { |
| | 4015 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 4016 | | { |
| | 4017 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 4018 | | } |
| | 4019 | | } |
| | 4020 | | if (filePermission != null) { _request.Headers.SetValue("x-ms-file-permission", filePermission); } |
| | 4021 | | if (filePermissionKey != null) { _request.Headers.SetValue("x-ms-file-permission-key", filePermissionKey |
| | 4022 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 4023 | |
|
| | 4024 | | return _message; |
| | 4025 | | } |
| | 4026 | |
|
| | 4027 | | /// <summary> |
| | 4028 | | /// Create the File.CreateAsync response or throw a failure exception. |
| | 4029 | | /// </summary> |
| | 4030 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 4031 | | /// <param name="response">The raw Response.</param> |
| | 4032 | | /// <returns>The File.CreateAsync Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageFileInfo}.</ret |
| | 4033 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.RawStorageFileInfo> CreateAsync_CreateRespo |
| | 4034 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4035 | | Azure.Response response) |
| | 4036 | | { |
| | 4037 | | // Process the response |
| | 4038 | | switch (response.Status) |
| | 4039 | | { |
| | 4040 | | case 201: |
| | 4041 | | { |
| | 4042 | | // Create the result |
| | 4043 | | Azure.Storage.Files.Shares.Models.RawStorageFileInfo _value = new Azure.Storage.Files.Shares.Mod |
| | 4044 | |
|
| | 4045 | | // Get response headers |
| | 4046 | | string _header; |
| | 4047 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 4048 | | { |
| | 4049 | | _value.ETag = new Azure.ETag(_header); |
| | 4050 | | } |
| | 4051 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 4052 | | { |
| | 4053 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 4054 | | } |
| | 4055 | | if (response.Headers.TryGetValue("x-ms-request-server-encrypted", out _header)) |
| | 4056 | | { |
| | 4057 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 4058 | | } |
| | 4059 | | if (response.Headers.TryGetValue("x-ms-file-permission-key", out _header)) |
| | 4060 | | { |
| | 4061 | | _value.FilePermissionKey = _header; |
| | 4062 | | } |
| | 4063 | | if (response.Headers.TryGetValue("x-ms-file-attributes", out _header)) |
| | 4064 | | { |
| | 4065 | | _value.FileAttributes = _header; |
| | 4066 | | } |
| | 4067 | | if (response.Headers.TryGetValue("x-ms-file-creation-time", out _header)) |
| | 4068 | | { |
| | 4069 | | _value.FileCreationTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureI |
| | 4070 | | } |
| | 4071 | | if (response.Headers.TryGetValue("x-ms-file-last-write-time", out _header)) |
| | 4072 | | { |
| | 4073 | | _value.FileLastWriteTime = System.DateTimeOffset.Parse(_header, System.Globalization.Culture |
| | 4074 | | } |
| | 4075 | | if (response.Headers.TryGetValue("x-ms-file-change-time", out _header)) |
| | 4076 | | { |
| | 4077 | | _value.FileChangeTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInf |
| | 4078 | | } |
| | 4079 | | if (response.Headers.TryGetValue("x-ms-file-id", out _header)) |
| | 4080 | | { |
| | 4081 | | _value.FileId = _header; |
| | 4082 | | } |
| | 4083 | | if (response.Headers.TryGetValue("x-ms-file-parent-id", out _header)) |
| | 4084 | | { |
| | 4085 | | _value.FileParentId = _header; |
| | 4086 | | } |
| | 4087 | |
|
| | 4088 | | // Create the response |
| | 4089 | | return Response.FromValue(_value, response); |
| | 4090 | | } |
| | 4091 | | default: |
| | 4092 | | { |
| | 4093 | | // Create the result |
| | 4094 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 4095 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 4096 | |
|
| | 4097 | | throw _value.CreateException(clientDiagnostics, response); |
| | 4098 | | } |
| | 4099 | | } |
| | 4100 | | } |
| | 4101 | | #endregion File.CreateAsync |
| | 4102 | |
|
| | 4103 | | #region File.DownloadAsync |
| | 4104 | | /// <summary> |
| | 4105 | | /// Reads or downloads a file from the system, including its metadata and properties. |
| | 4106 | | /// </summary> |
| | 4107 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 4108 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4109 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 4110 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4111 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4112 | | /// <param name="range">Return file data only from the specified byte range.</param> |
| | 4113 | | /// <param name="rangeGetContentHash">When this header is set to true and specified together with the Range |
| | 4114 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4115 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 4116 | | /// <param name="operationName">Operation name.</param> |
| | 4117 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 4118 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.FlattenedStorageFileProperties}</returns> |
| | 4119 | | public static async System.Threading.Tasks.ValueTask<(Azure.Response<Azure.Storage.Files.Shares.Models.Flatt |
| | 4120 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4121 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4122 | | System.Uri resourceUri, |
| | 4123 | | string version, |
| | 4124 | | int? timeout = default, |
| | 4125 | | string range = default, |
| | 4126 | | bool? rangeGetContentHash = default, |
| | 4127 | | string leaseId = default, |
| | 4128 | | bool async = true, |
| | 4129 | | string operationName = "FileClient.Download", |
| | 4130 | | System.Threading.CancellationToken cancellationToken = default) |
| | 4131 | | { |
| | 4132 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 4133 | | try |
| | 4134 | | { |
| | 4135 | | _scope.AddAttribute("url", resourceUri); |
| | 4136 | | _scope.Start(); |
| | 4137 | | using (Azure.Core.HttpMessage _message = DownloadAsync_CreateMessage( |
| | 4138 | | pipeline, |
| | 4139 | | resourceUri, |
| | 4140 | | version, |
| | 4141 | | timeout, |
| | 4142 | | range, |
| | 4143 | | rangeGetContentHash, |
| | 4144 | | leaseId)) |
| | 4145 | | { |
| | 4146 | | // Avoid buffering if stream is going to be returned to the caller |
| | 4147 | | _message.BufferResponse = false; |
| | 4148 | | if (async) |
| | 4149 | | { |
| | 4150 | | // Send the request asynchronously if we're being called via an async path |
| | 4151 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 4152 | | } |
| | 4153 | | else |
| | 4154 | | { |
| | 4155 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 4156 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 4157 | | pipeline.Send(_message, cancellationToken); |
| | 4158 | | } |
| | 4159 | | Azure.Response _response = _message.Response; |
| | 4160 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 4161 | | return (DownloadAsync_CreateResponse(clientDiagnostics, _response), _message.ExtractResponseCont |
| | 4162 | | } |
| | 4163 | | } |
| | 4164 | | catch (System.Exception ex) |
| | 4165 | | { |
| | 4166 | | _scope.Failed(ex); |
| | 4167 | | throw; |
| | 4168 | | } |
| | 4169 | | finally |
| | 4170 | | { |
| | 4171 | | _scope.Dispose(); |
| | 4172 | | } |
| | 4173 | | } |
| | 4174 | |
|
| | 4175 | | /// <summary> |
| | 4176 | | /// Create the File.DownloadAsync request. |
| | 4177 | | /// </summary> |
| | 4178 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4179 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 4180 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4181 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4182 | | /// <param name="range">Return file data only from the specified byte range.</param> |
| | 4183 | | /// <param name="rangeGetContentHash">When this header is set to true and specified together with the Range |
| | 4184 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4185 | | /// <returns>The File.DownloadAsync Message.</returns> |
| | 4186 | | internal static Azure.Core.HttpMessage DownloadAsync_CreateMessage( |
| | 4187 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4188 | | System.Uri resourceUri, |
| | 4189 | | string version, |
| | 4190 | | int? timeout = default, |
| | 4191 | | string range = default, |
| | 4192 | | bool? rangeGetContentHash = default, |
| | 4193 | | string leaseId = default) |
| | 4194 | | { |
| | 4195 | | // Validation |
| | 4196 | | if (resourceUri == null) |
| | 4197 | | { |
| | 4198 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 4199 | | } |
| | 4200 | | if (version == null) |
| | 4201 | | { |
| | 4202 | | throw new System.ArgumentNullException(nameof(version)); |
| | 4203 | | } |
| | 4204 | |
|
| | 4205 | | // Create the request |
| | 4206 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 4207 | | Azure.Core.Request _request = _message.Request; |
| | 4208 | |
|
| | 4209 | | // Set the endpoint |
| | 4210 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 4211 | | _request.Uri.Reset(resourceUri); |
| | 4212 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 4213 | |
|
| | 4214 | | // Add request headers |
| | 4215 | | _request.Headers.SetValue("x-ms-version", version); |
| | 4216 | | if (range != null) { _request.Headers.SetValue("x-ms-range", range); } |
| | 4217 | | if (rangeGetContentHash != null) { |
| | 4218 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 4219 | | _request.Headers.SetValue("x-ms-range-get-content-md5", rangeGetContentHash.Value.ToString(System.Global |
| | 4220 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 4221 | | } |
| | 4222 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 4223 | |
|
| | 4224 | | return _message; |
| | 4225 | | } |
| | 4226 | |
|
| | 4227 | | /// <summary> |
| | 4228 | | /// Create the File.DownloadAsync response or throw a failure exception. |
| | 4229 | | /// </summary> |
| | 4230 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 4231 | | /// <param name="response">The raw Response.</param> |
| | 4232 | | /// <returns>The File.DownloadAsync Azure.Response{Azure.Storage.Files.Shares.Models.FlattenedStorageFilePro |
| | 4233 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.FlattenedStorageFileProperties> DownloadAsy |
| | 4234 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4235 | | Azure.Response response) |
| | 4236 | | { |
| | 4237 | | // Process the response |
| | 4238 | | switch (response.Status) |
| | 4239 | | { |
| | 4240 | | case 200: |
| | 4241 | | { |
| | 4242 | | // Create the result |
| | 4243 | | Azure.Storage.Files.Shares.Models.FlattenedStorageFileProperties _value = new Azure.Storage.File |
| | 4244 | | _value.Content = response.ContentStream; // You should manually wrap with RetriableStream! |
| | 4245 | |
|
| | 4246 | | // Get response headers |
| | 4247 | | string _header; |
| | 4248 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 4249 | | { |
| | 4250 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 4251 | | } |
| | 4252 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompare |
| | 4253 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 4254 | | { |
| | 4255 | | if (_headerPair.Name.StartsWith("x-ms-meta-", System.StringComparison.InvariantCulture)) |
| | 4256 | | { |
| | 4257 | | _value.Metadata[_headerPair.Name.Substring(10)] = _headerPair.Value; |
| | 4258 | | } |
| | 4259 | | } |
| | 4260 | | if (response.Headers.TryGetValue("Content-Length", out _header)) |
| | 4261 | | { |
| | 4262 | | _value.ContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture |
| | 4263 | | } |
| | 4264 | | if (response.Headers.TryGetValue("Content-Type", out _header)) |
| | 4265 | | { |
| | 4266 | | _value.ContentType = _header; |
| | 4267 | | } |
| | 4268 | | if (response.Headers.TryGetValue("Content-Range", out _header)) |
| | 4269 | | { |
| | 4270 | | _value.ContentRange = _header; |
| | 4271 | | } |
| | 4272 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 4273 | | { |
| | 4274 | | _value.ETag = new Azure.ETag(_header); |
| | 4275 | | } |
| | 4276 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 4277 | | { |
| | 4278 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 4279 | | } |
| | 4280 | | if (response.Headers.TryGetValue("Content-Encoding", out _header)) |
| | 4281 | | { |
| | 4282 | | _value.ContentEncoding = (_header ?? "").Split(','); |
| | 4283 | | } |
| | 4284 | | if (response.Headers.TryGetValue("Cache-Control", out _header)) |
| | 4285 | | { |
| | 4286 | | _value.CacheControl = _header; |
| | 4287 | | } |
| | 4288 | | if (response.Headers.TryGetValue("Content-Disposition", out _header)) |
| | 4289 | | { |
| | 4290 | | _value.ContentDisposition = _header; |
| | 4291 | | } |
| | 4292 | | if (response.Headers.TryGetValue("Content-Language", out _header)) |
| | 4293 | | { |
| | 4294 | | _value.ContentLanguage = (_header ?? "").Split(','); |
| | 4295 | | } |
| | 4296 | | if (response.Headers.TryGetValue("Accept-Ranges", out _header)) |
| | 4297 | | { |
| | 4298 | | _value.AcceptRanges = _header; |
| | 4299 | | } |
| | 4300 | | if (response.Headers.TryGetValue("x-ms-copy-completion-time", out _header)) |
| | 4301 | | { |
| | 4302 | | _value.CopyCompletionTime = System.DateTimeOffset.Parse(_header, System.Globalization.Cultur |
| | 4303 | | } |
| | 4304 | | if (response.Headers.TryGetValue("x-ms-copy-status-description", out _header)) |
| | 4305 | | { |
| | 4306 | | _value.CopyStatusDescription = _header; |
| | 4307 | | } |
| | 4308 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 4309 | | { |
| | 4310 | | _value.CopyId = _header; |
| | 4311 | | } |
| | 4312 | | if (response.Headers.TryGetValue("x-ms-copy-progress", out _header)) |
| | 4313 | | { |
| | 4314 | | _value.CopyProgress = _header; |
| | 4315 | | } |
| | 4316 | | if (response.Headers.TryGetValue("x-ms-copy-source", out _header)) |
| | 4317 | | { |
| | 4318 | | _value.CopySource = new System.Uri(_header); |
| | 4319 | | } |
| | 4320 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 4321 | | { |
| | 4322 | | _value.CopyStatus = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseCopyStatus( |
| | 4323 | | } |
| | 4324 | | if (response.Headers.TryGetValue("x-ms-content-md5", out _header)) |
| | 4325 | | { |
| | 4326 | | _value.FileContentHash = System.Convert.FromBase64String(_header); |
| | 4327 | | } |
| | 4328 | | if (response.Headers.TryGetValue("x-ms-server-encrypted", out _header)) |
| | 4329 | | { |
| | 4330 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 4331 | | } |
| | 4332 | | if (response.Headers.TryGetValue("x-ms-file-attributes", out _header)) |
| | 4333 | | { |
| | 4334 | | _value.FileAttributes = _header; |
| | 4335 | | } |
| | 4336 | | if (response.Headers.TryGetValue("x-ms-file-creation-time", out _header)) |
| | 4337 | | { |
| | 4338 | | _value.FileCreationTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureI |
| | 4339 | | } |
| | 4340 | | if (response.Headers.TryGetValue("x-ms-file-last-write-time", out _header)) |
| | 4341 | | { |
| | 4342 | | _value.FileLastWriteTime = System.DateTimeOffset.Parse(_header, System.Globalization.Culture |
| | 4343 | | } |
| | 4344 | | if (response.Headers.TryGetValue("x-ms-file-change-time", out _header)) |
| | 4345 | | { |
| | 4346 | | _value.FileChangeTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInf |
| | 4347 | | } |
| | 4348 | | if (response.Headers.TryGetValue("x-ms-file-permission-key", out _header)) |
| | 4349 | | { |
| | 4350 | | _value.FilePermissionKey = _header; |
| | 4351 | | } |
| | 4352 | | if (response.Headers.TryGetValue("x-ms-file-id", out _header)) |
| | 4353 | | { |
| | 4354 | | _value.FileId = _header; |
| | 4355 | | } |
| | 4356 | | if (response.Headers.TryGetValue("x-ms-file-parent-id", out _header)) |
| | 4357 | | { |
| | 4358 | | _value.FileParentId = _header; |
| | 4359 | | } |
| | 4360 | | if (response.Headers.TryGetValue("x-ms-lease-duration", out _header)) |
| | 4361 | | { |
| | 4362 | | _value.LeaseDuration = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseShareLea |
| | 4363 | | } |
| | 4364 | | if (response.Headers.TryGetValue("x-ms-lease-state", out _header)) |
| | 4365 | | { |
| | 4366 | | _value.LeaseState = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseShareLeaseS |
| | 4367 | | } |
| | 4368 | | if (response.Headers.TryGetValue("x-ms-lease-status", out _header)) |
| | 4369 | | { |
| | 4370 | | _value.LeaseStatus = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseShareLease |
| | 4371 | | } |
| | 4372 | |
|
| | 4373 | | // Create the response |
| | 4374 | | return Response.FromValue(_value, response); |
| | 4375 | | } |
| | 4376 | | case 206: |
| | 4377 | | { |
| | 4378 | | // Create the result |
| | 4379 | | Azure.Storage.Files.Shares.Models.FlattenedStorageFileProperties _value = new Azure.Storage.File |
| | 4380 | | _value.Content = response.ContentStream; // You should manually wrap with RetriableStream! |
| | 4381 | |
|
| | 4382 | | // Get response headers |
| | 4383 | | string _header; |
| | 4384 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 4385 | | { |
| | 4386 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 4387 | | } |
| | 4388 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompare |
| | 4389 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 4390 | | { |
| | 4391 | | if (_headerPair.Name.StartsWith("x-ms-meta-", System.StringComparison.InvariantCulture)) |
| | 4392 | | { |
| | 4393 | | _value.Metadata[_headerPair.Name.Substring(10)] = _headerPair.Value; |
| | 4394 | | } |
| | 4395 | | } |
| | 4396 | | if (response.Headers.TryGetValue("Content-Length", out _header)) |
| | 4397 | | { |
| | 4398 | | _value.ContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture |
| | 4399 | | } |
| | 4400 | | if (response.Headers.TryGetValue("Content-Type", out _header)) |
| | 4401 | | { |
| | 4402 | | _value.ContentType = _header; |
| | 4403 | | } |
| | 4404 | | if (response.Headers.TryGetValue("Content-Range", out _header)) |
| | 4405 | | { |
| | 4406 | | _value.ContentRange = _header; |
| | 4407 | | } |
| | 4408 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 4409 | | { |
| | 4410 | | _value.ETag = new Azure.ETag(_header); |
| | 4411 | | } |
| | 4412 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 4413 | | { |
| | 4414 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 4415 | | } |
| | 4416 | | if (response.Headers.TryGetValue("Content-Encoding", out _header)) |
| | 4417 | | { |
| | 4418 | | _value.ContentEncoding = (_header ?? "").Split(','); |
| | 4419 | | } |
| | 4420 | | if (response.Headers.TryGetValue("Cache-Control", out _header)) |
| | 4421 | | { |
| | 4422 | | _value.CacheControl = _header; |
| | 4423 | | } |
| | 4424 | | if (response.Headers.TryGetValue("Content-Disposition", out _header)) |
| | 4425 | | { |
| | 4426 | | _value.ContentDisposition = _header; |
| | 4427 | | } |
| | 4428 | | if (response.Headers.TryGetValue("Content-Language", out _header)) |
| | 4429 | | { |
| | 4430 | | _value.ContentLanguage = (_header ?? "").Split(','); |
| | 4431 | | } |
| | 4432 | | if (response.Headers.TryGetValue("Accept-Ranges", out _header)) |
| | 4433 | | { |
| | 4434 | | _value.AcceptRanges = _header; |
| | 4435 | | } |
| | 4436 | | if (response.Headers.TryGetValue("x-ms-copy-completion-time", out _header)) |
| | 4437 | | { |
| | 4438 | | _value.CopyCompletionTime = System.DateTimeOffset.Parse(_header, System.Globalization.Cultur |
| | 4439 | | } |
| | 4440 | | if (response.Headers.TryGetValue("x-ms-copy-status-description", out _header)) |
| | 4441 | | { |
| | 4442 | | _value.CopyStatusDescription = _header; |
| | 4443 | | } |
| | 4444 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 4445 | | { |
| | 4446 | | _value.CopyId = _header; |
| | 4447 | | } |
| | 4448 | | if (response.Headers.TryGetValue("x-ms-copy-progress", out _header)) |
| | 4449 | | { |
| | 4450 | | _value.CopyProgress = _header; |
| | 4451 | | } |
| | 4452 | | if (response.Headers.TryGetValue("x-ms-copy-source", out _header)) |
| | 4453 | | { |
| | 4454 | | _value.CopySource = new System.Uri(_header); |
| | 4455 | | } |
| | 4456 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 4457 | | { |
| | 4458 | | _value.CopyStatus = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseCopyStatus( |
| | 4459 | | } |
| | 4460 | | if (response.Headers.TryGetValue("x-ms-content-md5", out _header)) |
| | 4461 | | { |
| | 4462 | | _value.FileContentHash = System.Convert.FromBase64String(_header); |
| | 4463 | | } |
| | 4464 | | if (response.Headers.TryGetValue("x-ms-server-encrypted", out _header)) |
| | 4465 | | { |
| | 4466 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 4467 | | } |
| | 4468 | | if (response.Headers.TryGetValue("x-ms-file-attributes", out _header)) |
| | 4469 | | { |
| | 4470 | | _value.FileAttributes = _header; |
| | 4471 | | } |
| | 4472 | | if (response.Headers.TryGetValue("x-ms-file-creation-time", out _header)) |
| | 4473 | | { |
| | 4474 | | _value.FileCreationTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureI |
| | 4475 | | } |
| | 4476 | | if (response.Headers.TryGetValue("x-ms-file-last-write-time", out _header)) |
| | 4477 | | { |
| | 4478 | | _value.FileLastWriteTime = System.DateTimeOffset.Parse(_header, System.Globalization.Culture |
| | 4479 | | } |
| | 4480 | | if (response.Headers.TryGetValue("x-ms-file-change-time", out _header)) |
| | 4481 | | { |
| | 4482 | | _value.FileChangeTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInf |
| | 4483 | | } |
| | 4484 | | if (response.Headers.TryGetValue("x-ms-file-permission-key", out _header)) |
| | 4485 | | { |
| | 4486 | | _value.FilePermissionKey = _header; |
| | 4487 | | } |
| | 4488 | | if (response.Headers.TryGetValue("x-ms-file-id", out _header)) |
| | 4489 | | { |
| | 4490 | | _value.FileId = _header; |
| | 4491 | | } |
| | 4492 | | if (response.Headers.TryGetValue("x-ms-file-parent-id", out _header)) |
| | 4493 | | { |
| | 4494 | | _value.FileParentId = _header; |
| | 4495 | | } |
| | 4496 | | if (response.Headers.TryGetValue("x-ms-lease-duration", out _header)) |
| | 4497 | | { |
| | 4498 | | _value.LeaseDuration = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseShareLea |
| | 4499 | | } |
| | 4500 | | if (response.Headers.TryGetValue("x-ms-lease-state", out _header)) |
| | 4501 | | { |
| | 4502 | | _value.LeaseState = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseShareLeaseS |
| | 4503 | | } |
| | 4504 | | if (response.Headers.TryGetValue("x-ms-lease-status", out _header)) |
| | 4505 | | { |
| | 4506 | | _value.LeaseStatus = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseShareLease |
| | 4507 | | } |
| | 4508 | |
|
| | 4509 | | // Create the response |
| | 4510 | | return Response.FromValue(_value, response); |
| | 4511 | | } |
| | 4512 | | case 304: |
| | 4513 | | { |
| | 4514 | | return new Azure.NoBodyResponse<Azure.Storage.Files.Shares.Models.FlattenedStorageFileProperties |
| | 4515 | | } |
| | 4516 | | default: |
| | 4517 | | { |
| | 4518 | | // Create the result |
| | 4519 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 4520 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 4521 | |
|
| | 4522 | | throw _value.CreateException(clientDiagnostics, response); |
| | 4523 | | } |
| | 4524 | | } |
| | 4525 | | } |
| | 4526 | | #endregion File.DownloadAsync |
| | 4527 | |
|
| | 4528 | | #region File.GetPropertiesAsync |
| | 4529 | | /// <summary> |
| | 4530 | | /// Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does |
| | 4531 | | /// </summary> |
| | 4532 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 4533 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4534 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 4535 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4536 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 4537 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4538 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4539 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 4540 | | /// <param name="operationName">Operation name.</param> |
| | 4541 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 4542 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageFileProperties}</returns> |
| | 4543 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.RawSto |
| | 4544 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4545 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4546 | | System.Uri resourceUri, |
| | 4547 | | string version, |
| | 4548 | | string sharesnapshot = default, |
| | 4549 | | int? timeout = default, |
| | 4550 | | string leaseId = default, |
| | 4551 | | bool async = true, |
| | 4552 | | string operationName = "FileClient.GetProperties", |
| | 4553 | | System.Threading.CancellationToken cancellationToken = default) |
| | 4554 | | { |
| | 4555 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 4556 | | try |
| | 4557 | | { |
| | 4558 | | _scope.AddAttribute("url", resourceUri); |
| | 4559 | | _scope.Start(); |
| | 4560 | | using (Azure.Core.HttpMessage _message = GetPropertiesAsync_CreateMessage( |
| | 4561 | | pipeline, |
| | 4562 | | resourceUri, |
| | 4563 | | version, |
| | 4564 | | sharesnapshot, |
| | 4565 | | timeout, |
| | 4566 | | leaseId)) |
| | 4567 | | { |
| | 4568 | | if (async) |
| | 4569 | | { |
| | 4570 | | // Send the request asynchronously if we're being called via an async path |
| | 4571 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 4572 | | } |
| | 4573 | | else |
| | 4574 | | { |
| | 4575 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 4576 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 4577 | | pipeline.Send(_message, cancellationToken); |
| | 4578 | | } |
| | 4579 | | Azure.Response _response = _message.Response; |
| | 4580 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 4581 | | return GetPropertiesAsync_CreateResponse(clientDiagnostics, _response); |
| | 4582 | | } |
| | 4583 | | } |
| | 4584 | | catch (System.Exception ex) |
| | 4585 | | { |
| | 4586 | | _scope.Failed(ex); |
| | 4587 | | throw; |
| | 4588 | | } |
| | 4589 | | finally |
| | 4590 | | { |
| | 4591 | | _scope.Dispose(); |
| | 4592 | | } |
| | 4593 | | } |
| | 4594 | |
|
| | 4595 | | /// <summary> |
| | 4596 | | /// Create the File.GetPropertiesAsync request. |
| | 4597 | | /// </summary> |
| | 4598 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4599 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 4600 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4601 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 4602 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4603 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4604 | | /// <returns>The File.GetPropertiesAsync Message.</returns> |
| | 4605 | | internal static Azure.Core.HttpMessage GetPropertiesAsync_CreateMessage( |
| | 4606 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4607 | | System.Uri resourceUri, |
| | 4608 | | string version, |
| | 4609 | | string sharesnapshot = default, |
| | 4610 | | int? timeout = default, |
| | 4611 | | string leaseId = default) |
| | 4612 | | { |
| | 4613 | | // Validation |
| | 4614 | | if (resourceUri == null) |
| | 4615 | | { |
| | 4616 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 4617 | | } |
| | 4618 | | if (version == null) |
| | 4619 | | { |
| | 4620 | | throw new System.ArgumentNullException(nameof(version)); |
| | 4621 | | } |
| | 4622 | |
|
| | 4623 | | // Create the request |
| | 4624 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 4625 | | Azure.Core.Request _request = _message.Request; |
| | 4626 | |
|
| | 4627 | | // Set the endpoint |
| | 4628 | | _request.Method = Azure.Core.RequestMethod.Head; |
| | 4629 | | _request.Uri.Reset(resourceUri); |
| | 4630 | | if (sharesnapshot != null) { _request.Uri.AppendQuery("sharesnapshot", sharesnapshot); } |
| | 4631 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 4632 | |
|
| | 4633 | | // Add request headers |
| | 4634 | | _request.Headers.SetValue("x-ms-version", version); |
| | 4635 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 4636 | |
|
| | 4637 | | return _message; |
| | 4638 | | } |
| | 4639 | |
|
| | 4640 | | /// <summary> |
| | 4641 | | /// Create the File.GetPropertiesAsync response or throw a failure exception. |
| | 4642 | | /// </summary> |
| | 4643 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 4644 | | /// <param name="response">The raw Response.</param> |
| | 4645 | | /// <returns>The File.GetPropertiesAsync Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageFileProp |
| | 4646 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.RawStorageFileProperties> GetPropertiesAsyn |
| | 4647 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4648 | | Azure.Response response) |
| | 4649 | | { |
| | 4650 | | // Process the response |
| | 4651 | | switch (response.Status) |
| | 4652 | | { |
| | 4653 | | case 200: |
| | 4654 | | { |
| | 4655 | | // Create the result |
| | 4656 | | Azure.Storage.Files.Shares.Models.RawStorageFileProperties _value = new Azure.Storage.Files.Shar |
| | 4657 | |
|
| | 4658 | | // Get response headers |
| | 4659 | | string _header; |
| | 4660 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 4661 | | { |
| | 4662 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 4663 | | } |
| | 4664 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringCompare |
| | 4665 | | foreach (Azure.Core.HttpHeader _headerPair in response.Headers) |
| | 4666 | | { |
| | 4667 | | if (_headerPair.Name.StartsWith("x-ms-meta-", System.StringComparison.InvariantCulture)) |
| | 4668 | | { |
| | 4669 | | _value.Metadata[_headerPair.Name.Substring(10)] = _headerPair.Value; |
| | 4670 | | } |
| | 4671 | | } |
| | 4672 | | if (response.Headers.TryGetValue("Content-Length", out _header)) |
| | 4673 | | { |
| | 4674 | | _value.ContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCulture |
| | 4675 | | } |
| | 4676 | | if (response.Headers.TryGetValue("Content-Type", out _header)) |
| | 4677 | | { |
| | 4678 | | _value.ContentType = _header; |
| | 4679 | | } |
| | 4680 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 4681 | | { |
| | 4682 | | _value.ETag = new Azure.ETag(_header); |
| | 4683 | | } |
| | 4684 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 4685 | | { |
| | 4686 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 4687 | | } |
| | 4688 | | if (response.Headers.TryGetValue("Content-Encoding", out _header)) |
| | 4689 | | { |
| | 4690 | | _value.ContentEncoding = (_header ?? "").Split(','); |
| | 4691 | | } |
| | 4692 | | if (response.Headers.TryGetValue("Cache-Control", out _header)) |
| | 4693 | | { |
| | 4694 | | _value.CacheControl = _header; |
| | 4695 | | } |
| | 4696 | | if (response.Headers.TryGetValue("Content-Disposition", out _header)) |
| | 4697 | | { |
| | 4698 | | _value.ContentDisposition = _header; |
| | 4699 | | } |
| | 4700 | | if (response.Headers.TryGetValue("Content-Language", out _header)) |
| | 4701 | | { |
| | 4702 | | _value.ContentLanguage = (_header ?? "").Split(','); |
| | 4703 | | } |
| | 4704 | | if (response.Headers.TryGetValue("x-ms-copy-completion-time", out _header)) |
| | 4705 | | { |
| | 4706 | | _value.CopyCompletionTime = System.DateTimeOffset.Parse(_header, System.Globalization.Cultur |
| | 4707 | | } |
| | 4708 | | if (response.Headers.TryGetValue("x-ms-copy-status-description", out _header)) |
| | 4709 | | { |
| | 4710 | | _value.CopyStatusDescription = _header; |
| | 4711 | | } |
| | 4712 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 4713 | | { |
| | 4714 | | _value.CopyId = _header; |
| | 4715 | | } |
| | 4716 | | if (response.Headers.TryGetValue("x-ms-copy-progress", out _header)) |
| | 4717 | | { |
| | 4718 | | _value.CopyProgress = _header; |
| | 4719 | | } |
| | 4720 | | if (response.Headers.TryGetValue("x-ms-copy-source", out _header)) |
| | 4721 | | { |
| | 4722 | | _value.CopySource = _header; |
| | 4723 | | } |
| | 4724 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 4725 | | { |
| | 4726 | | _value.CopyStatus = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseCopyStatus( |
| | 4727 | | } |
| | 4728 | | if (response.Headers.TryGetValue("x-ms-server-encrypted", out _header)) |
| | 4729 | | { |
| | 4730 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 4731 | | } |
| | 4732 | | if (response.Headers.TryGetValue("x-ms-file-attributes", out _header)) |
| | 4733 | | { |
| | 4734 | | _value.FileAttributes = _header; |
| | 4735 | | } |
| | 4736 | | if (response.Headers.TryGetValue("x-ms-file-creation-time", out _header)) |
| | 4737 | | { |
| | 4738 | | _value.FileCreationTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureI |
| | 4739 | | } |
| | 4740 | | if (response.Headers.TryGetValue("x-ms-file-last-write-time", out _header)) |
| | 4741 | | { |
| | 4742 | | _value.FileLastWriteTime = System.DateTimeOffset.Parse(_header, System.Globalization.Culture |
| | 4743 | | } |
| | 4744 | | if (response.Headers.TryGetValue("x-ms-file-change-time", out _header)) |
| | 4745 | | { |
| | 4746 | | _value.FileChangeTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInf |
| | 4747 | | } |
| | 4748 | | if (response.Headers.TryGetValue("x-ms-file-permission-key", out _header)) |
| | 4749 | | { |
| | 4750 | | _value.FilePermissionKey = _header; |
| | 4751 | | } |
| | 4752 | | if (response.Headers.TryGetValue("x-ms-file-id", out _header)) |
| | 4753 | | { |
| | 4754 | | _value.FileId = _header; |
| | 4755 | | } |
| | 4756 | | if (response.Headers.TryGetValue("x-ms-file-parent-id", out _header)) |
| | 4757 | | { |
| | 4758 | | _value.FileParentId = _header; |
| | 4759 | | } |
| | 4760 | | if (response.Headers.TryGetValue("x-ms-lease-duration", out _header)) |
| | 4761 | | { |
| | 4762 | | _value.LeaseDuration = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseShareLea |
| | 4763 | | } |
| | 4764 | | if (response.Headers.TryGetValue("x-ms-lease-state", out _header)) |
| | 4765 | | { |
| | 4766 | | _value.LeaseState = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseShareLeaseS |
| | 4767 | | } |
| | 4768 | | if (response.Headers.TryGetValue("x-ms-lease-status", out _header)) |
| | 4769 | | { |
| | 4770 | | _value.LeaseStatus = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseShareLease |
| | 4771 | | } |
| | 4772 | |
|
| | 4773 | | // Create the response |
| | 4774 | | return Response.FromValue(_value, response); |
| | 4775 | | } |
| | 4776 | | case 304: |
| | 4777 | | { |
| | 4778 | | return new Azure.NoBodyResponse<Azure.Storage.Files.Shares.Models.RawStorageFileProperties>(resp |
| | 4779 | | } |
| | 4780 | | default: |
| | 4781 | | { |
| | 4782 | | // Create the result |
| | 4783 | | Azure.Storage.Files.Shares.Models.FailureNoContent _value = new Azure.Storage.Files.Shares.Model |
| | 4784 | |
|
| | 4785 | | // Get response headers |
| | 4786 | | string _header; |
| | 4787 | | if (response.Headers.TryGetValue("x-ms-error-code", out _header)) |
| | 4788 | | { |
| | 4789 | | _value.ErrorCode = _header; |
| | 4790 | | } |
| | 4791 | |
|
| | 4792 | | throw _value.CreateException(clientDiagnostics, response); |
| | 4793 | | } |
| | 4794 | | } |
| | 4795 | | } |
| | 4796 | | #endregion File.GetPropertiesAsync |
| | 4797 | |
|
| | 4798 | | #region File.DeleteAsync |
| | 4799 | | /// <summary> |
| | 4800 | | /// removes the file from the storage account. |
| | 4801 | | /// </summary> |
| | 4802 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 4803 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4804 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 4805 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4806 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4807 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4808 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 4809 | | /// <param name="operationName">Operation name.</param> |
| | 4810 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 4811 | | /// <returns>Azure.Response</returns> |
| | 4812 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> DeleteAsync( |
| | 4813 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4814 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4815 | | System.Uri resourceUri, |
| | 4816 | | string version, |
| | 4817 | | int? timeout = default, |
| | 4818 | | string leaseId = default, |
| | 4819 | | bool async = true, |
| | 4820 | | string operationName = "FileClient.Delete", |
| | 4821 | | System.Threading.CancellationToken cancellationToken = default) |
| | 4822 | | { |
| | 4823 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 4824 | | try |
| | 4825 | | { |
| | 4826 | | _scope.AddAttribute("url", resourceUri); |
| | 4827 | | _scope.Start(); |
| | 4828 | | using (Azure.Core.HttpMessage _message = DeleteAsync_CreateMessage( |
| | 4829 | | pipeline, |
| | 4830 | | resourceUri, |
| | 4831 | | version, |
| | 4832 | | timeout, |
| | 4833 | | leaseId)) |
| | 4834 | | { |
| | 4835 | | if (async) |
| | 4836 | | { |
| | 4837 | | // Send the request asynchronously if we're being called via an async path |
| | 4838 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 4839 | | } |
| | 4840 | | else |
| | 4841 | | { |
| | 4842 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 4843 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 4844 | | pipeline.Send(_message, cancellationToken); |
| | 4845 | | } |
| | 4846 | | Azure.Response _response = _message.Response; |
| | 4847 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 4848 | | return DeleteAsync_CreateResponse(clientDiagnostics, _response); |
| | 4849 | | } |
| | 4850 | | } |
| | 4851 | | catch (System.Exception ex) |
| | 4852 | | { |
| | 4853 | | _scope.Failed(ex); |
| | 4854 | | throw; |
| | 4855 | | } |
| | 4856 | | finally |
| | 4857 | | { |
| | 4858 | | _scope.Dispose(); |
| | 4859 | | } |
| | 4860 | | } |
| | 4861 | |
|
| | 4862 | | /// <summary> |
| | 4863 | | /// Create the File.DeleteAsync request. |
| | 4864 | | /// </summary> |
| | 4865 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4866 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 4867 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4868 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4869 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4870 | | /// <returns>The File.DeleteAsync Message.</returns> |
| | 4871 | | internal static Azure.Core.HttpMessage DeleteAsync_CreateMessage( |
| | 4872 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4873 | | System.Uri resourceUri, |
| | 4874 | | string version, |
| | 4875 | | int? timeout = default, |
| | 4876 | | string leaseId = default) |
| | 4877 | | { |
| | 4878 | | // Validation |
| | 4879 | | if (resourceUri == null) |
| | 4880 | | { |
| | 4881 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 4882 | | } |
| | 4883 | | if (version == null) |
| | 4884 | | { |
| | 4885 | | throw new System.ArgumentNullException(nameof(version)); |
| | 4886 | | } |
| | 4887 | |
|
| | 4888 | | // Create the request |
| | 4889 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 4890 | | Azure.Core.Request _request = _message.Request; |
| | 4891 | |
|
| | 4892 | | // Set the endpoint |
| | 4893 | | _request.Method = Azure.Core.RequestMethod.Delete; |
| | 4894 | | _request.Uri.Reset(resourceUri); |
| | 4895 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 4896 | |
|
| | 4897 | | // Add request headers |
| | 4898 | | _request.Headers.SetValue("x-ms-version", version); |
| | 4899 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 4900 | |
|
| | 4901 | | return _message; |
| | 4902 | | } |
| | 4903 | |
|
| | 4904 | | /// <summary> |
| | 4905 | | /// Create the File.DeleteAsync response or throw a failure exception. |
| | 4906 | | /// </summary> |
| | 4907 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 4908 | | /// <param name="response">The raw Response.</param> |
| | 4909 | | /// <returns>The File.DeleteAsync Azure.Response.</returns> |
| | 4910 | | internal static Azure.Response DeleteAsync_CreateResponse( |
| | 4911 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4912 | | Azure.Response response) |
| | 4913 | | { |
| | 4914 | | // Process the response |
| | 4915 | | switch (response.Status) |
| | 4916 | | { |
| | 4917 | | case 202: |
| | 4918 | | { |
| | 4919 | | return response; |
| | 4920 | | } |
| | 4921 | | default: |
| | 4922 | | { |
| | 4923 | | // Create the result |
| | 4924 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 4925 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 4926 | |
|
| | 4927 | | throw _value.CreateException(clientDiagnostics, response); |
| | 4928 | | } |
| | 4929 | | } |
| | 4930 | | } |
| | 4931 | | #endregion File.DeleteAsync |
| | 4932 | |
|
| | 4933 | | #region File.SetPropertiesAsync |
| | 4934 | | /// <summary> |
| | 4935 | | /// Sets HTTP headers on the file. |
| | 4936 | | /// </summary> |
| | 4937 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 4938 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 4939 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 4940 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 4941 | | /// <param name="fileAttributes">If specified, the provided file attributes shall be set. Default value: ‘Ar |
| | 4942 | | /// <param name="fileCreationTime">Creation time for the file/directory. Default value: Now.</param> |
| | 4943 | | /// <param name="fileLastWriteTime">Last write time for the file/directory. Default value: Now.</param> |
| | 4944 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 4945 | | /// <param name="fileContentLength">Resizes a file to the specified size. If the specified byte value is les |
| | 4946 | | /// <param name="fileContentType">Sets the MIME content type of the file. The default type is 'application/o |
| | 4947 | | /// <param name="fileContentEncoding">Specifies which content encodings have been applied to the file.</para |
| | 4948 | | /// <param name="fileContentLanguage">Specifies the natural languages used by this resource.</param> |
| | 4949 | | /// <param name="fileCacheControl">Sets the file's cache control. The File service stores this value but doe |
| | 4950 | | /// <param name="fileContentHash">Sets the file's MD5 hash.</param> |
| | 4951 | | /// <param name="fileContentDisposition">Sets the file's Content-Disposition header.</param> |
| | 4952 | | /// <param name="filePermission">If specified the permission (security descriptor) shall be set for the dire |
| | 4953 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file. Note: Only one o |
| | 4954 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 4955 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 4956 | | /// <param name="operationName">Operation name.</param> |
| | 4957 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 4958 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageFileInfo}</returns> |
| | 4959 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.RawSto |
| | 4960 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 4961 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 4962 | | System.Uri resourceUri, |
| | 4963 | | string version, |
| | 4964 | | string fileAttributes, |
| | 4965 | | string fileCreationTime, |
| | 4966 | | string fileLastWriteTime, |
| | 4967 | | int? timeout = default, |
| | 4968 | | long? fileContentLength = default, |
| | 4969 | | string fileContentType = default, |
| | 4970 | | System.Collections.Generic.IEnumerable<string> fileContentEncoding = default, |
| | 4971 | | System.Collections.Generic.IEnumerable<string> fileContentLanguage = default, |
| | 4972 | | string fileCacheControl = default, |
| | 4973 | | byte[] fileContentHash = default, |
| | 4974 | | string fileContentDisposition = default, |
| | 4975 | | string filePermission = default, |
| | 4976 | | string filePermissionKey = default, |
| | 4977 | | string leaseId = default, |
| | 4978 | | bool async = true, |
| | 4979 | | string operationName = "FileClient.SetProperties", |
| | 4980 | | System.Threading.CancellationToken cancellationToken = default) |
| | 4981 | | { |
| | 4982 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 4983 | | try |
| | 4984 | | { |
| | 4985 | | _scope.AddAttribute("url", resourceUri); |
| | 4986 | | _scope.Start(); |
| | 4987 | | using (Azure.Core.HttpMessage _message = SetPropertiesAsync_CreateMessage( |
| | 4988 | | pipeline, |
| | 4989 | | resourceUri, |
| | 4990 | | version, |
| | 4991 | | fileAttributes, |
| | 4992 | | fileCreationTime, |
| | 4993 | | fileLastWriteTime, |
| | 4994 | | timeout, |
| | 4995 | | fileContentLength, |
| | 4996 | | fileContentType, |
| | 4997 | | fileContentEncoding, |
| | 4998 | | fileContentLanguage, |
| | 4999 | | fileCacheControl, |
| | 5000 | | fileContentHash, |
| | 5001 | | fileContentDisposition, |
| | 5002 | | filePermission, |
| | 5003 | | filePermissionKey, |
| | 5004 | | leaseId)) |
| | 5005 | | { |
| | 5006 | | if (async) |
| | 5007 | | { |
| | 5008 | | // Send the request asynchronously if we're being called via an async path |
| | 5009 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 5010 | | } |
| | 5011 | | else |
| | 5012 | | { |
| | 5013 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 5014 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 5015 | | pipeline.Send(_message, cancellationToken); |
| | 5016 | | } |
| | 5017 | | Azure.Response _response = _message.Response; |
| | 5018 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 5019 | | return SetPropertiesAsync_CreateResponse(clientDiagnostics, _response); |
| | 5020 | | } |
| | 5021 | | } |
| | 5022 | | catch (System.Exception ex) |
| | 5023 | | { |
| | 5024 | | _scope.Failed(ex); |
| | 5025 | | throw; |
| | 5026 | | } |
| | 5027 | | finally |
| | 5028 | | { |
| | 5029 | | _scope.Dispose(); |
| | 5030 | | } |
| | 5031 | | } |
| | 5032 | |
|
| | 5033 | | /// <summary> |
| | 5034 | | /// Create the File.SetPropertiesAsync request. |
| | 5035 | | /// </summary> |
| | 5036 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5037 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 5038 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5039 | | /// <param name="fileAttributes">If specified, the provided file attributes shall be set. Default value: ‘Ar |
| | 5040 | | /// <param name="fileCreationTime">Creation time for the file/directory. Default value: Now.</param> |
| | 5041 | | /// <param name="fileLastWriteTime">Last write time for the file/directory. Default value: Now.</param> |
| | 5042 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5043 | | /// <param name="fileContentLength">Resizes a file to the specified size. If the specified byte value is les |
| | 5044 | | /// <param name="fileContentType">Sets the MIME content type of the file. The default type is 'application/o |
| | 5045 | | /// <param name="fileContentEncoding">Specifies which content encodings have been applied to the file.</para |
| | 5046 | | /// <param name="fileContentLanguage">Specifies the natural languages used by this resource.</param> |
| | 5047 | | /// <param name="fileCacheControl">Sets the file's cache control. The File service stores this value but doe |
| | 5048 | | /// <param name="fileContentHash">Sets the file's MD5 hash.</param> |
| | 5049 | | /// <param name="fileContentDisposition">Sets the file's Content-Disposition header.</param> |
| | 5050 | | /// <param name="filePermission">If specified the permission (security descriptor) shall be set for the dire |
| | 5051 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file. Note: Only one o |
| | 5052 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 5053 | | /// <returns>The File.SetPropertiesAsync Message.</returns> |
| | 5054 | | internal static Azure.Core.HttpMessage SetPropertiesAsync_CreateMessage( |
| | 5055 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5056 | | System.Uri resourceUri, |
| | 5057 | | string version, |
| | 5058 | | string fileAttributes, |
| | 5059 | | string fileCreationTime, |
| | 5060 | | string fileLastWriteTime, |
| | 5061 | | int? timeout = default, |
| | 5062 | | long? fileContentLength = default, |
| | 5063 | | string fileContentType = default, |
| | 5064 | | System.Collections.Generic.IEnumerable<string> fileContentEncoding = default, |
| | 5065 | | System.Collections.Generic.IEnumerable<string> fileContentLanguage = default, |
| | 5066 | | string fileCacheControl = default, |
| | 5067 | | byte[] fileContentHash = default, |
| | 5068 | | string fileContentDisposition = default, |
| | 5069 | | string filePermission = default, |
| | 5070 | | string filePermissionKey = default, |
| | 5071 | | string leaseId = default) |
| | 5072 | | { |
| | 5073 | | // Validation |
| | 5074 | | if (resourceUri == null) |
| | 5075 | | { |
| | 5076 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 5077 | | } |
| | 5078 | | if (version == null) |
| | 5079 | | { |
| | 5080 | | throw new System.ArgumentNullException(nameof(version)); |
| | 5081 | | } |
| | 5082 | | if (fileAttributes == null) |
| | 5083 | | { |
| | 5084 | | throw new System.ArgumentNullException(nameof(fileAttributes)); |
| | 5085 | | } |
| | 5086 | | if (fileCreationTime == null) |
| | 5087 | | { |
| | 5088 | | throw new System.ArgumentNullException(nameof(fileCreationTime)); |
| | 5089 | | } |
| | 5090 | | if (fileLastWriteTime == null) |
| | 5091 | | { |
| | 5092 | | throw new System.ArgumentNullException(nameof(fileLastWriteTime)); |
| | 5093 | | } |
| | 5094 | |
|
| | 5095 | | // Create the request |
| | 5096 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 5097 | | Azure.Core.Request _request = _message.Request; |
| | 5098 | |
|
| | 5099 | | // Set the endpoint |
| | 5100 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 5101 | | _request.Uri.Reset(resourceUri); |
| | 5102 | | _request.Uri.AppendQuery("comp", "properties", escapeValue: false); |
| | 5103 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 5104 | |
|
| | 5105 | | // Add request headers |
| | 5106 | | _request.Headers.SetValue("x-ms-version", version); |
| | 5107 | | _request.Headers.SetValue("x-ms-file-attributes", fileAttributes); |
| | 5108 | | _request.Headers.SetValue("x-ms-file-creation-time", fileCreationTime); |
| | 5109 | | _request.Headers.SetValue("x-ms-file-last-write-time", fileLastWriteTime); |
| | 5110 | | if (fileContentLength != null) { _request.Headers.SetValue("x-ms-content-length", fileContentLength.Valu |
| | 5111 | | if (fileContentType != null) { _request.Headers.SetValue("x-ms-content-type", fileContentType); } |
| | 5112 | | if (fileContentEncoding != null) { |
| | 5113 | | foreach (string _item in fileContentEncoding) |
| | 5114 | | { |
| | 5115 | | _request.Headers.SetValue("x-ms-content-encoding", _item); |
| | 5116 | | } |
| | 5117 | | } |
| | 5118 | | if (fileContentLanguage != null) { |
| | 5119 | | foreach (string _item in fileContentLanguage) |
| | 5120 | | { |
| | 5121 | | _request.Headers.SetValue("x-ms-content-language", _item); |
| | 5122 | | } |
| | 5123 | | } |
| | 5124 | | if (fileCacheControl != null) { _request.Headers.SetValue("x-ms-cache-control", fileCacheControl); } |
| | 5125 | | if (fileContentHash != null) { _request.Headers.SetValue("x-ms-content-md5", System.Convert.ToBase64Stri |
| | 5126 | | if (fileContentDisposition != null) { _request.Headers.SetValue("x-ms-content-disposition", fileContentD |
| | 5127 | | if (filePermission != null) { _request.Headers.SetValue("x-ms-file-permission", filePermission); } |
| | 5128 | | if (filePermissionKey != null) { _request.Headers.SetValue("x-ms-file-permission-key", filePermissionKey |
| | 5129 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 5130 | |
|
| | 5131 | | return _message; |
| | 5132 | | } |
| | 5133 | |
|
| | 5134 | | /// <summary> |
| | 5135 | | /// Create the File.SetPropertiesAsync response or throw a failure exception. |
| | 5136 | | /// </summary> |
| | 5137 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 5138 | | /// <param name="response">The raw Response.</param> |
| | 5139 | | /// <returns>The File.SetPropertiesAsync Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageFileInfo |
| | 5140 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.RawStorageFileInfo> SetPropertiesAsync_Crea |
| | 5141 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5142 | | Azure.Response response) |
| | 5143 | | { |
| | 5144 | | // Process the response |
| | 5145 | | switch (response.Status) |
| | 5146 | | { |
| | 5147 | | case 200: |
| | 5148 | | { |
| | 5149 | | // Create the result |
| | 5150 | | Azure.Storage.Files.Shares.Models.RawStorageFileInfo _value = new Azure.Storage.Files.Shares.Mod |
| | 5151 | |
|
| | 5152 | | // Get response headers |
| | 5153 | | string _header; |
| | 5154 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 5155 | | { |
| | 5156 | | _value.ETag = new Azure.ETag(_header); |
| | 5157 | | } |
| | 5158 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 5159 | | { |
| | 5160 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 5161 | | } |
| | 5162 | | if (response.Headers.TryGetValue("x-ms-request-server-encrypted", out _header)) |
| | 5163 | | { |
| | 5164 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 5165 | | } |
| | 5166 | | if (response.Headers.TryGetValue("x-ms-file-permission-key", out _header)) |
| | 5167 | | { |
| | 5168 | | _value.FilePermissionKey = _header; |
| | 5169 | | } |
| | 5170 | | if (response.Headers.TryGetValue("x-ms-file-attributes", out _header)) |
| | 5171 | | { |
| | 5172 | | _value.FileAttributes = _header; |
| | 5173 | | } |
| | 5174 | | if (response.Headers.TryGetValue("x-ms-file-creation-time", out _header)) |
| | 5175 | | { |
| | 5176 | | _value.FileCreationTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureI |
| | 5177 | | } |
| | 5178 | | if (response.Headers.TryGetValue("x-ms-file-last-write-time", out _header)) |
| | 5179 | | { |
| | 5180 | | _value.FileLastWriteTime = System.DateTimeOffset.Parse(_header, System.Globalization.Culture |
| | 5181 | | } |
| | 5182 | | if (response.Headers.TryGetValue("x-ms-file-change-time", out _header)) |
| | 5183 | | { |
| | 5184 | | _value.FileChangeTime = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInf |
| | 5185 | | } |
| | 5186 | | if (response.Headers.TryGetValue("x-ms-file-id", out _header)) |
| | 5187 | | { |
| | 5188 | | _value.FileId = _header; |
| | 5189 | | } |
| | 5190 | | if (response.Headers.TryGetValue("x-ms-file-parent-id", out _header)) |
| | 5191 | | { |
| | 5192 | | _value.FileParentId = _header; |
| | 5193 | | } |
| | 5194 | |
|
| | 5195 | | // Create the response |
| | 5196 | | return Response.FromValue(_value, response); |
| | 5197 | | } |
| | 5198 | | default: |
| | 5199 | | { |
| | 5200 | | // Create the result |
| | 5201 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 5202 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 5203 | |
|
| | 5204 | | throw _value.CreateException(clientDiagnostics, response); |
| | 5205 | | } |
| | 5206 | | } |
| | 5207 | | } |
| | 5208 | | #endregion File.SetPropertiesAsync |
| | 5209 | |
|
| | 5210 | | #region File.SetMetadataAsync |
| | 5211 | | /// <summary> |
| | 5212 | | /// Updates user-defined metadata for the specified file. |
| | 5213 | | /// </summary> |
| | 5214 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 5215 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5216 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 5217 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5218 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5219 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 5220 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 5221 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 5222 | | /// <param name="operationName">Operation name.</param> |
| | 5223 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 5224 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageFileInfo}</returns> |
| | 5225 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.RawSto |
| | 5226 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5227 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5228 | | System.Uri resourceUri, |
| | 5229 | | string version, |
| | 5230 | | int? timeout = default, |
| | 5231 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 5232 | | string leaseId = default, |
| | 5233 | | bool async = true, |
| | 5234 | | string operationName = "FileClient.SetMetadata", |
| | 5235 | | System.Threading.CancellationToken cancellationToken = default) |
| | 5236 | | { |
| | 5237 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 5238 | | try |
| | 5239 | | { |
| | 5240 | | _scope.AddAttribute("url", resourceUri); |
| | 5241 | | _scope.Start(); |
| | 5242 | | using (Azure.Core.HttpMessage _message = SetMetadataAsync_CreateMessage( |
| | 5243 | | pipeline, |
| | 5244 | | resourceUri, |
| | 5245 | | version, |
| | 5246 | | timeout, |
| | 5247 | | metadata, |
| | 5248 | | leaseId)) |
| | 5249 | | { |
| | 5250 | | if (async) |
| | 5251 | | { |
| | 5252 | | // Send the request asynchronously if we're being called via an async path |
| | 5253 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 5254 | | } |
| | 5255 | | else |
| | 5256 | | { |
| | 5257 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 5258 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 5259 | | pipeline.Send(_message, cancellationToken); |
| | 5260 | | } |
| | 5261 | | Azure.Response _response = _message.Response; |
| | 5262 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 5263 | | return SetMetadataAsync_CreateResponse(clientDiagnostics, _response); |
| | 5264 | | } |
| | 5265 | | } |
| | 5266 | | catch (System.Exception ex) |
| | 5267 | | { |
| | 5268 | | _scope.Failed(ex); |
| | 5269 | | throw; |
| | 5270 | | } |
| | 5271 | | finally |
| | 5272 | | { |
| | 5273 | | _scope.Dispose(); |
| | 5274 | | } |
| | 5275 | | } |
| | 5276 | |
|
| | 5277 | | /// <summary> |
| | 5278 | | /// Create the File.SetMetadataAsync request. |
| | 5279 | | /// </summary> |
| | 5280 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5281 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 5282 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5283 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5284 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 5285 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 5286 | | /// <returns>The File.SetMetadataAsync Message.</returns> |
| | 5287 | | internal static Azure.Core.HttpMessage SetMetadataAsync_CreateMessage( |
| | 5288 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5289 | | System.Uri resourceUri, |
| | 5290 | | string version, |
| | 5291 | | int? timeout = default, |
| | 5292 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 5293 | | string leaseId = default) |
| | 5294 | | { |
| | 5295 | | // Validation |
| | 5296 | | if (resourceUri == null) |
| | 5297 | | { |
| | 5298 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 5299 | | } |
| | 5300 | | if (version == null) |
| | 5301 | | { |
| | 5302 | | throw new System.ArgumentNullException(nameof(version)); |
| | 5303 | | } |
| | 5304 | |
|
| | 5305 | | // Create the request |
| | 5306 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 5307 | | Azure.Core.Request _request = _message.Request; |
| | 5308 | |
|
| | 5309 | | // Set the endpoint |
| | 5310 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 5311 | | _request.Uri.Reset(resourceUri); |
| | 5312 | | _request.Uri.AppendQuery("comp", "metadata", escapeValue: false); |
| | 5313 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 5314 | |
|
| | 5315 | | // Add request headers |
| | 5316 | | _request.Headers.SetValue("x-ms-version", version); |
| | 5317 | | if (metadata != null) { |
| | 5318 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 5319 | | { |
| | 5320 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 5321 | | } |
| | 5322 | | } |
| | 5323 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 5324 | |
|
| | 5325 | | return _message; |
| | 5326 | | } |
| | 5327 | |
|
| | 5328 | | /// <summary> |
| | 5329 | | /// Create the File.SetMetadataAsync response or throw a failure exception. |
| | 5330 | | /// </summary> |
| | 5331 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 5332 | | /// <param name="response">The raw Response.</param> |
| | 5333 | | /// <returns>The File.SetMetadataAsync Azure.Response{Azure.Storage.Files.Shares.Models.RawStorageFileInfo}. |
| | 5334 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.RawStorageFileInfo> SetMetadataAsync_Create |
| | 5335 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5336 | | Azure.Response response) |
| | 5337 | | { |
| | 5338 | | // Process the response |
| | 5339 | | switch (response.Status) |
| | 5340 | | { |
| | 5341 | | case 200: |
| | 5342 | | { |
| | 5343 | | // Create the result |
| | 5344 | | Azure.Storage.Files.Shares.Models.RawStorageFileInfo _value = new Azure.Storage.Files.Shares.Mod |
| | 5345 | |
|
| | 5346 | | // Get response headers |
| | 5347 | | string _header; |
| | 5348 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 5349 | | { |
| | 5350 | | _value.ETag = new Azure.ETag(_header); |
| | 5351 | | } |
| | 5352 | | if (response.Headers.TryGetValue("x-ms-request-server-encrypted", out _header)) |
| | 5353 | | { |
| | 5354 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 5355 | | } |
| | 5356 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 5357 | | { |
| | 5358 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 5359 | | } |
| | 5360 | |
|
| | 5361 | | // Create the response |
| | 5362 | | return Response.FromValue(_value, response); |
| | 5363 | | } |
| | 5364 | | default: |
| | 5365 | | { |
| | 5366 | | // Create the result |
| | 5367 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 5368 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 5369 | |
|
| | 5370 | | throw _value.CreateException(clientDiagnostics, response); |
| | 5371 | | } |
| | 5372 | | } |
| | 5373 | | } |
| | 5374 | | #endregion File.SetMetadataAsync |
| | 5375 | |
|
| | 5376 | | #region File.AcquireLeaseAsync |
| | 5377 | | /// <summary> |
| | 5378 | | /// [Update] The Lease File operation establishes and manages a lock on a file for write and delete operatio |
| | 5379 | | /// </summary> |
| | 5380 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 5381 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5382 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 5383 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5384 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5385 | | /// <param name="duration">Specifies the duration of the lease, in seconds, or negative one (-1) for a lease |
| | 5386 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The File service returns 400 ( |
| | 5387 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5388 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 5389 | | /// <param name="operationName">Operation name.</param> |
| | 5390 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 5391 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.ShareFileLease}</returns> |
| | 5392 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareF |
| | 5393 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5394 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5395 | | System.Uri resourceUri, |
| | 5396 | | string version, |
| | 5397 | | int? timeout = default, |
| | 5398 | | int? duration = default, |
| | 5399 | | string proposedLeaseId = default, |
| | 5400 | | string requestId = default, |
| | 5401 | | bool async = true, |
| | 5402 | | string operationName = "FileClient.AcquireLease", |
| | 5403 | | System.Threading.CancellationToken cancellationToken = default) |
| | 5404 | | { |
| | 5405 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 5406 | | try |
| | 5407 | | { |
| | 5408 | | _scope.AddAttribute("url", resourceUri); |
| | 5409 | | _scope.Start(); |
| | 5410 | | using (Azure.Core.HttpMessage _message = AcquireLeaseAsync_CreateMessage( |
| | 5411 | | pipeline, |
| | 5412 | | resourceUri, |
| | 5413 | | version, |
| | 5414 | | timeout, |
| | 5415 | | duration, |
| | 5416 | | proposedLeaseId, |
| | 5417 | | requestId)) |
| | 5418 | | { |
| | 5419 | | if (async) |
| | 5420 | | { |
| | 5421 | | // Send the request asynchronously if we're being called via an async path |
| | 5422 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 5423 | | } |
| | 5424 | | else |
| | 5425 | | { |
| | 5426 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 5427 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 5428 | | pipeline.Send(_message, cancellationToken); |
| | 5429 | | } |
| | 5430 | | Azure.Response _response = _message.Response; |
| | 5431 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 5432 | | return AcquireLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 5433 | | } |
| | 5434 | | } |
| | 5435 | | catch (System.Exception ex) |
| | 5436 | | { |
| | 5437 | | _scope.Failed(ex); |
| | 5438 | | throw; |
| | 5439 | | } |
| | 5440 | | finally |
| | 5441 | | { |
| | 5442 | | _scope.Dispose(); |
| | 5443 | | } |
| | 5444 | | } |
| | 5445 | |
|
| | 5446 | | /// <summary> |
| | 5447 | | /// Create the File.AcquireLeaseAsync request. |
| | 5448 | | /// </summary> |
| | 5449 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5450 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 5451 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5452 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5453 | | /// <param name="duration">Specifies the duration of the lease, in seconds, or negative one (-1) for a lease |
| | 5454 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The File service returns 400 ( |
| | 5455 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5456 | | /// <returns>The File.AcquireLeaseAsync Message.</returns> |
| | 5457 | | internal static Azure.Core.HttpMessage AcquireLeaseAsync_CreateMessage( |
| | 5458 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5459 | | System.Uri resourceUri, |
| | 5460 | | string version, |
| | 5461 | | int? timeout = default, |
| | 5462 | | int? duration = default, |
| | 5463 | | string proposedLeaseId = default, |
| | 5464 | | string requestId = default) |
| | 5465 | | { |
| | 5466 | | // Validation |
| | 5467 | | if (resourceUri == null) |
| | 5468 | | { |
| | 5469 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 5470 | | } |
| | 5471 | | if (version == null) |
| | 5472 | | { |
| | 5473 | | throw new System.ArgumentNullException(nameof(version)); |
| | 5474 | | } |
| | 5475 | |
|
| | 5476 | | // Create the request |
| | 5477 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 5478 | | Azure.Core.Request _request = _message.Request; |
| | 5479 | |
|
| | 5480 | | // Set the endpoint |
| | 5481 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 5482 | | _request.Uri.Reset(resourceUri); |
| | 5483 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 5484 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 5485 | |
|
| | 5486 | | // Add request headers |
| | 5487 | | _request.Headers.SetValue("x-ms-lease-action", "acquire"); |
| | 5488 | | _request.Headers.SetValue("x-ms-version", version); |
| | 5489 | | if (duration != null) { _request.Headers.SetValue("x-ms-lease-duration", duration.Value.ToString(System. |
| | 5490 | | if (proposedLeaseId != null) { _request.Headers.SetValue("x-ms-proposed-lease-id", proposedLeaseId); } |
| | 5491 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 5492 | |
|
| | 5493 | | return _message; |
| | 5494 | | } |
| | 5495 | |
|
| | 5496 | | /// <summary> |
| | 5497 | | /// Create the File.AcquireLeaseAsync response or throw a failure exception. |
| | 5498 | | /// </summary> |
| | 5499 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 5500 | | /// <param name="response">The raw Response.</param> |
| | 5501 | | /// <returns>The File.AcquireLeaseAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareFileLease}.</r |
| | 5502 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareFileLease> AcquireLeaseAsync_CreateRes |
| | 5503 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5504 | | Azure.Response response) |
| | 5505 | | { |
| | 5506 | | // Process the response |
| | 5507 | | switch (response.Status) |
| | 5508 | | { |
| | 5509 | | case 201: |
| | 5510 | | { |
| | 5511 | | // Create the result |
| | 5512 | | Azure.Storage.Files.Shares.Models.ShareFileLease _value = new Azure.Storage.Files.Shares.Models. |
| | 5513 | |
|
| | 5514 | | // Get response headers |
| | 5515 | | string _header; |
| | 5516 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 5517 | | { |
| | 5518 | | _value.ETag = new Azure.ETag(_header); |
| | 5519 | | } |
| | 5520 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 5521 | | { |
| | 5522 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 5523 | | } |
| | 5524 | | if (response.Headers.TryGetValue("x-ms-lease-id", out _header)) |
| | 5525 | | { |
| | 5526 | | _value.LeaseId = _header; |
| | 5527 | | } |
| | 5528 | |
|
| | 5529 | | // Create the response |
| | 5530 | | return Response.FromValue(_value, response); |
| | 5531 | | } |
| | 5532 | | default: |
| | 5533 | | { |
| | 5534 | | // Create the result |
| | 5535 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 5536 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 5537 | |
|
| | 5538 | | throw _value.CreateException(clientDiagnostics, response); |
| | 5539 | | } |
| | 5540 | | } |
| | 5541 | | } |
| | 5542 | | #endregion File.AcquireLeaseAsync |
| | 5543 | |
|
| | 5544 | | #region File.ReleaseLeaseAsync |
| | 5545 | | /// <summary> |
| | 5546 | | /// [Update] The Lease File operation establishes and manages a lock on a file for write and delete operatio |
| | 5547 | | /// </summary> |
| | 5548 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 5549 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5550 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 5551 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 5552 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5553 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5554 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5555 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 5556 | | /// <param name="operationName">Operation name.</param> |
| | 5557 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 5558 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.FileLeaseReleaseInfo}</returns> |
| | 5559 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.FileLe |
| | 5560 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5561 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5562 | | System.Uri resourceUri, |
| | 5563 | | string leaseId, |
| | 5564 | | string version, |
| | 5565 | | int? timeout = default, |
| | 5566 | | string requestId = default, |
| | 5567 | | bool async = true, |
| | 5568 | | string operationName = "FileClient.ReleaseLease", |
| | 5569 | | System.Threading.CancellationToken cancellationToken = default) |
| | 5570 | | { |
| | 5571 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 5572 | | try |
| | 5573 | | { |
| | 5574 | | _scope.AddAttribute("url", resourceUri); |
| | 5575 | | _scope.Start(); |
| | 5576 | | using (Azure.Core.HttpMessage _message = ReleaseLeaseAsync_CreateMessage( |
| | 5577 | | pipeline, |
| | 5578 | | resourceUri, |
| | 5579 | | leaseId, |
| | 5580 | | version, |
| | 5581 | | timeout, |
| | 5582 | | requestId)) |
| | 5583 | | { |
| | 5584 | | if (async) |
| | 5585 | | { |
| | 5586 | | // Send the request asynchronously if we're being called via an async path |
| | 5587 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 5588 | | } |
| | 5589 | | else |
| | 5590 | | { |
| | 5591 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 5592 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 5593 | | pipeline.Send(_message, cancellationToken); |
| | 5594 | | } |
| | 5595 | | Azure.Response _response = _message.Response; |
| | 5596 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 5597 | | return ReleaseLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 5598 | | } |
| | 5599 | | } |
| | 5600 | | catch (System.Exception ex) |
| | 5601 | | { |
| | 5602 | | _scope.Failed(ex); |
| | 5603 | | throw; |
| | 5604 | | } |
| | 5605 | | finally |
| | 5606 | | { |
| | 5607 | | _scope.Dispose(); |
| | 5608 | | } |
| | 5609 | | } |
| | 5610 | |
|
| | 5611 | | /// <summary> |
| | 5612 | | /// Create the File.ReleaseLeaseAsync request. |
| | 5613 | | /// </summary> |
| | 5614 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5615 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 5616 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 5617 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5618 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5619 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5620 | | /// <returns>The File.ReleaseLeaseAsync Message.</returns> |
| | 5621 | | internal static Azure.Core.HttpMessage ReleaseLeaseAsync_CreateMessage( |
| | 5622 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5623 | | System.Uri resourceUri, |
| | 5624 | | string leaseId, |
| | 5625 | | string version, |
| | 5626 | | int? timeout = default, |
| | 5627 | | string requestId = default) |
| | 5628 | | { |
| | 5629 | | // Validation |
| | 5630 | | if (resourceUri == null) |
| | 5631 | | { |
| | 5632 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 5633 | | } |
| | 5634 | | if (leaseId == null) |
| | 5635 | | { |
| | 5636 | | throw new System.ArgumentNullException(nameof(leaseId)); |
| | 5637 | | } |
| | 5638 | | if (version == null) |
| | 5639 | | { |
| | 5640 | | throw new System.ArgumentNullException(nameof(version)); |
| | 5641 | | } |
| | 5642 | |
|
| | 5643 | | // Create the request |
| | 5644 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 5645 | | Azure.Core.Request _request = _message.Request; |
| | 5646 | |
|
| | 5647 | | // Set the endpoint |
| | 5648 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 5649 | | _request.Uri.Reset(resourceUri); |
| | 5650 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 5651 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 5652 | |
|
| | 5653 | | // Add request headers |
| | 5654 | | _request.Headers.SetValue("x-ms-lease-action", "release"); |
| | 5655 | | _request.Headers.SetValue("x-ms-lease-id", leaseId); |
| | 5656 | | _request.Headers.SetValue("x-ms-version", version); |
| | 5657 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 5658 | |
|
| | 5659 | | return _message; |
| | 5660 | | } |
| | 5661 | |
|
| | 5662 | | /// <summary> |
| | 5663 | | /// Create the File.ReleaseLeaseAsync response or throw a failure exception. |
| | 5664 | | /// </summary> |
| | 5665 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 5666 | | /// <param name="response">The raw Response.</param> |
| | 5667 | | /// <returns>The File.ReleaseLeaseAsync Azure.Response{Azure.Storage.Files.Shares.Models.FileLeaseReleaseInf |
| | 5668 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.FileLeaseReleaseInfo> ReleaseLeaseAsync_Cre |
| | 5669 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5670 | | Azure.Response response) |
| | 5671 | | { |
| | 5672 | | // Process the response |
| | 5673 | | switch (response.Status) |
| | 5674 | | { |
| | 5675 | | case 200: |
| | 5676 | | { |
| | 5677 | | // Create the result |
| | 5678 | | Azure.Storage.Files.Shares.Models.FileLeaseReleaseInfo _value = new Azure.Storage.Files.Shares.M |
| | 5679 | |
|
| | 5680 | | // Get response headers |
| | 5681 | | string _header; |
| | 5682 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 5683 | | { |
| | 5684 | | _value.ETag = new Azure.ETag(_header); |
| | 5685 | | } |
| | 5686 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 5687 | | { |
| | 5688 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 5689 | | } |
| | 5690 | |
|
| | 5691 | | // Create the response |
| | 5692 | | return Response.FromValue(_value, response); |
| | 5693 | | } |
| | 5694 | | default: |
| | 5695 | | { |
| | 5696 | | // Create the result |
| | 5697 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 5698 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 5699 | |
|
| | 5700 | | throw _value.CreateException(clientDiagnostics, response); |
| | 5701 | | } |
| | 5702 | | } |
| | 5703 | | } |
| | 5704 | | #endregion File.ReleaseLeaseAsync |
| | 5705 | |
|
| | 5706 | | #region File.ChangeLeaseAsync |
| | 5707 | | /// <summary> |
| | 5708 | | /// [Update] The Lease File operation establishes and manages a lock on a file for write and delete operatio |
| | 5709 | | /// </summary> |
| | 5710 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 5711 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5712 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 5713 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 5714 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5715 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5716 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The File service returns 400 ( |
| | 5717 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5718 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 5719 | | /// <param name="operationName">Operation name.</param> |
| | 5720 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 5721 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.ShareFileLease}</returns> |
| | 5722 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareF |
| | 5723 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5724 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5725 | | System.Uri resourceUri, |
| | 5726 | | string leaseId, |
| | 5727 | | string version, |
| | 5728 | | int? timeout = default, |
| | 5729 | | string proposedLeaseId = default, |
| | 5730 | | string requestId = default, |
| | 5731 | | bool async = true, |
| | 5732 | | string operationName = "FileClient.ChangeLease", |
| | 5733 | | System.Threading.CancellationToken cancellationToken = default) |
| | 5734 | | { |
| | 5735 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 5736 | | try |
| | 5737 | | { |
| | 5738 | | _scope.AddAttribute("url", resourceUri); |
| | 5739 | | _scope.Start(); |
| | 5740 | | using (Azure.Core.HttpMessage _message = ChangeLeaseAsync_CreateMessage( |
| | 5741 | | pipeline, |
| | 5742 | | resourceUri, |
| | 5743 | | leaseId, |
| | 5744 | | version, |
| | 5745 | | timeout, |
| | 5746 | | proposedLeaseId, |
| | 5747 | | requestId)) |
| | 5748 | | { |
| | 5749 | | if (async) |
| | 5750 | | { |
| | 5751 | | // Send the request asynchronously if we're being called via an async path |
| | 5752 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 5753 | | } |
| | 5754 | | else |
| | 5755 | | { |
| | 5756 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 5757 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 5758 | | pipeline.Send(_message, cancellationToken); |
| | 5759 | | } |
| | 5760 | | Azure.Response _response = _message.Response; |
| | 5761 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 5762 | | return ChangeLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 5763 | | } |
| | 5764 | | } |
| | 5765 | | catch (System.Exception ex) |
| | 5766 | | { |
| | 5767 | | _scope.Failed(ex); |
| | 5768 | | throw; |
| | 5769 | | } |
| | 5770 | | finally |
| | 5771 | | { |
| | 5772 | | _scope.Dispose(); |
| | 5773 | | } |
| | 5774 | | } |
| | 5775 | |
|
| | 5776 | | /// <summary> |
| | 5777 | | /// Create the File.ChangeLeaseAsync request. |
| | 5778 | | /// </summary> |
| | 5779 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5780 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 5781 | | /// <param name="leaseId">Specifies the current lease ID on the resource.</param> |
| | 5782 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5783 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5784 | | /// <param name="proposedLeaseId">Proposed lease ID, in a GUID string format. The File service returns 400 ( |
| | 5785 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5786 | | /// <returns>The File.ChangeLeaseAsync Message.</returns> |
| | 5787 | | internal static Azure.Core.HttpMessage ChangeLeaseAsync_CreateMessage( |
| | 5788 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5789 | | System.Uri resourceUri, |
| | 5790 | | string leaseId, |
| | 5791 | | string version, |
| | 5792 | | int? timeout = default, |
| | 5793 | | string proposedLeaseId = default, |
| | 5794 | | string requestId = default) |
| | 5795 | | { |
| | 5796 | | // Validation |
| | 5797 | | if (resourceUri == null) |
| | 5798 | | { |
| | 5799 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 5800 | | } |
| | 5801 | | if (leaseId == null) |
| | 5802 | | { |
| | 5803 | | throw new System.ArgumentNullException(nameof(leaseId)); |
| | 5804 | | } |
| | 5805 | | if (version == null) |
| | 5806 | | { |
| | 5807 | | throw new System.ArgumentNullException(nameof(version)); |
| | 5808 | | } |
| | 5809 | |
|
| | 5810 | | // Create the request |
| | 5811 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 5812 | | Azure.Core.Request _request = _message.Request; |
| | 5813 | |
|
| | 5814 | | // Set the endpoint |
| | 5815 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 5816 | | _request.Uri.Reset(resourceUri); |
| | 5817 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 5818 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 5819 | |
|
| | 5820 | | // Add request headers |
| | 5821 | | _request.Headers.SetValue("x-ms-lease-action", "change"); |
| | 5822 | | _request.Headers.SetValue("x-ms-lease-id", leaseId); |
| | 5823 | | _request.Headers.SetValue("x-ms-version", version); |
| | 5824 | | if (proposedLeaseId != null) { _request.Headers.SetValue("x-ms-proposed-lease-id", proposedLeaseId); } |
| | 5825 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 5826 | |
|
| | 5827 | | return _message; |
| | 5828 | | } |
| | 5829 | |
|
| | 5830 | | /// <summary> |
| | 5831 | | /// Create the File.ChangeLeaseAsync response or throw a failure exception. |
| | 5832 | | /// </summary> |
| | 5833 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 5834 | | /// <param name="response">The raw Response.</param> |
| | 5835 | | /// <returns>The File.ChangeLeaseAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareFileLease}.</re |
| | 5836 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareFileLease> ChangeLeaseAsync_CreateResp |
| | 5837 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5838 | | Azure.Response response) |
| | 5839 | | { |
| | 5840 | | // Process the response |
| | 5841 | | switch (response.Status) |
| | 5842 | | { |
| | 5843 | | case 200: |
| | 5844 | | { |
| | 5845 | | // Create the result |
| | 5846 | | Azure.Storage.Files.Shares.Models.ShareFileLease _value = new Azure.Storage.Files.Shares.Models. |
| | 5847 | |
|
| | 5848 | | // Get response headers |
| | 5849 | | string _header; |
| | 5850 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 5851 | | { |
| | 5852 | | _value.ETag = new Azure.ETag(_header); |
| | 5853 | | } |
| | 5854 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 5855 | | { |
| | 5856 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 5857 | | } |
| | 5858 | | if (response.Headers.TryGetValue("x-ms-lease-id", out _header)) |
| | 5859 | | { |
| | 5860 | | _value.LeaseId = _header; |
| | 5861 | | } |
| | 5862 | |
|
| | 5863 | | // Create the response |
| | 5864 | | return Response.FromValue(_value, response); |
| | 5865 | | } |
| | 5866 | | default: |
| | 5867 | | { |
| | 5868 | | // Create the result |
| | 5869 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 5870 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 5871 | |
|
| | 5872 | | throw _value.CreateException(clientDiagnostics, response); |
| | 5873 | | } |
| | 5874 | | } |
| | 5875 | | } |
| | 5876 | | #endregion File.ChangeLeaseAsync |
| | 5877 | |
|
| | 5878 | | #region File.BreakLeaseAsync |
| | 5879 | | /// <summary> |
| | 5880 | | /// [Update] The Lease File operation establishes and manages a lock on a file for write and delete operatio |
| | 5881 | | /// </summary> |
| | 5882 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 5883 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5884 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 5885 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5886 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5887 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 5888 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5889 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 5890 | | /// <param name="operationName">Operation name.</param> |
| | 5891 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 5892 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.BrokenLease}</returns> |
| | 5893 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.Broken |
| | 5894 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 5895 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5896 | | System.Uri resourceUri, |
| | 5897 | | string version, |
| | 5898 | | int? timeout = default, |
| | 5899 | | string leaseId = default, |
| | 5900 | | string requestId = default, |
| | 5901 | | bool async = true, |
| | 5902 | | string operationName = "FileClient.BreakLease", |
| | 5903 | | System.Threading.CancellationToken cancellationToken = default) |
| | 5904 | | { |
| | 5905 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 5906 | | try |
| | 5907 | | { |
| | 5908 | | _scope.AddAttribute("url", resourceUri); |
| | 5909 | | _scope.Start(); |
| | 5910 | | using (Azure.Core.HttpMessage _message = BreakLeaseAsync_CreateMessage( |
| | 5911 | | pipeline, |
| | 5912 | | resourceUri, |
| | 5913 | | version, |
| | 5914 | | timeout, |
| | 5915 | | leaseId, |
| | 5916 | | requestId)) |
| | 5917 | | { |
| | 5918 | | if (async) |
| | 5919 | | { |
| | 5920 | | // Send the request asynchronously if we're being called via an async path |
| | 5921 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 5922 | | } |
| | 5923 | | else |
| | 5924 | | { |
| | 5925 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 5926 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 5927 | | pipeline.Send(_message, cancellationToken); |
| | 5928 | | } |
| | 5929 | | Azure.Response _response = _message.Response; |
| | 5930 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 5931 | | return BreakLeaseAsync_CreateResponse(clientDiagnostics, _response); |
| | 5932 | | } |
| | 5933 | | } |
| | 5934 | | catch (System.Exception ex) |
| | 5935 | | { |
| | 5936 | | _scope.Failed(ex); |
| | 5937 | | throw; |
| | 5938 | | } |
| | 5939 | | finally |
| | 5940 | | { |
| | 5941 | | _scope.Dispose(); |
| | 5942 | | } |
| | 5943 | | } |
| | 5944 | |
|
| | 5945 | | /// <summary> |
| | 5946 | | /// Create the File.BreakLeaseAsync request. |
| | 5947 | | /// </summary> |
| | 5948 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 5949 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 5950 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 5951 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 5952 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 5953 | | /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is re |
| | 5954 | | /// <returns>The File.BreakLeaseAsync Message.</returns> |
| | 5955 | | internal static Azure.Core.HttpMessage BreakLeaseAsync_CreateMessage( |
| | 5956 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 5957 | | System.Uri resourceUri, |
| | 5958 | | string version, |
| | 5959 | | int? timeout = default, |
| | 5960 | | string leaseId = default, |
| | 5961 | | string requestId = default) |
| | 5962 | | { |
| | 5963 | | // Validation |
| | 5964 | | if (resourceUri == null) |
| | 5965 | | { |
| | 5966 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 5967 | | } |
| | 5968 | | if (version == null) |
| | 5969 | | { |
| | 5970 | | throw new System.ArgumentNullException(nameof(version)); |
| | 5971 | | } |
| | 5972 | |
|
| | 5973 | | // Create the request |
| | 5974 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 5975 | | Azure.Core.Request _request = _message.Request; |
| | 5976 | |
|
| | 5977 | | // Set the endpoint |
| | 5978 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 5979 | | _request.Uri.Reset(resourceUri); |
| | 5980 | | _request.Uri.AppendQuery("comp", "lease", escapeValue: false); |
| | 5981 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 5982 | |
|
| | 5983 | | // Add request headers |
| | 5984 | | _request.Headers.SetValue("x-ms-lease-action", "break"); |
| | 5985 | | _request.Headers.SetValue("x-ms-version", version); |
| | 5986 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 5987 | | if (requestId != null) { _request.Headers.SetValue("x-ms-client-request-id", requestId); } |
| | 5988 | |
|
| | 5989 | | return _message; |
| | 5990 | | } |
| | 5991 | |
|
| | 5992 | | /// <summary> |
| | 5993 | | /// Create the File.BreakLeaseAsync response or throw a failure exception. |
| | 5994 | | /// </summary> |
| | 5995 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 5996 | | /// <param name="response">The raw Response.</param> |
| | 5997 | | /// <returns>The File.BreakLeaseAsync Azure.Response{Azure.Storage.Files.Shares.Models.BrokenLease}.</return |
| | 5998 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.BrokenLease> BreakLeaseAsync_CreateResponse |
| | 5999 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6000 | | Azure.Response response) |
| | 6001 | | { |
| | 6002 | | // Process the response |
| | 6003 | | switch (response.Status) |
| | 6004 | | { |
| | 6005 | | case 202: |
| | 6006 | | { |
| | 6007 | | // Create the result |
| | 6008 | | Azure.Storage.Files.Shares.Models.BrokenLease _value = new Azure.Storage.Files.Shares.Models.Bro |
| | 6009 | |
|
| | 6010 | | // Get response headers |
| | 6011 | | string _header; |
| | 6012 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 6013 | | { |
| | 6014 | | _value.ETag = new Azure.ETag(_header); |
| | 6015 | | } |
| | 6016 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 6017 | | { |
| | 6018 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 6019 | | } |
| | 6020 | | if (response.Headers.TryGetValue("x-ms-lease-id", out _header)) |
| | 6021 | | { |
| | 6022 | | _value.LeaseId = _header; |
| | 6023 | | } |
| | 6024 | |
|
| | 6025 | | // Create the response |
| | 6026 | | return Response.FromValue(_value, response); |
| | 6027 | | } |
| | 6028 | | default: |
| | 6029 | | { |
| | 6030 | | // Create the result |
| | 6031 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6032 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 6033 | |
|
| | 6034 | | throw _value.CreateException(clientDiagnostics, response); |
| | 6035 | | } |
| | 6036 | | } |
| | 6037 | | } |
| | 6038 | | #endregion File.BreakLeaseAsync |
| | 6039 | |
|
| | 6040 | | #region File.UploadRangeAsync |
| | 6041 | | /// <summary> |
| | 6042 | | /// Upload a range of bytes to a file. |
| | 6043 | | /// </summary> |
| | 6044 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 6045 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6046 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 6047 | | /// <param name="range">Specifies the range of bytes to be written. Both the start and end of the range must |
| | 6048 | | /// <param name="fileRangeWrite">Specify one of the following options: - Update: Writes the bytes specified |
| | 6049 | | /// <param name="contentLength">Specifies the number of bytes being transmitted in the request body. When th |
| | 6050 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6051 | | /// <param name="optionalbody">Initial data.</param> |
| | 6052 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6053 | | /// <param name="contentHash">An MD5 hash of the content. This hash is used to verify the integrity of the d |
| | 6054 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6055 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 6056 | | /// <param name="operationName">Operation name.</param> |
| | 6057 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 6058 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.ShareFileUploadInfo}</returns> |
| | 6059 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareF |
| | 6060 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6061 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6062 | | System.Uri resourceUri, |
| | 6063 | | string range, |
| | 6064 | | Azure.Storage.Files.Shares.Models.ShareFileRangeWriteType fileRangeWrite, |
| | 6065 | | long contentLength, |
| | 6066 | | string version, |
| | 6067 | | System.IO.Stream optionalbody = default, |
| | 6068 | | int? timeout = default, |
| | 6069 | | byte[] contentHash = default, |
| | 6070 | | string leaseId = default, |
| | 6071 | | bool async = true, |
| | 6072 | | string operationName = "FileClient.UploadRange", |
| | 6073 | | System.Threading.CancellationToken cancellationToken = default) |
| | 6074 | | { |
| | 6075 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 6076 | | try |
| | 6077 | | { |
| | 6078 | | _scope.AddAttribute("url", resourceUri); |
| | 6079 | | _scope.Start(); |
| | 6080 | | using (Azure.Core.HttpMessage _message = UploadRangeAsync_CreateMessage( |
| | 6081 | | pipeline, |
| | 6082 | | resourceUri, |
| | 6083 | | range, |
| | 6084 | | fileRangeWrite, |
| | 6085 | | contentLength, |
| | 6086 | | version, |
| | 6087 | | optionalbody, |
| | 6088 | | timeout, |
| | 6089 | | contentHash, |
| | 6090 | | leaseId)) |
| | 6091 | | { |
| | 6092 | | if (async) |
| | 6093 | | { |
| | 6094 | | // Send the request asynchronously if we're being called via an async path |
| | 6095 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 6096 | | } |
| | 6097 | | else |
| | 6098 | | { |
| | 6099 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 6100 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 6101 | | pipeline.Send(_message, cancellationToken); |
| | 6102 | | } |
| | 6103 | | Azure.Response _response = _message.Response; |
| | 6104 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 6105 | | return UploadRangeAsync_CreateResponse(clientDiagnostics, _response); |
| | 6106 | | } |
| | 6107 | | } |
| | 6108 | | catch (System.Exception ex) |
| | 6109 | | { |
| | 6110 | | _scope.Failed(ex); |
| | 6111 | | throw; |
| | 6112 | | } |
| | 6113 | | finally |
| | 6114 | | { |
| | 6115 | | _scope.Dispose(); |
| | 6116 | | } |
| | 6117 | | } |
| | 6118 | |
|
| | 6119 | | /// <summary> |
| | 6120 | | /// Create the File.UploadRangeAsync request. |
| | 6121 | | /// </summary> |
| | 6122 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6123 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 6124 | | /// <param name="range">Specifies the range of bytes to be written. Both the start and end of the range must |
| | 6125 | | /// <param name="fileRangeWrite">Specify one of the following options: - Update: Writes the bytes specified |
| | 6126 | | /// <param name="contentLength">Specifies the number of bytes being transmitted in the request body. When th |
| | 6127 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6128 | | /// <param name="optionalbody">Initial data.</param> |
| | 6129 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6130 | | /// <param name="contentHash">An MD5 hash of the content. This hash is used to verify the integrity of the d |
| | 6131 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6132 | | /// <returns>The File.UploadRangeAsync Message.</returns> |
| | 6133 | | internal static Azure.Core.HttpMessage UploadRangeAsync_CreateMessage( |
| | 6134 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6135 | | System.Uri resourceUri, |
| | 6136 | | string range, |
| | 6137 | | Azure.Storage.Files.Shares.Models.ShareFileRangeWriteType fileRangeWrite, |
| | 6138 | | long contentLength, |
| | 6139 | | string version, |
| | 6140 | | System.IO.Stream optionalbody = default, |
| | 6141 | | int? timeout = default, |
| | 6142 | | byte[] contentHash = default, |
| | 6143 | | string leaseId = default) |
| | 6144 | | { |
| | 6145 | | // Validation |
| | 6146 | | if (resourceUri == null) |
| | 6147 | | { |
| | 6148 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 6149 | | } |
| | 6150 | | if (range == null) |
| | 6151 | | { |
| | 6152 | | throw new System.ArgumentNullException(nameof(range)); |
| | 6153 | | } |
| | 6154 | | if (version == null) |
| | 6155 | | { |
| | 6156 | | throw new System.ArgumentNullException(nameof(version)); |
| | 6157 | | } |
| | 6158 | |
|
| | 6159 | | // Create the request |
| | 6160 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 6161 | | Azure.Core.Request _request = _message.Request; |
| | 6162 | |
|
| | 6163 | | // Set the endpoint |
| | 6164 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 6165 | | _request.Uri.Reset(resourceUri); |
| | 6166 | | _request.Uri.AppendQuery("comp", "range", escapeValue: false); |
| | 6167 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 6168 | |
|
| | 6169 | | // Add request headers |
| | 6170 | | _request.Headers.SetValue("x-ms-range", range); |
| | 6171 | | _request.Headers.SetValue("x-ms-write", Azure.Storage.Files.Shares.FileRestClient.Serialization.ToString |
| | 6172 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 6173 | | _request.Headers.SetValue("x-ms-version", version); |
| | 6174 | | if (contentHash != null) { _request.Headers.SetValue("Content-MD5", System.Convert.ToBase64String(conten |
| | 6175 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 6176 | |
|
| | 6177 | | // Create the body |
| | 6178 | | if (optionalbody != null) |
| | 6179 | | { |
| | 6180 | | _request.Content = Azure.Core.RequestContent.Create(optionalbody); |
| | 6181 | | } |
| | 6182 | |
|
| | 6183 | | return _message; |
| | 6184 | | } |
| | 6185 | |
|
| | 6186 | | /// <summary> |
| | 6187 | | /// Create the File.UploadRangeAsync response or throw a failure exception. |
| | 6188 | | /// </summary> |
| | 6189 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 6190 | | /// <param name="response">The raw Response.</param> |
| | 6191 | | /// <returns>The File.UploadRangeAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareFileUploadInfo} |
| | 6192 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareFileUploadInfo> UploadRangeAsync_Creat |
| | 6193 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6194 | | Azure.Response response) |
| | 6195 | | { |
| | 6196 | | // Process the response |
| | 6197 | | switch (response.Status) |
| | 6198 | | { |
| | 6199 | | case 201: |
| | 6200 | | { |
| | 6201 | | // Create the result |
| | 6202 | | Azure.Storage.Files.Shares.Models.ShareFileUploadInfo _value = new Azure.Storage.Files.Shares.Mo |
| | 6203 | |
|
| | 6204 | | // Get response headers |
| | 6205 | | string _header; |
| | 6206 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 6207 | | { |
| | 6208 | | _value.ETag = new Azure.ETag(_header); |
| | 6209 | | } |
| | 6210 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 6211 | | { |
| | 6212 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 6213 | | } |
| | 6214 | | if (response.Headers.TryGetValue("Content-MD5", out _header)) |
| | 6215 | | { |
| | 6216 | | _value.ContentHash = System.Convert.FromBase64String(_header); |
| | 6217 | | } |
| | 6218 | | if (response.Headers.TryGetValue("x-ms-request-server-encrypted", out _header)) |
| | 6219 | | { |
| | 6220 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 6221 | | } |
| | 6222 | |
|
| | 6223 | | // Create the response |
| | 6224 | | return Response.FromValue(_value, response); |
| | 6225 | | } |
| | 6226 | | default: |
| | 6227 | | { |
| | 6228 | | // Create the result |
| | 6229 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6230 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 6231 | |
|
| | 6232 | | throw _value.CreateException(clientDiagnostics, response); |
| | 6233 | | } |
| | 6234 | | } |
| | 6235 | | } |
| | 6236 | | #endregion File.UploadRangeAsync |
| | 6237 | |
|
| | 6238 | | #region File.UploadRangeFromURLAsync |
| | 6239 | | /// <summary> |
| | 6240 | | /// Upload a range of bytes to a file where the contents are read from a URL. |
| | 6241 | | /// </summary> |
| | 6242 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 6243 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6244 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 6245 | | /// <param name="range">Writes data to the specified byte range in the file.</param> |
| | 6246 | | /// <param name="copySource">Specifies the URL of the source file or blob, up to 2 KB in length. To copy a f |
| | 6247 | | /// <param name="contentLength">Specifies the number of bytes being transmitted in the request body. When th |
| | 6248 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6249 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6250 | | /// <param name="sourceRange">Bytes of source data in the specified range.</param> |
| | 6251 | | /// <param name="sourceContentCrc64">Specify the crc64 calculated for the range of bytes that must be read f |
| | 6252 | | /// <param name="sourceIfMatchCrc64">Specify the crc64 value to operate only on range with a matching crc64 |
| | 6253 | | /// <param name="sourceIfNoneMatchCrc64">Specify the crc64 value to operate only on range without a matching |
| | 6254 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6255 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 6256 | | /// <param name="operationName">Operation name.</param> |
| | 6257 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 6258 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.FileUploadRangeFromURLResult}</returns> |
| | 6259 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.FileUp |
| | 6260 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6261 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6262 | | System.Uri resourceUri, |
| | 6263 | | string range, |
| | 6264 | | System.Uri copySource, |
| | 6265 | | long contentLength, |
| | 6266 | | string version, |
| | 6267 | | int? timeout = default, |
| | 6268 | | string sourceRange = default, |
| | 6269 | | byte[] sourceContentCrc64 = default, |
| | 6270 | | byte[] sourceIfMatchCrc64 = default, |
| | 6271 | | byte[] sourceIfNoneMatchCrc64 = default, |
| | 6272 | | string leaseId = default, |
| | 6273 | | bool async = true, |
| | 6274 | | string operationName = "FileClient.UploadRangeFromURL", |
| | 6275 | | System.Threading.CancellationToken cancellationToken = default) |
| | 6276 | | { |
| | 6277 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 6278 | | try |
| | 6279 | | { |
| | 6280 | | _scope.AddAttribute("url", resourceUri); |
| | 6281 | | _scope.Start(); |
| | 6282 | | using (Azure.Core.HttpMessage _message = UploadRangeFromURLAsync_CreateMessage( |
| | 6283 | | pipeline, |
| | 6284 | | resourceUri, |
| | 6285 | | range, |
| | 6286 | | copySource, |
| | 6287 | | contentLength, |
| | 6288 | | version, |
| | 6289 | | timeout, |
| | 6290 | | sourceRange, |
| | 6291 | | sourceContentCrc64, |
| | 6292 | | sourceIfMatchCrc64, |
| | 6293 | | sourceIfNoneMatchCrc64, |
| | 6294 | | leaseId)) |
| | 6295 | | { |
| | 6296 | | if (async) |
| | 6297 | | { |
| | 6298 | | // Send the request asynchronously if we're being called via an async path |
| | 6299 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 6300 | | } |
| | 6301 | | else |
| | 6302 | | { |
| | 6303 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 6304 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 6305 | | pipeline.Send(_message, cancellationToken); |
| | 6306 | | } |
| | 6307 | | Azure.Response _response = _message.Response; |
| | 6308 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 6309 | | return UploadRangeFromURLAsync_CreateResponse(clientDiagnostics, _response); |
| | 6310 | | } |
| | 6311 | | } |
| | 6312 | | catch (System.Exception ex) |
| | 6313 | | { |
| | 6314 | | _scope.Failed(ex); |
| | 6315 | | throw; |
| | 6316 | | } |
| | 6317 | | finally |
| | 6318 | | { |
| | 6319 | | _scope.Dispose(); |
| | 6320 | | } |
| | 6321 | | } |
| | 6322 | |
|
| | 6323 | | /// <summary> |
| | 6324 | | /// Create the File.UploadRangeFromURLAsync request. |
| | 6325 | | /// </summary> |
| | 6326 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6327 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 6328 | | /// <param name="range">Writes data to the specified byte range in the file.</param> |
| | 6329 | | /// <param name="copySource">Specifies the URL of the source file or blob, up to 2 KB in length. To copy a f |
| | 6330 | | /// <param name="contentLength">Specifies the number of bytes being transmitted in the request body. When th |
| | 6331 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6332 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6333 | | /// <param name="sourceRange">Bytes of source data in the specified range.</param> |
| | 6334 | | /// <param name="sourceContentCrc64">Specify the crc64 calculated for the range of bytes that must be read f |
| | 6335 | | /// <param name="sourceIfMatchCrc64">Specify the crc64 value to operate only on range with a matching crc64 |
| | 6336 | | /// <param name="sourceIfNoneMatchCrc64">Specify the crc64 value to operate only on range without a matching |
| | 6337 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6338 | | /// <returns>The File.UploadRangeFromURLAsync Message.</returns> |
| | 6339 | | internal static Azure.Core.HttpMessage UploadRangeFromURLAsync_CreateMessage( |
| | 6340 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6341 | | System.Uri resourceUri, |
| | 6342 | | string range, |
| | 6343 | | System.Uri copySource, |
| | 6344 | | long contentLength, |
| | 6345 | | string version, |
| | 6346 | | int? timeout = default, |
| | 6347 | | string sourceRange = default, |
| | 6348 | | byte[] sourceContentCrc64 = default, |
| | 6349 | | byte[] sourceIfMatchCrc64 = default, |
| | 6350 | | byte[] sourceIfNoneMatchCrc64 = default, |
| | 6351 | | string leaseId = default) |
| | 6352 | | { |
| | 6353 | | // Validation |
| | 6354 | | if (resourceUri == null) |
| | 6355 | | { |
| | 6356 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 6357 | | } |
| | 6358 | | if (range == null) |
| | 6359 | | { |
| | 6360 | | throw new System.ArgumentNullException(nameof(range)); |
| | 6361 | | } |
| | 6362 | | if (copySource == null) |
| | 6363 | | { |
| | 6364 | | throw new System.ArgumentNullException(nameof(copySource)); |
| | 6365 | | } |
| | 6366 | | if (version == null) |
| | 6367 | | { |
| | 6368 | | throw new System.ArgumentNullException(nameof(version)); |
| | 6369 | | } |
| | 6370 | |
|
| | 6371 | | // Create the request |
| | 6372 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 6373 | | Azure.Core.Request _request = _message.Request; |
| | 6374 | |
|
| | 6375 | | // Set the endpoint |
| | 6376 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 6377 | | _request.Uri.Reset(resourceUri); |
| | 6378 | | _request.Uri.AppendQuery("comp", "range", escapeValue: false); |
| | 6379 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 6380 | |
|
| | 6381 | | // Add request headers |
| | 6382 | | _request.Headers.SetValue("x-ms-range", range); |
| | 6383 | | _request.Headers.SetValue("x-ms-copy-source", copySource.AbsoluteUri); |
| | 6384 | | _request.Headers.SetValue("x-ms-write", "update"); |
| | 6385 | | _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.Inva |
| | 6386 | | _request.Headers.SetValue("x-ms-version", version); |
| | 6387 | | if (sourceRange != null) { _request.Headers.SetValue("x-ms-source-range", sourceRange); } |
| | 6388 | | if (sourceContentCrc64 != null) { _request.Headers.SetValue("x-ms-source-content-crc64", System.Convert. |
| | 6389 | | if (sourceIfMatchCrc64 != null) { _request.Headers.SetValue("x-ms-source-if-match-crc64", System.Convert |
| | 6390 | | if (sourceIfNoneMatchCrc64 != null) { _request.Headers.SetValue("x-ms-source-if-none-match-crc64", Syste |
| | 6391 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 6392 | |
|
| | 6393 | | return _message; |
| | 6394 | | } |
| | 6395 | |
|
| | 6396 | | /// <summary> |
| | 6397 | | /// Create the File.UploadRangeFromURLAsync response or throw a failure exception. |
| | 6398 | | /// </summary> |
| | 6399 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 6400 | | /// <param name="response">The raw Response.</param> |
| | 6401 | | /// <returns>The File.UploadRangeFromURLAsync Azure.Response{Azure.Storage.Files.Shares.Models.FileUploadRan |
| | 6402 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.FileUploadRangeFromURLResult> UploadRangeFr |
| | 6403 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6404 | | Azure.Response response) |
| | 6405 | | { |
| | 6406 | | // Process the response |
| | 6407 | | switch (response.Status) |
| | 6408 | | { |
| | 6409 | | case 201: |
| | 6410 | | { |
| | 6411 | | // Create the result |
| | 6412 | | Azure.Storage.Files.Shares.Models.FileUploadRangeFromURLResult _value = new Azure.Storage.Files. |
| | 6413 | |
|
| | 6414 | | // Get response headers |
| | 6415 | | string _header; |
| | 6416 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 6417 | | { |
| | 6418 | | _value.ETag = new Azure.ETag(_header); |
| | 6419 | | } |
| | 6420 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 6421 | | { |
| | 6422 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 6423 | | } |
| | 6424 | | if (response.Headers.TryGetValue("x-ms-content-crc64", out _header)) |
| | 6425 | | { |
| | 6426 | | _value.XMSContentCrc64 = System.Convert.FromBase64String(_header); |
| | 6427 | | } |
| | 6428 | | if (response.Headers.TryGetValue("x-ms-request-server-encrypted", out _header)) |
| | 6429 | | { |
| | 6430 | | _value.IsServerEncrypted = bool.Parse(_header); |
| | 6431 | | } |
| | 6432 | |
|
| | 6433 | | // Create the response |
| | 6434 | | return Response.FromValue(_value, response); |
| | 6435 | | } |
| | 6436 | | default: |
| | 6437 | | { |
| | 6438 | | // Create the result |
| | 6439 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6440 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 6441 | |
|
| | 6442 | | throw _value.CreateException(clientDiagnostics, response); |
| | 6443 | | } |
| | 6444 | | } |
| | 6445 | | } |
| | 6446 | | #endregion File.UploadRangeFromURLAsync |
| | 6447 | |
|
| | 6448 | | #region File.GetRangeListAsync |
| | 6449 | | /// <summary> |
| | 6450 | | /// Returns the list of valid ranges for a file. |
| | 6451 | | /// </summary> |
| | 6452 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 6453 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6454 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 6455 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6456 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 6457 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6458 | | /// <param name="range">Specifies the range of bytes over which to list ranges, inclusively.</param> |
| | 6459 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6460 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 6461 | | /// <param name="operationName">Operation name.</param> |
| | 6462 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 6463 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.ShareFileRangeInfoInternal}</returns> |
| | 6464 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareF |
| | 6465 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6466 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6467 | | System.Uri resourceUri, |
| | 6468 | | string version, |
| | 6469 | | string sharesnapshot = default, |
| | 6470 | | int? timeout = default, |
| | 6471 | | string range = default, |
| | 6472 | | string leaseId = default, |
| | 6473 | | bool async = true, |
| | 6474 | | string operationName = "FileClient.GetRangeList", |
| | 6475 | | System.Threading.CancellationToken cancellationToken = default) |
| | 6476 | | { |
| | 6477 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 6478 | | try |
| | 6479 | | { |
| | 6480 | | _scope.AddAttribute("url", resourceUri); |
| | 6481 | | _scope.Start(); |
| | 6482 | | using (Azure.Core.HttpMessage _message = GetRangeListAsync_CreateMessage( |
| | 6483 | | pipeline, |
| | 6484 | | resourceUri, |
| | 6485 | | version, |
| | 6486 | | sharesnapshot, |
| | 6487 | | timeout, |
| | 6488 | | range, |
| | 6489 | | leaseId)) |
| | 6490 | | { |
| | 6491 | | if (async) |
| | 6492 | | { |
| | 6493 | | // Send the request asynchronously if we're being called via an async path |
| | 6494 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 6495 | | } |
| | 6496 | | else |
| | 6497 | | { |
| | 6498 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 6499 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 6500 | | pipeline.Send(_message, cancellationToken); |
| | 6501 | | } |
| | 6502 | | Azure.Response _response = _message.Response; |
| | 6503 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 6504 | | return GetRangeListAsync_CreateResponse(clientDiagnostics, _response); |
| | 6505 | | } |
| | 6506 | | } |
| | 6507 | | catch (System.Exception ex) |
| | 6508 | | { |
| | 6509 | | _scope.Failed(ex); |
| | 6510 | | throw; |
| | 6511 | | } |
| | 6512 | | finally |
| | 6513 | | { |
| | 6514 | | _scope.Dispose(); |
| | 6515 | | } |
| | 6516 | | } |
| | 6517 | |
|
| | 6518 | | /// <summary> |
| | 6519 | | /// Create the File.GetRangeListAsync request. |
| | 6520 | | /// </summary> |
| | 6521 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6522 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 6523 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6524 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 6525 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6526 | | /// <param name="range">Specifies the range of bytes over which to list ranges, inclusively.</param> |
| | 6527 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6528 | | /// <returns>The File.GetRangeListAsync Message.</returns> |
| | 6529 | | internal static Azure.Core.HttpMessage GetRangeListAsync_CreateMessage( |
| | 6530 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6531 | | System.Uri resourceUri, |
| | 6532 | | string version, |
| | 6533 | | string sharesnapshot = default, |
| | 6534 | | int? timeout = default, |
| | 6535 | | string range = default, |
| | 6536 | | string leaseId = default) |
| | 6537 | | { |
| | 6538 | | // Validation |
| | 6539 | | if (resourceUri == null) |
| | 6540 | | { |
| | 6541 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 6542 | | } |
| | 6543 | | if (version == null) |
| | 6544 | | { |
| | 6545 | | throw new System.ArgumentNullException(nameof(version)); |
| | 6546 | | } |
| | 6547 | |
|
| | 6548 | | // Create the request |
| | 6549 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 6550 | | Azure.Core.Request _request = _message.Request; |
| | 6551 | |
|
| | 6552 | | // Set the endpoint |
| | 6553 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 6554 | | _request.Uri.Reset(resourceUri); |
| | 6555 | | _request.Uri.AppendQuery("comp", "rangelist", escapeValue: false); |
| | 6556 | | if (sharesnapshot != null) { _request.Uri.AppendQuery("sharesnapshot", sharesnapshot); } |
| | 6557 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 6558 | |
|
| | 6559 | | // Add request headers |
| | 6560 | | _request.Headers.SetValue("x-ms-version", version); |
| | 6561 | | if (range != null) { _request.Headers.SetValue("x-ms-range", range); } |
| | 6562 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 6563 | |
|
| | 6564 | | return _message; |
| | 6565 | | } |
| | 6566 | |
|
| | 6567 | | /// <summary> |
| | 6568 | | /// Create the File.GetRangeListAsync response or throw a failure exception. |
| | 6569 | | /// </summary> |
| | 6570 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 6571 | | /// <param name="response">The raw Response.</param> |
| | 6572 | | /// <returns>The File.GetRangeListAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareFileRangeInfoI |
| | 6573 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareFileRangeInfoInternal> GetRangeListAsy |
| | 6574 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6575 | | Azure.Response response) |
| | 6576 | | { |
| | 6577 | | // Process the response |
| | 6578 | | switch (response.Status) |
| | 6579 | | { |
| | 6580 | | case 200: |
| | 6581 | | { |
| | 6582 | | // Create the result |
| | 6583 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6584 | | Azure.Storage.Files.Shares.Models.ShareFileRangeInfoInternal _value = new Azure.Storage.Files.Sh |
| | 6585 | | _value.Ranges = |
| | 6586 | | System.Linq.Enumerable.ToList( |
| | 6587 | | System.Linq.Enumerable.Select( |
| | 6588 | | _xml.Element(System.Xml.Linq.XName.Get("Ranges", "")).Elements(System.Xml.Linq.XName |
| | 6589 | | Azure.Storage.Files.Shares.Models.Range.FromXml)); |
| | 6590 | |
|
| | 6591 | | // Get response headers |
| | 6592 | | string _header; |
| | 6593 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 6594 | | { |
| | 6595 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 6596 | | } |
| | 6597 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 6598 | | { |
| | 6599 | | _value.ETag = new Azure.ETag(_header); |
| | 6600 | | } |
| | 6601 | | if (response.Headers.TryGetValue("x-ms-content-length", out _header)) |
| | 6602 | | { |
| | 6603 | | _value.FileContentLength = long.Parse(_header, System.Globalization.CultureInfo.InvariantCul |
| | 6604 | | } |
| | 6605 | |
|
| | 6606 | | // Create the response |
| | 6607 | | return Response.FromValue(_value, response); |
| | 6608 | | } |
| | 6609 | | case 304: |
| | 6610 | | { |
| | 6611 | | return new Azure.NoBodyResponse<Azure.Storage.Files.Shares.Models.ShareFileRangeInfoInternal>(re |
| | 6612 | | } |
| | 6613 | | default: |
| | 6614 | | { |
| | 6615 | | // Create the result |
| | 6616 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6617 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 6618 | |
|
| | 6619 | | throw _value.CreateException(clientDiagnostics, response); |
| | 6620 | | } |
| | 6621 | | } |
| | 6622 | | } |
| | 6623 | | #endregion File.GetRangeListAsync |
| | 6624 | |
|
| | 6625 | | #region File.StartCopyAsync |
| | 6626 | | /// <summary> |
| | 6627 | | /// Copies a blob or file to a destination file within the storage account. |
| | 6628 | | /// </summary> |
| | 6629 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 6630 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6631 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 6632 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6633 | | /// <param name="copySource">Specifies the URL of the source file or blob, up to 2 KB in length. To copy a f |
| | 6634 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6635 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 6636 | | /// <param name="filePermission">If specified the permission (security descriptor) shall be set for the dire |
| | 6637 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file. Note: Only one o |
| | 6638 | | /// <param name="filePermissionCopyMode">Specifies the option to copy file security descriptor from source f |
| | 6639 | | /// <param name="ignoreReadOnly">Specifies the option to overwrite the target file if it already exists and |
| | 6640 | | /// <param name="fileAttributes">Specifies either the option to copy file attributes from a source file(sour |
| | 6641 | | /// <param name="fileCreationTime">Specifies either the option to copy file creation time from a source file |
| | 6642 | | /// <param name="fileLastWriteTime">Specifies either the option to copy file last write time from a source f |
| | 6643 | | /// <param name="setArchiveAttribute">Specifies the option to set archive attribute on a target file. True m |
| | 6644 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6645 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 6646 | | /// <param name="operationName">Operation name.</param> |
| | 6647 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 6648 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.ShareFileCopyInfo}</returns> |
| | 6649 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.ShareF |
| | 6650 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6651 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6652 | | System.Uri resourceUri, |
| | 6653 | | string version, |
| | 6654 | | System.Uri copySource, |
| | 6655 | | int? timeout = default, |
| | 6656 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 6657 | | string filePermission = default, |
| | 6658 | | string filePermissionKey = default, |
| | 6659 | | Azure.Storage.Files.Shares.Models.PermissionCopyMode? filePermissionCopyMode = default, |
| | 6660 | | bool? ignoreReadOnly = default, |
| | 6661 | | string fileAttributes = default, |
| | 6662 | | string fileCreationTime = default, |
| | 6663 | | string fileLastWriteTime = default, |
| | 6664 | | bool? setArchiveAttribute = default, |
| | 6665 | | string leaseId = default, |
| | 6666 | | bool async = true, |
| | 6667 | | string operationName = "FileClient.StartCopy", |
| | 6668 | | System.Threading.CancellationToken cancellationToken = default) |
| | 6669 | | { |
| | 6670 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 6671 | | try |
| | 6672 | | { |
| | 6673 | | _scope.AddAttribute("url", resourceUri); |
| | 6674 | | _scope.Start(); |
| | 6675 | | using (Azure.Core.HttpMessage _message = StartCopyAsync_CreateMessage( |
| | 6676 | | pipeline, |
| | 6677 | | resourceUri, |
| | 6678 | | version, |
| | 6679 | | copySource, |
| | 6680 | | timeout, |
| | 6681 | | metadata, |
| | 6682 | | filePermission, |
| | 6683 | | filePermissionKey, |
| | 6684 | | filePermissionCopyMode, |
| | 6685 | | ignoreReadOnly, |
| | 6686 | | fileAttributes, |
| | 6687 | | fileCreationTime, |
| | 6688 | | fileLastWriteTime, |
| | 6689 | | setArchiveAttribute, |
| | 6690 | | leaseId)) |
| | 6691 | | { |
| | 6692 | | if (async) |
| | 6693 | | { |
| | 6694 | | // Send the request asynchronously if we're being called via an async path |
| | 6695 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 6696 | | } |
| | 6697 | | else |
| | 6698 | | { |
| | 6699 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 6700 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 6701 | | pipeline.Send(_message, cancellationToken); |
| | 6702 | | } |
| | 6703 | | Azure.Response _response = _message.Response; |
| | 6704 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 6705 | | return StartCopyAsync_CreateResponse(clientDiagnostics, _response); |
| | 6706 | | } |
| | 6707 | | } |
| | 6708 | | catch (System.Exception ex) |
| | 6709 | | { |
| | 6710 | | _scope.Failed(ex); |
| | 6711 | | throw; |
| | 6712 | | } |
| | 6713 | | finally |
| | 6714 | | { |
| | 6715 | | _scope.Dispose(); |
| | 6716 | | } |
| | 6717 | | } |
| | 6718 | |
|
| | 6719 | | /// <summary> |
| | 6720 | | /// Create the File.StartCopyAsync request. |
| | 6721 | | /// </summary> |
| | 6722 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6723 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 6724 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6725 | | /// <param name="copySource">Specifies the URL of the source file or blob, up to 2 KB in length. To copy a f |
| | 6726 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6727 | | /// <param name="metadata">A name-value pair to associate with a file storage object.</param> |
| | 6728 | | /// <param name="filePermission">If specified the permission (security descriptor) shall be set for the dire |
| | 6729 | | /// <param name="filePermissionKey">Key of the permission to be set for the directory/file. Note: Only one o |
| | 6730 | | /// <param name="filePermissionCopyMode">Specifies the option to copy file security descriptor from source f |
| | 6731 | | /// <param name="ignoreReadOnly">Specifies the option to overwrite the target file if it already exists and |
| | 6732 | | /// <param name="fileAttributes">Specifies either the option to copy file attributes from a source file(sour |
| | 6733 | | /// <param name="fileCreationTime">Specifies either the option to copy file creation time from a source file |
| | 6734 | | /// <param name="fileLastWriteTime">Specifies either the option to copy file last write time from a source f |
| | 6735 | | /// <param name="setArchiveAttribute">Specifies the option to set archive attribute on a target file. True m |
| | 6736 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6737 | | /// <returns>The File.StartCopyAsync Message.</returns> |
| | 6738 | | internal static Azure.Core.HttpMessage StartCopyAsync_CreateMessage( |
| | 6739 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6740 | | System.Uri resourceUri, |
| | 6741 | | string version, |
| | 6742 | | System.Uri copySource, |
| | 6743 | | int? timeout = default, |
| | 6744 | | System.Collections.Generic.IDictionary<string, string> metadata = default, |
| | 6745 | | string filePermission = default, |
| | 6746 | | string filePermissionKey = default, |
| | 6747 | | Azure.Storage.Files.Shares.Models.PermissionCopyMode? filePermissionCopyMode = default, |
| | 6748 | | bool? ignoreReadOnly = default, |
| | 6749 | | string fileAttributes = default, |
| | 6750 | | string fileCreationTime = default, |
| | 6751 | | string fileLastWriteTime = default, |
| | 6752 | | bool? setArchiveAttribute = default, |
| | 6753 | | string leaseId = default) |
| | 6754 | | { |
| | 6755 | | // Validation |
| | 6756 | | if (resourceUri == null) |
| | 6757 | | { |
| | 6758 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 6759 | | } |
| | 6760 | | if (version == null) |
| | 6761 | | { |
| | 6762 | | throw new System.ArgumentNullException(nameof(version)); |
| | 6763 | | } |
| | 6764 | | if (copySource == null) |
| | 6765 | | { |
| | 6766 | | throw new System.ArgumentNullException(nameof(copySource)); |
| | 6767 | | } |
| | 6768 | |
|
| | 6769 | | // Create the request |
| | 6770 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 6771 | | Azure.Core.Request _request = _message.Request; |
| | 6772 | |
|
| | 6773 | | // Set the endpoint |
| | 6774 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 6775 | | _request.Uri.Reset(resourceUri); |
| | 6776 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 6777 | |
|
| | 6778 | | // Add request headers |
| | 6779 | | _request.Headers.SetValue("x-ms-version", version); |
| | 6780 | | _request.Headers.SetValue("x-ms-copy-source", copySource.AbsoluteUri); |
| | 6781 | | if (metadata != null) { |
| | 6782 | | foreach (System.Collections.Generic.KeyValuePair<string, string> _pair in metadata) |
| | 6783 | | { |
| | 6784 | | _request.Headers.SetValue("x-ms-meta-" + _pair.Key, _pair.Value); |
| | 6785 | | } |
| | 6786 | | } |
| | 6787 | | if (filePermission != null) { _request.Headers.SetValue("x-ms-file-permission", filePermission); } |
| | 6788 | | if (filePermissionKey != null) { _request.Headers.SetValue("x-ms-file-permission-key", filePermissionKey |
| | 6789 | | if (filePermissionCopyMode != null) { _request.Headers.SetValue("x-ms-file-permission-copy-mode", Azure. |
| | 6790 | | if (ignoreReadOnly != null) { |
| | 6791 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 6792 | | _request.Headers.SetValue("x-ms-file-copy-ignore-read-only", ignoreReadOnly.Value.ToString(System.Global |
| | 6793 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 6794 | | } |
| | 6795 | | if (fileAttributes != null) { _request.Headers.SetValue("x-ms-file-attributes", fileAttributes); } |
| | 6796 | | if (fileCreationTime != null) { _request.Headers.SetValue("x-ms-file-creation-time", fileCreationTime); |
| | 6797 | | if (fileLastWriteTime != null) { _request.Headers.SetValue("x-ms-file-last-write-time", fileLastWriteTim |
| | 6798 | | if (setArchiveAttribute != null) { |
| | 6799 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 6800 | | _request.Headers.SetValue("x-ms-file-copy-set-archive", setArchiveAttribute.Value.ToString(System.Global |
| | 6801 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 6802 | | } |
| | 6803 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 6804 | |
|
| | 6805 | | return _message; |
| | 6806 | | } |
| | 6807 | |
|
| | 6808 | | /// <summary> |
| | 6809 | | /// Create the File.StartCopyAsync response or throw a failure exception. |
| | 6810 | | /// </summary> |
| | 6811 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 6812 | | /// <param name="response">The raw Response.</param> |
| | 6813 | | /// <returns>The File.StartCopyAsync Azure.Response{Azure.Storage.Files.Shares.Models.ShareFileCopyInfo}.</r |
| | 6814 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.ShareFileCopyInfo> StartCopyAsync_CreateRes |
| | 6815 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6816 | | Azure.Response response) |
| | 6817 | | { |
| | 6818 | | // Process the response |
| | 6819 | | switch (response.Status) |
| | 6820 | | { |
| | 6821 | | case 202: |
| | 6822 | | { |
| | 6823 | | // Create the result |
| | 6824 | | Azure.Storage.Files.Shares.Models.ShareFileCopyInfo _value = new Azure.Storage.Files.Shares.Mode |
| | 6825 | |
|
| | 6826 | | // Get response headers |
| | 6827 | | string _header; |
| | 6828 | | if (response.Headers.TryGetValue("ETag", out _header)) |
| | 6829 | | { |
| | 6830 | | _value.ETag = new Azure.ETag(_header); |
| | 6831 | | } |
| | 6832 | | if (response.Headers.TryGetValue("Last-Modified", out _header)) |
| | 6833 | | { |
| | 6834 | | _value.LastModified = System.DateTimeOffset.Parse(_header, System.Globalization.CultureInfo. |
| | 6835 | | } |
| | 6836 | | if (response.Headers.TryGetValue("x-ms-copy-id", out _header)) |
| | 6837 | | { |
| | 6838 | | _value.CopyId = _header; |
| | 6839 | | } |
| | 6840 | | if (response.Headers.TryGetValue("x-ms-copy-status", out _header)) |
| | 6841 | | { |
| | 6842 | | _value.CopyStatus = Azure.Storage.Files.Shares.FileRestClient.Serialization.ParseCopyStatus( |
| | 6843 | | } |
| | 6844 | |
|
| | 6845 | | // Create the response |
| | 6846 | | return Response.FromValue(_value, response); |
| | 6847 | | } |
| | 6848 | | default: |
| | 6849 | | { |
| | 6850 | | // Create the result |
| | 6851 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6852 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 6853 | |
|
| | 6854 | | throw _value.CreateException(clientDiagnostics, response); |
| | 6855 | | } |
| | 6856 | | } |
| | 6857 | | } |
| | 6858 | | #endregion File.StartCopyAsync |
| | 6859 | |
|
| | 6860 | | #region File.AbortCopyAsync |
| | 6861 | | /// <summary> |
| | 6862 | | /// Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. |
| | 6863 | | /// </summary> |
| | 6864 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 6865 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6866 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 6867 | | /// <param name="copyId">The copy identifier provided in the x-ms-copy-id header of the original Copy File o |
| | 6868 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6869 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6870 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6871 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 6872 | | /// <param name="operationName">Operation name.</param> |
| | 6873 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 6874 | | /// <returns>Azure.Response</returns> |
| | 6875 | | public static async System.Threading.Tasks.ValueTask<Azure.Response> AbortCopyAsync( |
| | 6876 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6877 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6878 | | System.Uri resourceUri, |
| | 6879 | | string copyId, |
| | 6880 | | string version, |
| | 6881 | | int? timeout = default, |
| | 6882 | | string leaseId = default, |
| | 6883 | | bool async = true, |
| | 6884 | | string operationName = "FileClient.AbortCopy", |
| | 6885 | | System.Threading.CancellationToken cancellationToken = default) |
| | 6886 | | { |
| | 6887 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 6888 | | try |
| | 6889 | | { |
| | 6890 | | _scope.AddAttribute("url", resourceUri); |
| | 6891 | | _scope.Start(); |
| | 6892 | | using (Azure.Core.HttpMessage _message = AbortCopyAsync_CreateMessage( |
| | 6893 | | pipeline, |
| | 6894 | | resourceUri, |
| | 6895 | | copyId, |
| | 6896 | | version, |
| | 6897 | | timeout, |
| | 6898 | | leaseId)) |
| | 6899 | | { |
| | 6900 | | if (async) |
| | 6901 | | { |
| | 6902 | | // Send the request asynchronously if we're being called via an async path |
| | 6903 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 6904 | | } |
| | 6905 | | else |
| | 6906 | | { |
| | 6907 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 6908 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 6909 | | pipeline.Send(_message, cancellationToken); |
| | 6910 | | } |
| | 6911 | | Azure.Response _response = _message.Response; |
| | 6912 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 6913 | | return AbortCopyAsync_CreateResponse(clientDiagnostics, _response); |
| | 6914 | | } |
| | 6915 | | } |
| | 6916 | | catch (System.Exception ex) |
| | 6917 | | { |
| | 6918 | | _scope.Failed(ex); |
| | 6919 | | throw; |
| | 6920 | | } |
| | 6921 | | finally |
| | 6922 | | { |
| | 6923 | | _scope.Dispose(); |
| | 6924 | | } |
| | 6925 | | } |
| | 6926 | |
|
| | 6927 | | /// <summary> |
| | 6928 | | /// Create the File.AbortCopyAsync request. |
| | 6929 | | /// </summary> |
| | 6930 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 6931 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 6932 | | /// <param name="copyId">The copy identifier provided in the x-ms-copy-id header of the original Copy File o |
| | 6933 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 6934 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 6935 | | /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and ma |
| | 6936 | | /// <returns>The File.AbortCopyAsync Message.</returns> |
| | 6937 | | internal static Azure.Core.HttpMessage AbortCopyAsync_CreateMessage( |
| | 6938 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 6939 | | System.Uri resourceUri, |
| | 6940 | | string copyId, |
| | 6941 | | string version, |
| | 6942 | | int? timeout = default, |
| | 6943 | | string leaseId = default) |
| | 6944 | | { |
| | 6945 | | // Validation |
| | 6946 | | if (resourceUri == null) |
| | 6947 | | { |
| | 6948 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 6949 | | } |
| | 6950 | | if (copyId == null) |
| | 6951 | | { |
| | 6952 | | throw new System.ArgumentNullException(nameof(copyId)); |
| | 6953 | | } |
| | 6954 | | if (version == null) |
| | 6955 | | { |
| | 6956 | | throw new System.ArgumentNullException(nameof(version)); |
| | 6957 | | } |
| | 6958 | |
|
| | 6959 | | // Create the request |
| | 6960 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 6961 | | Azure.Core.Request _request = _message.Request; |
| | 6962 | |
|
| | 6963 | | // Set the endpoint |
| | 6964 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 6965 | | _request.Uri.Reset(resourceUri); |
| | 6966 | | _request.Uri.AppendQuery("comp", "copy", escapeValue: false); |
| | 6967 | | _request.Uri.AppendQuery("copyid", copyId); |
| | 6968 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 6969 | |
|
| | 6970 | | // Add request headers |
| | 6971 | | _request.Headers.SetValue("x-ms-copy-action", "abort"); |
| | 6972 | | _request.Headers.SetValue("x-ms-version", version); |
| | 6973 | | if (leaseId != null) { _request.Headers.SetValue("x-ms-lease-id", leaseId); } |
| | 6974 | |
|
| | 6975 | | return _message; |
| | 6976 | | } |
| | 6977 | |
|
| | 6978 | | /// <summary> |
| | 6979 | | /// Create the File.AbortCopyAsync response or throw a failure exception. |
| | 6980 | | /// </summary> |
| | 6981 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 6982 | | /// <param name="response">The raw Response.</param> |
| | 6983 | | /// <returns>The File.AbortCopyAsync Azure.Response.</returns> |
| | 6984 | | internal static Azure.Response AbortCopyAsync_CreateResponse( |
| | 6985 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 6986 | | Azure.Response response) |
| | 6987 | | { |
| | 6988 | | // Process the response |
| | 6989 | | switch (response.Status) |
| | 6990 | | { |
| | 6991 | | case 204: |
| | 6992 | | { |
| | 6993 | | return response; |
| | 6994 | | } |
| | 6995 | | default: |
| | 6996 | | { |
| | 6997 | | // Create the result |
| | 6998 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 6999 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 7000 | |
|
| | 7001 | | throw _value.CreateException(clientDiagnostics, response); |
| | 7002 | | } |
| | 7003 | | } |
| | 7004 | | } |
| | 7005 | | #endregion File.AbortCopyAsync |
| | 7006 | |
|
| | 7007 | | #region File.ListHandlesAsync |
| | 7008 | | /// <summary> |
| | 7009 | | /// Lists handles for file |
| | 7010 | | /// </summary> |
| | 7011 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 7012 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7013 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 7014 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7015 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 7016 | | /// <param name="maxresults">Specifies the maximum number of entries to return. If the request does not spec |
| | 7017 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7018 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 7019 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 7020 | | /// <param name="operationName">Operation name.</param> |
| | 7021 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 7022 | | /// <returns>An enumeration of handles.</returns> |
| | 7023 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.Storag |
| | 7024 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7025 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7026 | | System.Uri resourceUri, |
| | 7027 | | string version, |
| | 7028 | | string marker = default, |
| | 7029 | | int? maxresults = default, |
| | 7030 | | int? timeout = default, |
| | 7031 | | string sharesnapshot = default, |
| | 7032 | | bool async = true, |
| | 7033 | | string operationName = "FileClient.ListHandles", |
| | 7034 | | System.Threading.CancellationToken cancellationToken = default) |
| | 7035 | | { |
| | 7036 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 7037 | | try |
| | 7038 | | { |
| | 7039 | | _scope.AddAttribute("url", resourceUri); |
| | 7040 | | _scope.Start(); |
| | 7041 | | using (Azure.Core.HttpMessage _message = ListHandlesAsync_CreateMessage( |
| | 7042 | | pipeline, |
| | 7043 | | resourceUri, |
| | 7044 | | version, |
| | 7045 | | marker, |
| | 7046 | | maxresults, |
| | 7047 | | timeout, |
| | 7048 | | sharesnapshot)) |
| | 7049 | | { |
| | 7050 | | if (async) |
| | 7051 | | { |
| | 7052 | | // Send the request asynchronously if we're being called via an async path |
| | 7053 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 7054 | | } |
| | 7055 | | else |
| | 7056 | | { |
| | 7057 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 7058 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 7059 | | pipeline.Send(_message, cancellationToken); |
| | 7060 | | } |
| | 7061 | | Azure.Response _response = _message.Response; |
| | 7062 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 7063 | | return ListHandlesAsync_CreateResponse(clientDiagnostics, _response); |
| | 7064 | | } |
| | 7065 | | } |
| | 7066 | | catch (System.Exception ex) |
| | 7067 | | { |
| | 7068 | | _scope.Failed(ex); |
| | 7069 | | throw; |
| | 7070 | | } |
| | 7071 | | finally |
| | 7072 | | { |
| | 7073 | | _scope.Dispose(); |
| | 7074 | | } |
| | 7075 | | } |
| | 7076 | |
|
| | 7077 | | /// <summary> |
| | 7078 | | /// Create the File.ListHandlesAsync request. |
| | 7079 | | /// </summary> |
| | 7080 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7081 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 7082 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7083 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 7084 | | /// <param name="maxresults">Specifies the maximum number of entries to return. If the request does not spec |
| | 7085 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7086 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 7087 | | /// <returns>The File.ListHandlesAsync Message.</returns> |
| | 7088 | | internal static Azure.Core.HttpMessage ListHandlesAsync_CreateMessage( |
| | 7089 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7090 | | System.Uri resourceUri, |
| | 7091 | | string version, |
| | 7092 | | string marker = default, |
| | 7093 | | int? maxresults = default, |
| | 7094 | | int? timeout = default, |
| | 7095 | | string sharesnapshot = default) |
| | 7096 | | { |
| | 7097 | | // Validation |
| | 7098 | | if (resourceUri == null) |
| | 7099 | | { |
| | 7100 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 7101 | | } |
| | 7102 | | if (version == null) |
| | 7103 | | { |
| | 7104 | | throw new System.ArgumentNullException(nameof(version)); |
| | 7105 | | } |
| | 7106 | |
|
| | 7107 | | // Create the request |
| | 7108 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 7109 | | Azure.Core.Request _request = _message.Request; |
| | 7110 | |
|
| | 7111 | | // Set the endpoint |
| | 7112 | | _request.Method = Azure.Core.RequestMethod.Get; |
| | 7113 | | _request.Uri.Reset(resourceUri); |
| | 7114 | | _request.Uri.AppendQuery("comp", "listhandles", escapeValue: false); |
| | 7115 | | if (marker != null) { _request.Uri.AppendQuery("marker", marker); } |
| | 7116 | | if (maxresults != null) { _request.Uri.AppendQuery("maxresults", maxresults.Value.ToString(System.Global |
| | 7117 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 7118 | | if (sharesnapshot != null) { _request.Uri.AppendQuery("sharesnapshot", sharesnapshot); } |
| | 7119 | |
|
| | 7120 | | // Add request headers |
| | 7121 | | _request.Headers.SetValue("x-ms-version", version); |
| | 7122 | |
|
| | 7123 | | return _message; |
| | 7124 | | } |
| | 7125 | |
|
| | 7126 | | /// <summary> |
| | 7127 | | /// Create the File.ListHandlesAsync response or throw a failure exception. |
| | 7128 | | /// </summary> |
| | 7129 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 7130 | | /// <param name="response">The raw Response.</param> |
| | 7131 | | /// <returns>The File.ListHandlesAsync Azure.Response{Azure.Storage.Files.Shares.Models.StorageHandlesSegmen |
| | 7132 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.StorageHandlesSegment> ListHandlesAsync_Cre |
| | 7133 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7134 | | Azure.Response response) |
| | 7135 | | { |
| | 7136 | | // Process the response |
| | 7137 | | switch (response.Status) |
| | 7138 | | { |
| | 7139 | | case 200: |
| | 7140 | | { |
| | 7141 | | // Create the result |
| | 7142 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 7143 | | Azure.Storage.Files.Shares.Models.StorageHandlesSegment _value = Azure.Storage.Files.Shares.Mode |
| | 7144 | |
|
| | 7145 | | // Create the response |
| | 7146 | | return Response.FromValue(_value, response); |
| | 7147 | | } |
| | 7148 | | case 304: |
| | 7149 | | { |
| | 7150 | | return new Azure.NoBodyResponse<Azure.Storage.Files.Shares.Models.StorageHandlesSegment>(respons |
| | 7151 | | } |
| | 7152 | | default: |
| | 7153 | | { |
| | 7154 | | // Create the result |
| | 7155 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 7156 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 7157 | |
|
| | 7158 | | throw _value.CreateException(clientDiagnostics, response); |
| | 7159 | | } |
| | 7160 | | } |
| | 7161 | | } |
| | 7162 | | #endregion File.ListHandlesAsync |
| | 7163 | |
|
| | 7164 | | #region File.ForceCloseHandlesAsync |
| | 7165 | | /// <summary> |
| | 7166 | | /// Closes all handles open for given file |
| | 7167 | | /// </summary> |
| | 7168 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param> |
| | 7169 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7170 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 7171 | | /// <param name="handleId">Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) |
| | 7172 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7173 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7174 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 7175 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 7176 | | /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> |
| | 7177 | | /// <param name="operationName">Operation name.</param> |
| | 7178 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | 7179 | | /// <returns>Azure.Response{Azure.Storage.Files.Shares.Models.StorageClosedHandlesSegment}</returns> |
| | 7180 | | public static async System.Threading.Tasks.ValueTask<Azure.Response<Azure.Storage.Files.Shares.Models.Storag |
| | 7181 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7182 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7183 | | System.Uri resourceUri, |
| | 7184 | | string handleId, |
| | 7185 | | string version, |
| | 7186 | | int? timeout = default, |
| | 7187 | | string marker = default, |
| | 7188 | | string sharesnapshot = default, |
| | 7189 | | bool async = true, |
| | 7190 | | string operationName = "FileClient.ForceCloseHandles", |
| | 7191 | | System.Threading.CancellationToken cancellationToken = default) |
| | 7192 | | { |
| | 7193 | | Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName); |
| | 7194 | | try |
| | 7195 | | { |
| | 7196 | | _scope.AddAttribute("url", resourceUri); |
| | 7197 | | _scope.Start(); |
| | 7198 | | using (Azure.Core.HttpMessage _message = ForceCloseHandlesAsync_CreateMessage( |
| | 7199 | | pipeline, |
| | 7200 | | resourceUri, |
| | 7201 | | handleId, |
| | 7202 | | version, |
| | 7203 | | timeout, |
| | 7204 | | marker, |
| | 7205 | | sharesnapshot)) |
| | 7206 | | { |
| | 7207 | | if (async) |
| | 7208 | | { |
| | 7209 | | // Send the request asynchronously if we're being called via an async path |
| | 7210 | | await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false); |
| | 7211 | | } |
| | 7212 | | else |
| | 7213 | | { |
| | 7214 | | // Send the request synchronously through the API that blocks if we're being called via a sy |
| | 7215 | | // (this is safe because the Task will complete before the user can call Wait) |
| | 7216 | | pipeline.Send(_message, cancellationToken); |
| | 7217 | | } |
| | 7218 | | Azure.Response _response = _message.Response; |
| | 7219 | | cancellationToken.ThrowIfCancellationRequested(); |
| | 7220 | | return ForceCloseHandlesAsync_CreateResponse(clientDiagnostics, _response); |
| | 7221 | | } |
| | 7222 | | } |
| | 7223 | | catch (System.Exception ex) |
| | 7224 | | { |
| | 7225 | | _scope.Failed(ex); |
| | 7226 | | throw; |
| | 7227 | | } |
| | 7228 | | finally |
| | 7229 | | { |
| | 7230 | | _scope.Dispose(); |
| | 7231 | | } |
| | 7232 | | } |
| | 7233 | |
|
| | 7234 | | /// <summary> |
| | 7235 | | /// Create the File.ForceCloseHandlesAsync request. |
| | 7236 | | /// </summary> |
| | 7237 | | /// <param name="pipeline">The pipeline used for sending requests.</param> |
| | 7238 | | /// <param name="resourceUri">The URL of the service account, share, directory or file that is the target of |
| | 7239 | | /// <param name="handleId">Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) |
| | 7240 | | /// <param name="version">Specifies the version of the operation to use for this request.</param> |
| | 7241 | | /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a href=" |
| | 7242 | | /// <param name="marker">A string value that identifies the portion of the list to be returned with the next |
| | 7243 | | /// <param name="sharesnapshot">The snapshot parameter is an opaque DateTime value that, when present, speci |
| | 7244 | | /// <returns>The File.ForceCloseHandlesAsync Message.</returns> |
| | 7245 | | internal static Azure.Core.HttpMessage ForceCloseHandlesAsync_CreateMessage( |
| | 7246 | | Azure.Core.Pipeline.HttpPipeline pipeline, |
| | 7247 | | System.Uri resourceUri, |
| | 7248 | | string handleId, |
| | 7249 | | string version, |
| | 7250 | | int? timeout = default, |
| | 7251 | | string marker = default, |
| | 7252 | | string sharesnapshot = default) |
| | 7253 | | { |
| | 7254 | | // Validation |
| | 7255 | | if (resourceUri == null) |
| | 7256 | | { |
| | 7257 | | throw new System.ArgumentNullException(nameof(resourceUri)); |
| | 7258 | | } |
| | 7259 | | if (handleId == null) |
| | 7260 | | { |
| | 7261 | | throw new System.ArgumentNullException(nameof(handleId)); |
| | 7262 | | } |
| | 7263 | | if (version == null) |
| | 7264 | | { |
| | 7265 | | throw new System.ArgumentNullException(nameof(version)); |
| | 7266 | | } |
| | 7267 | |
|
| | 7268 | | // Create the request |
| | 7269 | | Azure.Core.HttpMessage _message = pipeline.CreateMessage(); |
| | 7270 | | Azure.Core.Request _request = _message.Request; |
| | 7271 | |
|
| | 7272 | | // Set the endpoint |
| | 7273 | | _request.Method = Azure.Core.RequestMethod.Put; |
| | 7274 | | _request.Uri.Reset(resourceUri); |
| | 7275 | | _request.Uri.AppendQuery("comp", "forceclosehandles", escapeValue: false); |
| | 7276 | | if (timeout != null) { _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.C |
| | 7277 | | if (marker != null) { _request.Uri.AppendQuery("marker", marker); } |
| | 7278 | | if (sharesnapshot != null) { _request.Uri.AppendQuery("sharesnapshot", sharesnapshot); } |
| | 7279 | |
|
| | 7280 | | // Add request headers |
| | 7281 | | _request.Headers.SetValue("x-ms-handle-id", handleId); |
| | 7282 | | _request.Headers.SetValue("x-ms-version", version); |
| | 7283 | |
|
| | 7284 | | return _message; |
| | 7285 | | } |
| | 7286 | |
|
| | 7287 | | /// <summary> |
| | 7288 | | /// Create the File.ForceCloseHandlesAsync response or throw a failure exception. |
| | 7289 | | /// </summary> |
| | 7290 | | /// <param name="clientDiagnostics">The ClientDiagnostics instance to use.</param> |
| | 7291 | | /// <param name="response">The raw Response.</param> |
| | 7292 | | /// <returns>The File.ForceCloseHandlesAsync Azure.Response{Azure.Storage.Files.Shares.Models.StorageClosedH |
| | 7293 | | internal static Azure.Response<Azure.Storage.Files.Shares.Models.StorageClosedHandlesSegment> ForceCloseHand |
| | 7294 | | Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, |
| | 7295 | | Azure.Response response) |
| | 7296 | | { |
| | 7297 | | // Process the response |
| | 7298 | | switch (response.Status) |
| | 7299 | | { |
| | 7300 | | case 200: |
| | 7301 | | { |
| | 7302 | | // Create the result |
| | 7303 | | Azure.Storage.Files.Shares.Models.StorageClosedHandlesSegment _value = new Azure.Storage.Files.S |
| | 7304 | |
|
| | 7305 | | // Get response headers |
| | 7306 | | string _header; |
| | 7307 | | if (response.Headers.TryGetValue("x-ms-marker", out _header)) |
| | 7308 | | { |
| | 7309 | | _value.Marker = _header; |
| | 7310 | | } |
| | 7311 | | if (response.Headers.TryGetValue("x-ms-number-of-handles-closed", out _header)) |
| | 7312 | | { |
| | 7313 | | _value.NumberOfHandlesClosed = int.Parse(_header, System.Globalization.CultureInfo.Invariant |
| | 7314 | | } |
| | 7315 | | if (response.Headers.TryGetValue("x-ms-number-of-handles-failed", out _header)) |
| | 7316 | | { |
| | 7317 | | _value.NumberOfHandlesFailedToClose = int.Parse(_header, System.Globalization.CultureInfo.In |
| | 7318 | | } |
| | 7319 | |
|
| | 7320 | | // Create the response |
| | 7321 | | return Response.FromValue(_value, response); |
| | 7322 | | } |
| | 7323 | | default: |
| | 7324 | | { |
| | 7325 | | // Create the result |
| | 7326 | | System.Xml.Linq.XDocument _xml = System.Xml.Linq.XDocument.Load(response.ContentStream, System.X |
| | 7327 | | Azure.Storage.Files.Shares.Models.StorageError _value = Azure.Storage.Files.Shares.Models.Storag |
| | 7328 | |
|
| | 7329 | | throw _value.CreateException(clientDiagnostics, response); |
| | 7330 | | } |
| | 7331 | | } |
| | 7332 | | } |
| | 7333 | | #endregion File.ForceCloseHandlesAsync |
| | 7334 | | } |
| | 7335 | | #endregion File operations |
| | 7336 | | } |
| | 7337 | | } |
| | 7338 | | #endregion Service |
| | 7339 | |
|
| | 7340 | | #region Models |
| | 7341 | | #region class BrokenLease |
| | 7342 | | namespace Azure.Storage.Files.Shares.Models |
| | 7343 | | { |
| | 7344 | | /// <summary> |
| | 7345 | | /// BrokenLease |
| | 7346 | | /// </summary> |
| | 7347 | | internal partial class BrokenLease |
| | 7348 | | { |
| | 7349 | | /// <summary> |
| | 7350 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 7351 | | /// </summary> |
| | 7352 | | public Azure.ETag ETag { get; internal set; } |
| | 7353 | |
|
| | 7354 | | /// <summary> |
| | 7355 | | /// Returns the date and time the file was last modified. Any operation that modifies the file, including an upd |
| | 7356 | | /// </summary> |
| | 7357 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 7358 | |
|
| | 7359 | | /// <summary> |
| | 7360 | | /// Uniquely identifies a file's lease |
| | 7361 | | /// </summary> |
| | 7362 | | public string LeaseId { get; internal set; } |
| | 7363 | |
|
| | 7364 | | /// <summary> |
| | 7365 | | /// Prevent direct instantiation of BrokenLease instances. |
| | 7366 | | /// You can use ShareModelFactory.BrokenLease instead. |
| | 7367 | | /// </summary> |
| | 7368 | | internal BrokenLease() { } |
| | 7369 | | } |
| | 7370 | | } |
| | 7371 | | #endregion class BrokenLease |
| | 7372 | |
|
| | 7373 | | #region enum CopyStatus |
| | 7374 | | namespace Azure.Storage.Files.Shares.Models |
| | 7375 | | { |
| | 7376 | | /// <summary> |
| | 7377 | | /// State of the copy operation identified by 'x-ms-copy-id'. |
| | 7378 | | /// </summary> |
| | 7379 | | #pragma warning disable CA1717 // Only FlagsAttribute enums should have plural names |
| | 7380 | | public enum CopyStatus |
| | 7381 | | #pragma warning restore CA1717 // Only FlagsAttribute enums should have plural names |
| | 7382 | | { |
| | 7383 | | /// <summary> |
| | 7384 | | /// pending |
| | 7385 | | /// </summary> |
| | 7386 | | Pending, |
| | 7387 | |
|
| | 7388 | | /// <summary> |
| | 7389 | | /// success |
| | 7390 | | /// </summary> |
| | 7391 | | Success, |
| | 7392 | |
|
| | 7393 | | /// <summary> |
| | 7394 | | /// aborted |
| | 7395 | | /// </summary> |
| | 7396 | | Aborted, |
| | 7397 | |
|
| | 7398 | | /// <summary> |
| | 7399 | | /// failed |
| | 7400 | | /// </summary> |
| | 7401 | | Failed |
| | 7402 | | } |
| | 7403 | | } |
| | 7404 | |
|
| | 7405 | | namespace Azure.Storage.Files.Shares |
| | 7406 | | { |
| | 7407 | | internal static partial class FileRestClient |
| | 7408 | | { |
| | 7409 | | public static partial class Serialization |
| | 7410 | | { |
| | 7411 | | public static string ToString(Azure.Storage.Files.Shares.Models.CopyStatus value) |
| | 7412 | | { |
| | 7413 | | return value switch |
| | 7414 | | { |
| | 7415 | | Azure.Storage.Files.Shares.Models.CopyStatus.Pending => "pending", |
| | 7416 | | Azure.Storage.Files.Shares.Models.CopyStatus.Success => "success", |
| | 7417 | | Azure.Storage.Files.Shares.Models.CopyStatus.Aborted => "aborted", |
| | 7418 | | Azure.Storage.Files.Shares.Models.CopyStatus.Failed => "failed", |
| | 7419 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 7420 | | }; |
| | 7421 | | } |
| | 7422 | |
|
| | 7423 | | public static Azure.Storage.Files.Shares.Models.CopyStatus ParseCopyStatus(string value) |
| | 7424 | | { |
| | 7425 | | return value switch |
| | 7426 | | { |
| | 7427 | | "pending" => Azure.Storage.Files.Shares.Models.CopyStatus.Pending, |
| | 7428 | | "success" => Azure.Storage.Files.Shares.Models.CopyStatus.Success, |
| | 7429 | | "aborted" => Azure.Storage.Files.Shares.Models.CopyStatus.Aborted, |
| | 7430 | | "failed" => Azure.Storage.Files.Shares.Models.CopyStatus.Failed, |
| | 7431 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 7432 | | }; |
| | 7433 | | } |
| | 7434 | | } |
| | 7435 | | } |
| | 7436 | | } |
| | 7437 | | #endregion enum CopyStatus |
| | 7438 | |
|
| | 7439 | | #region enum DeleteSnapshotsOptionType |
| | 7440 | | namespace Azure.Storage.Files.Shares.Models |
| | 7441 | | { |
| | 7442 | | /// <summary> |
| | 7443 | | /// Specifies the option include to delete the base share and all of its snapshots. |
| | 7444 | | /// </summary> |
| | 7445 | | internal enum DeleteSnapshotsOptionType |
| | 7446 | | { |
| | 7447 | | /// <summary> |
| | 7448 | | /// include |
| | 7449 | | /// </summary> |
| | 7450 | | Include |
| | 7451 | | } |
| | 7452 | | } |
| | 7453 | |
|
| | 7454 | | namespace Azure.Storage.Files.Shares |
| | 7455 | | { |
| | 7456 | | internal static partial class FileRestClient |
| | 7457 | | { |
| | 7458 | | public static partial class Serialization |
| | 7459 | | { |
| | 7460 | | public static string ToString(Azure.Storage.Files.Shares.Models.DeleteSnapshotsOptionType value) |
| | 7461 | | { |
| | 7462 | | return value switch |
| | 7463 | | { |
| | 7464 | | Azure.Storage.Files.Shares.Models.DeleteSnapshotsOptionType.Include => "include", |
| | 7465 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 7466 | | }; |
| | 7467 | | } |
| | 7468 | |
|
| | 7469 | | public static Azure.Storage.Files.Shares.Models.DeleteSnapshotsOptionType ParseDeleteSnapshotsOptionType(str |
| | 7470 | | { |
| | 7471 | | return value switch |
| | 7472 | | { |
| | 7473 | | "include" => Azure.Storage.Files.Shares.Models.DeleteSnapshotsOptionType.Include, |
| | 7474 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 7475 | | }; |
| | 7476 | | } |
| | 7477 | | } |
| | 7478 | | } |
| | 7479 | | } |
| | 7480 | | #endregion enum DeleteSnapshotsOptionType |
| | 7481 | |
|
| | 7482 | | #region class DirectoryItem |
| | 7483 | | namespace Azure.Storage.Files.Shares.Models |
| | 7484 | | { |
| | 7485 | | /// <summary> |
| | 7486 | | /// A listed directory item. |
| | 7487 | | /// </summary> |
| | 7488 | | internal partial class DirectoryItem |
| | 7489 | | { |
| | 7490 | | /// <summary> |
| | 7491 | | /// Name |
| | 7492 | | /// </summary> |
| 84 | 7493 | | public string Name { get; internal set; } |
| | 7494 | |
|
| | 7495 | | /// <summary> |
| | 7496 | | /// Prevent direct instantiation of DirectoryItem instances. |
| | 7497 | | /// You can use ShareModelFactory.DirectoryItem instead. |
| | 7498 | | /// </summary> |
| 84 | 7499 | | internal DirectoryItem() { } |
| | 7500 | |
|
| | 7501 | | /// <summary> |
| | 7502 | | /// Deserializes XML into a new DirectoryItem instance. |
| | 7503 | | /// </summary> |
| | 7504 | | /// <param name="element">The XML element to deserialize.</param> |
| | 7505 | | /// <returns>A deserialized DirectoryItem instance.</returns> |
| | 7506 | | internal static Azure.Storage.Files.Shares.Models.DirectoryItem FromXml(System.Xml.Linq.XElement element) |
| | 7507 | | { |
| | 7508 | | System.Diagnostics.Debug.Assert(element != null); |
| | 7509 | | System.Xml.Linq.XElement _child; |
| 42 | 7510 | | Azure.Storage.Files.Shares.Models.DirectoryItem _value = new Azure.Storage.Files.Shares.Models.DirectoryItem |
| 42 | 7511 | | _child = element.Element(System.Xml.Linq.XName.Get("Name", "")); |
| 42 | 7512 | | if (_child != null) |
| | 7513 | | { |
| 42 | 7514 | | _value.Name = _child.Value; |
| | 7515 | | } |
| | 7516 | | CustomizeFromXml(element, _value); |
| 42 | 7517 | | return _value; |
| | 7518 | | } |
| | 7519 | |
|
| | 7520 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.Directo |
| | 7521 | | } |
| | 7522 | | } |
| | 7523 | | #endregion class DirectoryItem |
| | 7524 | |
|
| | 7525 | | #region class FailureNoContent |
| | 7526 | | namespace Azure.Storage.Files.Shares.Models |
| | 7527 | | { |
| | 7528 | | /// <summary> |
| | 7529 | | /// FailureNoContent |
| | 7530 | | /// </summary> |
| | 7531 | | internal partial class FailureNoContent |
| | 7532 | | { |
| | 7533 | | /// <summary> |
| | 7534 | | /// x-ms-error-code |
| | 7535 | | /// </summary> |
| | 7536 | | public string ErrorCode { get; internal set; } |
| | 7537 | |
|
| | 7538 | | /// <summary> |
| | 7539 | | /// Prevent direct instantiation of FailureNoContent instances. |
| | 7540 | | /// You can use ShareModelFactory.FailureNoContent instead. |
| | 7541 | | /// </summary> |
| | 7542 | | internal FailureNoContent() { } |
| | 7543 | | } |
| | 7544 | | } |
| | 7545 | | #endregion class FailureNoContent |
| | 7546 | |
|
| | 7547 | | #region class FileUploadRangeFromURLResult |
| | 7548 | | namespace Azure.Storage.Files.Shares.Models |
| | 7549 | | { |
| | 7550 | | /// <summary> |
| | 7551 | | /// File UploadRangeFromURLResult |
| | 7552 | | /// </summary> |
| | 7553 | | internal partial class FileUploadRangeFromURLResult |
| | 7554 | | { |
| | 7555 | | /// <summary> |
| | 7556 | | /// The ETag contains a value which represents the version of the file, in quotes. |
| | 7557 | | /// </summary> |
| | 7558 | | public Azure.ETag ETag { get; internal set; } |
| | 7559 | |
|
| | 7560 | | /// <summary> |
| | 7561 | | /// Returns the date and time the directory was last modified. Any operation that modifies the share or its prop |
| | 7562 | | /// </summary> |
| | 7563 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 7564 | |
|
| | 7565 | | /// <summary> |
| | 7566 | | /// This header is returned so that the client can check for message content integrity. The value of this header |
| | 7567 | | /// </summary> |
| | 7568 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 7569 | | public byte[] XMSContentCrc64 { get; internal set; } |
| | 7570 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 7571 | |
|
| | 7572 | | /// <summary> |
| | 7573 | | /// The value of this header is set to true if the contents of the request are successfully encrypted using the |
| | 7574 | | /// </summary> |
| | 7575 | | public bool IsServerEncrypted { get; internal set; } |
| | 7576 | |
|
| | 7577 | | /// <summary> |
| | 7578 | | /// Prevent direct instantiation of FileUploadRangeFromURLResult instances. |
| | 7579 | | /// You can use ShareModelFactory.FileUploadRangeFromURLResult instead. |
| | 7580 | | /// </summary> |
| | 7581 | | internal FileUploadRangeFromURLResult() { } |
| | 7582 | | } |
| | 7583 | | } |
| | 7584 | | #endregion class FileUploadRangeFromURLResult |
| | 7585 | |
|
| | 7586 | | #region class FileItem |
| | 7587 | | namespace Azure.Storage.Files.Shares.Models |
| | 7588 | | { |
| | 7589 | | /// <summary> |
| | 7590 | | /// A listed file item. |
| | 7591 | | /// </summary> |
| | 7592 | | internal partial class FileItem |
| | 7593 | | { |
| | 7594 | | /// <summary> |
| | 7595 | | /// Name |
| | 7596 | | /// </summary> |
| | 7597 | | public string Name { get; internal set; } |
| | 7598 | |
|
| | 7599 | | /// <summary> |
| | 7600 | | /// File properties. |
| | 7601 | | /// </summary> |
| | 7602 | | public Azure.Storage.Files.Shares.Models.FileProperty Properties { get; internal set; } |
| | 7603 | |
|
| | 7604 | | /// <summary> |
| | 7605 | | /// Creates a new FileItem instance |
| | 7606 | | /// </summary> |
| | 7607 | | public FileItem() |
| | 7608 | | : this(false) |
| | 7609 | | { |
| | 7610 | | } |
| | 7611 | |
|
| | 7612 | | /// <summary> |
| | 7613 | | /// Creates a new FileItem instance |
| | 7614 | | /// </summary> |
| | 7615 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 7616 | | internal FileItem(bool skipInitialization) |
| | 7617 | | { |
| | 7618 | | if (!skipInitialization) |
| | 7619 | | { |
| | 7620 | | Properties = new Azure.Storage.Files.Shares.Models.FileProperty(); |
| | 7621 | | } |
| | 7622 | | } |
| | 7623 | |
|
| | 7624 | | /// <summary> |
| | 7625 | | /// Deserializes XML into a new FileItem instance. |
| | 7626 | | /// </summary> |
| | 7627 | | /// <param name="element">The XML element to deserialize.</param> |
| | 7628 | | /// <returns>A deserialized FileItem instance.</returns> |
| | 7629 | | internal static Azure.Storage.Files.Shares.Models.FileItem FromXml(System.Xml.Linq.XElement element) |
| | 7630 | | { |
| | 7631 | | System.Diagnostics.Debug.Assert(element != null); |
| | 7632 | | System.Xml.Linq.XElement _child; |
| | 7633 | | Azure.Storage.Files.Shares.Models.FileItem _value = new Azure.Storage.Files.Shares.Models.FileItem(true); |
| | 7634 | | _child = element.Element(System.Xml.Linq.XName.Get("Name", "")); |
| | 7635 | | if (_child != null) |
| | 7636 | | { |
| | 7637 | | _value.Name = _child.Value; |
| | 7638 | | } |
| | 7639 | | _child = element.Element(System.Xml.Linq.XName.Get("Properties", "")); |
| | 7640 | | if (_child != null) |
| | 7641 | | { |
| | 7642 | | _value.Properties = Azure.Storage.Files.Shares.Models.FileProperty.FromXml(_child); |
| | 7643 | | } |
| | 7644 | | CustomizeFromXml(element, _value); |
| | 7645 | | return _value; |
| | 7646 | | } |
| | 7647 | |
|
| | 7648 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.FileIte |
| | 7649 | | } |
| | 7650 | | } |
| | 7651 | | #endregion class FileItem |
| | 7652 | |
|
| | 7653 | | #region class FileLeaseReleaseInfo |
| | 7654 | | namespace Azure.Storage.Files.Shares.Models |
| | 7655 | | { |
| | 7656 | | /// <summary> |
| | 7657 | | /// FileLeaseReleaseInfo |
| | 7658 | | /// </summary> |
| | 7659 | | public partial class FileLeaseReleaseInfo |
| | 7660 | | { |
| | 7661 | | /// <summary> |
| | 7662 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 7663 | | /// </summary> |
| | 7664 | | public Azure.ETag ETag { get; internal set; } |
| | 7665 | |
|
| | 7666 | | /// <summary> |
| | 7667 | | /// Returns the date and time the file was last modified. Any operation that modifies the file, including an upd |
| | 7668 | | /// </summary> |
| | 7669 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 7670 | |
|
| | 7671 | | /// <summary> |
| | 7672 | | /// Prevent direct instantiation of FileLeaseReleaseInfo instances. |
| | 7673 | | /// You can use ShareModelFactory.FileLeaseReleaseInfo instead. |
| | 7674 | | /// </summary> |
| | 7675 | | internal FileLeaseReleaseInfo() { } |
| | 7676 | | } |
| | 7677 | |
|
| | 7678 | | /// <summary> |
| | 7679 | | /// ShareModelFactory provides utilities for mocking. |
| | 7680 | | /// </summary> |
| | 7681 | | public static partial class ShareModelFactory |
| | 7682 | | { |
| | 7683 | | /// <summary> |
| | 7684 | | /// Creates a new FileLeaseReleaseInfo instance for mocking. |
| | 7685 | | /// </summary> |
| | 7686 | | public static FileLeaseReleaseInfo FileLeaseReleaseInfo( |
| | 7687 | | Azure.ETag eTag, |
| | 7688 | | System.DateTimeOffset lastModified) |
| | 7689 | | { |
| | 7690 | | return new FileLeaseReleaseInfo() |
| | 7691 | | { |
| | 7692 | | ETag = eTag, |
| | 7693 | | LastModified = lastModified, |
| | 7694 | | }; |
| | 7695 | | } |
| | 7696 | | } |
| | 7697 | | } |
| | 7698 | | #endregion class FileLeaseReleaseInfo |
| | 7699 | |
|
| | 7700 | | #region class FileProperty |
| | 7701 | | namespace Azure.Storage.Files.Shares.Models |
| | 7702 | | { |
| | 7703 | | /// <summary> |
| | 7704 | | /// File properties. |
| | 7705 | | /// </summary> |
| | 7706 | | internal partial class FileProperty |
| | 7707 | | { |
| | 7708 | | /// <summary> |
| | 7709 | | /// Content length of the file. This value may not be up-to-date since an SMB client may have modified the file |
| | 7710 | | /// </summary> |
| | 7711 | | public long ContentLength { get; internal set; } |
| | 7712 | |
|
| | 7713 | | /// <summary> |
| | 7714 | | /// Prevent direct instantiation of FileProperty instances. |
| | 7715 | | /// You can use ShareModelFactory.FileProperty instead. |
| | 7716 | | /// </summary> |
| | 7717 | | internal FileProperty() { } |
| | 7718 | |
|
| | 7719 | | /// <summary> |
| | 7720 | | /// Deserializes XML into a new FileProperty instance. |
| | 7721 | | /// </summary> |
| | 7722 | | /// <param name="element">The XML element to deserialize.</param> |
| | 7723 | | /// <returns>A deserialized FileProperty instance.</returns> |
| | 7724 | | internal static Azure.Storage.Files.Shares.Models.FileProperty FromXml(System.Xml.Linq.XElement element) |
| | 7725 | | { |
| | 7726 | | System.Diagnostics.Debug.Assert(element != null); |
| | 7727 | | System.Xml.Linq.XElement _child; |
| | 7728 | | Azure.Storage.Files.Shares.Models.FileProperty _value = new Azure.Storage.Files.Shares.Models.FileProperty() |
| | 7729 | | _child = element.Element(System.Xml.Linq.XName.Get("Content-Length", "")); |
| | 7730 | | if (_child != null) |
| | 7731 | | { |
| | 7732 | | _value.ContentLength = long.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 7733 | | } |
| | 7734 | | CustomizeFromXml(element, _value); |
| | 7735 | | return _value; |
| | 7736 | | } |
| | 7737 | |
|
| | 7738 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.FilePro |
| | 7739 | | } |
| | 7740 | | } |
| | 7741 | | #endregion class FileProperty |
| | 7742 | |
|
| | 7743 | | #region class FilesAndDirectoriesSegment |
| | 7744 | | namespace Azure.Storage.Files.Shares.Models |
| | 7745 | | { |
| | 7746 | | /// <summary> |
| | 7747 | | /// An enumeration of directories and files. |
| | 7748 | | /// </summary> |
| | 7749 | | internal partial class FilesAndDirectoriesSegment |
| | 7750 | | { |
| | 7751 | | /// <summary> |
| | 7752 | | /// ServiceEndpoint |
| | 7753 | | /// </summary> |
| | 7754 | | public string ServiceEndpoint { get; internal set; } |
| | 7755 | |
|
| | 7756 | | /// <summary> |
| | 7757 | | /// ShareName |
| | 7758 | | /// </summary> |
| | 7759 | | public string ShareName { get; internal set; } |
| | 7760 | |
|
| | 7761 | | /// <summary> |
| | 7762 | | /// ShareSnapshot |
| | 7763 | | /// </summary> |
| | 7764 | | public string ShareSnapshot { get; internal set; } |
| | 7765 | |
|
| | 7766 | | /// <summary> |
| | 7767 | | /// DirectoryPath |
| | 7768 | | /// </summary> |
| | 7769 | | public string DirectoryPath { get; internal set; } |
| | 7770 | |
|
| | 7771 | | /// <summary> |
| | 7772 | | /// Prefix |
| | 7773 | | /// </summary> |
| | 7774 | | public string Prefix { get; internal set; } |
| | 7775 | |
|
| | 7776 | | /// <summary> |
| | 7777 | | /// Marker |
| | 7778 | | /// </summary> |
| | 7779 | | public string Marker { get; internal set; } |
| | 7780 | |
|
| | 7781 | | /// <summary> |
| | 7782 | | /// MaxResults |
| | 7783 | | /// </summary> |
| | 7784 | | public int? MaxResults { get; internal set; } |
| | 7785 | |
|
| | 7786 | | /// <summary> |
| | 7787 | | /// NextMarker |
| | 7788 | | /// </summary> |
| | 7789 | | public string NextMarker { get; internal set; } |
| | 7790 | |
|
| | 7791 | | /// <summary> |
| | 7792 | | /// DirectoryItems |
| | 7793 | | /// </summary> |
| | 7794 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.DirectoryItem> DirectoryItems { |
| | 7795 | |
|
| | 7796 | | /// <summary> |
| | 7797 | | /// FileItems |
| | 7798 | | /// </summary> |
| | 7799 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.FileItem> FileItems { get; inter |
| | 7800 | |
|
| | 7801 | | /// <summary> |
| | 7802 | | /// Creates a new FilesAndDirectoriesSegment instance |
| | 7803 | | /// </summary> |
| | 7804 | | public FilesAndDirectoriesSegment() |
| | 7805 | | : this(false) |
| | 7806 | | { |
| | 7807 | | } |
| | 7808 | |
|
| | 7809 | | /// <summary> |
| | 7810 | | /// Creates a new FilesAndDirectoriesSegment instance |
| | 7811 | | /// </summary> |
| | 7812 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 7813 | | internal FilesAndDirectoriesSegment(bool skipInitialization) |
| | 7814 | | { |
| | 7815 | | if (!skipInitialization) |
| | 7816 | | { |
| | 7817 | | DirectoryItems = new System.Collections.Generic.List<Azure.Storage.Files.Shares.Models.DirectoryItem>(); |
| | 7818 | | FileItems = new System.Collections.Generic.List<Azure.Storage.Files.Shares.Models.FileItem>(); |
| | 7819 | | } |
| | 7820 | | } |
| | 7821 | |
|
| | 7822 | | /// <summary> |
| | 7823 | | /// Deserializes XML into a new FilesAndDirectoriesSegment instance. |
| | 7824 | | /// </summary> |
| | 7825 | | /// <param name="element">The XML element to deserialize.</param> |
| | 7826 | | /// <returns>A deserialized FilesAndDirectoriesSegment instance.</returns> |
| | 7827 | | internal static Azure.Storage.Files.Shares.Models.FilesAndDirectoriesSegment FromXml(System.Xml.Linq.XElement el |
| | 7828 | | { |
| | 7829 | | System.Diagnostics.Debug.Assert(element != null); |
| | 7830 | | System.Xml.Linq.XElement _child; |
| | 7831 | | System.Xml.Linq.XAttribute _attribute; |
| | 7832 | | Azure.Storage.Files.Shares.Models.FilesAndDirectoriesSegment _value = new Azure.Storage.Files.Shares.Models. |
| | 7833 | | _attribute = element.Attribute(System.Xml.Linq.XName.Get("ServiceEndpoint", "")); |
| | 7834 | | if (_attribute != null) |
| | 7835 | | { |
| | 7836 | | _value.ServiceEndpoint = _attribute.Value; |
| | 7837 | | } |
| | 7838 | | _attribute = element.Attribute(System.Xml.Linq.XName.Get("ShareName", "")); |
| | 7839 | | if (_attribute != null) |
| | 7840 | | { |
| | 7841 | | _value.ShareName = _attribute.Value; |
| | 7842 | | } |
| | 7843 | | _attribute = element.Attribute(System.Xml.Linq.XName.Get("ShareSnapshot", "")); |
| | 7844 | | if (_attribute != null) |
| | 7845 | | { |
| | 7846 | | _value.ShareSnapshot = _attribute.Value; |
| | 7847 | | } |
| | 7848 | | _attribute = element.Attribute(System.Xml.Linq.XName.Get("DirectoryPath", "")); |
| | 7849 | | if (_attribute != null) |
| | 7850 | | { |
| | 7851 | | _value.DirectoryPath = _attribute.Value; |
| | 7852 | | } |
| | 7853 | | _child = element.Element(System.Xml.Linq.XName.Get("Prefix", "")); |
| | 7854 | | if (_child != null) |
| | 7855 | | { |
| | 7856 | | _value.Prefix = _child.Value; |
| | 7857 | | } |
| | 7858 | | _child = element.Element(System.Xml.Linq.XName.Get("Marker", "")); |
| | 7859 | | if (_child != null) |
| | 7860 | | { |
| | 7861 | | _value.Marker = _child.Value; |
| | 7862 | | } |
| | 7863 | | _child = element.Element(System.Xml.Linq.XName.Get("MaxResults", "")); |
| | 7864 | | if (_child != null) |
| | 7865 | | { |
| | 7866 | | _value.MaxResults = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 7867 | | } |
| | 7868 | | _child = element.Element(System.Xml.Linq.XName.Get("NextMarker", "")); |
| | 7869 | | if (_child != null) |
| | 7870 | | { |
| | 7871 | | _value.NextMarker = _child.Value; |
| | 7872 | | } |
| | 7873 | | _child = element.Element(System.Xml.Linq.XName.Get("Entries", "")); |
| | 7874 | | if (_child != null) |
| | 7875 | | { |
| | 7876 | | _value.DirectoryItems = System.Linq.Enumerable.ToList( |
| | 7877 | | System.Linq.Enumerable.Select( |
| | 7878 | | _child.Elements(System.Xml.Linq.XName.Get("Directory", "")), |
| | 7879 | | e => Azure.Storage.Files.Shares.Models.DirectoryItem.FromXml(e))); |
| | 7880 | | } |
| | 7881 | | else |
| | 7882 | | { |
| | 7883 | | _value.DirectoryItems = new System.Collections.Generic.List<Azure.Storage.Files.Shares.Models.DirectoryI |
| | 7884 | | } |
| | 7885 | | _child = element.Element(System.Xml.Linq.XName.Get("Entries", "")); |
| | 7886 | | if (_child != null) |
| | 7887 | | { |
| | 7888 | | _value.FileItems = System.Linq.Enumerable.ToList( |
| | 7889 | | System.Linq.Enumerable.Select( |
| | 7890 | | _child.Elements(System.Xml.Linq.XName.Get("File", "")), |
| | 7891 | | e => Azure.Storage.Files.Shares.Models.FileItem.FromXml(e))); |
| | 7892 | | } |
| | 7893 | | else |
| | 7894 | | { |
| | 7895 | | _value.FileItems = new System.Collections.Generic.List<Azure.Storage.Files.Shares.Models.FileItem>(); |
| | 7896 | | } |
| | 7897 | | CustomizeFromXml(element, _value); |
| | 7898 | | return _value; |
| | 7899 | | } |
| | 7900 | |
|
| | 7901 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.FilesAn |
| | 7902 | | } |
| | 7903 | | } |
| | 7904 | | #endregion class FilesAndDirectoriesSegment |
| | 7905 | |
|
| | 7906 | | #region class FlattenedStorageFileProperties |
| | 7907 | | namespace Azure.Storage.Files.Shares.Models |
| | 7908 | | { |
| | 7909 | | /// <summary> |
| | 7910 | | /// FlattenedStorageFileProperties |
| | 7911 | | /// </summary> |
| | 7912 | | internal partial class FlattenedStorageFileProperties |
| | 7913 | | { |
| | 7914 | | /// <summary> |
| | 7915 | | /// Returns the date and time the file was last modified. Any operation that modifies the file or its properties |
| | 7916 | | /// </summary> |
| | 7917 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 7918 | |
|
| | 7919 | | /// <summary> |
| | 7920 | | /// A set of name-value pairs associated with this file as user-defined metadata. |
| | 7921 | | /// </summary> |
| | 7922 | | public System.Collections.Generic.IDictionary<string, string> Metadata { get; internal set; } |
| | 7923 | |
|
| | 7924 | | /// <summary> |
| | 7925 | | /// The number of bytes present in the response body. |
| | 7926 | | /// </summary> |
| | 7927 | | public long ContentLength { get; internal set; } |
| | 7928 | |
|
| | 7929 | | /// <summary> |
| | 7930 | | /// The content type specified for the file. The default content type is 'application/octet-stream' |
| | 7931 | | /// </summary> |
| | 7932 | | public string ContentType { get; internal set; } |
| | 7933 | |
|
| | 7934 | | /// <summary> |
| | 7935 | | /// Indicates the range of bytes returned if the client requested a subset of the file by setting the Range requ |
| | 7936 | | /// </summary> |
| | 7937 | | public string ContentRange { get; internal set; } |
| | 7938 | |
|
| | 7939 | | /// <summary> |
| | 7940 | | /// The ETag contains a value that you can use to perform operations conditionally, in quotes. |
| | 7941 | | /// </summary> |
| | 7942 | | public Azure.ETag ETag { get; internal set; } |
| | 7943 | |
|
| | 7944 | | /// <summary> |
| | 7945 | | /// If the file has an MD5 hash and the request is to read the full file, this response header is returned so th |
| | 7946 | | /// </summary> |
| | 7947 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 7948 | | public byte[] ContentHash { get; internal set; } |
| | 7949 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 7950 | |
|
| | 7951 | | /// <summary> |
| | 7952 | | /// Returns the value that was specified for the Content-Encoding request header. |
| | 7953 | | /// </summary> |
| | 7954 | | public System.Collections.Generic.IEnumerable<string> ContentEncoding { get; internal set; } |
| | 7955 | |
|
| | 7956 | | /// <summary> |
| | 7957 | | /// Returned if it was previously specified for the file. |
| | 7958 | | /// </summary> |
| | 7959 | | public string CacheControl { get; internal set; } |
| | 7960 | |
|
| | 7961 | | /// <summary> |
| | 7962 | | /// Returns the value that was specified for the 'x-ms-content-disposition' header and specifies how to process |
| | 7963 | | /// </summary> |
| | 7964 | | public string ContentDisposition { get; internal set; } |
| | 7965 | |
|
| | 7966 | | /// <summary> |
| | 7967 | | /// Returns the value that was specified for the Content-Language request header. |
| | 7968 | | /// </summary> |
| | 7969 | | public System.Collections.Generic.IEnumerable<string> ContentLanguage { get; internal set; } |
| | 7970 | |
|
| | 7971 | | /// <summary> |
| | 7972 | | /// Indicates that the service supports requests for partial file content. |
| | 7973 | | /// </summary> |
| | 7974 | | public string AcceptRanges { get; internal set; } |
| | 7975 | |
|
| | 7976 | | /// <summary> |
| | 7977 | | /// Conclusion time of the last attempted Copy File operation where this file was the destination file. This val |
| | 7978 | | /// </summary> |
| | 7979 | | public System.DateTimeOffset CopyCompletionTime { get; internal set; } |
| | 7980 | |
|
| | 7981 | | /// <summary> |
| | 7982 | | /// Only appears when x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operatio |
| | 7983 | | /// </summary> |
| | 7984 | | public string CopyStatusDescription { get; internal set; } |
| | 7985 | |
|
| | 7986 | | /// <summary> |
| | 7987 | | /// String identifier for the last attempted Copy File operation where this file was the destination file. |
| | 7988 | | /// </summary> |
| | 7989 | | public string CopyId { get; internal set; } |
| | 7990 | |
|
| | 7991 | | /// <summary> |
| | 7992 | | /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy File operat |
| | 7993 | | /// </summary> |
| | 7994 | | public string CopyProgress { get; internal set; } |
| | 7995 | |
|
| | 7996 | | /// <summary> |
| | 7997 | | /// URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where |
| | 7998 | | /// </summary> |
| | 7999 | | public System.Uri CopySource { get; internal set; } |
| | 8000 | |
|
| | 8001 | | /// <summary> |
| | 8002 | | /// State of the copy operation identified by 'x-ms-copy-id'. |
| | 8003 | | /// </summary> |
| | 8004 | | public Azure.Storage.Files.Shares.Models.CopyStatus CopyStatus { get; internal set; } |
| | 8005 | |
|
| | 8006 | | /// <summary> |
| | 8007 | | /// If the file has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header |
| | 8008 | | /// </summary> |
| | 8009 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 8010 | | public byte[] FileContentHash { get; internal set; } |
| | 8011 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 8012 | |
|
| | 8013 | | /// <summary> |
| | 8014 | | /// The value of this header is set to true if the file data and application metadata are completely encrypted u |
| | 8015 | | /// </summary> |
| | 8016 | | public bool IsServerEncrypted { get; internal set; } |
| | 8017 | |
|
| | 8018 | | /// <summary> |
| | 8019 | | /// Attributes set for the file. |
| | 8020 | | /// </summary> |
| | 8021 | | public string FileAttributes { get; internal set; } |
| | 8022 | |
|
| | 8023 | | /// <summary> |
| | 8024 | | /// Creation time for the file. |
| | 8025 | | /// </summary> |
| | 8026 | | public System.DateTimeOffset FileCreationTime { get; internal set; } |
| | 8027 | |
|
| | 8028 | | /// <summary> |
| | 8029 | | /// Last write time for the file. |
| | 8030 | | /// </summary> |
| | 8031 | | public System.DateTimeOffset FileLastWriteTime { get; internal set; } |
| | 8032 | |
|
| | 8033 | | /// <summary> |
| | 8034 | | /// Change time for the file. |
| | 8035 | | /// </summary> |
| | 8036 | | public System.DateTimeOffset FileChangeTime { get; internal set; } |
| | 8037 | |
|
| | 8038 | | /// <summary> |
| | 8039 | | /// Key of the permission set for the file. |
| | 8040 | | /// </summary> |
| | 8041 | | public string FilePermissionKey { get; internal set; } |
| | 8042 | |
|
| | 8043 | | /// <summary> |
| | 8044 | | /// The fileId of the file. |
| | 8045 | | /// </summary> |
| | 8046 | | public string FileId { get; internal set; } |
| | 8047 | |
|
| | 8048 | | /// <summary> |
| | 8049 | | /// The parent fileId of the file. |
| | 8050 | | /// </summary> |
| | 8051 | | public string FileParentId { get; internal set; } |
| | 8052 | |
|
| | 8053 | | /// <summary> |
| | 8054 | | /// When a file is leased, specifies whether the lease is of infinite or fixed duration. |
| | 8055 | | /// </summary> |
| | 8056 | | public Azure.Storage.Files.Shares.Models.ShareLeaseDuration LeaseDuration { get; internal set; } |
| | 8057 | |
|
| | 8058 | | /// <summary> |
| | 8059 | | /// Lease state of the file. |
| | 8060 | | /// </summary> |
| | 8061 | | public Azure.Storage.Files.Shares.Models.ShareLeaseState LeaseState { get; internal set; } |
| | 8062 | |
|
| | 8063 | | /// <summary> |
| | 8064 | | /// The current lease status of the file. |
| | 8065 | | /// </summary> |
| | 8066 | | public Azure.Storage.Files.Shares.Models.ShareLeaseStatus LeaseStatus { get; internal set; } |
| | 8067 | |
|
| | 8068 | | /// <summary> |
| | 8069 | | /// Content |
| | 8070 | | /// </summary> |
| | 8071 | | public System.IO.Stream Content { get; internal set; } |
| | 8072 | |
|
| | 8073 | | /// <summary> |
| | 8074 | | /// Creates a new FlattenedStorageFileProperties instance |
| | 8075 | | /// </summary> |
| | 8076 | | public FlattenedStorageFileProperties() |
| | 8077 | | { |
| | 8078 | | Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgnoreCase |
| | 8079 | | ContentEncoding = new System.Collections.Generic.List<string>(); |
| | 8080 | | ContentLanguage = new System.Collections.Generic.List<string>(); |
| | 8081 | | } |
| | 8082 | | } |
| | 8083 | | } |
| | 8084 | | #endregion class FlattenedStorageFileProperties |
| | 8085 | |
|
| | 8086 | | #region enum ListSharesIncludeType |
| | 8087 | | namespace Azure.Storage.Files.Shares.Models |
| | 8088 | | { |
| | 8089 | | /// <summary> |
| | 8090 | | /// ListSharesIncludeType values |
| | 8091 | | /// </summary> |
| | 8092 | | internal enum ListSharesIncludeType |
| | 8093 | | { |
| | 8094 | | /// <summary> |
| | 8095 | | /// snapshots |
| | 8096 | | /// </summary> |
| | 8097 | | Snapshots, |
| | 8098 | |
|
| | 8099 | | /// <summary> |
| | 8100 | | /// metadata |
| | 8101 | | /// </summary> |
| | 8102 | | Metadata, |
| | 8103 | |
|
| | 8104 | | /// <summary> |
| | 8105 | | /// deleted |
| | 8106 | | /// </summary> |
| | 8107 | | Deleted |
| | 8108 | | } |
| | 8109 | | } |
| | 8110 | |
|
| | 8111 | | namespace Azure.Storage.Files.Shares |
| | 8112 | | { |
| | 8113 | | internal static partial class FileRestClient |
| | 8114 | | { |
| | 8115 | | public static partial class Serialization |
| | 8116 | | { |
| | 8117 | | public static string ToString(Azure.Storage.Files.Shares.Models.ListSharesIncludeType value) |
| | 8118 | | { |
| | 8119 | | return value switch |
| | 8120 | | { |
| | 8121 | | Azure.Storage.Files.Shares.Models.ListSharesIncludeType.Snapshots => "snapshots", |
| | 8122 | | Azure.Storage.Files.Shares.Models.ListSharesIncludeType.Metadata => "metadata", |
| | 8123 | | Azure.Storage.Files.Shares.Models.ListSharesIncludeType.Deleted => "deleted", |
| | 8124 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 8125 | | }; |
| | 8126 | | } |
| | 8127 | |
|
| | 8128 | | public static Azure.Storage.Files.Shares.Models.ListSharesIncludeType ParseListSharesIncludeType(string valu |
| | 8129 | | { |
| | 8130 | | return value switch |
| | 8131 | | { |
| | 8132 | | "snapshots" => Azure.Storage.Files.Shares.Models.ListSharesIncludeType.Snapshots, |
| | 8133 | | "metadata" => Azure.Storage.Files.Shares.Models.ListSharesIncludeType.Metadata, |
| | 8134 | | "deleted" => Azure.Storage.Files.Shares.Models.ListSharesIncludeType.Deleted, |
| | 8135 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 8136 | | }; |
| | 8137 | | } |
| | 8138 | | } |
| | 8139 | | } |
| | 8140 | | } |
| | 8141 | | #endregion enum ListSharesIncludeType |
| | 8142 | |
|
| | 8143 | | #region enum PermissionCopyMode |
| | 8144 | | namespace Azure.Storage.Files.Shares.Models |
| | 8145 | | { |
| | 8146 | | /// <summary> |
| | 8147 | | /// Specifies the option to copy file security descriptor from source file or to set it using the value which is def |
| | 8148 | | /// </summary> |
| | 8149 | | public enum PermissionCopyMode |
| | 8150 | | { |
| | 8151 | | /// <summary> |
| | 8152 | | /// source |
| | 8153 | | /// </summary> |
| | 8154 | | Source, |
| | 8155 | |
|
| | 8156 | | /// <summary> |
| | 8157 | | /// override |
| | 8158 | | /// </summary> |
| | 8159 | | Override |
| | 8160 | | } |
| | 8161 | | } |
| | 8162 | |
|
| | 8163 | | namespace Azure.Storage.Files.Shares |
| | 8164 | | { |
| | 8165 | | internal static partial class FileRestClient |
| | 8166 | | { |
| | 8167 | | public static partial class Serialization |
| | 8168 | | { |
| | 8169 | | public static string ToString(Azure.Storage.Files.Shares.Models.PermissionCopyMode value) |
| | 8170 | | { |
| | 8171 | | return value switch |
| | 8172 | | { |
| | 8173 | | Azure.Storage.Files.Shares.Models.PermissionCopyMode.Source => "source", |
| | 8174 | | Azure.Storage.Files.Shares.Models.PermissionCopyMode.Override => "override", |
| | 8175 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 8176 | | }; |
| | 8177 | | } |
| | 8178 | |
|
| | 8179 | | public static Azure.Storage.Files.Shares.Models.PermissionCopyMode ParsePermissionCopyMode(string value) |
| | 8180 | | { |
| | 8181 | | return value switch |
| | 8182 | | { |
| | 8183 | | "source" => Azure.Storage.Files.Shares.Models.PermissionCopyMode.Source, |
| | 8184 | | "override" => Azure.Storage.Files.Shares.Models.PermissionCopyMode.Override, |
| | 8185 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 8186 | | }; |
| | 8187 | | } |
| | 8188 | | } |
| | 8189 | | } |
| | 8190 | | } |
| | 8191 | | #endregion enum PermissionCopyMode |
| | 8192 | |
|
| | 8193 | | #region class PermissionInfo |
| | 8194 | | namespace Azure.Storage.Files.Shares.Models |
| | 8195 | | { |
| | 8196 | | /// <summary> |
| | 8197 | | /// PermissionInfo |
| | 8198 | | /// </summary> |
| | 8199 | | public partial class PermissionInfo |
| | 8200 | | { |
| | 8201 | | /// <summary> |
| | 8202 | | /// Key of the permission set for the directory/file. |
| | 8203 | | /// </summary> |
| | 8204 | | public string FilePermissionKey { get; internal set; } |
| | 8205 | |
|
| | 8206 | | /// <summary> |
| | 8207 | | /// Prevent direct instantiation of PermissionInfo instances. |
| | 8208 | | /// You can use ShareModelFactory.PermissionInfo instead. |
| | 8209 | | /// </summary> |
| | 8210 | | internal PermissionInfo() { } |
| | 8211 | | } |
| | 8212 | |
|
| | 8213 | | /// <summary> |
| | 8214 | | /// ShareModelFactory provides utilities for mocking. |
| | 8215 | | /// </summary> |
| | 8216 | | public static partial class ShareModelFactory |
| | 8217 | | { |
| | 8218 | | /// <summary> |
| | 8219 | | /// Creates a new PermissionInfo instance for mocking. |
| | 8220 | | /// </summary> |
| | 8221 | | public static PermissionInfo PermissionInfo( |
| | 8222 | | string filePermissionKey) |
| | 8223 | | { |
| | 8224 | | return new PermissionInfo() |
| | 8225 | | { |
| | 8226 | | FilePermissionKey = filePermissionKey, |
| | 8227 | | }; |
| | 8228 | | } |
| | 8229 | | } |
| | 8230 | | } |
| | 8231 | | #endregion class PermissionInfo |
| | 8232 | |
|
| | 8233 | | #region class Range |
| | 8234 | | namespace Azure.Storage.Files.Shares.Models |
| | 8235 | | { |
| | 8236 | | /// <summary> |
| | 8237 | | /// An Azure Storage file range. |
| | 8238 | | /// </summary> |
| | 8239 | | internal partial class Range |
| | 8240 | | { |
| | 8241 | | /// <summary> |
| | 8242 | | /// Start of the range. |
| | 8243 | | /// </summary> |
| | 8244 | | public long Start { get; internal set; } |
| | 8245 | |
|
| | 8246 | | /// <summary> |
| | 8247 | | /// End of the range. |
| | 8248 | | /// </summary> |
| | 8249 | | public long End { get; internal set; } |
| | 8250 | |
|
| | 8251 | | /// <summary> |
| | 8252 | | /// Prevent direct instantiation of Range instances. |
| | 8253 | | /// You can use ShareModelFactory.Range instead. |
| | 8254 | | /// </summary> |
| | 8255 | | internal Range() { } |
| | 8256 | |
|
| | 8257 | | /// <summary> |
| | 8258 | | /// Deserializes XML into a new Range instance. |
| | 8259 | | /// </summary> |
| | 8260 | | /// <param name="element">The XML element to deserialize.</param> |
| | 8261 | | /// <returns>A deserialized Range instance.</returns> |
| | 8262 | | internal static Azure.Storage.Files.Shares.Models.Range FromXml(System.Xml.Linq.XElement element) |
| | 8263 | | { |
| | 8264 | | System.Diagnostics.Debug.Assert(element != null); |
| | 8265 | | System.Xml.Linq.XElement _child; |
| | 8266 | | Azure.Storage.Files.Shares.Models.Range _value = new Azure.Storage.Files.Shares.Models.Range(); |
| | 8267 | | _child = element.Element(System.Xml.Linq.XName.Get("Start", "")); |
| | 8268 | | if (_child != null) |
| | 8269 | | { |
| | 8270 | | _value.Start = long.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 8271 | | } |
| | 8272 | | _child = element.Element(System.Xml.Linq.XName.Get("End", "")); |
| | 8273 | | if (_child != null) |
| | 8274 | | { |
| | 8275 | | _value.End = long.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 8276 | | } |
| | 8277 | | CustomizeFromXml(element, _value); |
| | 8278 | | return _value; |
| | 8279 | | } |
| | 8280 | |
|
| | 8281 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.Range v |
| | 8282 | | } |
| | 8283 | | } |
| | 8284 | | #endregion class Range |
| | 8285 | |
|
| | 8286 | | #region class RawStorageDirectoryInfo |
| | 8287 | | namespace Azure.Storage.Files.Shares.Models |
| | 8288 | | { |
| | 8289 | | /// <summary> |
| | 8290 | | /// RawStorageDirectoryInfo |
| | 8291 | | /// </summary> |
| | 8292 | | internal partial class RawStorageDirectoryInfo |
| | 8293 | | { |
| | 8294 | | /// <summary> |
| | 8295 | | /// The ETag contains a value which represents the version of the directory, in quotes. |
| | 8296 | | /// </summary> |
| | 8297 | | public Azure.ETag ETag { get; internal set; } |
| | 8298 | |
|
| | 8299 | | /// <summary> |
| | 8300 | | /// Returns the date and time the share was last modified. Any operation that modifies the directory or its prop |
| | 8301 | | /// </summary> |
| | 8302 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 8303 | |
|
| | 8304 | | /// <summary> |
| | 8305 | | /// Key of the permission set for the directory. |
| | 8306 | | /// </summary> |
| | 8307 | | public string FilePermissionKey { get; internal set; } |
| | 8308 | |
|
| | 8309 | | /// <summary> |
| | 8310 | | /// Attributes set for the directory. |
| | 8311 | | /// </summary> |
| | 8312 | | public string FileAttributes { get; internal set; } |
| | 8313 | |
|
| | 8314 | | /// <summary> |
| | 8315 | | /// Creation time for the directory. |
| | 8316 | | /// </summary> |
| | 8317 | | public System.DateTimeOffset FileCreationTime { get; internal set; } |
| | 8318 | |
|
| | 8319 | | /// <summary> |
| | 8320 | | /// Last write time for the directory. |
| | 8321 | | /// </summary> |
| | 8322 | | public System.DateTimeOffset FileLastWriteTime { get; internal set; } |
| | 8323 | |
|
| | 8324 | | /// <summary> |
| | 8325 | | /// Change time for the directory. |
| | 8326 | | /// </summary> |
| | 8327 | | public System.DateTimeOffset FileChangeTime { get; internal set; } |
| | 8328 | |
|
| | 8329 | | /// <summary> |
| | 8330 | | /// The fileId of the directory. |
| | 8331 | | /// </summary> |
| | 8332 | | public string FileId { get; internal set; } |
| | 8333 | |
|
| | 8334 | | /// <summary> |
| | 8335 | | /// The parent fileId of the directory. |
| | 8336 | | /// </summary> |
| | 8337 | | public string FileParentId { get; internal set; } |
| | 8338 | |
|
| | 8339 | | /// <summary> |
| | 8340 | | /// Prevent direct instantiation of RawStorageDirectoryInfo instances. |
| | 8341 | | /// You can use ShareModelFactory.RawStorageDirectoryInfo instead. |
| | 8342 | | /// </summary> |
| | 8343 | | internal RawStorageDirectoryInfo() { } |
| | 8344 | | } |
| | 8345 | | } |
| | 8346 | | #endregion class RawStorageDirectoryInfo |
| | 8347 | |
|
| | 8348 | | #region class RawStorageDirectoryProperties |
| | 8349 | | namespace Azure.Storage.Files.Shares.Models |
| | 8350 | | { |
| | 8351 | | /// <summary> |
| | 8352 | | /// RawStorageDirectoryProperties |
| | 8353 | | /// </summary> |
| | 8354 | | internal partial class RawStorageDirectoryProperties |
| | 8355 | | { |
| | 8356 | | /// <summary> |
| | 8357 | | /// A set of name-value pairs that contain metadata for the directory. |
| | 8358 | | /// </summary> |
| | 8359 | | public System.Collections.Generic.IDictionary<string, string> Metadata { get; internal set; } |
| | 8360 | |
|
| | 8361 | | /// <summary> |
| | 8362 | | /// The ETag contains a value that you can use to perform operations conditionally, in quotes. |
| | 8363 | | /// </summary> |
| | 8364 | | public Azure.ETag ETag { get; internal set; } |
| | 8365 | |
|
| | 8366 | | /// <summary> |
| | 8367 | | /// Returns the date and time the Directory was last modified. Operations on files within the directory do not a |
| | 8368 | | /// </summary> |
| | 8369 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 8370 | |
|
| | 8371 | | /// <summary> |
| | 8372 | | /// The value of this header is set to true if the directory metadata is completely encrypted using the specifie |
| | 8373 | | /// </summary> |
| | 8374 | | public bool IsServerEncrypted { get; internal set; } |
| | 8375 | |
|
| | 8376 | | /// <summary> |
| | 8377 | | /// Attributes set for the directory. |
| | 8378 | | /// </summary> |
| | 8379 | | public string FileAttributes { get; internal set; } |
| | 8380 | |
|
| | 8381 | | /// <summary> |
| | 8382 | | /// Creation time for the directory. |
| | 8383 | | /// </summary> |
| | 8384 | | public System.DateTimeOffset FileCreationTime { get; internal set; } |
| | 8385 | |
|
| | 8386 | | /// <summary> |
| | 8387 | | /// Last write time for the directory. |
| | 8388 | | /// </summary> |
| | 8389 | | public System.DateTimeOffset FileLastWriteTime { get; internal set; } |
| | 8390 | |
|
| | 8391 | | /// <summary> |
| | 8392 | | /// Change time for the directory. |
| | 8393 | | /// </summary> |
| | 8394 | | public System.DateTimeOffset FileChangeTime { get; internal set; } |
| | 8395 | |
|
| | 8396 | | /// <summary> |
| | 8397 | | /// Key of the permission set for the directory. |
| | 8398 | | /// </summary> |
| | 8399 | | public string FilePermissionKey { get; internal set; } |
| | 8400 | |
|
| | 8401 | | /// <summary> |
| | 8402 | | /// The fileId of the directory. |
| | 8403 | | /// </summary> |
| | 8404 | | public string FileId { get; internal set; } |
| | 8405 | |
|
| | 8406 | | /// <summary> |
| | 8407 | | /// The parent fileId of the directory. |
| | 8408 | | /// </summary> |
| | 8409 | | public string FileParentId { get; internal set; } |
| | 8410 | |
|
| | 8411 | | /// <summary> |
| | 8412 | | /// Creates a new RawStorageDirectoryProperties instance |
| | 8413 | | /// </summary> |
| | 8414 | | public RawStorageDirectoryProperties() |
| | 8415 | | { |
| | 8416 | | Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgnoreCase |
| | 8417 | | } |
| | 8418 | | } |
| | 8419 | | } |
| | 8420 | | #endregion class RawStorageDirectoryProperties |
| | 8421 | |
|
| | 8422 | | #region class RawStorageFileInfo |
| | 8423 | | namespace Azure.Storage.Files.Shares.Models |
| | 8424 | | { |
| | 8425 | | /// <summary> |
| | 8426 | | /// RawStorageFileInfo |
| | 8427 | | /// </summary> |
| | 8428 | | internal partial class RawStorageFileInfo |
| | 8429 | | { |
| | 8430 | | /// <summary> |
| | 8431 | | /// The ETag contains a value which represents the version of the file, in quotes. |
| | 8432 | | /// </summary> |
| | 8433 | | public Azure.ETag ETag { get; internal set; } |
| | 8434 | |
|
| | 8435 | | /// <summary> |
| | 8436 | | /// Returns the date and time the share was last modified. Any operation that modifies the directory or its prop |
| | 8437 | | /// </summary> |
| | 8438 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 8439 | |
|
| | 8440 | | /// <summary> |
| | 8441 | | /// The value of this header is set to true if the contents of the request are successfully encrypted using the |
| | 8442 | | /// </summary> |
| | 8443 | | public bool IsServerEncrypted { get; internal set; } |
| | 8444 | |
|
| | 8445 | | /// <summary> |
| | 8446 | | /// Key of the permission set for the file. |
| | 8447 | | /// </summary> |
| | 8448 | | public string FilePermissionKey { get; internal set; } |
| | 8449 | |
|
| | 8450 | | /// <summary> |
| | 8451 | | /// Attributes set for the file. |
| | 8452 | | /// </summary> |
| | 8453 | | public string FileAttributes { get; internal set; } |
| | 8454 | |
|
| | 8455 | | /// <summary> |
| | 8456 | | /// Creation time for the file. |
| | 8457 | | /// </summary> |
| | 8458 | | public System.DateTimeOffset FileCreationTime { get; internal set; } |
| | 8459 | |
|
| | 8460 | | /// <summary> |
| | 8461 | | /// Last write time for the file. |
| | 8462 | | /// </summary> |
| | 8463 | | public System.DateTimeOffset FileLastWriteTime { get; internal set; } |
| | 8464 | |
|
| | 8465 | | /// <summary> |
| | 8466 | | /// Change time for the file. |
| | 8467 | | /// </summary> |
| | 8468 | | public System.DateTimeOffset FileChangeTime { get; internal set; } |
| | 8469 | |
|
| | 8470 | | /// <summary> |
| | 8471 | | /// The fileId of the file. |
| | 8472 | | /// </summary> |
| | 8473 | | public string FileId { get; internal set; } |
| | 8474 | |
|
| | 8475 | | /// <summary> |
| | 8476 | | /// The parent fileId of the file. |
| | 8477 | | /// </summary> |
| | 8478 | | public string FileParentId { get; internal set; } |
| | 8479 | |
|
| | 8480 | | /// <summary> |
| | 8481 | | /// Prevent direct instantiation of RawStorageFileInfo instances. |
| | 8482 | | /// You can use ShareModelFactory.RawStorageFileInfo instead. |
| | 8483 | | /// </summary> |
| | 8484 | | internal RawStorageFileInfo() { } |
| | 8485 | | } |
| | 8486 | | } |
| | 8487 | | #endregion class RawStorageFileInfo |
| | 8488 | |
|
| | 8489 | | #region class RawStorageFileProperties |
| | 8490 | | namespace Azure.Storage.Files.Shares.Models |
| | 8491 | | { |
| | 8492 | | /// <summary> |
| | 8493 | | /// RawStorageFileProperties |
| | 8494 | | /// </summary> |
| | 8495 | | internal partial class RawStorageFileProperties |
| | 8496 | | { |
| | 8497 | | /// <summary> |
| | 8498 | | /// Returns the date and time the file was last modified. The date format follows RFC 1123. Any operation that m |
| | 8499 | | /// </summary> |
| | 8500 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 8501 | |
|
| | 8502 | | /// <summary> |
| | 8503 | | /// A set of name-value pairs associated with this file as user-defined metadata. |
| | 8504 | | /// </summary> |
| | 8505 | | public System.Collections.Generic.IDictionary<string, string> Metadata { get; internal set; } |
| | 8506 | |
|
| | 8507 | | /// <summary> |
| | 8508 | | /// The size of the file in bytes. This header returns the value of the 'x-ms-content-length' header that is sto |
| | 8509 | | /// </summary> |
| | 8510 | | public long ContentLength { get; internal set; } |
| | 8511 | |
|
| | 8512 | | /// <summary> |
| | 8513 | | /// The content type specified for the file. The default content type is 'application/octet-stream' |
| | 8514 | | /// </summary> |
| | 8515 | | public string ContentType { get; internal set; } |
| | 8516 | |
|
| | 8517 | | /// <summary> |
| | 8518 | | /// The ETag contains a value that you can use to perform operations conditionally, in quotes. |
| | 8519 | | /// </summary> |
| | 8520 | | public Azure.ETag ETag { get; internal set; } |
| | 8521 | |
|
| | 8522 | | /// <summary> |
| | 8523 | | /// If the Content-MD5 header has been set for the file, the Content-MD5 response header is returned so that the |
| | 8524 | | /// </summary> |
| | 8525 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 8526 | | public byte[] ContentHash { get; internal set; } |
| | 8527 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 8528 | |
|
| | 8529 | | /// <summary> |
| | 8530 | | /// If the Content-Encoding request header has previously been set for the file, the Content-Encoding value is r |
| | 8531 | | /// </summary> |
| | 8532 | | public System.Collections.Generic.IEnumerable<string> ContentEncoding { get; internal set; } |
| | 8533 | |
|
| | 8534 | | /// <summary> |
| | 8535 | | /// If the Cache-Control request header has previously been set for the file, the Cache-Control value is returne |
| | 8536 | | /// </summary> |
| | 8537 | | public string CacheControl { get; internal set; } |
| | 8538 | |
|
| | 8539 | | /// <summary> |
| | 8540 | | /// Returns the value that was specified for the 'x-ms-content-disposition' header and specifies how to process |
| | 8541 | | /// </summary> |
| | 8542 | | public string ContentDisposition { get; internal set; } |
| | 8543 | |
|
| | 8544 | | /// <summary> |
| | 8545 | | /// Returns the value that was specified for the Content-Language request header. |
| | 8546 | | /// </summary> |
| | 8547 | | public System.Collections.Generic.IEnumerable<string> ContentLanguage { get; internal set; } |
| | 8548 | |
|
| | 8549 | | /// <summary> |
| | 8550 | | /// Conclusion time of the last attempted Copy File operation where this file was the destination file. This val |
| | 8551 | | /// </summary> |
| | 8552 | | public System.DateTimeOffset CopyCompletionTime { get; internal set; } |
| | 8553 | |
|
| | 8554 | | /// <summary> |
| | 8555 | | /// Only appears when x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operatio |
| | 8556 | | /// </summary> |
| | 8557 | | public string CopyStatusDescription { get; internal set; } |
| | 8558 | |
|
| | 8559 | | /// <summary> |
| | 8560 | | /// String identifier for the last attempted Copy File operation where this file was the destination file. |
| | 8561 | | /// </summary> |
| | 8562 | | public string CopyId { get; internal set; } |
| | 8563 | |
|
| | 8564 | | /// <summary> |
| | 8565 | | /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy File operat |
| | 8566 | | /// </summary> |
| | 8567 | | public string CopyProgress { get; internal set; } |
| | 8568 | |
|
| | 8569 | | /// <summary> |
| | 8570 | | /// URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where |
| | 8571 | | /// </summary> |
| | 8572 | | public string CopySource { get; internal set; } |
| | 8573 | |
|
| | 8574 | | /// <summary> |
| | 8575 | | /// State of the copy operation identified by 'x-ms-copy-id'. |
| | 8576 | | /// </summary> |
| | 8577 | | public Azure.Storage.Files.Shares.Models.CopyStatus CopyStatus { get; internal set; } |
| | 8578 | |
|
| | 8579 | | /// <summary> |
| | 8580 | | /// The value of this header is set to true if the file data and application metadata are completely encrypted u |
| | 8581 | | /// </summary> |
| | 8582 | | public bool IsServerEncrypted { get; internal set; } |
| | 8583 | |
|
| | 8584 | | /// <summary> |
| | 8585 | | /// Attributes set for the file. |
| | 8586 | | /// </summary> |
| | 8587 | | public string FileAttributes { get; internal set; } |
| | 8588 | |
|
| | 8589 | | /// <summary> |
| | 8590 | | /// Creation time for the file. |
| | 8591 | | /// </summary> |
| | 8592 | | public System.DateTimeOffset FileCreationTime { get; internal set; } |
| | 8593 | |
|
| | 8594 | | /// <summary> |
| | 8595 | | /// Last write time for the file. |
| | 8596 | | /// </summary> |
| | 8597 | | public System.DateTimeOffset FileLastWriteTime { get; internal set; } |
| | 8598 | |
|
| | 8599 | | /// <summary> |
| | 8600 | | /// Change time for the file. |
| | 8601 | | /// </summary> |
| | 8602 | | public System.DateTimeOffset FileChangeTime { get; internal set; } |
| | 8603 | |
|
| | 8604 | | /// <summary> |
| | 8605 | | /// Key of the permission set for the file. |
| | 8606 | | /// </summary> |
| | 8607 | | public string FilePermissionKey { get; internal set; } |
| | 8608 | |
|
| | 8609 | | /// <summary> |
| | 8610 | | /// The fileId of the file. |
| | 8611 | | /// </summary> |
| | 8612 | | public string FileId { get; internal set; } |
| | 8613 | |
|
| | 8614 | | /// <summary> |
| | 8615 | | /// The parent fileId of the file. |
| | 8616 | | /// </summary> |
| | 8617 | | public string FileParentId { get; internal set; } |
| | 8618 | |
|
| | 8619 | | /// <summary> |
| | 8620 | | /// When a file is leased, specifies whether the lease is of infinite or fixed duration. |
| | 8621 | | /// </summary> |
| | 8622 | | public Azure.Storage.Files.Shares.Models.ShareLeaseDuration LeaseDuration { get; internal set; } |
| | 8623 | |
|
| | 8624 | | /// <summary> |
| | 8625 | | /// Lease state of the file. |
| | 8626 | | /// </summary> |
| | 8627 | | public Azure.Storage.Files.Shares.Models.ShareLeaseState LeaseState { get; internal set; } |
| | 8628 | |
|
| | 8629 | | /// <summary> |
| | 8630 | | /// The current lease status of the file. |
| | 8631 | | /// </summary> |
| | 8632 | | public Azure.Storage.Files.Shares.Models.ShareLeaseStatus LeaseStatus { get; internal set; } |
| | 8633 | |
|
| | 8634 | | /// <summary> |
| | 8635 | | /// Creates a new RawStorageFileProperties instance |
| | 8636 | | /// </summary> |
| | 8637 | | public RawStorageFileProperties() |
| | 8638 | | { |
| | 8639 | | Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgnoreCase |
| | 8640 | | ContentEncoding = new System.Collections.Generic.List<string>(); |
| | 8641 | | ContentLanguage = new System.Collections.Generic.List<string>(); |
| | 8642 | | } |
| | 8643 | | } |
| | 8644 | | } |
| | 8645 | | #endregion class RawStorageFileProperties |
| | 8646 | |
|
| | 8647 | | #region class ShareAccessPolicy |
| | 8648 | | namespace Azure.Storage.Files.Shares.Models |
| | 8649 | | { |
| | 8650 | | /// <summary> |
| | 8651 | | /// An Access policy. |
| | 8652 | | /// </summary> |
| | 8653 | | public partial class ShareAccessPolicy |
| | 8654 | | { |
| | 8655 | | /// <summary> |
| | 8656 | | /// The date-time the policy is active. |
| | 8657 | | /// </summary> |
| | 8658 | | public System.DateTimeOffset? PolicyStartsOn { get; set; } |
| | 8659 | |
|
| | 8660 | | /// <summary> |
| | 8661 | | /// The date-time the policy expires. |
| | 8662 | | /// </summary> |
| | 8663 | | public System.DateTimeOffset? PolicyExpiresOn { get; set; } |
| | 8664 | |
|
| | 8665 | | /// <summary> |
| | 8666 | | /// The permissions for the ACL policy. |
| | 8667 | | /// </summary> |
| | 8668 | | public string Permissions { get; set; } |
| | 8669 | |
|
| | 8670 | | /// <summary> |
| | 8671 | | /// Creates a new ShareAccessPolicy instance |
| | 8672 | | /// </summary> |
| | 8673 | | public ShareAccessPolicy() { } |
| | 8674 | |
|
| | 8675 | | /// <summary> |
| | 8676 | | /// Serialize a ShareAccessPolicy instance as XML. |
| | 8677 | | /// </summary> |
| | 8678 | | /// <param name="value">The ShareAccessPolicy instance to serialize.</param> |
| | 8679 | | /// <param name="name">An optional name to use for the root element instead of "AccessPolicy".</param> |
| | 8680 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 8681 | | /// <returns>The serialized XML element.</returns> |
| | 8682 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Files.Shares.Models.ShareAccessPolicy value, string |
| | 8683 | | { |
| | 8684 | | System.Diagnostics.Debug.Assert(value != null); |
| | 8685 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 8686 | | if (value.PolicyStartsOn != null) |
| | 8687 | | { |
| | 8688 | | _element.Add(new System.Xml.Linq.XElement( |
| | 8689 | | System.Xml.Linq.XName.Get("Start", ""), |
| | 8690 | | value.PolicyStartsOn.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffZ", System.Globalization.C |
| | 8691 | | } |
| | 8692 | | if (value.PolicyExpiresOn != null) |
| | 8693 | | { |
| | 8694 | | _element.Add(new System.Xml.Linq.XElement( |
| | 8695 | | System.Xml.Linq.XName.Get("Expiry", ""), |
| | 8696 | | value.PolicyExpiresOn.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffZ", System.Globalization. |
| | 8697 | | } |
| | 8698 | | if (value.Permissions != null) |
| | 8699 | | { |
| | 8700 | | _element.Add(new System.Xml.Linq.XElement( |
| | 8701 | | System.Xml.Linq.XName.Get("Permission", ""), |
| | 8702 | | value.Permissions)); |
| | 8703 | | } |
| | 8704 | | return _element; |
| | 8705 | | } |
| | 8706 | |
|
| | 8707 | | /// <summary> |
| | 8708 | | /// Deserializes XML into a new ShareAccessPolicy instance. |
| | 8709 | | /// </summary> |
| | 8710 | | /// <param name="element">The XML element to deserialize.</param> |
| | 8711 | | /// <returns>A deserialized ShareAccessPolicy instance.</returns> |
| | 8712 | | internal static Azure.Storage.Files.Shares.Models.ShareAccessPolicy FromXml(System.Xml.Linq.XElement element) |
| | 8713 | | { |
| | 8714 | | System.Diagnostics.Debug.Assert(element != null); |
| | 8715 | | System.Xml.Linq.XElement _child; |
| | 8716 | | Azure.Storage.Files.Shares.Models.ShareAccessPolicy _value = new Azure.Storage.Files.Shares.Models.ShareAcce |
| | 8717 | | _child = element.Element(System.Xml.Linq.XName.Get("Start", "")); |
| | 8718 | | if (_child != null) |
| | 8719 | | { |
| | 8720 | | _value.PolicyStartsOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.Invar |
| | 8721 | | } |
| | 8722 | | _child = element.Element(System.Xml.Linq.XName.Get("Expiry", "")); |
| | 8723 | | if (_child != null) |
| | 8724 | | { |
| | 8725 | | _value.PolicyExpiresOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.Inva |
| | 8726 | | } |
| | 8727 | | _child = element.Element(System.Xml.Linq.XName.Get("Permission", "")); |
| | 8728 | | if (_child != null) |
| | 8729 | | { |
| | 8730 | | _value.Permissions = _child.Value; |
| | 8731 | | } |
| | 8732 | | CustomizeFromXml(element, _value); |
| | 8733 | | return _value; |
| | 8734 | | } |
| | 8735 | |
|
| | 8736 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.ShareAc |
| | 8737 | | } |
| | 8738 | | } |
| | 8739 | | #endregion class ShareAccessPolicy |
| | 8740 | |
|
| | 8741 | | #region class ShareCorsRule |
| | 8742 | | namespace Azure.Storage.Files.Shares.Models |
| | 8743 | | { |
| | 8744 | | /// <summary> |
| | 8745 | | /// CORS is an HTTP feature that enables a web application running under one domain to access resources in another d |
| | 8746 | | /// </summary> |
| | 8747 | | public partial class ShareCorsRule |
| | 8748 | | { |
| | 8749 | | /// <summary> |
| | 8750 | | /// The origin domains that are permitted to make a request against the storage service via CORS. The origin dom |
| | 8751 | | /// </summary> |
| | 8752 | | public string AllowedOrigins { get; set; } |
| | 8753 | |
|
| | 8754 | | /// <summary> |
| | 8755 | | /// The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated) |
| | 8756 | | /// </summary> |
| | 8757 | | public string AllowedMethods { get; set; } |
| | 8758 | |
|
| | 8759 | | /// <summary> |
| | 8760 | | /// The request headers that the origin domain may specify on the CORS request. |
| | 8761 | | /// </summary> |
| | 8762 | | public string AllowedHeaders { get; set; } |
| | 8763 | |
|
| | 8764 | | /// <summary> |
| | 8765 | | /// The response headers that may be sent in the response to the CORS request and exposed by the browser to the |
| | 8766 | | /// </summary> |
| | 8767 | | public string ExposedHeaders { get; set; } |
| | 8768 | |
|
| | 8769 | | /// <summary> |
| | 8770 | | /// The maximum amount time that a browser should cache the preflight OPTIONS request. |
| | 8771 | | /// </summary> |
| | 8772 | | public int MaxAgeInSeconds { get; set; } |
| | 8773 | |
|
| | 8774 | | /// <summary> |
| | 8775 | | /// Creates a new ShareCorsRule instance |
| | 8776 | | /// </summary> |
| | 8777 | | public ShareCorsRule() { } |
| | 8778 | |
|
| | 8779 | | /// <summary> |
| | 8780 | | /// Serialize a ShareCorsRule instance as XML. |
| | 8781 | | /// </summary> |
| | 8782 | | /// <param name="value">The ShareCorsRule instance to serialize.</param> |
| | 8783 | | /// <param name="name">An optional name to use for the root element instead of "CorsRule".</param> |
| | 8784 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 8785 | | /// <returns>The serialized XML element.</returns> |
| | 8786 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Files.Shares.Models.ShareCorsRule value, string nam |
| | 8787 | | { |
| | 8788 | | System.Diagnostics.Debug.Assert(value != null); |
| | 8789 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 8790 | | _element.Add(new System.Xml.Linq.XElement( |
| | 8791 | | System.Xml.Linq.XName.Get("AllowedOrigins", ""), |
| | 8792 | | value.AllowedOrigins)); |
| | 8793 | | _element.Add(new System.Xml.Linq.XElement( |
| | 8794 | | System.Xml.Linq.XName.Get("AllowedMethods", ""), |
| | 8795 | | value.AllowedMethods)); |
| | 8796 | | _element.Add(new System.Xml.Linq.XElement( |
| | 8797 | | System.Xml.Linq.XName.Get("AllowedHeaders", ""), |
| | 8798 | | value.AllowedHeaders)); |
| | 8799 | | _element.Add(new System.Xml.Linq.XElement( |
| | 8800 | | System.Xml.Linq.XName.Get("ExposedHeaders", ""), |
| | 8801 | | value.ExposedHeaders)); |
| | 8802 | | _element.Add(new System.Xml.Linq.XElement( |
| | 8803 | | System.Xml.Linq.XName.Get("MaxAgeInSeconds", ""), |
| | 8804 | | value.MaxAgeInSeconds.ToString(System.Globalization.CultureInfo.InvariantCulture))); |
| | 8805 | | return _element; |
| | 8806 | | } |
| | 8807 | |
|
| | 8808 | | /// <summary> |
| | 8809 | | /// Deserializes XML into a new ShareCorsRule instance. |
| | 8810 | | /// </summary> |
| | 8811 | | /// <param name="element">The XML element to deserialize.</param> |
| | 8812 | | /// <returns>A deserialized ShareCorsRule instance.</returns> |
| | 8813 | | internal static Azure.Storage.Files.Shares.Models.ShareCorsRule FromXml(System.Xml.Linq.XElement element) |
| | 8814 | | { |
| | 8815 | | System.Diagnostics.Debug.Assert(element != null); |
| | 8816 | | System.Xml.Linq.XElement _child; |
| | 8817 | | Azure.Storage.Files.Shares.Models.ShareCorsRule _value = new Azure.Storage.Files.Shares.Models.ShareCorsRule |
| | 8818 | | _child = element.Element(System.Xml.Linq.XName.Get("AllowedOrigins", "")); |
| | 8819 | | if (_child != null) |
| | 8820 | | { |
| | 8821 | | _value.AllowedOrigins = _child.Value; |
| | 8822 | | } |
| | 8823 | | _child = element.Element(System.Xml.Linq.XName.Get("AllowedMethods", "")); |
| | 8824 | | if (_child != null) |
| | 8825 | | { |
| | 8826 | | _value.AllowedMethods = _child.Value; |
| | 8827 | | } |
| | 8828 | | _child = element.Element(System.Xml.Linq.XName.Get("AllowedHeaders", "")); |
| | 8829 | | if (_child != null) |
| | 8830 | | { |
| | 8831 | | _value.AllowedHeaders = _child.Value; |
| | 8832 | | } |
| | 8833 | | _child = element.Element(System.Xml.Linq.XName.Get("ExposedHeaders", "")); |
| | 8834 | | if (_child != null) |
| | 8835 | | { |
| | 8836 | | _value.ExposedHeaders = _child.Value; |
| | 8837 | | } |
| | 8838 | | _child = element.Element(System.Xml.Linq.XName.Get("MaxAgeInSeconds", "")); |
| | 8839 | | if (_child != null) |
| | 8840 | | { |
| | 8841 | | _value.MaxAgeInSeconds = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 8842 | | } |
| | 8843 | | CustomizeFromXml(element, _value); |
| | 8844 | | return _value; |
| | 8845 | | } |
| | 8846 | |
|
| | 8847 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.ShareCo |
| | 8848 | | } |
| | 8849 | | } |
| | 8850 | | #endregion class ShareCorsRule |
| | 8851 | |
|
| | 8852 | | #region enum strings ShareErrorCode |
| | 8853 | | namespace Azure.Storage.Files.Shares.Models |
| | 8854 | | { |
| | 8855 | | /// <summary> |
| | 8856 | | /// Error codes returned by the service |
| | 8857 | | /// </summary> |
| | 8858 | | public readonly struct ShareErrorCode : System.IEquatable<ShareErrorCode> |
| | 8859 | | { |
| | 8860 | | /// <summary> |
| | 8861 | | /// The ShareErrorCode value. |
| | 8862 | | /// </summary> |
| | 8863 | | private readonly string _value; |
| | 8864 | |
|
| | 8865 | | /// <summary> |
| | 8866 | | /// Initializes a new instance of the <see cref="ShareErrorCode"/> structure. |
| | 8867 | | /// </summary> |
| | 8868 | | /// <param name="value">The string value of the instance.</param> |
| | 8869 | | public ShareErrorCode(string value) { _value = value ?? throw new System.ArgumentNullException(nameof(value)); } |
| | 8870 | |
|
| | 8871 | | /// <summary> |
| | 8872 | | /// AccountAlreadyExists |
| | 8873 | | /// </summary> |
| | 8874 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode AccountAlreadyExists { get; } = new ShareErrorCod |
| | 8875 | |
|
| | 8876 | | /// <summary> |
| | 8877 | | /// AccountBeingCreated |
| | 8878 | | /// </summary> |
| | 8879 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode AccountBeingCreated { get; } = new ShareErrorCode |
| | 8880 | |
|
| | 8881 | | /// <summary> |
| | 8882 | | /// AccountIsDisabled |
| | 8883 | | /// </summary> |
| | 8884 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode AccountIsDisabled { get; } = new ShareErrorCode(@ |
| | 8885 | |
|
| | 8886 | | /// <summary> |
| | 8887 | | /// AuthenticationFailed |
| | 8888 | | /// </summary> |
| | 8889 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode AuthenticationFailed { get; } = new ShareErrorCod |
| | 8890 | |
|
| | 8891 | | /// <summary> |
| | 8892 | | /// AuthorizationFailure |
| | 8893 | | /// </summary> |
| | 8894 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode AuthorizationFailure { get; } = new ShareErrorCod |
| | 8895 | |
|
| | 8896 | | /// <summary> |
| | 8897 | | /// ConditionHeadersNotSupported |
| | 8898 | | /// </summary> |
| | 8899 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ConditionHeadersNotSupported { get; } = new Share |
| | 8900 | |
|
| | 8901 | | /// <summary> |
| | 8902 | | /// ConditionNotMet |
| | 8903 | | /// </summary> |
| | 8904 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ConditionNotMet { get; } = new ShareErrorCode(@"C |
| | 8905 | |
|
| | 8906 | | /// <summary> |
| | 8907 | | /// EmptyMetadataKey |
| | 8908 | | /// </summary> |
| | 8909 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode EmptyMetadataKey { get; } = new ShareErrorCode(@" |
| | 8910 | |
|
| | 8911 | | /// <summary> |
| | 8912 | | /// InsufficientAccountPermissions |
| | 8913 | | /// </summary> |
| | 8914 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InsufficientAccountPermissions { get; } = new Sha |
| | 8915 | |
|
| | 8916 | | /// <summary> |
| | 8917 | | /// InternalError |
| | 8918 | | /// </summary> |
| | 8919 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InternalError { get; } = new ShareErrorCode(@"Int |
| | 8920 | |
|
| | 8921 | | /// <summary> |
| | 8922 | | /// InvalidAuthenticationInfo |
| | 8923 | | /// </summary> |
| | 8924 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidAuthenticationInfo { get; } = new ShareErr |
| | 8925 | |
|
| | 8926 | | /// <summary> |
| | 8927 | | /// InvalidHeaderValue |
| | 8928 | | /// </summary> |
| | 8929 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidHeaderValue { get; } = new ShareErrorCode( |
| | 8930 | |
|
| | 8931 | | /// <summary> |
| | 8932 | | /// InvalidHttpVerb |
| | 8933 | | /// </summary> |
| | 8934 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidHttpVerb { get; } = new ShareErrorCode(@"I |
| | 8935 | |
|
| | 8936 | | /// <summary> |
| | 8937 | | /// InvalidInput |
| | 8938 | | /// </summary> |
| | 8939 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidInput { get; } = new ShareErrorCode(@"Inva |
| | 8940 | |
|
| | 8941 | | /// <summary> |
| | 8942 | | /// InvalidMd5 |
| | 8943 | | /// </summary> |
| | 8944 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidMd5 { get; } = new ShareErrorCode(@"Invali |
| | 8945 | |
|
| | 8946 | | /// <summary> |
| | 8947 | | /// InvalidMetadata |
| | 8948 | | /// </summary> |
| | 8949 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidMetadata { get; } = new ShareErrorCode(@"I |
| | 8950 | |
|
| | 8951 | | /// <summary> |
| | 8952 | | /// InvalidQueryParameterValue |
| | 8953 | | /// </summary> |
| | 8954 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidQueryParameterValue { get; } = new ShareEr |
| | 8955 | |
|
| | 8956 | | /// <summary> |
| | 8957 | | /// InvalidRange |
| | 8958 | | /// </summary> |
| | 8959 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidRange { get; } = new ShareErrorCode(@"Inva |
| | 8960 | |
|
| | 8961 | | /// <summary> |
| | 8962 | | /// InvalidResourceName |
| | 8963 | | /// </summary> |
| | 8964 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidResourceName { get; } = new ShareErrorCode |
| | 8965 | |
|
| | 8966 | | /// <summary> |
| | 8967 | | /// InvalidUri |
| | 8968 | | /// </summary> |
| | 8969 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidUri { get; } = new ShareErrorCode(@"Invali |
| | 8970 | |
|
| | 8971 | | /// <summary> |
| | 8972 | | /// InvalidXmlDocument |
| | 8973 | | /// </summary> |
| | 8974 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidXmlDocument { get; } = new ShareErrorCode( |
| | 8975 | |
|
| | 8976 | | /// <summary> |
| | 8977 | | /// InvalidXmlNodeValue |
| | 8978 | | /// </summary> |
| | 8979 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidXmlNodeValue { get; } = new ShareErrorCode |
| | 8980 | |
|
| | 8981 | | /// <summary> |
| | 8982 | | /// Md5Mismatch |
| | 8983 | | /// </summary> |
| | 8984 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode Md5Mismatch { get; } = new ShareErrorCode(@"Md5Mi |
| | 8985 | |
|
| | 8986 | | /// <summary> |
| | 8987 | | /// MetadataTooLarge |
| | 8988 | | /// </summary> |
| | 8989 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode MetadataTooLarge { get; } = new ShareErrorCode(@" |
| | 8990 | |
|
| | 8991 | | /// <summary> |
| | 8992 | | /// MissingContentLengthHeader |
| | 8993 | | /// </summary> |
| | 8994 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode MissingContentLengthHeader { get; } = new ShareEr |
| | 8995 | |
|
| | 8996 | | /// <summary> |
| | 8997 | | /// MissingRequiredQueryParameter |
| | 8998 | | /// </summary> |
| | 8999 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode MissingRequiredQueryParameter { get; } = new Shar |
| | 9000 | |
|
| | 9001 | | /// <summary> |
| | 9002 | | /// MissingRequiredHeader |
| | 9003 | | /// </summary> |
| | 9004 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode MissingRequiredHeader { get; } = new ShareErrorCo |
| | 9005 | |
|
| | 9006 | | /// <summary> |
| | 9007 | | /// MissingRequiredXmlNode |
| | 9008 | | /// </summary> |
| | 9009 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode MissingRequiredXmlNode { get; } = new ShareErrorC |
| | 9010 | |
|
| | 9011 | | /// <summary> |
| | 9012 | | /// MultipleConditionHeadersNotSupported |
| | 9013 | | /// </summary> |
| | 9014 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode MultipleConditionHeadersNotSupported { get; } = n |
| | 9015 | |
|
| | 9016 | | /// <summary> |
| | 9017 | | /// OperationTimedOut |
| | 9018 | | /// </summary> |
| | 9019 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode OperationTimedOut { get; } = new ShareErrorCode(@ |
| | 9020 | |
|
| | 9021 | | /// <summary> |
| | 9022 | | /// OutOfRangeInput |
| | 9023 | | /// </summary> |
| | 9024 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode OutOfRangeInput { get; } = new ShareErrorCode(@"O |
| | 9025 | |
|
| | 9026 | | /// <summary> |
| | 9027 | | /// OutOfRangeQueryParameterValue |
| | 9028 | | /// </summary> |
| | 9029 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode OutOfRangeQueryParameterValue { get; } = new Shar |
| | 9030 | |
|
| | 9031 | | /// <summary> |
| | 9032 | | /// RequestBodyTooLarge |
| | 9033 | | /// </summary> |
| | 9034 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode RequestBodyTooLarge { get; } = new ShareErrorCode |
| | 9035 | |
|
| | 9036 | | /// <summary> |
| | 9037 | | /// ResourceTypeMismatch |
| | 9038 | | /// </summary> |
| | 9039 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ResourceTypeMismatch { get; } = new ShareErrorCod |
| | 9040 | |
|
| | 9041 | | /// <summary> |
| | 9042 | | /// RequestUrlFailedToParse |
| | 9043 | | /// </summary> |
| | 9044 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode RequestUrlFailedToParse { get; } = new ShareError |
| | 9045 | |
|
| | 9046 | | /// <summary> |
| | 9047 | | /// ResourceAlreadyExists |
| | 9048 | | /// </summary> |
| | 9049 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ResourceAlreadyExists { get; } = new ShareErrorCo |
| | 9050 | |
|
| | 9051 | | /// <summary> |
| | 9052 | | /// ResourceNotFound |
| | 9053 | | /// </summary> |
| | 9054 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ResourceNotFound { get; } = new ShareErrorCode(@" |
| | 9055 | |
|
| | 9056 | | /// <summary> |
| | 9057 | | /// ServerBusy |
| | 9058 | | /// </summary> |
| | 9059 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ServerBusy { get; } = new ShareErrorCode(@"Server |
| | 9060 | |
|
| | 9061 | | /// <summary> |
| | 9062 | | /// UnsupportedHeader |
| | 9063 | | /// </summary> |
| | 9064 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode UnsupportedHeader { get; } = new ShareErrorCode(@ |
| | 9065 | |
|
| | 9066 | | /// <summary> |
| | 9067 | | /// UnsupportedXmlNode |
| | 9068 | | /// </summary> |
| | 9069 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode UnsupportedXmlNode { get; } = new ShareErrorCode( |
| | 9070 | |
|
| | 9071 | | /// <summary> |
| | 9072 | | /// UnsupportedQueryParameter |
| | 9073 | | /// </summary> |
| | 9074 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode UnsupportedQueryParameter { get; } = new ShareErr |
| | 9075 | |
|
| | 9076 | | /// <summary> |
| | 9077 | | /// UnsupportedHttpVerb |
| | 9078 | | /// </summary> |
| | 9079 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode UnsupportedHttpVerb { get; } = new ShareErrorCode |
| | 9080 | |
|
| | 9081 | | /// <summary> |
| | 9082 | | /// CannotDeleteFileOrDirectory |
| | 9083 | | /// </summary> |
| | 9084 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode CannotDeleteFileOrDirectory { get; } = new ShareE |
| | 9085 | |
|
| | 9086 | | /// <summary> |
| | 9087 | | /// ClientCacheFlushDelay |
| | 9088 | | /// </summary> |
| | 9089 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ClientCacheFlushDelay { get; } = new ShareErrorCo |
| | 9090 | |
|
| | 9091 | | /// <summary> |
| | 9092 | | /// DeletePending |
| | 9093 | | /// </summary> |
| | 9094 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode DeletePending { get; } = new ShareErrorCode(@"Del |
| | 9095 | |
|
| | 9096 | | /// <summary> |
| | 9097 | | /// DirectoryNotEmpty |
| | 9098 | | /// </summary> |
| | 9099 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode DirectoryNotEmpty { get; } = new ShareErrorCode(@ |
| | 9100 | |
|
| | 9101 | | /// <summary> |
| | 9102 | | /// FileLockConflict |
| | 9103 | | /// </summary> |
| | 9104 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode FileLockConflict { get; } = new ShareErrorCode(@" |
| | 9105 | |
|
| | 9106 | | /// <summary> |
| | 9107 | | /// InvalidFileOrDirectoryPathName |
| | 9108 | | /// </summary> |
| | 9109 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode InvalidFileOrDirectoryPathName { get; } = new Sha |
| | 9110 | |
|
| | 9111 | | /// <summary> |
| | 9112 | | /// ParentNotFound |
| | 9113 | | /// </summary> |
| | 9114 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ParentNotFound { get; } = new ShareErrorCode(@"Pa |
| | 9115 | |
|
| | 9116 | | /// <summary> |
| | 9117 | | /// ReadOnlyAttribute |
| | 9118 | | /// </summary> |
| | 9119 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ReadOnlyAttribute { get; } = new ShareErrorCode(@ |
| | 9120 | |
|
| | 9121 | | /// <summary> |
| | 9122 | | /// ShareAlreadyExists |
| | 9123 | | /// </summary> |
| | 9124 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ShareAlreadyExists { get; } = new ShareErrorCode( |
| | 9125 | |
|
| | 9126 | | /// <summary> |
| | 9127 | | /// ShareBeingDeleted |
| | 9128 | | /// </summary> |
| | 9129 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ShareBeingDeleted { get; } = new ShareErrorCode(@ |
| | 9130 | |
|
| | 9131 | | /// <summary> |
| | 9132 | | /// ShareDisabled |
| | 9133 | | /// </summary> |
| | 9134 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ShareDisabled { get; } = new ShareErrorCode(@"Sha |
| | 9135 | |
|
| | 9136 | | /// <summary> |
| | 9137 | | /// ShareNotFound |
| | 9138 | | /// </summary> |
| | 9139 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ShareNotFound { get; } = new ShareErrorCode(@"Sha |
| | 9140 | |
|
| | 9141 | | /// <summary> |
| | 9142 | | /// SharingViolation |
| | 9143 | | /// </summary> |
| | 9144 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode SharingViolation { get; } = new ShareErrorCode(@" |
| | 9145 | |
|
| | 9146 | | /// <summary> |
| | 9147 | | /// ShareSnapshotInProgress |
| | 9148 | | /// </summary> |
| | 9149 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ShareSnapshotInProgress { get; } = new ShareError |
| | 9150 | |
|
| | 9151 | | /// <summary> |
| | 9152 | | /// ShareSnapshotCountExceeded |
| | 9153 | | /// </summary> |
| | 9154 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ShareSnapshotCountExceeded { get; } = new ShareEr |
| | 9155 | |
|
| | 9156 | | /// <summary> |
| | 9157 | | /// ShareSnapshotOperationNotSupported |
| | 9158 | | /// </summary> |
| | 9159 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ShareSnapshotOperationNotSupported { get; } = new |
| | 9160 | |
|
| | 9161 | | /// <summary> |
| | 9162 | | /// ShareHasSnapshots |
| | 9163 | | /// </summary> |
| | 9164 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ShareHasSnapshots { get; } = new ShareErrorCode(@ |
| | 9165 | |
|
| | 9166 | | /// <summary> |
| | 9167 | | /// ContainerQuotaDowngradeNotAllowed |
| | 9168 | | /// </summary> |
| | 9169 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode ContainerQuotaDowngradeNotAllowed { get; } = new |
| | 9170 | |
|
| | 9171 | | /// <summary> |
| | 9172 | | /// AuthorizationSourceIPMismatch |
| | 9173 | | /// </summary> |
| | 9174 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode AuthorizationSourceIPMismatch { get; } = new Shar |
| | 9175 | |
|
| | 9176 | | /// <summary> |
| | 9177 | | /// AuthorizationProtocolMismatch |
| | 9178 | | /// </summary> |
| | 9179 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode AuthorizationProtocolMismatch { get; } = new Shar |
| | 9180 | |
|
| | 9181 | | /// <summary> |
| | 9182 | | /// AuthorizationPermissionMismatch |
| | 9183 | | /// </summary> |
| | 9184 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode AuthorizationPermissionMismatch { get; } = new Sh |
| | 9185 | |
|
| | 9186 | | /// <summary> |
| | 9187 | | /// AuthorizationServiceMismatch |
| | 9188 | | /// </summary> |
| | 9189 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode AuthorizationServiceMismatch { get; } = new Share |
| | 9190 | |
|
| | 9191 | | /// <summary> |
| | 9192 | | /// AuthorizationResourceTypeMismatch |
| | 9193 | | /// </summary> |
| | 9194 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode AuthorizationResourceTypeMismatch { get; } = new |
| | 9195 | |
|
| | 9196 | | /// <summary> |
| | 9197 | | /// FeatureVersionMismatch |
| | 9198 | | /// </summary> |
| | 9199 | | public static Azure.Storage.Files.Shares.Models.ShareErrorCode FeatureVersionMismatch { get; } = new ShareErrorC |
| | 9200 | |
|
| | 9201 | | /// <summary> |
| | 9202 | | /// Determines if two <see cref="ShareErrorCode"/> values are the same. |
| | 9203 | | /// </summary> |
| | 9204 | | /// <param name="left">The first <see cref="ShareErrorCode"/> to compare.</param> |
| | 9205 | | /// <param name="right">The second <see cref="ShareErrorCode"/> to compare.</param> |
| | 9206 | | /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are the same; otherwise, false.</retur |
| | 9207 | | public static bool operator ==(Azure.Storage.Files.Shares.Models.ShareErrorCode left, Azure.Storage.Files.Shares |
| | 9208 | |
|
| | 9209 | | /// <summary> |
| | 9210 | | /// Determines if two <see cref="ShareErrorCode"/> values are different. |
| | 9211 | | /// </summary> |
| | 9212 | | /// <param name="left">The first <see cref="ShareErrorCode"/> to compare.</param> |
| | 9213 | | /// <param name="right">The second <see cref="ShareErrorCode"/> to compare.</param> |
| | 9214 | | /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are different; otherwise, false.</retu |
| | 9215 | | public static bool operator !=(Azure.Storage.Files.Shares.Models.ShareErrorCode left, Azure.Storage.Files.Shares |
| | 9216 | |
|
| | 9217 | | /// <summary> |
| | 9218 | | /// Converts a string to a <see cref="ShareErrorCode"/>. |
| | 9219 | | /// </summary> |
| | 9220 | | /// <param name="value">The string value to convert.</param> |
| | 9221 | | /// <returns>The ShareErrorCode value.</returns> |
| | 9222 | | public static implicit operator ShareErrorCode(string value) => new Azure.Storage.Files.Shares.Models.ShareError |
| | 9223 | |
|
| | 9224 | | /// <summary> |
| | 9225 | | /// Check if two <see cref="ShareErrorCode"/> instances are equal. |
| | 9226 | | /// </summary> |
| | 9227 | | /// <param name="obj">The instance to compare to.</param> |
| | 9228 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 9229 | | [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] |
| | 9230 | | public override bool Equals(object obj) => obj is Azure.Storage.Files.Shares.Models.ShareErrorCode other && Equa |
| | 9231 | |
|
| | 9232 | | /// <summary> |
| | 9233 | | /// Check if two <see cref="ShareErrorCode"/> instances are equal. |
| | 9234 | | /// </summary> |
| | 9235 | | /// <param name="other">The instance to compare to.</param> |
| | 9236 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 9237 | | public bool Equals(Azure.Storage.Files.Shares.Models.ShareErrorCode other) => string.Equals(_value, other._value |
| | 9238 | |
|
| | 9239 | | /// <summary> |
| | 9240 | | /// Get a hash code for the <see cref="ShareErrorCode"/>. |
| | 9241 | | /// </summary> |
| | 9242 | | /// <returns>Hash code for the ShareErrorCode.</returns> |
| | 9243 | | [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] |
| | 9244 | | public override int GetHashCode() => _value?.GetHashCode() ?? 0; |
| | 9245 | |
|
| | 9246 | | /// <summary> |
| | 9247 | | /// Convert the <see cref="ShareErrorCode"/> to a string. |
| | 9248 | | /// </summary> |
| | 9249 | | /// <returns>String representation of the ShareErrorCode.</returns> |
| | 9250 | | public override string ToString() => _value; |
| | 9251 | | } |
| | 9252 | | } |
| | 9253 | | #endregion enum strings ShareErrorCode |
| | 9254 | |
|
| | 9255 | | #region class ShareFileCopyInfo |
| | 9256 | | namespace Azure.Storage.Files.Shares.Models |
| | 9257 | | { |
| | 9258 | | /// <summary> |
| | 9259 | | /// ShareFileCopyInfo |
| | 9260 | | /// </summary> |
| | 9261 | | public partial class ShareFileCopyInfo |
| | 9262 | | { |
| | 9263 | | /// <summary> |
| | 9264 | | /// If the copy is completed, contains the ETag of the destination file. If the copy is not complete, contains t |
| | 9265 | | /// </summary> |
| | 9266 | | public Azure.ETag ETag { get; internal set; } |
| | 9267 | |
|
| | 9268 | | /// <summary> |
| | 9269 | | /// Returns the date/time that the copy operation to the destination file completed. |
| | 9270 | | /// </summary> |
| | 9271 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 9272 | |
|
| | 9273 | | /// <summary> |
| | 9274 | | /// String identifier for this copy operation. Use with Get File or Get File Properties to check the status of t |
| | 9275 | | /// </summary> |
| | 9276 | | public string CopyId { get; internal set; } |
| | 9277 | |
|
| | 9278 | | /// <summary> |
| | 9279 | | /// State of the copy operation identified by x-ms-copy-id. |
| | 9280 | | /// </summary> |
| | 9281 | | public Azure.Storage.Files.Shares.Models.CopyStatus CopyStatus { get; internal set; } |
| | 9282 | |
|
| | 9283 | | /// <summary> |
| | 9284 | | /// Prevent direct instantiation of ShareFileCopyInfo instances. |
| | 9285 | | /// You can use ShareModelFactory.ShareFileCopyInfo instead. |
| | 9286 | | /// </summary> |
| | 9287 | | internal ShareFileCopyInfo() { } |
| | 9288 | | } |
| | 9289 | |
|
| | 9290 | | /// <summary> |
| | 9291 | | /// ShareModelFactory provides utilities for mocking. |
| | 9292 | | /// </summary> |
| | 9293 | | public static partial class ShareModelFactory |
| | 9294 | | { |
| | 9295 | | /// <summary> |
| | 9296 | | /// Creates a new ShareFileCopyInfo instance for mocking. |
| | 9297 | | /// </summary> |
| | 9298 | | public static ShareFileCopyInfo ShareFileCopyInfo( |
| | 9299 | | Azure.ETag eTag, |
| | 9300 | | System.DateTimeOffset lastModified, |
| | 9301 | | string copyId, |
| | 9302 | | Azure.Storage.Files.Shares.Models.CopyStatus copyStatus) |
| | 9303 | | { |
| | 9304 | | return new ShareFileCopyInfo() |
| | 9305 | | { |
| | 9306 | | ETag = eTag, |
| | 9307 | | LastModified = lastModified, |
| | 9308 | | CopyId = copyId, |
| | 9309 | | CopyStatus = copyStatus, |
| | 9310 | | }; |
| | 9311 | | } |
| | 9312 | | } |
| | 9313 | | } |
| | 9314 | | #endregion class ShareFileCopyInfo |
| | 9315 | |
|
| | 9316 | | #region class ShareFileHandle |
| | 9317 | | namespace Azure.Storage.Files.Shares.Models |
| | 9318 | | { |
| | 9319 | | /// <summary> |
| | 9320 | | /// A listed Azure Storage handle item. |
| | 9321 | | /// </summary> |
| | 9322 | | public partial class ShareFileHandle |
| | 9323 | | { |
| | 9324 | | /// <summary> |
| | 9325 | | /// XSMB service handle ID |
| | 9326 | | /// </summary> |
| | 9327 | | public string HandleId { get; internal set; } |
| | 9328 | |
|
| | 9329 | | /// <summary> |
| | 9330 | | /// File or directory name including full path starting from share root |
| | 9331 | | /// </summary> |
| | 9332 | | public string Path { get; internal set; } |
| | 9333 | |
|
| | 9334 | | /// <summary> |
| | 9335 | | /// FileId uniquely identifies the file or directory. |
| | 9336 | | /// </summary> |
| | 9337 | | public string FileId { get; internal set; } |
| | 9338 | |
|
| | 9339 | | /// <summary> |
| | 9340 | | /// ParentId uniquely identifies the parent directory of the object. |
| | 9341 | | /// </summary> |
| | 9342 | | public string ParentId { get; internal set; } |
| | 9343 | |
|
| | 9344 | | /// <summary> |
| | 9345 | | /// SMB session ID in context of which the file handle was opened |
| | 9346 | | /// </summary> |
| | 9347 | | public string SessionId { get; internal set; } |
| | 9348 | |
|
| | 9349 | | /// <summary> |
| | 9350 | | /// Client IP that opened the handle |
| | 9351 | | /// </summary> |
| | 9352 | | public string ClientIp { get; internal set; } |
| | 9353 | |
|
| | 9354 | | /// <summary> |
| | 9355 | | /// Time when the session that previously opened the handle has last been reconnected. (UTC) |
| | 9356 | | /// </summary> |
| | 9357 | | public System.DateTimeOffset? OpenedOn { get; internal set; } |
| | 9358 | |
|
| | 9359 | | /// <summary> |
| | 9360 | | /// Time handle was last connected to (UTC) |
| | 9361 | | /// </summary> |
| | 9362 | | public System.DateTimeOffset? LastReconnectedOn { get; internal set; } |
| | 9363 | |
|
| | 9364 | | /// <summary> |
| | 9365 | | /// Prevent direct instantiation of ShareFileHandle instances. |
| | 9366 | | /// You can use ShareModelFactory.ShareFileHandle instead. |
| | 9367 | | /// </summary> |
| | 9368 | | internal ShareFileHandle() { } |
| | 9369 | |
|
| | 9370 | | /// <summary> |
| | 9371 | | /// Deserializes XML into a new ShareFileHandle instance. |
| | 9372 | | /// </summary> |
| | 9373 | | /// <param name="element">The XML element to deserialize.</param> |
| | 9374 | | /// <returns>A deserialized ShareFileHandle instance.</returns> |
| | 9375 | | internal static Azure.Storage.Files.Shares.Models.ShareFileHandle FromXml(System.Xml.Linq.XElement element) |
| | 9376 | | { |
| | 9377 | | System.Diagnostics.Debug.Assert(element != null); |
| | 9378 | | System.Xml.Linq.XElement _child; |
| | 9379 | | Azure.Storage.Files.Shares.Models.ShareFileHandle _value = new Azure.Storage.Files.Shares.Models.ShareFileHa |
| | 9380 | | _child = element.Element(System.Xml.Linq.XName.Get("HandleId", "")); |
| | 9381 | | if (_child != null) |
| | 9382 | | { |
| | 9383 | | _value.HandleId = _child.Value; |
| | 9384 | | } |
| | 9385 | | _child = element.Element(System.Xml.Linq.XName.Get("Path", "")); |
| | 9386 | | if (_child != null) |
| | 9387 | | { |
| | 9388 | | _value.Path = _child.Value; |
| | 9389 | | } |
| | 9390 | | _child = element.Element(System.Xml.Linq.XName.Get("FileId", "")); |
| | 9391 | | if (_child != null) |
| | 9392 | | { |
| | 9393 | | _value.FileId = _child.Value; |
| | 9394 | | } |
| | 9395 | | _child = element.Element(System.Xml.Linq.XName.Get("ParentId", "")); |
| | 9396 | | if (_child != null) |
| | 9397 | | { |
| | 9398 | | _value.ParentId = _child.Value; |
| | 9399 | | } |
| | 9400 | | _child = element.Element(System.Xml.Linq.XName.Get("SessionId", "")); |
| | 9401 | | if (_child != null) |
| | 9402 | | { |
| | 9403 | | _value.SessionId = _child.Value; |
| | 9404 | | } |
| | 9405 | | _child = element.Element(System.Xml.Linq.XName.Get("ClientIp", "")); |
| | 9406 | | if (_child != null) |
| | 9407 | | { |
| | 9408 | | _value.ClientIp = _child.Value; |
| | 9409 | | } |
| | 9410 | | _child = element.Element(System.Xml.Linq.XName.Get("OpenTime", "")); |
| | 9411 | | if (_child != null) |
| | 9412 | | { |
| | 9413 | | _value.OpenedOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCu |
| | 9414 | | } |
| | 9415 | | _child = element.Element(System.Xml.Linq.XName.Get("LastReconnectTime", "")); |
| | 9416 | | if (_child != null) |
| | 9417 | | { |
| | 9418 | | _value.LastReconnectedOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.In |
| | 9419 | | } |
| | 9420 | | CustomizeFromXml(element, _value); |
| | 9421 | | return _value; |
| | 9422 | | } |
| | 9423 | |
|
| | 9424 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.ShareFi |
| | 9425 | | } |
| | 9426 | |
|
| | 9427 | | /// <summary> |
| | 9428 | | /// ShareModelFactory provides utilities for mocking. |
| | 9429 | | /// </summary> |
| | 9430 | | public static partial class ShareModelFactory |
| | 9431 | | { |
| | 9432 | | /// <summary> |
| | 9433 | | /// Creates a new ShareFileHandle instance for mocking. |
| | 9434 | | /// </summary> |
| | 9435 | | public static ShareFileHandle ShareFileHandle( |
| | 9436 | | string handleId, |
| | 9437 | | string path, |
| | 9438 | | string fileId, |
| | 9439 | | string sessionId, |
| | 9440 | | string clientIp, |
| | 9441 | | string parentId = default, |
| | 9442 | | System.DateTimeOffset? openedOn = default, |
| | 9443 | | System.DateTimeOffset? lastReconnectedOn = default) |
| | 9444 | | { |
| | 9445 | | return new ShareFileHandle() |
| | 9446 | | { |
| | 9447 | | HandleId = handleId, |
| | 9448 | | Path = path, |
| | 9449 | | FileId = fileId, |
| | 9450 | | SessionId = sessionId, |
| | 9451 | | ClientIp = clientIp, |
| | 9452 | | ParentId = parentId, |
| | 9453 | | OpenedOn = openedOn, |
| | 9454 | | LastReconnectedOn = lastReconnectedOn, |
| | 9455 | | }; |
| | 9456 | | } |
| | 9457 | | } |
| | 9458 | | } |
| | 9459 | | #endregion class ShareFileHandle |
| | 9460 | |
|
| | 9461 | | #region class ShareFileLease |
| | 9462 | | namespace Azure.Storage.Files.Shares.Models |
| | 9463 | | { |
| | 9464 | | /// <summary> |
| | 9465 | | /// ShareFileLease |
| | 9466 | | /// </summary> |
| | 9467 | | public partial class ShareFileLease |
| | 9468 | | { |
| | 9469 | | /// <summary> |
| | 9470 | | /// The ETag contains a value that you can use to perform operations conditionally. If the request version is 20 |
| | 9471 | | /// </summary> |
| | 9472 | | public Azure.ETag ETag { get; internal set; } |
| | 9473 | |
|
| | 9474 | | /// <summary> |
| | 9475 | | /// Returns the date and time the file was last modified. Any operation that modifies the file, including an upd |
| | 9476 | | /// </summary> |
| | 9477 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 9478 | |
|
| | 9479 | | /// <summary> |
| | 9480 | | /// Uniquely identifies a file's lease |
| | 9481 | | /// </summary> |
| | 9482 | | public string LeaseId { get; internal set; } |
| | 9483 | |
|
| | 9484 | | /// <summary> |
| | 9485 | | /// Prevent direct instantiation of ShareFileLease instances. |
| | 9486 | | /// You can use ShareModelFactory.ShareFileLease instead. |
| | 9487 | | /// </summary> |
| | 9488 | | internal ShareFileLease() { } |
| | 9489 | | } |
| | 9490 | |
|
| | 9491 | | /// <summary> |
| | 9492 | | /// ShareModelFactory provides utilities for mocking. |
| | 9493 | | /// </summary> |
| | 9494 | | public static partial class ShareModelFactory |
| | 9495 | | { |
| | 9496 | | /// <summary> |
| | 9497 | | /// Creates a new ShareFileLease instance for mocking. |
| | 9498 | | /// </summary> |
| | 9499 | | public static ShareFileLease ShareFileLease( |
| | 9500 | | Azure.ETag eTag, |
| | 9501 | | System.DateTimeOffset lastModified, |
| | 9502 | | string leaseId) |
| | 9503 | | { |
| | 9504 | | return new ShareFileLease() |
| | 9505 | | { |
| | 9506 | | ETag = eTag, |
| | 9507 | | LastModified = lastModified, |
| | 9508 | | LeaseId = leaseId, |
| | 9509 | | }; |
| | 9510 | | } |
| | 9511 | | } |
| | 9512 | | } |
| | 9513 | | #endregion class ShareFileLease |
| | 9514 | |
|
| | 9515 | | #region class ShareFileRangeInfoInternal |
| | 9516 | | namespace Azure.Storage.Files.Shares.Models |
| | 9517 | | { |
| | 9518 | | /// <summary> |
| | 9519 | | /// ShareFileRangeInfoInternal |
| | 9520 | | /// </summary> |
| | 9521 | | internal partial class ShareFileRangeInfoInternal |
| | 9522 | | { |
| | 9523 | | /// <summary> |
| | 9524 | | /// The date/time that the file was last modified. Any operation that modifies the file, including an update of |
| | 9525 | | /// </summary> |
| | 9526 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 9527 | |
|
| | 9528 | | /// <summary> |
| | 9529 | | /// The ETag contains a value which represents the version of the file, in quotes. |
| | 9530 | | /// </summary> |
| | 9531 | | public Azure.ETag ETag { get; internal set; } |
| | 9532 | |
|
| | 9533 | | /// <summary> |
| | 9534 | | /// The size of the file in bytes. |
| | 9535 | | /// </summary> |
| | 9536 | | public long FileContentLength { get; internal set; } |
| | 9537 | |
|
| | 9538 | | /// <summary> |
| | 9539 | | /// A list of non-overlapping valid ranges, sorted by increasing address range. |
| | 9540 | | /// </summary> |
| | 9541 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.Range> Ranges { get; internal se |
| | 9542 | |
|
| | 9543 | | /// <summary> |
| | 9544 | | /// Creates a new ShareFileRangeInfoInternal instance |
| | 9545 | | /// </summary> |
| | 9546 | | public ShareFileRangeInfoInternal() |
| | 9547 | | { |
| | 9548 | | Ranges = new System.Collections.Generic.List<Azure.Storage.Files.Shares.Models.Range>(); |
| | 9549 | | } |
| | 9550 | | } |
| | 9551 | | } |
| | 9552 | | #endregion class ShareFileRangeInfoInternal |
| | 9553 | |
|
| | 9554 | | #region enum ShareFileRangeWriteType |
| | 9555 | | namespace Azure.Storage.Files.Shares.Models |
| | 9556 | | { |
| | 9557 | | /// <summary> |
| | 9558 | | /// Specify one of the following options: - Update: Writes the bytes specified by the request body into the specifie |
| | 9559 | | /// </summary> |
| | 9560 | | public enum ShareFileRangeWriteType |
| | 9561 | | { |
| | 9562 | | /// <summary> |
| | 9563 | | /// update |
| | 9564 | | /// </summary> |
| | 9565 | | Update, |
| | 9566 | |
|
| | 9567 | | /// <summary> |
| | 9568 | | /// clear |
| | 9569 | | /// </summary> |
| | 9570 | | Clear |
| | 9571 | | } |
| | 9572 | | } |
| | 9573 | |
|
| | 9574 | | namespace Azure.Storage.Files.Shares |
| | 9575 | | { |
| | 9576 | | internal static partial class FileRestClient |
| | 9577 | | { |
| | 9578 | | public static partial class Serialization |
| | 9579 | | { |
| | 9580 | | public static string ToString(Azure.Storage.Files.Shares.Models.ShareFileRangeWriteType value) |
| | 9581 | | { |
| | 9582 | | return value switch |
| | 9583 | | { |
| | 9584 | | Azure.Storage.Files.Shares.Models.ShareFileRangeWriteType.Update => "update", |
| | 9585 | | Azure.Storage.Files.Shares.Models.ShareFileRangeWriteType.Clear => "clear", |
| | 9586 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 9587 | | }; |
| | 9588 | | } |
| | 9589 | |
|
| | 9590 | | public static Azure.Storage.Files.Shares.Models.ShareFileRangeWriteType ParseShareFileRangeWriteType(string |
| | 9591 | | { |
| | 9592 | | return value switch |
| | 9593 | | { |
| | 9594 | | "update" => Azure.Storage.Files.Shares.Models.ShareFileRangeWriteType.Update, |
| | 9595 | | "clear" => Azure.Storage.Files.Shares.Models.ShareFileRangeWriteType.Clear, |
| | 9596 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 9597 | | }; |
| | 9598 | | } |
| | 9599 | | } |
| | 9600 | | } |
| | 9601 | | } |
| | 9602 | | #endregion enum ShareFileRangeWriteType |
| | 9603 | |
|
| | 9604 | | #region class ShareFileUploadInfo |
| | 9605 | | namespace Azure.Storage.Files.Shares.Models |
| | 9606 | | { |
| | 9607 | | /// <summary> |
| | 9608 | | /// ShareFileUploadInfo |
| | 9609 | | /// </summary> |
| | 9610 | | public partial class ShareFileUploadInfo |
| | 9611 | | { |
| | 9612 | | /// <summary> |
| | 9613 | | /// The ETag contains a value which represents the version of the file, in quotes. |
| | 9614 | | /// </summary> |
| | 9615 | | public Azure.ETag ETag { get; internal set; } |
| | 9616 | |
|
| | 9617 | | /// <summary> |
| | 9618 | | /// Returns the date and time the directory was last modified. Any operation that modifies the share or its prop |
| | 9619 | | /// </summary> |
| | 9620 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 9621 | |
|
| | 9622 | | /// <summary> |
| | 9623 | | /// This header is returned so that the client can check for message content integrity. The value of this header |
| | 9624 | | /// </summary> |
| | 9625 | | #pragma warning disable CA1819 // Properties should not return arrays |
| | 9626 | | public byte[] ContentHash { get; internal set; } |
| | 9627 | | #pragma warning restore CA1819 // Properties should not return arrays |
| | 9628 | |
|
| | 9629 | | /// <summary> |
| | 9630 | | /// The value of this header is set to true if the contents of the request are successfully encrypted using the |
| | 9631 | | /// </summary> |
| | 9632 | | public bool IsServerEncrypted { get; internal set; } |
| | 9633 | |
|
| | 9634 | | /// <summary> |
| | 9635 | | /// Prevent direct instantiation of ShareFileUploadInfo instances. |
| | 9636 | | /// You can use ShareModelFactory.ShareFileUploadInfo instead. |
| | 9637 | | /// </summary> |
| | 9638 | | internal ShareFileUploadInfo() { } |
| | 9639 | | } |
| | 9640 | |
|
| | 9641 | | /// <summary> |
| | 9642 | | /// ShareModelFactory provides utilities for mocking. |
| | 9643 | | /// </summary> |
| | 9644 | | public static partial class ShareModelFactory |
| | 9645 | | { |
| | 9646 | | /// <summary> |
| | 9647 | | /// Creates a new ShareFileUploadInfo instance for mocking. |
| | 9648 | | /// </summary> |
| | 9649 | | public static ShareFileUploadInfo ShareFileUploadInfo( |
| | 9650 | | Azure.ETag eTag, |
| | 9651 | | System.DateTimeOffset lastModified, |
| | 9652 | | byte[] contentHash, |
| | 9653 | | bool isServerEncrypted) |
| | 9654 | | { |
| | 9655 | | return new ShareFileUploadInfo() |
| | 9656 | | { |
| | 9657 | | ETag = eTag, |
| | 9658 | | LastModified = lastModified, |
| | 9659 | | ContentHash = contentHash, |
| | 9660 | | IsServerEncrypted = isServerEncrypted, |
| | 9661 | | }; |
| | 9662 | | } |
| | 9663 | | } |
| | 9664 | | } |
| | 9665 | | #endregion class ShareFileUploadInfo |
| | 9666 | |
|
| | 9667 | | #region class ShareInfo |
| | 9668 | | namespace Azure.Storage.Files.Shares.Models |
| | 9669 | | { |
| | 9670 | | /// <summary> |
| | 9671 | | /// ShareInfo |
| | 9672 | | /// </summary> |
| | 9673 | | public partial class ShareInfo |
| | 9674 | | { |
| | 9675 | | /// <summary> |
| | 9676 | | /// The ETag contains a value which represents the version of the share, in quotes. |
| | 9677 | | /// </summary> |
| | 9678 | | public Azure.ETag ETag { get; internal set; } |
| | 9679 | |
|
| | 9680 | | /// <summary> |
| | 9681 | | /// Returns the date and time the share was last modified. Any operation that modifies the share or its properti |
| | 9682 | | /// </summary> |
| | 9683 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 9684 | |
|
| | 9685 | | /// <summary> |
| | 9686 | | /// Prevent direct instantiation of ShareInfo instances. |
| | 9687 | | /// You can use ShareModelFactory.ShareInfo instead. |
| | 9688 | | /// </summary> |
| | 9689 | | internal ShareInfo() { } |
| | 9690 | | } |
| | 9691 | |
|
| | 9692 | | /// <summary> |
| | 9693 | | /// ShareModelFactory provides utilities for mocking. |
| | 9694 | | /// </summary> |
| | 9695 | | public static partial class ShareModelFactory |
| | 9696 | | { |
| | 9697 | | /// <summary> |
| | 9698 | | /// Creates a new ShareInfo instance for mocking. |
| | 9699 | | /// </summary> |
| | 9700 | | public static ShareInfo ShareInfo( |
| | 9701 | | Azure.ETag eTag, |
| | 9702 | | System.DateTimeOffset lastModified) |
| | 9703 | | { |
| | 9704 | | return new ShareInfo() |
| | 9705 | | { |
| | 9706 | | ETag = eTag, |
| | 9707 | | LastModified = lastModified, |
| | 9708 | | }; |
| | 9709 | | } |
| | 9710 | | } |
| | 9711 | | } |
| | 9712 | | #endregion class ShareInfo |
| | 9713 | |
|
| | 9714 | | #region class ShareItem |
| | 9715 | | namespace Azure.Storage.Files.Shares.Models |
| | 9716 | | { |
| | 9717 | | /// <summary> |
| | 9718 | | /// A listed Azure Storage share item. |
| | 9719 | | /// </summary> |
| | 9720 | | public partial class ShareItem |
| | 9721 | | { |
| | 9722 | | /// <summary> |
| | 9723 | | /// Name |
| | 9724 | | /// </summary> |
| | 9725 | | public string Name { get; internal set; } |
| | 9726 | |
|
| | 9727 | | /// <summary> |
| | 9728 | | /// Snapshot |
| | 9729 | | /// </summary> |
| | 9730 | | public string Snapshot { get; internal set; } |
| | 9731 | |
|
| | 9732 | | /// <summary> |
| | 9733 | | /// Deleted |
| | 9734 | | /// </summary> |
| | 9735 | | public bool? IsDeleted { get; internal set; } |
| | 9736 | |
|
| | 9737 | | /// <summary> |
| | 9738 | | /// Version |
| | 9739 | | /// </summary> |
| | 9740 | | public string VersionId { get; internal set; } |
| | 9741 | |
|
| | 9742 | | /// <summary> |
| | 9743 | | /// Properties of a share. |
| | 9744 | | /// </summary> |
| | 9745 | | public Azure.Storage.Files.Shares.Models.ShareProperties Properties { get; internal set; } |
| | 9746 | |
|
| | 9747 | | /// <summary> |
| | 9748 | | /// Creates a new ShareItem instance |
| | 9749 | | /// </summary> |
| | 9750 | | internal ShareItem() |
| | 9751 | | : this(false) |
| | 9752 | | { |
| | 9753 | | } |
| | 9754 | |
|
| | 9755 | | /// <summary> |
| | 9756 | | /// Creates a new ShareItem instance |
| | 9757 | | /// </summary> |
| | 9758 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 9759 | | internal ShareItem(bool skipInitialization) |
| | 9760 | | { |
| | 9761 | | if (!skipInitialization) |
| | 9762 | | { |
| | 9763 | | Properties = new Azure.Storage.Files.Shares.Models.ShareProperties(); |
| | 9764 | | } |
| | 9765 | | } |
| | 9766 | |
|
| | 9767 | | /// <summary> |
| | 9768 | | /// Deserializes XML into a new ShareItem instance. |
| | 9769 | | /// </summary> |
| | 9770 | | /// <param name="element">The XML element to deserialize.</param> |
| | 9771 | | /// <returns>A deserialized ShareItem instance.</returns> |
| | 9772 | | internal static Azure.Storage.Files.Shares.Models.ShareItem FromXml(System.Xml.Linq.XElement element) |
| | 9773 | | { |
| | 9774 | | System.Diagnostics.Debug.Assert(element != null); |
| | 9775 | | System.Xml.Linq.XElement _child; |
| | 9776 | | Azure.Storage.Files.Shares.Models.ShareItem _value = new Azure.Storage.Files.Shares.Models.ShareItem(true); |
| | 9777 | | _child = element.Element(System.Xml.Linq.XName.Get("Name", "")); |
| | 9778 | | if (_child != null) |
| | 9779 | | { |
| | 9780 | | _value.Name = _child.Value; |
| | 9781 | | } |
| | 9782 | | _child = element.Element(System.Xml.Linq.XName.Get("Snapshot", "")); |
| | 9783 | | if (_child != null) |
| | 9784 | | { |
| | 9785 | | _value.Snapshot = _child.Value; |
| | 9786 | | } |
| | 9787 | | _child = element.Element(System.Xml.Linq.XName.Get("Deleted", "")); |
| | 9788 | | if (_child != null) |
| | 9789 | | { |
| | 9790 | | _value.IsDeleted = bool.Parse(_child.Value); |
| | 9791 | | } |
| | 9792 | | _child = element.Element(System.Xml.Linq.XName.Get("Version", "")); |
| | 9793 | | if (_child != null) |
| | 9794 | | { |
| | 9795 | | _value.VersionId = _child.Value; |
| | 9796 | | } |
| | 9797 | | _child = element.Element(System.Xml.Linq.XName.Get("Properties", "")); |
| | 9798 | | if (_child != null) |
| | 9799 | | { |
| | 9800 | | _value.Properties = Azure.Storage.Files.Shares.Models.ShareProperties.FromXml(_child); |
| | 9801 | | } |
| | 9802 | | CustomizeFromXml(element, _value); |
| | 9803 | | return _value; |
| | 9804 | | } |
| | 9805 | |
|
| | 9806 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.ShareIt |
| | 9807 | | } |
| | 9808 | |
|
| | 9809 | | /// <summary> |
| | 9810 | | /// ShareModelFactory provides utilities for mocking. |
| | 9811 | | /// </summary> |
| | 9812 | | public static partial class ShareModelFactory |
| | 9813 | | { |
| | 9814 | | /// <summary> |
| | 9815 | | /// Creates a new ShareItem instance for mocking. |
| | 9816 | | /// </summary> |
| | 9817 | | public static ShareItem ShareItem( |
| | 9818 | | string name, |
| | 9819 | | Azure.Storage.Files.Shares.Models.ShareProperties properties, |
| | 9820 | | string snapshot = default, |
| | 9821 | | bool? isDeleted = default, |
| | 9822 | | string versionId = default) |
| | 9823 | | { |
| | 9824 | | return new ShareItem() |
| | 9825 | | { |
| | 9826 | | Name = name, |
| | 9827 | | Properties = properties, |
| | 9828 | | Snapshot = snapshot, |
| | 9829 | | IsDeleted = isDeleted, |
| | 9830 | | VersionId = versionId, |
| | 9831 | | }; |
| | 9832 | | } |
| | 9833 | | } |
| | 9834 | | } |
| | 9835 | | #endregion class ShareItem |
| | 9836 | |
|
| | 9837 | | #region enum ShareLeaseDuration |
| | 9838 | | namespace Azure.Storage.Files.Shares.Models |
| | 9839 | | { |
| | 9840 | | /// <summary> |
| | 9841 | | /// When a file is leased, specifies whether the lease is of infinite or fixed duration. |
| | 9842 | | /// </summary> |
| | 9843 | | public enum ShareLeaseDuration |
| | 9844 | | { |
| | 9845 | | /// <summary> |
| | 9846 | | /// infinite |
| | 9847 | | /// </summary> |
| | 9848 | | Infinite, |
| | 9849 | |
|
| | 9850 | | /// <summary> |
| | 9851 | | /// fixed |
| | 9852 | | /// </summary> |
| | 9853 | | Fixed |
| | 9854 | | } |
| | 9855 | | } |
| | 9856 | |
|
| | 9857 | | namespace Azure.Storage.Files.Shares |
| | 9858 | | { |
| | 9859 | | internal static partial class FileRestClient |
| | 9860 | | { |
| | 9861 | | public static partial class Serialization |
| | 9862 | | { |
| | 9863 | | public static string ToString(Azure.Storage.Files.Shares.Models.ShareLeaseDuration value) |
| | 9864 | | { |
| | 9865 | | return value switch |
| | 9866 | | { |
| | 9867 | | Azure.Storage.Files.Shares.Models.ShareLeaseDuration.Infinite => "infinite", |
| | 9868 | | Azure.Storage.Files.Shares.Models.ShareLeaseDuration.Fixed => "fixed", |
| | 9869 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 9870 | | }; |
| | 9871 | | } |
| | 9872 | |
|
| | 9873 | | public static Azure.Storage.Files.Shares.Models.ShareLeaseDuration ParseShareLeaseDuration(string value) |
| | 9874 | | { |
| | 9875 | | return value switch |
| | 9876 | | { |
| | 9877 | | "infinite" => Azure.Storage.Files.Shares.Models.ShareLeaseDuration.Infinite, |
| | 9878 | | "fixed" => Azure.Storage.Files.Shares.Models.ShareLeaseDuration.Fixed, |
| | 9879 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 9880 | | }; |
| | 9881 | | } |
| | 9882 | | } |
| | 9883 | | } |
| | 9884 | | } |
| | 9885 | | #endregion enum ShareLeaseDuration |
| | 9886 | |
|
| | 9887 | | #region enum ShareLeaseState |
| | 9888 | | namespace Azure.Storage.Files.Shares.Models |
| | 9889 | | { |
| | 9890 | | /// <summary> |
| | 9891 | | /// Lease state of the file. |
| | 9892 | | /// </summary> |
| | 9893 | | public enum ShareLeaseState |
| | 9894 | | { |
| | 9895 | | /// <summary> |
| | 9896 | | /// available |
| | 9897 | | /// </summary> |
| | 9898 | | Available, |
| | 9899 | |
|
| | 9900 | | /// <summary> |
| | 9901 | | /// leased |
| | 9902 | | /// </summary> |
| | 9903 | | Leased, |
| | 9904 | |
|
| | 9905 | | /// <summary> |
| | 9906 | | /// expired |
| | 9907 | | /// </summary> |
| | 9908 | | Expired, |
| | 9909 | |
|
| | 9910 | | /// <summary> |
| | 9911 | | /// breaking |
| | 9912 | | /// </summary> |
| | 9913 | | Breaking, |
| | 9914 | |
|
| | 9915 | | /// <summary> |
| | 9916 | | /// broken |
| | 9917 | | /// </summary> |
| | 9918 | | Broken |
| | 9919 | | } |
| | 9920 | | } |
| | 9921 | |
|
| | 9922 | | namespace Azure.Storage.Files.Shares |
| | 9923 | | { |
| | 9924 | | internal static partial class FileRestClient |
| | 9925 | | { |
| | 9926 | | public static partial class Serialization |
| | 9927 | | { |
| | 9928 | | public static string ToString(Azure.Storage.Files.Shares.Models.ShareLeaseState value) |
| | 9929 | | { |
| | 9930 | | return value switch |
| | 9931 | | { |
| | 9932 | | Azure.Storage.Files.Shares.Models.ShareLeaseState.Available => "available", |
| | 9933 | | Azure.Storage.Files.Shares.Models.ShareLeaseState.Leased => "leased", |
| | 9934 | | Azure.Storage.Files.Shares.Models.ShareLeaseState.Expired => "expired", |
| | 9935 | | Azure.Storage.Files.Shares.Models.ShareLeaseState.Breaking => "breaking", |
| | 9936 | | Azure.Storage.Files.Shares.Models.ShareLeaseState.Broken => "broken", |
| | 9937 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 9938 | | }; |
| | 9939 | | } |
| | 9940 | |
|
| | 9941 | | public static Azure.Storage.Files.Shares.Models.ShareLeaseState ParseShareLeaseState(string value) |
| | 9942 | | { |
| | 9943 | | return value switch |
| | 9944 | | { |
| | 9945 | | "available" => Azure.Storage.Files.Shares.Models.ShareLeaseState.Available, |
| | 9946 | | "leased" => Azure.Storage.Files.Shares.Models.ShareLeaseState.Leased, |
| | 9947 | | "expired" => Azure.Storage.Files.Shares.Models.ShareLeaseState.Expired, |
| | 9948 | | "breaking" => Azure.Storage.Files.Shares.Models.ShareLeaseState.Breaking, |
| | 9949 | | "broken" => Azure.Storage.Files.Shares.Models.ShareLeaseState.Broken, |
| | 9950 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 9951 | | }; |
| | 9952 | | } |
| | 9953 | | } |
| | 9954 | | } |
| | 9955 | | } |
| | 9956 | | #endregion enum ShareLeaseState |
| | 9957 | |
|
| | 9958 | | #region enum ShareLeaseStatus |
| | 9959 | | namespace Azure.Storage.Files.Shares.Models |
| | 9960 | | { |
| | 9961 | | /// <summary> |
| | 9962 | | /// The current lease status of the file. |
| | 9963 | | /// </summary> |
| | 9964 | | #pragma warning disable CA1717 // Only FlagsAttribute enums should have plural names |
| | 9965 | | public enum ShareLeaseStatus |
| | 9966 | | #pragma warning restore CA1717 // Only FlagsAttribute enums should have plural names |
| | 9967 | | { |
| | 9968 | | /// <summary> |
| | 9969 | | /// locked |
| | 9970 | | /// </summary> |
| | 9971 | | Locked, |
| | 9972 | |
|
| | 9973 | | /// <summary> |
| | 9974 | | /// unlocked |
| | 9975 | | /// </summary> |
| | 9976 | | Unlocked |
| | 9977 | | } |
| | 9978 | | } |
| | 9979 | |
|
| | 9980 | | namespace Azure.Storage.Files.Shares |
| | 9981 | | { |
| | 9982 | | internal static partial class FileRestClient |
| | 9983 | | { |
| | 9984 | | public static partial class Serialization |
| | 9985 | | { |
| | 9986 | | public static string ToString(Azure.Storage.Files.Shares.Models.ShareLeaseStatus value) |
| | 9987 | | { |
| | 9988 | | return value switch |
| | 9989 | | { |
| | 9990 | | Azure.Storage.Files.Shares.Models.ShareLeaseStatus.Locked => "locked", |
| | 9991 | | Azure.Storage.Files.Shares.Models.ShareLeaseStatus.Unlocked => "unlocked", |
| | 9992 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 9993 | | }; |
| | 9994 | | } |
| | 9995 | |
|
| | 9996 | | public static Azure.Storage.Files.Shares.Models.ShareLeaseStatus ParseShareLeaseStatus(string value) |
| | 9997 | | { |
| | 9998 | | return value switch |
| | 9999 | | { |
| | 10000 | | "locked" => Azure.Storage.Files.Shares.Models.ShareLeaseStatus.Locked, |
| | 10001 | | "unlocked" => Azure.Storage.Files.Shares.Models.ShareLeaseStatus.Unlocked, |
| | 10002 | | _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Files |
| | 10003 | | }; |
| | 10004 | | } |
| | 10005 | | } |
| | 10006 | | } |
| | 10007 | | } |
| | 10008 | | #endregion enum ShareLeaseStatus |
| | 10009 | |
|
| | 10010 | | #region class ShareMetrics |
| | 10011 | | namespace Azure.Storage.Files.Shares.Models |
| | 10012 | | { |
| | 10013 | | /// <summary> |
| | 10014 | | /// Storage Analytics metrics for file service. |
| | 10015 | | /// </summary> |
| | 10016 | | public partial class ShareMetrics |
| | 10017 | | { |
| | 10018 | | /// <summary> |
| | 10019 | | /// The version of Storage Analytics to configure. |
| | 10020 | | /// </summary> |
| | 10021 | | public string Version { get; set; } |
| | 10022 | |
|
| | 10023 | | /// <summary> |
| | 10024 | | /// Indicates whether metrics are enabled for the File service. |
| | 10025 | | /// </summary> |
| | 10026 | | public bool Enabled { get; set; } |
| | 10027 | |
|
| | 10028 | | /// <summary> |
| | 10029 | | /// The retention policy. |
| | 10030 | | /// </summary> |
| | 10031 | | public Azure.Storage.Files.Shares.Models.ShareRetentionPolicy RetentionPolicy { get; set; } |
| | 10032 | |
|
| | 10033 | | /// <summary> |
| | 10034 | | /// Indicates whether metrics should generate summary statistics for called API operations. |
| | 10035 | | /// </summary> |
| | 10036 | | public bool? IncludeApis { get; set; } |
| | 10037 | |
|
| | 10038 | | /// <summary> |
| | 10039 | | /// Creates a new ShareMetrics instance |
| | 10040 | | /// </summary> |
| | 10041 | | public ShareMetrics() |
| | 10042 | | : this(false) |
| | 10043 | | { |
| | 10044 | | } |
| | 10045 | |
|
| | 10046 | | /// <summary> |
| | 10047 | | /// Creates a new ShareMetrics instance |
| | 10048 | | /// </summary> |
| | 10049 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 10050 | | internal ShareMetrics(bool skipInitialization) |
| | 10051 | | { |
| | 10052 | | if (!skipInitialization) |
| | 10053 | | { |
| | 10054 | | RetentionPolicy = new Azure.Storage.Files.Shares.Models.ShareRetentionPolicy(); |
| | 10055 | | } |
| | 10056 | | } |
| | 10057 | |
|
| | 10058 | | /// <summary> |
| | 10059 | | /// Serialize a ShareMetrics instance as XML. |
| | 10060 | | /// </summary> |
| | 10061 | | /// <param name="value">The ShareMetrics instance to serialize.</param> |
| | 10062 | | /// <param name="name">An optional name to use for the root element instead of "Metrics".</param> |
| | 10063 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 10064 | | /// <returns>The serialized XML element.</returns> |
| | 10065 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Files.Shares.Models.ShareMetrics value, string name |
| | 10066 | | { |
| | 10067 | | System.Diagnostics.Debug.Assert(value != null); |
| | 10068 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 10069 | | _element.Add(new System.Xml.Linq.XElement( |
| | 10070 | | System.Xml.Linq.XName.Get("Version", ""), |
| | 10071 | | value.Version)); |
| | 10072 | | _element.Add(new System.Xml.Linq.XElement( |
| | 10073 | | System.Xml.Linq.XName.Get("Enabled", ""), |
| | 10074 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 10075 | | value.Enabled.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant())); |
| | 10076 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 10077 | | if (value.RetentionPolicy != null) |
| | 10078 | | { |
| | 10079 | | _element.Add(Azure.Storage.Files.Shares.Models.ShareRetentionPolicy.ToXml(value.RetentionPolicy, "Retent |
| | 10080 | | } |
| | 10081 | | if (value.IncludeApis != null) |
| | 10082 | | { |
| | 10083 | | _element.Add(new System.Xml.Linq.XElement( |
| | 10084 | | System.Xml.Linq.XName.Get("IncludeAPIs", ""), |
| | 10085 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 10086 | | value.IncludeApis.Value.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant |
| | 10087 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 10088 | | } |
| | 10089 | | return _element; |
| | 10090 | | } |
| | 10091 | |
|
| | 10092 | | /// <summary> |
| | 10093 | | /// Deserializes XML into a new ShareMetrics instance. |
| | 10094 | | /// </summary> |
| | 10095 | | /// <param name="element">The XML element to deserialize.</param> |
| | 10096 | | /// <returns>A deserialized ShareMetrics instance.</returns> |
| | 10097 | | internal static Azure.Storage.Files.Shares.Models.ShareMetrics FromXml(System.Xml.Linq.XElement element) |
| | 10098 | | { |
| | 10099 | | System.Diagnostics.Debug.Assert(element != null); |
| | 10100 | | System.Xml.Linq.XElement _child; |
| | 10101 | | Azure.Storage.Files.Shares.Models.ShareMetrics _value = new Azure.Storage.Files.Shares.Models.ShareMetrics(t |
| | 10102 | | _child = element.Element(System.Xml.Linq.XName.Get("Version", "")); |
| | 10103 | | if (_child != null) |
| | 10104 | | { |
| | 10105 | | _value.Version = _child.Value; |
| | 10106 | | } |
| | 10107 | | _child = element.Element(System.Xml.Linq.XName.Get("Enabled", "")); |
| | 10108 | | if (_child != null) |
| | 10109 | | { |
| | 10110 | | _value.Enabled = bool.Parse(_child.Value); |
| | 10111 | | } |
| | 10112 | | _child = element.Element(System.Xml.Linq.XName.Get("RetentionPolicy", "")); |
| | 10113 | | if (_child != null) |
| | 10114 | | { |
| | 10115 | | _value.RetentionPolicy = Azure.Storage.Files.Shares.Models.ShareRetentionPolicy.FromXml(_child); |
| | 10116 | | } |
| | 10117 | | _child = element.Element(System.Xml.Linq.XName.Get("IncludeAPIs", "")); |
| | 10118 | | if (_child != null) |
| | 10119 | | { |
| | 10120 | | _value.IncludeApis = bool.Parse(_child.Value); |
| | 10121 | | } |
| | 10122 | | CustomizeFromXml(element, _value); |
| | 10123 | | return _value; |
| | 10124 | | } |
| | 10125 | |
|
| | 10126 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.ShareMe |
| | 10127 | | } |
| | 10128 | | } |
| | 10129 | | #endregion class ShareMetrics |
| | 10130 | |
|
| | 10131 | | #region class ShareProperties |
| | 10132 | | namespace Azure.Storage.Files.Shares.Models |
| | 10133 | | { |
| | 10134 | | /// <summary> |
| | 10135 | | /// Properties of a share. |
| | 10136 | | /// </summary> |
| | 10137 | | public partial class ShareProperties |
| | 10138 | | { |
| | 10139 | | /// <summary> |
| | 10140 | | /// Last-Modified |
| | 10141 | | /// </summary> |
| | 10142 | | public System.DateTimeOffset? LastModified { get; internal set; } |
| | 10143 | |
|
| | 10144 | | /// <summary> |
| | 10145 | | /// Etag |
| | 10146 | | /// </summary> |
| | 10147 | | public Azure.ETag? ETag { get; internal set; } |
| | 10148 | |
|
| | 10149 | | /// <summary> |
| | 10150 | | /// ProvisionedIops |
| | 10151 | | /// </summary> |
| | 10152 | | public int? ProvisionedIops { get; internal set; } |
| | 10153 | |
|
| | 10154 | | /// <summary> |
| | 10155 | | /// ProvisionedIngressMBps |
| | 10156 | | /// </summary> |
| | 10157 | | public int? ProvisionedIngressMBps { get; internal set; } |
| | 10158 | |
|
| | 10159 | | /// <summary> |
| | 10160 | | /// ProvisionedEgressMBps |
| | 10161 | | /// </summary> |
| | 10162 | | public int? ProvisionedEgressMBps { get; internal set; } |
| | 10163 | |
|
| | 10164 | | /// <summary> |
| | 10165 | | /// NextAllowedQuotaDowngradeTime |
| | 10166 | | /// </summary> |
| | 10167 | | public System.DateTimeOffset? NextAllowedQuotaDowngradeTime { get; internal set; } |
| | 10168 | |
|
| | 10169 | | /// <summary> |
| | 10170 | | /// DeletedTime |
| | 10171 | | /// </summary> |
| | 10172 | | public System.DateTimeOffset? DeletedOn { get; internal set; } |
| | 10173 | |
|
| | 10174 | | /// <summary> |
| | 10175 | | /// RemainingRetentionDays |
| | 10176 | | /// </summary> |
| | 10177 | | public int? RemainingRetentionDays { get; internal set; } |
| | 10178 | |
|
| | 10179 | | /// <summary> |
| | 10180 | | /// QuotaInGB |
| | 10181 | | /// </summary> |
| | 10182 | | public int? QuotaInGB { get; internal set; } |
| | 10183 | |
|
| | 10184 | | /// <summary> |
| | 10185 | | /// Metadata |
| | 10186 | | /// </summary> |
| | 10187 | | public System.Collections.Generic.IDictionary<string, string> Metadata { get; internal set; } |
| | 10188 | |
|
| | 10189 | | /// <summary> |
| | 10190 | | /// Creates a new ShareProperties instance |
| | 10191 | | /// </summary> |
| | 10192 | | internal ShareProperties() |
| | 10193 | | : this(false) |
| | 10194 | | { |
| | 10195 | | } |
| | 10196 | |
|
| | 10197 | | /// <summary> |
| | 10198 | | /// Creates a new ShareProperties instance |
| | 10199 | | /// </summary> |
| | 10200 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 10201 | | internal ShareProperties(bool skipInitialization) |
| | 10202 | | { |
| | 10203 | | if (!skipInitialization) |
| | 10204 | | { |
| | 10205 | | Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgnore |
| | 10206 | | } |
| | 10207 | | } |
| | 10208 | |
|
| | 10209 | | /// <summary> |
| | 10210 | | /// Deserializes XML into a new ShareProperties instance. |
| | 10211 | | /// </summary> |
| | 10212 | | /// <param name="element">The XML element to deserialize.</param> |
| | 10213 | | /// <returns>A deserialized ShareProperties instance.</returns> |
| | 10214 | | internal static Azure.Storage.Files.Shares.Models.ShareProperties FromXml(System.Xml.Linq.XElement element) |
| | 10215 | | { |
| | 10216 | | System.Diagnostics.Debug.Assert(element != null); |
| | 10217 | | System.Xml.Linq.XElement _child; |
| | 10218 | | Azure.Storage.Files.Shares.Models.ShareProperties _value = new Azure.Storage.Files.Shares.Models.ShareProper |
| | 10219 | | _child = element.Element(System.Xml.Linq.XName.Get("Last-Modified", "")); |
| | 10220 | | if (_child != null) |
| | 10221 | | { |
| | 10222 | | _value.LastModified = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.Invaria |
| | 10223 | | } |
| | 10224 | | _child = element.Element(System.Xml.Linq.XName.Get("Etag", "")); |
| | 10225 | | if (_child != null) |
| | 10226 | | { |
| | 10227 | | _value.ETag = new Azure.ETag(_child.Value); |
| | 10228 | | } |
| | 10229 | | _child = element.Element(System.Xml.Linq.XName.Get("ProvisionedIops", "")); |
| | 10230 | | if (_child != null) |
| | 10231 | | { |
| | 10232 | | _value.ProvisionedIops = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 10233 | | } |
| | 10234 | | _child = element.Element(System.Xml.Linq.XName.Get("ProvisionedIngressMBps", "")); |
| | 10235 | | if (_child != null) |
| | 10236 | | { |
| | 10237 | | _value.ProvisionedIngressMBps = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCultur |
| | 10238 | | } |
| | 10239 | | _child = element.Element(System.Xml.Linq.XName.Get("ProvisionedEgressMBps", "")); |
| | 10240 | | if (_child != null) |
| | 10241 | | { |
| | 10242 | | _value.ProvisionedEgressMBps = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture |
| | 10243 | | } |
| | 10244 | | _child = element.Element(System.Xml.Linq.XName.Get("NextAllowedQuotaDowngradeTime", "")); |
| | 10245 | | if (_child != null) |
| | 10246 | | { |
| | 10247 | | _value.NextAllowedQuotaDowngradeTime = System.DateTimeOffset.Parse(_child.Value, System.Globalization.Cu |
| | 10248 | | } |
| | 10249 | | _child = element.Element(System.Xml.Linq.XName.Get("DeletedTime", "")); |
| | 10250 | | if (_child != null) |
| | 10251 | | { |
| | 10252 | | _value.DeletedOn = System.DateTimeOffset.Parse(_child.Value, System.Globalization.CultureInfo.InvariantC |
| | 10253 | | } |
| | 10254 | | _child = element.Element(System.Xml.Linq.XName.Get("RemainingRetentionDays", "")); |
| | 10255 | | if (_child != null) |
| | 10256 | | { |
| | 10257 | | _value.RemainingRetentionDays = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCultur |
| | 10258 | | } |
| | 10259 | | _child = element.Element(System.Xml.Linq.XName.Get("Quota", "")); |
| | 10260 | | if (_child != null) |
| | 10261 | | { |
| | 10262 | | _value.QuotaInGB = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 10263 | | } |
| | 10264 | | _value.Metadata = new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.OrdinalIgn |
| | 10265 | | _child = element.Element(System.Xml.Linq.XName.Get("Metadata", "")); |
| | 10266 | | if (_child != null) |
| | 10267 | | { |
| | 10268 | | foreach (System.Xml.Linq.XElement _pair in _child.Elements()) |
| | 10269 | | { |
| | 10270 | | _value.Metadata[_pair.Name.LocalName] = _pair.Value; |
| | 10271 | | } |
| | 10272 | | } |
| | 10273 | | CustomizeFromXml(element, _value); |
| | 10274 | | return _value; |
| | 10275 | | } |
| | 10276 | |
|
| | 10277 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.SharePr |
| | 10278 | | } |
| | 10279 | |
|
| | 10280 | | /// <summary> |
| | 10281 | | /// ShareModelFactory provides utilities for mocking. |
| | 10282 | | /// </summary> |
| | 10283 | | public static partial class ShareModelFactory |
| | 10284 | | { |
| | 10285 | | /// <summary> |
| | 10286 | | /// Creates a new ShareProperties instance for mocking. |
| | 10287 | | /// </summary> |
| | 10288 | | public static ShareProperties ShareProperties( |
| | 10289 | | System.DateTimeOffset? lastModified = default, |
| | 10290 | | Azure.ETag? eTag = default, |
| | 10291 | | int? provisionedIops = default, |
| | 10292 | | int? provisionedIngressMBps = default, |
| | 10293 | | int? provisionedEgressMBps = default, |
| | 10294 | | System.DateTimeOffset? nextAllowedQuotaDowngradeTime = default, |
| | 10295 | | System.DateTimeOffset? deletedOn = default, |
| | 10296 | | int? remainingRetentionDays = default, |
| | 10297 | | int? quotaInGB = default, |
| | 10298 | | System.Collections.Generic.IDictionary<string, string> metadata = default) |
| | 10299 | | { |
| | 10300 | | return new ShareProperties() |
| | 10301 | | { |
| | 10302 | | LastModified = lastModified, |
| | 10303 | | ETag = eTag, |
| | 10304 | | ProvisionedIops = provisionedIops, |
| | 10305 | | ProvisionedIngressMBps = provisionedIngressMBps, |
| | 10306 | | ProvisionedEgressMBps = provisionedEgressMBps, |
| | 10307 | | NextAllowedQuotaDowngradeTime = nextAllowedQuotaDowngradeTime, |
| | 10308 | | DeletedOn = deletedOn, |
| | 10309 | | RemainingRetentionDays = remainingRetentionDays, |
| | 10310 | | QuotaInGB = quotaInGB, |
| | 10311 | | Metadata = metadata, |
| | 10312 | | }; |
| | 10313 | | } |
| | 10314 | | } |
| | 10315 | | } |
| | 10316 | | #endregion class ShareProperties |
| | 10317 | |
|
| | 10318 | | #region class ShareRetentionPolicy |
| | 10319 | | namespace Azure.Storage.Files.Shares.Models |
| | 10320 | | { |
| | 10321 | | /// <summary> |
| | 10322 | | /// The retention policy. |
| | 10323 | | /// </summary> |
| | 10324 | | public partial class ShareRetentionPolicy |
| | 10325 | | { |
| | 10326 | | /// <summary> |
| | 10327 | | /// Indicates whether a retention policy is enabled for the File service. If false, metrics data is retained, an |
| | 10328 | | /// </summary> |
| | 10329 | | public bool Enabled { get; set; } |
| | 10330 | |
|
| | 10331 | | /// <summary> |
| | 10332 | | /// Indicates the number of days that metrics data should be retained. All data older than this value will be de |
| | 10333 | | /// </summary> |
| | 10334 | | public int? Days { get; set; } |
| | 10335 | |
|
| | 10336 | | /// <summary> |
| | 10337 | | /// Creates a new ShareRetentionPolicy instance |
| | 10338 | | /// </summary> |
| | 10339 | | public ShareRetentionPolicy() { } |
| | 10340 | |
|
| | 10341 | | /// <summary> |
| | 10342 | | /// Serialize a ShareRetentionPolicy instance as XML. |
| | 10343 | | /// </summary> |
| | 10344 | | /// <param name="value">The ShareRetentionPolicy instance to serialize.</param> |
| | 10345 | | /// <param name="name">An optional name to use for the root element instead of "RetentionPolicy".</param> |
| | 10346 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 10347 | | /// <returns>The serialized XML element.</returns> |
| | 10348 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Files.Shares.Models.ShareRetentionPolicy value, str |
| | 10349 | | { |
| | 10350 | | System.Diagnostics.Debug.Assert(value != null); |
| | 10351 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 10352 | | _element.Add(new System.Xml.Linq.XElement( |
| | 10353 | | System.Xml.Linq.XName.Get("Enabled", ""), |
| | 10354 | | #pragma warning disable CA1308 // Normalize strings to uppercase |
| | 10355 | | value.Enabled.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant())); |
| | 10356 | | #pragma warning restore CA1308 // Normalize strings to uppercase |
| | 10357 | | if (value.Days != null) |
| | 10358 | | { |
| | 10359 | | _element.Add(new System.Xml.Linq.XElement( |
| | 10360 | | System.Xml.Linq.XName.Get("Days", ""), |
| | 10361 | | value.Days.Value.ToString(System.Globalization.CultureInfo.InvariantCulture))); |
| | 10362 | | } |
| | 10363 | | return _element; |
| | 10364 | | } |
| | 10365 | |
|
| | 10366 | | /// <summary> |
| | 10367 | | /// Deserializes XML into a new ShareRetentionPolicy instance. |
| | 10368 | | /// </summary> |
| | 10369 | | /// <param name="element">The XML element to deserialize.</param> |
| | 10370 | | /// <returns>A deserialized ShareRetentionPolicy instance.</returns> |
| | 10371 | | internal static Azure.Storage.Files.Shares.Models.ShareRetentionPolicy FromXml(System.Xml.Linq.XElement element) |
| | 10372 | | { |
| | 10373 | | System.Diagnostics.Debug.Assert(element != null); |
| | 10374 | | System.Xml.Linq.XElement _child; |
| | 10375 | | Azure.Storage.Files.Shares.Models.ShareRetentionPolicy _value = new Azure.Storage.Files.Shares.Models.ShareR |
| | 10376 | | _child = element.Element(System.Xml.Linq.XName.Get("Enabled", "")); |
| | 10377 | | if (_child != null) |
| | 10378 | | { |
| | 10379 | | _value.Enabled = bool.Parse(_child.Value); |
| | 10380 | | } |
| | 10381 | | _child = element.Element(System.Xml.Linq.XName.Get("Days", "")); |
| | 10382 | | if (_child != null) |
| | 10383 | | { |
| | 10384 | | _value.Days = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 10385 | | } |
| | 10386 | | CustomizeFromXml(element, _value); |
| | 10387 | | return _value; |
| | 10388 | | } |
| | 10389 | |
|
| | 10390 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.ShareRe |
| | 10391 | | } |
| | 10392 | | } |
| | 10393 | | #endregion class ShareRetentionPolicy |
| | 10394 | |
|
| | 10395 | | #region class ShareServiceProperties |
| | 10396 | | namespace Azure.Storage.Files.Shares.Models |
| | 10397 | | { |
| | 10398 | | /// <summary> |
| | 10399 | | /// Storage service properties. |
| | 10400 | | /// </summary> |
| | 10401 | | public partial class ShareServiceProperties |
| | 10402 | | { |
| | 10403 | | /// <summary> |
| | 10404 | | /// A summary of request statistics grouped by API in hourly aggregates for files. |
| | 10405 | | /// </summary> |
| | 10406 | | public Azure.Storage.Files.Shares.Models.ShareMetrics HourMetrics { get; set; } |
| | 10407 | |
|
| | 10408 | | /// <summary> |
| | 10409 | | /// A summary of request statistics grouped by API in minute aggregates for files. |
| | 10410 | | /// </summary> |
| | 10411 | | public Azure.Storage.Files.Shares.Models.ShareMetrics MinuteMetrics { get; set; } |
| | 10412 | |
|
| | 10413 | | /// <summary> |
| | 10414 | | /// The set of CORS rules. |
| | 10415 | | /// </summary> |
| | 10416 | | public System.Collections.Generic.IList<Azure.Storage.Files.Shares.Models.ShareCorsRule> Cors { get; set; } |
| | 10417 | |
|
| | 10418 | | /// <summary> |
| | 10419 | | /// Creates a new ShareServiceProperties instance |
| | 10420 | | /// </summary> |
| | 10421 | | public ShareServiceProperties() |
| | 10422 | | : this(false) |
| | 10423 | | { |
| | 10424 | | } |
| | 10425 | |
|
| | 10426 | | /// <summary> |
| | 10427 | | /// Creates a new ShareServiceProperties instance |
| | 10428 | | /// </summary> |
| | 10429 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 10430 | | internal ShareServiceProperties(bool skipInitialization) |
| | 10431 | | { |
| | 10432 | | if (!skipInitialization) |
| | 10433 | | { |
| | 10434 | | HourMetrics = new Azure.Storage.Files.Shares.Models.ShareMetrics(); |
| | 10435 | | MinuteMetrics = new Azure.Storage.Files.Shares.Models.ShareMetrics(); |
| | 10436 | | } |
| | 10437 | | } |
| | 10438 | |
|
| | 10439 | | /// <summary> |
| | 10440 | | /// Serialize a ShareServiceProperties instance as XML. |
| | 10441 | | /// </summary> |
| | 10442 | | /// <param name="value">The ShareServiceProperties instance to serialize.</param> |
| | 10443 | | /// <param name="name">An optional name to use for the root element instead of "StorageServiceProperties".</para |
| | 10444 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 10445 | | /// <returns>The serialized XML element.</returns> |
| | 10446 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Files.Shares.Models.ShareServiceProperties value, s |
| | 10447 | | { |
| | 10448 | | System.Diagnostics.Debug.Assert(value != null); |
| | 10449 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 10450 | | if (value.HourMetrics != null) |
| | 10451 | | { |
| | 10452 | | _element.Add(Azure.Storage.Files.Shares.Models.ShareMetrics.ToXml(value.HourMetrics, "HourMetrics", "")) |
| | 10453 | | } |
| | 10454 | | if (value.MinuteMetrics != null) |
| | 10455 | | { |
| | 10456 | | _element.Add(Azure.Storage.Files.Shares.Models.ShareMetrics.ToXml(value.MinuteMetrics, "MinuteMetrics", |
| | 10457 | | } |
| | 10458 | | if (value.Cors != null) |
| | 10459 | | { |
| | 10460 | | System.Xml.Linq.XElement _elements = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get("Cors", "")) |
| | 10461 | | foreach (Azure.Storage.Files.Shares.Models.ShareCorsRule _child in value.Cors) |
| | 10462 | | { |
| | 10463 | | _elements.Add(Azure.Storage.Files.Shares.Models.ShareCorsRule.ToXml(_child)); |
| | 10464 | | } |
| | 10465 | | _element.Add(_elements); |
| | 10466 | | } |
| | 10467 | | return _element; |
| | 10468 | | } |
| | 10469 | |
|
| | 10470 | | /// <summary> |
| | 10471 | | /// Deserializes XML into a new ShareServiceProperties instance. |
| | 10472 | | /// </summary> |
| | 10473 | | /// <param name="element">The XML element to deserialize.</param> |
| | 10474 | | /// <returns>A deserialized ShareServiceProperties instance.</returns> |
| | 10475 | | internal static Azure.Storage.Files.Shares.Models.ShareServiceProperties FromXml(System.Xml.Linq.XElement elemen |
| | 10476 | | { |
| | 10477 | | System.Diagnostics.Debug.Assert(element != null); |
| | 10478 | | System.Xml.Linq.XElement _child; |
| | 10479 | | Azure.Storage.Files.Shares.Models.ShareServiceProperties _value = new Azure.Storage.Files.Shares.Models.Shar |
| | 10480 | | _child = element.Element(System.Xml.Linq.XName.Get("HourMetrics", "")); |
| | 10481 | | if (_child != null) |
| | 10482 | | { |
| | 10483 | | _value.HourMetrics = Azure.Storage.Files.Shares.Models.ShareMetrics.FromXml(_child); |
| | 10484 | | } |
| | 10485 | | _child = element.Element(System.Xml.Linq.XName.Get("MinuteMetrics", "")); |
| | 10486 | | if (_child != null) |
| | 10487 | | { |
| | 10488 | | _value.MinuteMetrics = Azure.Storage.Files.Shares.Models.ShareMetrics.FromXml(_child); |
| | 10489 | | } |
| | 10490 | | _child = element.Element(System.Xml.Linq.XName.Get("Cors", "")); |
| | 10491 | | if (_child != null) |
| | 10492 | | { |
| | 10493 | | _value.Cors = System.Linq.Enumerable.ToList( |
| | 10494 | | System.Linq.Enumerable.Select( |
| | 10495 | | _child.Elements(System.Xml.Linq.XName.Get("CorsRule", "")), |
| | 10496 | | e => Azure.Storage.Files.Shares.Models.ShareCorsRule.FromXml(e))); |
| | 10497 | | } |
| | 10498 | | else |
| | 10499 | | { |
| | 10500 | | _value.Cors = new System.Collections.Generic.List<Azure.Storage.Files.Shares.Models.ShareCorsRule>(); |
| | 10501 | | } |
| | 10502 | | CustomizeFromXml(element, _value); |
| | 10503 | | return _value; |
| | 10504 | | } |
| | 10505 | |
|
| | 10506 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.ShareSe |
| | 10507 | | } |
| | 10508 | | } |
| | 10509 | | #endregion class ShareServiceProperties |
| | 10510 | |
|
| | 10511 | | #region class ShareSignedIdentifier |
| | 10512 | | namespace Azure.Storage.Files.Shares.Models |
| | 10513 | | { |
| | 10514 | | /// <summary> |
| | 10515 | | /// Signed identifier. |
| | 10516 | | /// </summary> |
| | 10517 | | public partial class ShareSignedIdentifier |
| | 10518 | | { |
| | 10519 | | /// <summary> |
| | 10520 | | /// A unique id. |
| | 10521 | | /// </summary> |
| | 10522 | | public string Id { get; set; } |
| | 10523 | |
|
| | 10524 | | /// <summary> |
| | 10525 | | /// The access policy. |
| | 10526 | | /// </summary> |
| | 10527 | | public Azure.Storage.Files.Shares.Models.ShareAccessPolicy AccessPolicy { get; set; } |
| | 10528 | |
|
| | 10529 | | /// <summary> |
| | 10530 | | /// Creates a new ShareSignedIdentifier instance |
| | 10531 | | /// </summary> |
| | 10532 | | public ShareSignedIdentifier() |
| | 10533 | | : this(false) |
| | 10534 | | { |
| | 10535 | | } |
| | 10536 | |
|
| | 10537 | | /// <summary> |
| | 10538 | | /// Creates a new ShareSignedIdentifier instance |
| | 10539 | | /// </summary> |
| | 10540 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 10541 | | internal ShareSignedIdentifier(bool skipInitialization) |
| | 10542 | | { |
| | 10543 | | if (!skipInitialization) |
| | 10544 | | { |
| | 10545 | | AccessPolicy = new Azure.Storage.Files.Shares.Models.ShareAccessPolicy(); |
| | 10546 | | } |
| | 10547 | | } |
| | 10548 | |
|
| | 10549 | | /// <summary> |
| | 10550 | | /// Serialize a ShareSignedIdentifier instance as XML. |
| | 10551 | | /// </summary> |
| | 10552 | | /// <param name="value">The ShareSignedIdentifier instance to serialize.</param> |
| | 10553 | | /// <param name="name">An optional name to use for the root element instead of "SignedIdentifier".</param> |
| | 10554 | | /// <param name="ns">An optional namespace to use for the root element instead of "".</param> |
| | 10555 | | /// <returns>The serialized XML element.</returns> |
| | 10556 | | internal static System.Xml.Linq.XElement ToXml(Azure.Storage.Files.Shares.Models.ShareSignedIdentifier value, st |
| | 10557 | | { |
| | 10558 | | System.Diagnostics.Debug.Assert(value != null); |
| | 10559 | | System.Xml.Linq.XElement _element = new System.Xml.Linq.XElement(System.Xml.Linq.XName.Get(name, ns)); |
| | 10560 | | _element.Add(new System.Xml.Linq.XElement( |
| | 10561 | | System.Xml.Linq.XName.Get("Id", ""), |
| | 10562 | | value.Id)); |
| | 10563 | | if (value.AccessPolicy != null) |
| | 10564 | | { |
| | 10565 | | _element.Add(Azure.Storage.Files.Shares.Models.ShareAccessPolicy.ToXml(value.AccessPolicy, "AccessPolicy |
| | 10566 | | } |
| | 10567 | | return _element; |
| | 10568 | | } |
| | 10569 | |
|
| | 10570 | | /// <summary> |
| | 10571 | | /// Deserializes XML into a new ShareSignedIdentifier instance. |
| | 10572 | | /// </summary> |
| | 10573 | | /// <param name="element">The XML element to deserialize.</param> |
| | 10574 | | /// <returns>A deserialized ShareSignedIdentifier instance.</returns> |
| | 10575 | | internal static Azure.Storage.Files.Shares.Models.ShareSignedIdentifier FromXml(System.Xml.Linq.XElement element |
| | 10576 | | { |
| | 10577 | | System.Diagnostics.Debug.Assert(element != null); |
| | 10578 | | System.Xml.Linq.XElement _child; |
| | 10579 | | Azure.Storage.Files.Shares.Models.ShareSignedIdentifier _value = new Azure.Storage.Files.Shares.Models.Share |
| | 10580 | | _child = element.Element(System.Xml.Linq.XName.Get("Id", "")); |
| | 10581 | | if (_child != null) |
| | 10582 | | { |
| | 10583 | | _value.Id = _child.Value; |
| | 10584 | | } |
| | 10585 | | _child = element.Element(System.Xml.Linq.XName.Get("AccessPolicy", "")); |
| | 10586 | | if (_child != null) |
| | 10587 | | { |
| | 10588 | | _value.AccessPolicy = Azure.Storage.Files.Shares.Models.ShareAccessPolicy.FromXml(_child); |
| | 10589 | | } |
| | 10590 | | CustomizeFromXml(element, _value); |
| | 10591 | | return _value; |
| | 10592 | | } |
| | 10593 | |
|
| | 10594 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.ShareSi |
| | 10595 | | } |
| | 10596 | | } |
| | 10597 | | #endregion class ShareSignedIdentifier |
| | 10598 | |
|
| | 10599 | | #region class ShareSnapshotInfo |
| | 10600 | | namespace Azure.Storage.Files.Shares.Models |
| | 10601 | | { |
| | 10602 | | /// <summary> |
| | 10603 | | /// ShareSnapshotInfo |
| | 10604 | | /// </summary> |
| | 10605 | | public partial class ShareSnapshotInfo |
| | 10606 | | { |
| | 10607 | | /// <summary> |
| | 10608 | | /// This header is a DateTime value that uniquely identifies the share snapshot. The value of this header may be |
| | 10609 | | /// </summary> |
| | 10610 | | public string Snapshot { get; internal set; } |
| | 10611 | |
|
| | 10612 | | /// <summary> |
| | 10613 | | /// The ETag contains a value which represents the version of the share snapshot, in quotes. A share snapshot ca |
| | 10614 | | /// </summary> |
| | 10615 | | public Azure.ETag ETag { get; internal set; } |
| | 10616 | |
|
| | 10617 | | /// <summary> |
| | 10618 | | /// Returns the date and time the share was last modified. A share snapshot cannot be modified, so the last modi |
| | 10619 | | /// </summary> |
| | 10620 | | public System.DateTimeOffset LastModified { get; internal set; } |
| | 10621 | |
|
| | 10622 | | /// <summary> |
| | 10623 | | /// Prevent direct instantiation of ShareSnapshotInfo instances. |
| | 10624 | | /// You can use ShareModelFactory.ShareSnapshotInfo instead. |
| | 10625 | | /// </summary> |
| | 10626 | | internal ShareSnapshotInfo() { } |
| | 10627 | | } |
| | 10628 | |
|
| | 10629 | | /// <summary> |
| | 10630 | | /// ShareModelFactory provides utilities for mocking. |
| | 10631 | | /// </summary> |
| | 10632 | | public static partial class ShareModelFactory |
| | 10633 | | { |
| | 10634 | | /// <summary> |
| | 10635 | | /// Creates a new ShareSnapshotInfo instance for mocking. |
| | 10636 | | /// </summary> |
| | 10637 | | public static ShareSnapshotInfo ShareSnapshotInfo( |
| | 10638 | | string snapshot, |
| | 10639 | | Azure.ETag eTag, |
| | 10640 | | System.DateTimeOffset lastModified) |
| | 10641 | | { |
| | 10642 | | return new ShareSnapshotInfo() |
| | 10643 | | { |
| | 10644 | | Snapshot = snapshot, |
| | 10645 | | ETag = eTag, |
| | 10646 | | LastModified = lastModified, |
| | 10647 | | }; |
| | 10648 | | } |
| | 10649 | | } |
| | 10650 | | } |
| | 10651 | | #endregion class ShareSnapshotInfo |
| | 10652 | |
|
| | 10653 | | #region class ShareStatistics |
| | 10654 | | namespace Azure.Storage.Files.Shares.Models |
| | 10655 | | { |
| | 10656 | | /// <summary> |
| | 10657 | | /// Stats for the share. |
| | 10658 | | /// </summary> |
| | 10659 | | public partial class ShareStatistics |
| | 10660 | | { |
| | 10661 | | /// <summary> |
| | 10662 | | /// The approximate size of the data stored in bytes, rounded up to the nearest gigabyte. Note that this value m |
| | 10663 | | /// </summary> |
| | 10664 | | public long ShareUsageInBytes { get; internal set; } |
| | 10665 | |
|
| | 10666 | | /// <summary> |
| | 10667 | | /// Prevent direct instantiation of ShareStatistics instances. |
| | 10668 | | /// You can use ShareModelFactory.ShareStatistics instead. |
| | 10669 | | /// </summary> |
| | 10670 | | internal ShareStatistics() { } |
| | 10671 | |
|
| | 10672 | | /// <summary> |
| | 10673 | | /// Deserializes XML into a new ShareStatistics instance. |
| | 10674 | | /// </summary> |
| | 10675 | | /// <param name="element">The XML element to deserialize.</param> |
| | 10676 | | /// <returns>A deserialized ShareStatistics instance.</returns> |
| | 10677 | | internal static Azure.Storage.Files.Shares.Models.ShareStatistics FromXml(System.Xml.Linq.XElement element) |
| | 10678 | | { |
| | 10679 | | System.Diagnostics.Debug.Assert(element != null); |
| | 10680 | | System.Xml.Linq.XElement _child; |
| | 10681 | | Azure.Storage.Files.Shares.Models.ShareStatistics _value = new Azure.Storage.Files.Shares.Models.ShareStatis |
| | 10682 | | _child = element.Element(System.Xml.Linq.XName.Get("ShareUsageBytes", "")); |
| | 10683 | | if (_child != null) |
| | 10684 | | { |
| | 10685 | | _value.ShareUsageInBytes = long.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 10686 | | } |
| | 10687 | | CustomizeFromXml(element, _value); |
| | 10688 | | return _value; |
| | 10689 | | } |
| | 10690 | |
|
| | 10691 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.ShareSt |
| | 10692 | | } |
| | 10693 | |
|
| | 10694 | | /// <summary> |
| | 10695 | | /// ShareModelFactory provides utilities for mocking. |
| | 10696 | | /// </summary> |
| | 10697 | | public static partial class ShareModelFactory |
| | 10698 | | { |
| | 10699 | | /// <summary> |
| | 10700 | | /// Creates a new ShareStatistics instance for mocking. |
| | 10701 | | /// </summary> |
| | 10702 | | public static ShareStatistics ShareStatistics( |
| | 10703 | | long shareUsageInBytes) |
| | 10704 | | { |
| | 10705 | | return new ShareStatistics() |
| | 10706 | | { |
| | 10707 | | ShareUsageInBytes = shareUsageInBytes, |
| | 10708 | | }; |
| | 10709 | | } |
| | 10710 | | } |
| | 10711 | | } |
| | 10712 | | #endregion class ShareStatistics |
| | 10713 | |
|
| | 10714 | | #region class SharesSegment |
| | 10715 | | namespace Azure.Storage.Files.Shares.Models |
| | 10716 | | { |
| | 10717 | | /// <summary> |
| | 10718 | | /// An enumeration of shares. |
| | 10719 | | /// </summary> |
| | 10720 | | internal partial class SharesSegment |
| | 10721 | | { |
| | 10722 | | /// <summary> |
| | 10723 | | /// ServiceEndpoint |
| | 10724 | | /// </summary> |
| | 10725 | | public string ServiceEndpoint { get; internal set; } |
| | 10726 | |
|
| | 10727 | | /// <summary> |
| | 10728 | | /// Prefix |
| | 10729 | | /// </summary> |
| | 10730 | | public string Prefix { get; internal set; } |
| | 10731 | |
|
| | 10732 | | /// <summary> |
| | 10733 | | /// Marker |
| | 10734 | | /// </summary> |
| | 10735 | | public string Marker { get; internal set; } |
| | 10736 | |
|
| | 10737 | | /// <summary> |
| | 10738 | | /// MaxResults |
| | 10739 | | /// </summary> |
| | 10740 | | public int? MaxResults { get; internal set; } |
| | 10741 | |
|
| | 10742 | | /// <summary> |
| | 10743 | | /// ShareItems |
| | 10744 | | /// </summary> |
| | 10745 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.ShareItem> ShareItems { get; int |
| | 10746 | |
|
| | 10747 | | /// <summary> |
| | 10748 | | /// NextMarker |
| | 10749 | | /// </summary> |
| | 10750 | | public string NextMarker { get; internal set; } |
| | 10751 | |
|
| | 10752 | | /// <summary> |
| | 10753 | | /// Creates a new SharesSegment instance |
| | 10754 | | /// </summary> |
| | 10755 | | public SharesSegment() |
| | 10756 | | : this(false) |
| | 10757 | | { |
| | 10758 | | } |
| | 10759 | |
|
| | 10760 | | /// <summary> |
| | 10761 | | /// Creates a new SharesSegment instance |
| | 10762 | | /// </summary> |
| | 10763 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 10764 | | internal SharesSegment(bool skipInitialization) |
| | 10765 | | { |
| | 10766 | | if (!skipInitialization) |
| | 10767 | | { |
| | 10768 | | ShareItems = new System.Collections.Generic.List<Azure.Storage.Files.Shares.Models.ShareItem>(); |
| | 10769 | | } |
| | 10770 | | } |
| | 10771 | |
|
| | 10772 | | /// <summary> |
| | 10773 | | /// Deserializes XML into a new SharesSegment instance. |
| | 10774 | | /// </summary> |
| | 10775 | | /// <param name="element">The XML element to deserialize.</param> |
| | 10776 | | /// <returns>A deserialized SharesSegment instance.</returns> |
| | 10777 | | internal static Azure.Storage.Files.Shares.Models.SharesSegment FromXml(System.Xml.Linq.XElement element) |
| | 10778 | | { |
| | 10779 | | System.Diagnostics.Debug.Assert(element != null); |
| | 10780 | | System.Xml.Linq.XElement _child; |
| | 10781 | | System.Xml.Linq.XAttribute _attribute; |
| | 10782 | | Azure.Storage.Files.Shares.Models.SharesSegment _value = new Azure.Storage.Files.Shares.Models.SharesSegment |
| | 10783 | | _attribute = element.Attribute(System.Xml.Linq.XName.Get("ServiceEndpoint", "")); |
| | 10784 | | if (_attribute != null) |
| | 10785 | | { |
| | 10786 | | _value.ServiceEndpoint = _attribute.Value; |
| | 10787 | | } |
| | 10788 | | _child = element.Element(System.Xml.Linq.XName.Get("Prefix", "")); |
| | 10789 | | if (_child != null) |
| | 10790 | | { |
| | 10791 | | _value.Prefix = _child.Value; |
| | 10792 | | } |
| | 10793 | | _child = element.Element(System.Xml.Linq.XName.Get("Marker", "")); |
| | 10794 | | if (_child != null) |
| | 10795 | | { |
| | 10796 | | _value.Marker = _child.Value; |
| | 10797 | | } |
| | 10798 | | _child = element.Element(System.Xml.Linq.XName.Get("MaxResults", "")); |
| | 10799 | | if (_child != null) |
| | 10800 | | { |
| | 10801 | | _value.MaxResults = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); |
| | 10802 | | } |
| | 10803 | | _child = element.Element(System.Xml.Linq.XName.Get("Shares", "")); |
| | 10804 | | if (_child != null) |
| | 10805 | | { |
| | 10806 | | _value.ShareItems = System.Linq.Enumerable.ToList( |
| | 10807 | | System.Linq.Enumerable.Select( |
| | 10808 | | _child.Elements(System.Xml.Linq.XName.Get("Share", "")), |
| | 10809 | | e => Azure.Storage.Files.Shares.Models.ShareItem.FromXml(e))); |
| | 10810 | | } |
| | 10811 | | else |
| | 10812 | | { |
| | 10813 | | _value.ShareItems = new System.Collections.Generic.List<Azure.Storage.Files.Shares.Models.ShareItem>(); |
| | 10814 | | } |
| | 10815 | | _child = element.Element(System.Xml.Linq.XName.Get("NextMarker", "")); |
| | 10816 | | if (_child != null) |
| | 10817 | | { |
| | 10818 | | _value.NextMarker = _child.Value; |
| | 10819 | | } |
| | 10820 | | CustomizeFromXml(element, _value); |
| | 10821 | | return _value; |
| | 10822 | | } |
| | 10823 | |
|
| | 10824 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.SharesS |
| | 10825 | | } |
| | 10826 | | } |
| | 10827 | | #endregion class SharesSegment |
| | 10828 | |
|
| | 10829 | | #region class StorageClosedHandlesSegment |
| | 10830 | | namespace Azure.Storage.Files.Shares.Models |
| | 10831 | | { |
| | 10832 | | /// <summary> |
| | 10833 | | /// StorageClosedHandlesSegment |
| | 10834 | | /// </summary> |
| | 10835 | | public partial class StorageClosedHandlesSegment |
| | 10836 | | { |
| | 10837 | | /// <summary> |
| | 10838 | | /// A string describing next handle to be closed. It is returned when more handles need to be closed to complete |
| | 10839 | | /// </summary> |
| | 10840 | | public string Marker { get; internal set; } |
| | 10841 | |
|
| | 10842 | | /// <summary> |
| | 10843 | | /// Contains count of number of handles closed. |
| | 10844 | | /// </summary> |
| | 10845 | | public int NumberOfHandlesClosed { get; internal set; } |
| | 10846 | |
|
| | 10847 | | /// <summary> |
| | 10848 | | /// Contains count of number of handles that failed to close. |
| | 10849 | | /// </summary> |
| | 10850 | | public int NumberOfHandlesFailedToClose { get; internal set; } |
| | 10851 | |
|
| | 10852 | | /// <summary> |
| | 10853 | | /// Prevent direct instantiation of StorageClosedHandlesSegment instances. |
| | 10854 | | /// You can use ShareModelFactory.StorageClosedHandlesSegment instead. |
| | 10855 | | /// </summary> |
| | 10856 | | internal StorageClosedHandlesSegment() { } |
| | 10857 | | } |
| | 10858 | |
|
| | 10859 | | /// <summary> |
| | 10860 | | /// ShareModelFactory provides utilities for mocking. |
| | 10861 | | /// </summary> |
| | 10862 | | public static partial class ShareModelFactory |
| | 10863 | | { |
| | 10864 | | /// <summary> |
| | 10865 | | /// Creates a new StorageClosedHandlesSegment instance for mocking. |
| | 10866 | | /// </summary> |
| | 10867 | | public static StorageClosedHandlesSegment StorageClosedHandlesSegment( |
| | 10868 | | string marker, |
| | 10869 | | int numberOfHandlesClosed, |
| | 10870 | | int numberOfHandlesFailedToClose) |
| | 10871 | | { |
| | 10872 | | return new StorageClosedHandlesSegment() |
| | 10873 | | { |
| | 10874 | | Marker = marker, |
| | 10875 | | NumberOfHandlesClosed = numberOfHandlesClosed, |
| | 10876 | | NumberOfHandlesFailedToClose = numberOfHandlesFailedToClose, |
| | 10877 | | }; |
| | 10878 | | } |
| | 10879 | | } |
| | 10880 | | } |
| | 10881 | | #endregion class StorageClosedHandlesSegment |
| | 10882 | |
|
| | 10883 | | #region class StorageError |
| | 10884 | | namespace Azure.Storage.Files.Shares.Models |
| | 10885 | | { |
| | 10886 | | /// <summary> |
| | 10887 | | /// StorageError |
| | 10888 | | /// </summary> |
| | 10889 | | internal partial class StorageError |
| | 10890 | | { |
| | 10891 | | /// <summary> |
| | 10892 | | /// Message |
| | 10893 | | /// </summary> |
| | 10894 | | public string Message { get; internal set; } |
| | 10895 | |
|
| | 10896 | | /// <summary> |
| | 10897 | | /// Code |
| | 10898 | | /// </summary> |
| | 10899 | | public string Code { get; internal set; } |
| | 10900 | |
|
| | 10901 | | /// <summary> |
| | 10902 | | /// Prevent direct instantiation of StorageError instances. |
| | 10903 | | /// You can use ShareModelFactory.StorageError instead. |
| | 10904 | | /// </summary> |
| | 10905 | | internal StorageError() { } |
| | 10906 | |
|
| | 10907 | | /// <summary> |
| | 10908 | | /// Deserializes XML into a new StorageError instance. |
| | 10909 | | /// </summary> |
| | 10910 | | /// <param name="element">The XML element to deserialize.</param> |
| | 10911 | | /// <returns>A deserialized StorageError instance.</returns> |
| | 10912 | | internal static Azure.Storage.Files.Shares.Models.StorageError FromXml(System.Xml.Linq.XElement element) |
| | 10913 | | { |
| | 10914 | | System.Diagnostics.Debug.Assert(element != null); |
| | 10915 | | System.Xml.Linq.XElement _child; |
| | 10916 | | Azure.Storage.Files.Shares.Models.StorageError _value = new Azure.Storage.Files.Shares.Models.StorageError() |
| | 10917 | | _child = element.Element(System.Xml.Linq.XName.Get("Message", "")); |
| | 10918 | | if (_child != null) |
| | 10919 | | { |
| | 10920 | | _value.Message = _child.Value; |
| | 10921 | | } |
| | 10922 | | _child = element.Element(System.Xml.Linq.XName.Get("Code", "")); |
| | 10923 | | if (_child != null) |
| | 10924 | | { |
| | 10925 | | _value.Code = _child.Value; |
| | 10926 | | } |
| | 10927 | | CustomizeFromXml(element, _value); |
| | 10928 | | return _value; |
| | 10929 | | } |
| | 10930 | |
|
| | 10931 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.Storage |
| | 10932 | | } |
| | 10933 | | } |
| | 10934 | | #endregion class StorageError |
| | 10935 | |
|
| | 10936 | | #region class StorageHandlesSegment |
| | 10937 | | namespace Azure.Storage.Files.Shares.Models |
| | 10938 | | { |
| | 10939 | | /// <summary> |
| | 10940 | | /// An enumeration of handles. |
| | 10941 | | /// </summary> |
| | 10942 | | internal partial class StorageHandlesSegment |
| | 10943 | | { |
| | 10944 | | /// <summary> |
| | 10945 | | /// NextMarker |
| | 10946 | | /// </summary> |
| | 10947 | | public string NextMarker { get; internal set; } |
| | 10948 | |
|
| | 10949 | | /// <summary> |
| | 10950 | | /// Handles |
| | 10951 | | /// </summary> |
| | 10952 | | public System.Collections.Generic.IEnumerable<Azure.Storage.Files.Shares.Models.ShareFileHandle> Handles { get; |
| | 10953 | |
|
| | 10954 | | /// <summary> |
| | 10955 | | /// Creates a new StorageHandlesSegment instance |
| | 10956 | | /// </summary> |
| | 10957 | | public StorageHandlesSegment() |
| | 10958 | | : this(false) |
| | 10959 | | { |
| | 10960 | | } |
| | 10961 | |
|
| | 10962 | | /// <summary> |
| | 10963 | | /// Creates a new StorageHandlesSegment instance |
| | 10964 | | /// </summary> |
| | 10965 | | /// <param name="skipInitialization">Whether to skip initializing nested objects.</param> |
| | 10966 | | internal StorageHandlesSegment(bool skipInitialization) |
| | 10967 | | { |
| | 10968 | | if (!skipInitialization) |
| | 10969 | | { |
| | 10970 | | Handles = new System.Collections.Generic.List<Azure.Storage.Files.Shares.Models.ShareFileHandle>(); |
| | 10971 | | } |
| | 10972 | | } |
| | 10973 | |
|
| | 10974 | | /// <summary> |
| | 10975 | | /// Deserializes XML into a new StorageHandlesSegment instance. |
| | 10976 | | /// </summary> |
| | 10977 | | /// <param name="element">The XML element to deserialize.</param> |
| | 10978 | | /// <returns>A deserialized StorageHandlesSegment instance.</returns> |
| | 10979 | | internal static Azure.Storage.Files.Shares.Models.StorageHandlesSegment FromXml(System.Xml.Linq.XElement element |
| | 10980 | | { |
| | 10981 | | System.Diagnostics.Debug.Assert(element != null); |
| | 10982 | | System.Xml.Linq.XElement _child; |
| | 10983 | | Azure.Storage.Files.Shares.Models.StorageHandlesSegment _value = new Azure.Storage.Files.Shares.Models.Stora |
| | 10984 | | _child = element.Element(System.Xml.Linq.XName.Get("NextMarker", "")); |
| | 10985 | | if (_child != null) |
| | 10986 | | { |
| | 10987 | | _value.NextMarker = _child.Value; |
| | 10988 | | } |
| | 10989 | | _child = element.Element(System.Xml.Linq.XName.Get("Entries", "")); |
| | 10990 | | if (_child != null) |
| | 10991 | | { |
| | 10992 | | _value.Handles = System.Linq.Enumerable.ToList( |
| | 10993 | | System.Linq.Enumerable.Select( |
| | 10994 | | _child.Elements(System.Xml.Linq.XName.Get("Handle", "")), |
| | 10995 | | e => Azure.Storage.Files.Shares.Models.ShareFileHandle.FromXml(e))); |
| | 10996 | | } |
| | 10997 | | else |
| | 10998 | | { |
| | 10999 | | _value.Handles = new System.Collections.Generic.List<Azure.Storage.Files.Shares.Models.ShareFileHandle>( |
| | 11000 | | } |
| | 11001 | | CustomizeFromXml(element, _value); |
| | 11002 | | return _value; |
| | 11003 | | } |
| | 11004 | |
|
| | 11005 | | static partial void CustomizeFromXml(System.Xml.Linq.XElement element, Azure.Storage.Files.Shares.Models.Storage |
| | 11006 | | } |
| | 11007 | | } |
| | 11008 | | #endregion class StorageHandlesSegment |
| | 11009 | | #endregion Models |
| | 11010 | |
|