/// <summary> /// Gets information about the specified application. /// </summary> /// <param name="applicationId">The id of the application to get.</param> /// <param name="detailLevel">A <see cref="DetailLevel"/> used for controlling which properties are retrieved from the service.</param> /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are applied to the Batch service request after the <see cref="CustomBehaviors"/> and <paramref name="detailLevel"/>.</param> /// <returns>An <see cref="ApplicationSummary"/> containing information about the specified application.</returns> /// <remarks>This is a blocking operation. For a non-blocking equivalent, see <see cref="GetApplicationSummaryAsync"/>.</remarks> public ApplicationSummary GetApplicationSummary(string applicationId, DetailLevel detailLevel = null, IEnumerable <BatchClientBehavior> additionalBehaviors = null) { Task <ApplicationSummary> asyncTask = GetApplicationSummaryAsync(applicationId, detailLevel, additionalBehaviors); ApplicationSummary applicationSummary = asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors); return(applicationSummary); }
internal PSApplicationSummary(Microsoft.Azure.Batch.ApplicationSummary omObject) { if ((omObject == null)) { throw new System.ArgumentNullException("omObject"); } this.omObject = omObject; }
/// <summary> /// Gets information about the specified application. /// </summary> /// <param name="applicationId">The id of the application to get.</param> /// <param name="detailLevel">A <see cref="DetailLevel"/> used for controlling which properties are retrieved from the service.</param> /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are applied to the Batch service request after the <see cref="CustomBehaviors"/> and <paramref name="detailLevel"/>.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynchronous operation.</param> /// <returns>An <see cref="ApplicationSummary"/> containing information about the specified application.</returns> /// <remarks>The get application operation runs asynchronously.</remarks> public async System.Threading.Tasks.Task <ApplicationSummary> GetApplicationSummaryAsync(string applicationId, DetailLevel detailLevel = null, IEnumerable <BatchClientBehavior> additionalBehaviors = null, CancellationToken cancellationToken = default(CancellationToken)) { // create the behavior manager BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors, detailLevel); // start call to server var asyncTask = this.ParentBatchClient.ProtocolLayer.GetApplicationSummary(applicationId, bhMgr, cancellationToken); var response = await asyncTask.ConfigureAwait(continueOnCapturedContext : false); // construct object model ApplicationSummary ApplicationSummary applicationSummary = new ApplicationSummary(response.Body); return(applicationSummary); }
public async Task GetApplicationSummaryAsyncTest() { const string applicationId = "blender.exe"; const string displayName = "blender"; IList <string> versions = new[] { "1.0", "1.5" }; BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); using (BatchClient client = await BatchClient.OpenAsync(credentials)) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor( baseRequest => { var request = (Protocol.BatchRequest <Models.ApplicationGetOptions, AzureOperationResponse <Models.ApplicationSummary, Models.ApplicationGetHeaders> >)baseRequest; request.ServiceRequestFunc = (token) => { var response = new AzureOperationResponse <Models.ApplicationSummary, Models.ApplicationGetHeaders> { Body = new Models.ApplicationSummary { Id = applicationId, DisplayName = displayName, Versions = versions } }; return(Task.FromResult(response)); }; }); Microsoft.Azure.Batch.ApplicationSummary applicationSummary = client.ApplicationOperations.GetApplicationSummaryAsync(applicationId, additionalBehaviors: new List <BatchClientBehavior> { interceptor }).Result; Assert.Equal(applicationId, applicationSummary.Id); Assert.Equal(displayName, applicationSummary.DisplayName); Assert.Equal(versions.First(), applicationSummary.Versions.First()); } }