| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for license information. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using System.Collections.Generic; |
| | 6 | | using System.Linq; |
| | 7 | | using System.Text; |
| | 8 | | using System.Threading.Tasks; |
| | 9 | |
|
| | 10 | | namespace Microsoft.Azure.Batch |
| | 11 | | { |
| | 12 | | /// <summary> |
| | 13 | | /// Tools and utilities for the Azure Batch Service. |
| | 14 | | /// </summary> |
| | 15 | | public class Utilities : IInheritedBehaviors |
| | 16 | | { |
| | 17 | | #region constructors |
| | 18 | |
|
| 0 | 19 | | private Utilities() |
| | 20 | | { |
| 0 | 21 | | } |
| | 22 | |
|
| 3 | 23 | | internal Utilities(BatchClient parentBatchClient, IEnumerable<BatchClientBehavior> baseBehaviors) |
| | 24 | | { |
| 3 | 25 | | this.ParentBatchClient = parentBatchClient; |
| | 26 | |
|
| | 27 | | // inherit the base behaviors |
| 3 | 28 | | InheritUtil.InheritClientBehaviorsAndSetPublicProperty(this, baseBehaviors); |
| 3 | 29 | | } |
| | 30 | |
|
| | 31 | | #endregion constructors |
| | 32 | |
|
| | 33 | | #region IInheritedBehaviors |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Gets or sets a list of behaviors that modify or customize requests to the Batch service |
| | 37 | | /// made via this <see cref="Utilities"/>. |
| | 38 | | /// </summary> |
| | 39 | | /// <remarks> |
| | 40 | | /// <para>These behaviors are inherited by child objects.</para> |
| | 41 | | /// <para>Modifications are applied in the order of the collection. The last write wins.</para> |
| | 42 | | /// </remarks> |
| 6 | 43 | | public IList<BatchClientBehavior> CustomBehaviors { get; set; } |
| | 44 | |
|
| | 45 | | #endregion IInheritedBehaviors |
| | 46 | |
|
| | 47 | | #region Utilities |
| | 48 | |
|
| | 49 | | /// <summary> |
| | 50 | | /// Creates an TaskStateMonitor. |
| | 51 | | /// </summary> |
| | 52 | | /// <returns>A <see cref="TaskStateMonitor"/> instance.</returns> |
| | 53 | | public TaskStateMonitor CreateTaskStateMonitor() |
| | 54 | | { |
| 3 | 55 | | TaskStateMonitor tsm = new TaskStateMonitor(this, this.CustomBehaviors); |
| | 56 | |
|
| 3 | 57 | | return tsm; |
| | 58 | | } |
| | 59 | |
|
| | 60 | | #endregion Utilities |
| | 61 | |
|
| | 62 | | #region internal/private |
| | 63 | |
|
| 6 | 64 | | internal BatchClient ParentBatchClient { get; set; } |
| | 65 | |
|
| | 66 | | #endregion internal/private |
| | 67 | |
|
| | 68 | | } |
| | 69 | | } |