Ejemplo n.º 1
0
        public virtual PSApplication AddApplication(string resourceGroupName, string accountName, string applicationId, bool?allowUpdates, string displayName)
        {
            if (string.IsNullOrEmpty(resourceGroupName))
            {
                // use resource mgr to see if account exists and then use resource group name to do the actual lookup
                resourceGroupName = GetGroupForAccount(accountName);
            }

            AddApplicationParameters addApplicationParameters = new AddApplicationParameters()
            {
                DisplayName  = displayName,
                AllowUpdates = allowUpdates
            };

            var response = BatchManagementClient.Application.AddApplication(
                resourceGroupName,
                accountName,
                applicationId,
                addApplicationParameters);

            return(ConvertApplicationToPSApplication(response));
        }
 /// <summary>
 /// Adds an application to the specified Batch account.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group that contains the Batch account.
 /// </param>
 /// <param name='accountName'>
 /// The name of the Batch account.
 /// </param>
 /// <param name='applicationId'>
 /// The id of the application.
 /// </param>
 /// <param name='parameters'>
 /// The parameters for the request.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Application> AddApplicationAsync(this IApplicationOperations operations, string resourceGroupName, string accountName, string applicationId, AddApplicationParameters parameters = default(AddApplicationParameters), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.AddApplicationWithHttpMessagesAsync(resourceGroupName, accountName, applicationId, parameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Adds an application to the specified Batch account.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group that contains the Batch account.
 /// </param>
 /// <param name='accountName'>
 /// The name of the Batch account.
 /// </param>
 /// <param name='applicationId'>
 /// The id of the application.
 /// </param>
 /// <param name='parameters'>
 /// The parameters for the request.
 /// </param>
 public static Application AddApplication(this IApplicationOperations operations, string resourceGroupName, string accountName, string applicationId, AddApplicationParameters parameters = default(AddApplicationParameters))
 {
     return(Task.Factory.StartNew(s => ((IApplicationOperations)s).AddApplicationAsync(resourceGroupName, accountName, applicationId, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Adds an application to the specified account.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Batch.IApplicationOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group that contains the Batch
 /// account.
 /// </param>
 /// <param name='accountName'>
 /// Required. The name of the Batch account.
 /// </param>
 /// <param name='applicationId'>
 /// Required. The id of the application.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters for the request.
 /// </param>
 /// <returns>
 /// Response to an ApplicationOperations.AddApplicationResponse request.
 /// </returns>
 public static Task <AddApplicationResponse> AddApplicationAsync(this IApplicationOperations operations, string resourceGroupName, string accountName, string applicationId, AddApplicationParameters parameters)
 {
     return(operations.AddApplicationAsync(resourceGroupName, accountName, applicationId, parameters, CancellationToken.None));
 }