/// <summary>
            /// <para>Updates the health policy of the given repair task.</para>
            /// </summary>
            /// <param name="repairTaskId">
            /// <para>The ID of the repair task for which the health policy is to be updated.</para>
            /// </param>
            /// <param name="version">
            /// <para>The current version number of the repair task. If non-zero, then the request will only succeed if this value matches the actual current value of the repair task. If zero, then no version check is performed.</para>
            /// </param>
            /// <param name="performPreparingHealthCheck">
            /// <para>
            /// A nullable boolean indicating if health check is to be performed in the Preparing stage of the repair task.
            /// Specify <c>null</c> for this parameter if the existing value should not be altered. Else, specify the appropriate <c>bool</c> value.
            /// </para>
            /// </param>
            /// <param name="performRestoringHealthCheck">
            /// <para>
            /// A nullable boolean indicating if health check is to be performed in the Restoring stage of the repair task.
            /// Specify <c>null</c> for this parameter if the existing value should not be altered. Else, specify the appropriate <c>bool</c> value.
            /// </para>
            /// </param>
            /// <param name="timeout">
            /// <para>The maximum amount of time Service Fabric will allow this operation to continue before returning a <see cref="System.TimeoutException" />.</para>
            /// </param>
            /// <param name="cancellationToken">
            /// <para>The optional cancellation token that the operation is observing. It can be used to send a notification that the operation should be canceled. Note that cancellation is advisory and that the operation may still be completed even if it is cancelled.</para>
            /// </param>
            /// <returns>
            /// <para>A task representing the asynchronous operation.</para>
            /// </returns>
            public Task <Int64> UpdateRepairTaskHealthPolicyAsync(
                string repairTaskId,
                Int64 version,
                bool?performPreparingHealthCheck,
                bool?performRestoringHealthCheck,
                TimeSpan timeout,
                CancellationToken cancellationToken)
            {
                this.fabricClient.ThrowIfDisposed();
                Requires.Argument("repairTaskId", repairTaskId).NotNull();

                var requestDescription = new RepairTaskHealthPolicyUpdateDescription(
                    DefaultScope,
                    repairTaskId,
                    version,
                    performPreparingHealthCheck,
                    performRestoringHealthCheck);

                return(Utility.WrapNativeAsyncInvokeInMTA <Int64>(
                           callback => this.UpdateRepairTaskHealthPolicyAsyncBeginWrapper(
                               requestDescription,
                               timeout,
                               callback),
                           this.UpdateRepairTaskHealthPolicyAsyncEndWrapper,
                           cancellationToken,
                           "RepairManagementClient.UpdateRepairTaskHealthPolicyAsync"));
            }
 private NativeCommon.IFabricAsyncOperationContext UpdateRepairTaskHealthPolicyAsyncBeginWrapper(
     RepairTaskHealthPolicyUpdateDescription requestDescription,
     TimeSpan timeout,
     NativeCommon.IFabricAsyncOperationCallback callback)
 {
     using (var pin = new PinCollection())
     {
         return(this.nativeRepairClient.BeginUpdateRepairTaskHealthPolicy(
                    requestDescription.ToNative(pin),
                    Utility.ToMilliseconds(timeout, "timeout"),
                    callback));
     }
 }