Beispiel #1
0
        public void CanPatchPoolByDeletingAppPkgRefs()
        {
            var poolId = Guid.NewGuid().ToString();
            var client = new BatchServiceClient(new Uri(Url), new BatchSharedKeyCredential(AccountName, AccountKey));

            var poolAddParameter = new PoolAddParameter(poolId, "small", "4");

            poolAddParameter.ApplicationPackageReferences = new[]
            {
                new ApplicationPackageReference {
                    ApplicationId = AppPackageIdOne, Version = "1.0"
                },
                new ApplicationPackageReference {
                    ApplicationId = AppPackageIdTwo
                },
            };

            try
            {
                client.Pool.AddAsync(poolAddParameter).Wait();

                var patchParams = new PoolPatchParameter();
                patchParams.ApplicationPackageReferences = new ApplicationPackageReference[] { };
                var updateResponse = client.Pool.PatchWithHttpMessagesAsync(poolId, patchParams).Result;
                Assert.Equal(HttpStatusCode.OK, updateResponse.Response.StatusCode);

                var pool = client.Pool.GetAsync(poolId).Result;
                Assert.Equal(poolId, pool.Id);
                Assert.Null(pool.ApplicationPackageReferences);
            }
            finally
            {
                TestUtilities.DeletePoolIfExistsNoThrow(client, poolId, output);
            }
        }
 public virtual Response Patch(string poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions, CancellationToken cancellationToken = default)
 {
     return(RestClient.Patch(poolId, poolPatchParameter, poolPatchOptions, cancellationToken).GetRawResponse());
 }
 public virtual async Task <Response> PatchAsync(string poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions, CancellationToken cancellationToken = default)
 {
     return((await RestClient.PatchAsync(poolId, poolPatchParameter, poolPatchOptions, cancellationToken).ConfigureAwait(false)).GetRawResponse());
 }
Beispiel #4
0
 /// <summary>
 /// Updates the properties of the specified Pool.
 /// </summary>
 /// <remarks>
 /// This only replaces the Pool properties specified in the request. For
 /// example, if the Pool has a StartTask associated with it, and a request does
 /// not specify a StartTask element, then the Pool keeps the existing
 /// StartTask.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='poolId'>
 /// The ID of the Pool to update.
 /// </param>
 /// <param name='poolPatchParameter'>
 /// The parameters for the request.
 /// </param>
 /// <param name='poolPatchOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <PoolPatchHeaders> PatchAsync(this IPoolOperations operations, string poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions = default(PoolPatchOptions), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.PatchWithHttpMessagesAsync(poolId, poolPatchParameter, poolPatchOptions, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Headers);
     }
 }
Beispiel #5
0
 /// <summary>
 /// Updates the properties of the specified Pool.
 /// </summary>
 /// <remarks>
 /// This only replaces the Pool properties specified in the request. For
 /// example, if the Pool has a StartTask associated with it, and a request does
 /// not specify a StartTask element, then the Pool keeps the existing
 /// StartTask.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='poolId'>
 /// The ID of the Pool to update.
 /// </param>
 /// <param name='poolPatchParameter'>
 /// The parameters for the request.
 /// </param>
 /// <param name='poolPatchOptions'>
 /// Additional parameters for the operation
 /// </param>
 public static PoolPatchHeaders Patch(this IPoolOperations operations, string poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions = default(PoolPatchOptions))
 {
     return(operations.PatchAsync(poolId, poolPatchParameter, poolPatchOptions).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Updates the properties of a pool.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='poolId'>
 /// The id of the pool to update.
 /// </param>
 /// <param name='poolPatchParameter'>
 /// The parameters for the request.
 /// </param>
 /// <param name='poolPatchOptions'>
 /// Additional parameters for the operation
 /// </param>
 public static PoolPatchHeaders Patch(this IPoolOperations operations, string poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions = default(PoolPatchOptions))
 {
     return(System.Threading.Tasks.Task.Factory.StartNew(s => ((IPoolOperations)s).PatchAsync(poolId, poolPatchParameter, poolPatchOptions), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }