namespace Microsoft.Azure.Management.RecoveryServices.Backup
{
    using System.Threading.Tasks;
   using Microsoft.Rest.Azure;
   using Models;

    /// <summary>
    /// Extension methods for ExportJobsOperationResultsOperations.
    /// </summary>
    public static partial class ExportJobsOperationResultsOperationsExtensions
    {
            /// <summary>
            /// Fetches the result of the operation triggered by the Export Job API.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='vaultName'>
            /// The name of the recovery services vault.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group where the recovery services vault is
            /// present.
            /// </param>
            /// <param name='operationId'>
            /// OperationID which represents the export job.
            /// </param>
            public static OperationResultInfoBaseResource Get(this IExportJobsOperationResultsOperations operations, string vaultName, string resourceGroupName, string operationId)
            {
                return System.Threading.Tasks.Task.Factory.StartNew(s => ((IExportJobsOperationResultsOperations)s).GetAsync(vaultName, resourceGroupName, operationId), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Fetches the result of the operation triggered by the Export Job API.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='vaultName'>
            /// The name of the recovery services vault.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group where the recovery services vault is
            /// present.
            /// </param>
            /// <param name='operationId'>
            /// OperationID which represents the export job.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async System.Threading.Tasks.Task<OperationResultInfoBaseResource> GetAsync(this IExportJobsOperationResultsOperations operations, string vaultName, string resourceGroupName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
            {
                using (var _result = await operations.GetWithHttpMessagesAsync(vaultName, resourceGroupName, operationId, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

    }
}
