From 059e340256e48355c0ef4b18813e2e2ab0034911 Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Wed, 1 Aug 2018 13:53:13 -0700 Subject: [PATCH 01/10] Increase client side timeout for some server requests - Requests whose default timeouts are 2m should have a client side timeout longer than 2m. --- src/SDKs/Batch/DataPlane/Azure.Batch/Constants.cs | 6 ++++++ .../Protocol/BatchRequests/NamedBatchRequests.cs | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Constants.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Constants.cs index c7347b7859d2f..4b77b97b049e2 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Constants.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Constants.cs @@ -40,6 +40,12 @@ public static class Constants /// request. /// public static readonly TimeSpan DefaultSingleRestRequestClientTimeout = TimeSpan.FromSeconds(60); + + /// + /// The default amount of time to wait for a response from the Batch service before automatically cancelling the + /// request. This is used for "long running" requests such as get file and bulk add task. + /// + public static readonly TimeSpan DefaultLongRestRequestClientTimeout = TimeSpan.FromSeconds(180); } internal static class InternalConstants diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchRequests/NamedBatchRequests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchRequests/NamedBatchRequests.cs index aba7c366b4ce6..544d23e4ddf25 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchRequests/NamedBatchRequests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchRequests/NamedBatchRequests.cs @@ -574,6 +574,7 @@ public FileGetFromTaskBatchRequest( BatchServiceClient serviceClient, CancellationToken cancellationToken) : base(serviceClient, cancellationToken) { + this.Timeout = Constants.DefaultLongRestRequestClientTimeout; } } @@ -634,6 +635,7 @@ public FileGetFromComputeNodeBatchRequest( BatchServiceClient serviceClient, CancellationToken cancellationToken) : base(serviceClient, cancellationToken) { + this.Timeout = Constants.DefaultLongRestRequestClientTimeout; } } @@ -1676,6 +1678,7 @@ public TaskAddBatchRequest( TaskAddParameter parameters, CancellationToken cancellationToken) : base(serviceClient, parameters, cancellationToken) { + this.Timeout = Constants.DefaultLongRestRequestClientTimeout; } } From fee90138a727443df2b73c9d9539c66757142912 Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Wed, 1 Aug 2018 13:59:25 -0700 Subject: [PATCH 02/10] Stop doing hacky %5C/%2F handling in shared key auth - The underlying server bug/behavior which caused us to need to do this has been fixed in the latest REST API version. --- .../DataPlane/Azure.Batch/Protocol/BatchSharedKeyCredential.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchSharedKeyCredential.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchSharedKeyCredential.cs index d37fca67fa247..2a86fbe172b7d 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchSharedKeyCredential.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchSharedKeyCredential.cs @@ -133,8 +133,7 @@ public override Task ProcessHttpRequestAsync(HttpRequestMessage httpRequest, Can signature.Append(canonicalHeader).Append(':').Append(value).Append('\n'); } - // We temporary change client side auth code generator to bypass server bug 4092533 - signature.Append('/').Append(AccountName).Append('/').Append(httpRequest.RequestUri.AbsolutePath.TrimStart('/').Replace("%5C", "/").Replace("%2F", "/")); + signature.Append('/').Append(AccountName).Append('/').Append(httpRequest.RequestUri.AbsolutePath.TrimStart('/')); if (!string.IsNullOrEmpty(httpRequest.RequestUri.Query)) { #if FullNetFx From 58d2675b80bce6df1de32b15f0db6fd0549fb7b9 Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Wed, 1 Aug 2018 16:54:53 -0700 Subject: [PATCH 03/10] Fix bug where sharedkey auth fails in netcoreapp 2.1 - This is due to https://github.com/dotnet/corefx/issues/31172 --- .../HttpClientBehaviorTests.cs | 4 ---- .../Protocol/BatchSharedKeyCredential.cs | 19 +++++++------------ 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/HttpClientBehaviorTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/HttpClientBehaviorTests.cs index ce450a5925d27..10df48f575b0c 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/HttpClientBehaviorTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/HttpClientBehaviorTests.cs @@ -74,12 +74,8 @@ private static void AssertRequestHasExpectedContentLength(HttpMethod httpMethod, } else if (httpMethod == HttpMethod.Delete || httpMethod == new HttpMethod("PATCH") || httpMethod == HttpMethod.Options) { -#if !FullNetFx - Assert.DoesNotContain(ctx.Request.Headers.Keys, str => str == "Content-Length"); -#else Assert.Contains(ctx.Request.Headers.Keys, str => str == "Content-Length"); Assert.Equal("0", ctx.Request.Headers["Content-Length"].Single()); -#endif } else if (httpMethod == HttpMethod.Post || httpMethod == HttpMethod.Put) { diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchSharedKeyCredential.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchSharedKeyCredential.cs index 2a86fbe172b7d..034cfd1bf0447 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchSharedKeyCredential.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Protocol/BatchSharedKeyCredential.cs @@ -27,6 +27,8 @@ public class BatchSharedKeyCredential : ServiceClientCredentials { private const string OCPDateHeaderString = "ocp-date"; + private static readonly byte[] EmptyArray = new byte[0]; + /// /// Gets the Batch account name. /// @@ -78,19 +80,12 @@ public override Task ProcessHttpRequestAsync(HttpRequestMessage httpRequest, Can if (contentLength == null) { - // Because C# httpRequest adds a content-length = 0 header for DELETE, PATCH, and OPTIONS even if there is no body (but only in netframework), we have to - // sign the request knowing that there will be content-length set. -#if FullNetFx - if (httpRequest.Method == HttpMethod.Delete || httpRequest.Method == new HttpMethod("PATCH") || httpRequest.Method == HttpMethod.Options) - { - contentLength = 0; - } -#endif - - // Because C# httpRequest adds a content-length = 0 header for POST even if there is no body, we have to - // sign the request knowing that there will be content-length set. - if (httpRequest.Method == HttpMethod.Post) + // C# in .NET Framework adds a content-lenth = 0 reader for DELETE, PATH, OPTIONS, and POST, so we need to manually set the content-length to 0 + // Because of https://github.com/dotnet/corefx/issues/31172 netstandard/netcore has different behavior depending on version, so we purpusefully set + // httoRequest.Content to an empty array to froce inclusion of content-length = 0 on all versions. + if (httpRequest.Method == HttpMethod.Delete || httpRequest.Method == new HttpMethod("PATCH") || httpRequest.Method == HttpMethod.Options || httpRequest.Method == HttpMethod.Post) { + httpRequest.Content = new ByteArrayContent(EmptyArray); contentLength = 0; } } From 597d0cc0bfa76f85d786081afa97dbac36e516ea Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Thu, 2 Aug 2018 14:01:25 -0700 Subject: [PATCH 04/10] Add CopyNodeFileContentToStream and CopyNodeFileContentToString - This allows callers to bypass a superfluous GetFileProperties call if they're really interested in performance when downloading files. --- .../NodeFileIntegrationTests.cs | 88 +++++++----- .../Batch/DataPlane/Azure.Batch/CloudTask.cs | 97 +++++++++++++ .../DataPlane/Azure.Batch/ComputeNode.cs | 98 ++++++++++++- .../DataPlane/Azure.Batch/JobOperations.cs | 133 ++++++++++++++++++ .../Batch/DataPlane/Azure.Batch/NodeFile.cs | 23 +-- .../DataPlane/Azure.Batch/PoolOperations.cs | 131 +++++++++++++++++ .../Azure.Batch/UtilitiesInternal.cs | 30 ++++ 7 files changed, 547 insertions(+), 53 deletions(-) diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/NodeFileIntegrationTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/NodeFileIntegrationTests.cs index c3271ee19458b..3ef54fe55343d 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/NodeFileIntegrationTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/NodeFileIntegrationTests.cs @@ -157,12 +157,11 @@ public void Bug230385SupportDeleteNodeFileByTask() // //Delete single file - const string stdOutFileName = "stdout.txt"; - NodeFile file = batchCli.JobOperations.GetNodeFile(jobId, taskId, stdOutFileName); + NodeFile file = batchCli.JobOperations.GetNodeFile(jobId, taskId, Constants.StandardOutFileName); file.Delete(); //Ensure delete succeeded - TestUtilities.AssertThrows(() => batchCli.JobOperations.GetNodeFile(jobId, taskId, stdOutFileName)); + TestUtilities.AssertThrows(() => batchCli.JobOperations.GetNodeFile(jobId, taskId, Constants.StandardOutFileName)); //Delete directory @@ -176,12 +175,11 @@ public void Bug230385SupportDeleteNodeFileByTask() // // JobScheduleOperations delete task file // - const string stdErrFileName = "stderr.txt"; - batchCli.JobOperations.GetNodeFile(jobId, taskId, stdErrFileName); - batchCli.JobOperations.DeleteNodeFile(jobId, taskId, stdErrFileName); + batchCli.JobOperations.GetNodeFile(jobId, taskId, Constants.StandardErrorFileName); + batchCli.JobOperations.DeleteNodeFile(jobId, taskId, Constants.StandardErrorFileName); //Ensure delete succeeded - TestUtilities.AssertThrows(() => batchCli.JobOperations.GetNodeFile(jobId, taskId, stdErrFileName)); + TestUtilities.AssertThrows(() => batchCli.JobOperations.GetNodeFile(jobId, taskId, Constants.StandardErrorFileName)); //Delete directory directory = batchCli.JobOperations.ListNodeFiles(jobId, directoryCreationTaskId2, recursive: true).First(item => item.Path.Contains(directoryNameTwo)); @@ -203,13 +201,13 @@ public void Bug230385SupportDeleteNodeFileByTask() [Fact] [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.MediumDuration)] - public void Bug1771166_1771181_1771038_GetListDeleteNodeFile() + public void TestNode_GetListDeleteFiles() { Action test = () => { using (BatchClient batchCli = TestUtilities.OpenBatchClientAsync(TestUtilities.GetCredentialsFromEnvironment()).Result) { - string jobId = "Bug1771166Job-" + TestUtilities.GetMyName(); + string jobId = "TestNodeGetListDeleteFiles-" + TestUtilities.GetMyName(); try { @@ -246,10 +244,10 @@ public void Bug1771166_1771181_1771038_GetListDeleteNodeFile() TaskStateMonitor taskStateMonitor = utilities.CreateTaskStateMonitor(); taskStateMonitor.WaitAll( - boundJob.ListTasks(), - Microsoft.Azure.Batch.Common.TaskState.Completed, - TimeSpan.FromMinutes(3)); - + boundJob.ListTasks(), + Microsoft.Azure.Batch.Common.TaskState.Completed, + TimeSpan.FromMinutes(3)); + CloudTask boundTask = boundJob.GetTask(taskId); //Since the compute node name comes back as "Node:" we need to split on : to get the actual compute node name string computeNodeId = boundTask.ComputeNodeInformation.AffinityId.Split(':')[1]; @@ -312,12 +310,22 @@ public void Bug1771166_1771181_1771038_GetListDeleteNodeFile() // // Get file from operations // - string filePathToGet = fileListFromComputeNode.First(f => !f.IsDirectory.Value).Path; + string filePathToGet = fileListFromComputeNode.First(f => !f.IsDirectory.Value && f.Properties.ContentLength > 0).Path; this.testOutputHelper.WriteLine("Getting file: {0}", filePathToGet); NodeFile computeNodeFileFromManager = batchCli.PoolOperations.GetNodeFile(this.poolFixture.PoolId, computeNodeId, filePathToGet); this.testOutputHelper.WriteLine("Successfully retrieved file: {0}", filePathToGet); this.testOutputHelper.WriteLine("---- File data: ----"); - this.testOutputHelper.WriteLine(computeNodeFileFromManager.ReadAsString()); + var computeNodeFileContentFromManager = computeNodeFileFromManager.ReadAsString(); + this.testOutputHelper.WriteLine(computeNodeFileContentFromManager); + Assert.NotEmpty(computeNodeFileContentFromManager); + + // + // Get file directly from operations (bypassing the properties call) + // + var computeNodeFileContentDirect = batchCli.PoolOperations.CopyNodeFileContentToString(this.poolFixture.PoolId, computeNodeId, filePathToGet); + this.testOutputHelper.WriteLine("---- File data: ----"); + this.testOutputHelper.WriteLine(computeNodeFileContentDirect); + Assert.NotEmpty(computeNodeFileContentDirect); // // Get file from compute node @@ -326,13 +334,22 @@ public void Bug1771166_1771181_1771038_GetListDeleteNodeFile() NodeFile fileFromComputeNode = computeNode.GetNodeFile(filePathToGet); this.testOutputHelper.WriteLine("Successfully retrieved file: {0}", filePathToGet); this.testOutputHelper.WriteLine("---- File data: ----"); - this.testOutputHelper.WriteLine(fileFromComputeNode.ReadAsString()); + var computeNodeFileContentFromNode = fileFromComputeNode.ReadAsString(); + this.testOutputHelper.WriteLine(computeNodeFileContentFromNode); + Assert.NotEmpty(computeNodeFileContentFromNode); + + // + // Get file from compute node (bypassing the properties call) + // + computeNodeFileContentDirect = computeNode.CopyNodeFileContentToString(filePathToGet); + this.testOutputHelper.WriteLine("---- File data: ----"); + this.testOutputHelper.WriteLine(computeNodeFileContentDirect); + Assert.NotEmpty(computeNodeFileContentDirect); // // NodeFile delete // - const string stdOutFileName = "stdout.txt"; - string filePath = Path.Combine(@"workitems", jobId, "job-1", taskId, stdOutFileName); + string filePath = Path.Combine(@"workitems", jobId, "job-1", taskId, Constants.StandardOutFileName); NodeFile nodeFile = batchCli.PoolOperations.GetNodeFile(this.poolFixture.PoolId, computeNodeId, filePath); nodeFile.Delete(); @@ -353,14 +370,13 @@ public void Bug1771166_1771181_1771038_GetListDeleteNodeFile() // // PoolManager delete node file // - const string stdErrFileName = "stderr.txt"; - filePath = Path.Combine(@"workitems", jobId, "job-1", taskId, stdErrFileName); + filePath = Path.Combine(@"workitems", jobId, "job-1", taskId, Constants.StandardErrorFileName); - NodeFile file = batchCli.JobOperations.GetNodeFile(jobId, taskId, stdErrFileName); + NodeFile file = batchCli.JobOperations.GetNodeFile(jobId, taskId, Constants.StandardErrorFileName); batchCli.PoolOperations.DeleteNodeFile(this.poolFixture.PoolId, computeNodeId, filePath); //Ensure delete succeeded - TestUtilities.AssertThrows(() => batchCli.JobOperations.GetNodeFile(jobId, taskId, stdErrFileName)); + TestUtilities.AssertThrows(() => batchCli.JobOperations.GetNodeFile(jobId, taskId, Constants.StandardErrorFileName)); //Delete directory directory = batchCli.PoolOperations.ListNodeFiles(this.poolFixture.PoolId, computeNodeId, recursive: true).First(item => item.Path.Contains(directoryNameTwo)); @@ -485,14 +501,13 @@ public void Bug1480491NodeFileFileProperties() // // NodeFile by task // - const string stdOutFileName = "stdout.txt"; - NodeFile file = batchCli.JobOperations.GetNodeFile(jobId, taskId, stdOutFileName); + NodeFile file = batchCli.JobOperations.GetNodeFile(jobId, taskId, Constants.StandardOutFileName); - this.testOutputHelper.WriteLine("File {0} has content length: {1}", stdOutFileName, file.Properties.ContentLength); - this.testOutputHelper.WriteLine("File {0} has content type: {1}", stdOutFileName, file.Properties.ContentType); + this.testOutputHelper.WriteLine("File {0} has content length: {1}", Constants.StandardOutFileName, file.Properties.ContentLength); + this.testOutputHelper.WriteLine("File {0} has content type: {1}", Constants.StandardOutFileName, file.Properties.ContentType); - this.testOutputHelper.WriteLine("File {0} has creation time: {1}", stdOutFileName, file.Properties.CreationTime); - this.testOutputHelper.WriteLine("File {0} has last modified time: {1}", stdOutFileName, file.Properties.LastModified); + this.testOutputHelper.WriteLine("File {0} has creation time: {1}", Constants.StandardOutFileName, file.Properties.CreationTime); + this.testOutputHelper.WriteLine("File {0} has last modified time: {1}", Constants.StandardOutFileName, file.Properties.LastModified); Assert.Equal(expectedFileSize, file.Properties.ContentLength); Assert.Equal("application/octet-stream", file.Properties.ContentType); @@ -513,7 +528,7 @@ public void Bug1480491NodeFileFileProperties() this.testOutputHelper.WriteLine("Found file: {0}", nodeFile.Path); } - string filePathToGet = string.Format("workitems/{0}/{1}/{2}/{3}", jobId, "job-1", taskId, stdOutFileName); + string filePathToGet = string.Format("workitems/{0}/{1}/{2}/{3}", jobId, "job-1", taskId, Constants.StandardOutFileName); file = computeNode.GetNodeFile(filePathToGet); this.testOutputHelper.WriteLine("File {0} has content length: {1}", filePathToGet, file.Properties.ContentLength); @@ -537,7 +552,7 @@ public void Bug1480491NodeFileFileProperties() [Fact] [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.MediumDuration)] - public void Bug1501413TestGetNodeFileByTask() + public void TestGetNodeFileByTask() { Action test = () => { @@ -545,7 +560,7 @@ public void Bug1501413TestGetNodeFileByTask() { JobOperations jobOperations = batchCli.JobOperations; - string jobId = Microsoft.Azure.Batch.Constants.DefaultConveniencePrefix + TestUtilities.GetMyName() + "-Bug1501413TestGetNodeFileByTask"; + string jobId = Constants.DefaultConveniencePrefix + TestUtilities.GetMyName() + "-" + nameof(TestGetNodeFileByTask); try { // @@ -585,7 +600,6 @@ public void Bug1501413TestGetNodeFileByTask() TaskStateMonitor taskStateMonitor = utilities.CreateTaskStateMonitor(); //Wait for the task state to be running - taskStateMonitor.WaitAll( jobOperations.ListTasks(jobId), TaskState.Completed, @@ -593,12 +607,14 @@ public void Bug1501413TestGetNodeFileByTask() //Download the data this.testOutputHelper.WriteLine("Downloading the stdout for the file"); - NodeFile file = jobOperations.GetNodeFile(jobId, taskId, "stdout.txt"); - - string data = file.ReadAsString(encoding: Encoding.UTF8); - + NodeFile file = jobOperations.GetNodeFile(jobId, taskId, Constants.StandardOutFileName); + string data = file.ReadAsString(); this.testOutputHelper.WriteLine("Data: {0}", data); + Assert.Contains(taskMessage, data); + // Download the data again using the JobOperations read file content helper + data = batchCli.JobOperations.CopyNodeFileContentToString(jobId, taskId, Constants.StandardOutFileName); + this.testOutputHelper.WriteLine("Data: {0}", data); Assert.Contains(taskMessage, data); } finally diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/CloudTask.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/CloudTask.cs index b50c133565ac2..f9d5450e11292 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/CloudTask.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/CloudTask.cs @@ -1,6 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. +using System.IO; +using System.Text; + namespace Microsoft.Azure.Batch { using System; @@ -354,6 +357,100 @@ public NodeFile GetNodeFile(string filePath, IEnumerable ad return file; } + /// + /// Copies the contents of a file in the task's directory from the node to the given . + /// + /// The path of the file to retrieve. + /// The stream to copy the file contents to. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. + /// A for controlling the lifetime of the asynchronous operation. + /// A object that represents the asynchronous operation. + public Task CopyNodeFileContentToStreamAsync( + string filePath, + Stream stream, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null, + CancellationToken cancellationToken = default(CancellationToken)) + { + // create the behavior manager + BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors); + Task asyncTask = this.parentBatchClient.PoolOperations.CopyNodeFileContentToStreamAsyncImpl( + this.parentJobId, + this.Id, + filePath, + stream, + byteRange, + bhMgr, + cancellationToken); + + return asyncTask; + } + + /// + /// Copies the contents of a file in the task's directory from the node to the given . + /// + /// The path of the file to retrieve. + /// The stream to copy the file contents to. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. + /// A bound object. + public void CopyNodeFileContentToStream( + string filePath, + Stream stream, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null) + { + Task asyncTask = this.CopyNodeFileContentToStreamAsync(filePath, stream, byteRange, additionalBehaviors); + asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors); + } + + /// + /// Reads the contents of a file in the task's directory on its compute node into a string. + /// + /// The path of the file to retrieve. + /// The encoding to use. If no value or null is specified, UTF8 is used. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. + /// A for controlling the lifetime of the asynchronous operation. + /// A object that represents the asynchronous operation. + public Task CopyNodeFileContentToStringAsync( + string filePath, + Encoding encoding = null, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null, + CancellationToken cancellationToken = default(CancellationToken)) + { + // create the behavior manager + BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors); + return this.parentBatchClient.PoolOperations.CopyNodeFileContentToStringAsyncImpl( + this.parentJobId, + this.Id, + filePath, + encoding, + byteRange, + bhMgr, + cancellationToken); + } + + /// + /// Reads the contents of a file in the task's directory on its compute node into a string. + /// + /// The path of the file to retrieve. + /// The encoding to use. If no value or null is specified, UTF8 is used. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. + /// A bound object. + public string CopyNodeFileContentToString( + string filePath, + Encoding encoding = null, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null) + { + Task asyncTask = this.CopyNodeFileContentToStringAsync(filePath, encoding, byteRange, additionalBehaviors); + return asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors); + } + #region IRefreshable /// diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/ComputeNode.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/ComputeNode.cs index e4892d3722644..ac0e39ec5f470 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/ComputeNode.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/ComputeNode.cs @@ -1,7 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace Microsoft.Azure.Batch +using System.Text; + +namespace Microsoft.Azure.Batch { using System; using System.Collections.Generic; @@ -299,6 +301,100 @@ public NodeFile GetNodeFile(string filePath, IEnumerable ad return asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors); } + /// + /// Copies the contents of a file from the node to the given . + /// + /// The path of the file to retrieve. + /// The stream to copy the file contents to. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. + /// A for controlling the lifetime of the asynchronous operation. + /// A object that represents the asynchronous operation. + public Task CopyNodeFileContentToStreamAsync( + string filePath, + Stream stream, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null, + CancellationToken cancellationToken = default(CancellationToken)) + { + // create the behavior manager + BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors); + Task asyncTask = this.parentBatchClient.PoolOperations.CopyNodeFileContentToStreamAsyncImpl( + this.parentPoolId, + this.Id, + filePath, + stream, + byteRange, + bhMgr, + cancellationToken); + + return asyncTask; + } + + /// + /// Copies the contents of a file from the node to the given . + /// + /// The path of the file to retrieve. + /// The stream to copy the file contents to. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. + /// A bound object. + public void CopyNodeFileContentToStream( + string filePath, + Stream stream, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null) + { + Task asyncTask = this.CopyNodeFileContentToStreamAsync(filePath, stream, byteRange, additionalBehaviors); + asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors); + } + + /// + /// Reads the contents of a file from the specified node into a string. + /// + /// The path of the file to retrieve. + /// The encoding to use. If no value or null is specified, UTF8 is used. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. + /// A for controlling the lifetime of the asynchronous operation. + /// A object that represents the asynchronous operation. + public Task CopyNodeFileContentToStringAsync( + string filePath, + Encoding encoding = null, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null, + CancellationToken cancellationToken = default(CancellationToken)) + { + // create the behavior manager + BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors); + return this.parentBatchClient.PoolOperations.CopyNodeFileContentToStringAsyncImpl( + this.parentPoolId, + this.Id, + filePath, + encoding, + byteRange, + bhMgr, + cancellationToken); + } + + /// + /// Reads the contents of a file from the specified node into a string. + /// + /// The path of the file to retrieve. + /// The encoding to use. If no value or null is specified, UTF8 is used. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. + /// A bound object. + public string CopyNodeFileContentToString( + string filePath, + Encoding encoding = null, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null) + { + Task asyncTask = this.CopyNodeFileContentToStringAsync(filePath, encoding, byteRange, additionalBehaviors); + return asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors); + } + /// /// Exposes synchronous and asynchronous enumeration of the files for the node. /// diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/JobOperations.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/JobOperations.cs index a0016be22f08d..faabd73e84ab5 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/JobOperations.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/JobOperations.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. +using System.IO; + namespace Microsoft.Azure.Batch { using System; @@ -871,6 +873,137 @@ public NodeFile GetNodeFile( return file; } + internal async Task CopyNodeFileContentToStreamAsyncImpl( + string jobId, + string taskId, + string filePath, + Stream stream, + GetFileRequestByteRange byteRange, + BehaviorManager bhMgr, + CancellationToken cancellationToken) + { + await this.ParentBatchClient.ProtocolLayer.GetNodeFileByTask( + jobId, + taskId, + filePath, + stream, + byteRange, + bhMgr, + cancellationToken).ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copies the contents of a file from the specified task's directory on its compute node to the given . + /// + /// The id of the job containing the task. + /// The id of the task. + /// The path of the file to retrieve. + /// The stream to copy the file contents to. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of instances that are applied to the Batch service request after the . + /// A for controlling the lifetime of the asynchronous operation. + /// The get file operation runs asynchronously. + public Task CopyNodeFileContentToStreamAsync( + string jobId, + string taskId, + string filePath, + Stream stream, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null, + CancellationToken cancellationToken = default(CancellationToken)) + { + // set up behavior manager + BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors); + return this.CopyNodeFileContentToStreamAsyncImpl(jobId, taskId, filePath, stream, byteRange, bhMgr, cancellationToken); + } + + /// + /// Copies the contents of a file from the specified task's directory on its compute node to the given . + /// + /// The id of the job containing the task. + /// The id of the task. + /// The path of the file to retrieve. + /// The stream to copy the file contents to. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of instances that are applied to the Batch service request after the . + /// This is a blocking operation. For a non-blocking equivalent, see . + public void CopyNodeFileContentToStream( + string jobId, + string taskId, + string filePath, + Stream stream, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null) + { + Task asyncTask = this.CopyNodeFileContentToStreamAsync(jobId, taskId, filePath, stream, byteRange, additionalBehaviors); + asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors); + } + + internal Task CopyNodeFileContentToStringAsyncImpl( + string jobId, + string taskId, + string filePath, + Encoding encoding, + GetFileRequestByteRange byteRange, + BehaviorManager bhMgr, + CancellationToken cancellationToken) + { + return UtilitiesInternal.ReadNodeFileAsStringAsync( + // Note that behaviors is purposefully dropped in the below call since it's already managed by the bhMgr + (stream, bRange, behaviors, ct) => this.CopyNodeFileContentToStreamAsyncImpl(jobId, taskId, filePath, stream, bRange, bhMgr, ct), + encoding, + byteRange, + additionalBehaviors: null, + cancellationToken: cancellationToken); + } + + /// + /// Reads the contents of a file from the specified task's directory on its compute node into a string. + /// + /// The id of the job containing the task. + /// The id of the task. + /// The path of the file to retrieve. + /// The encoding to use. If no value or null is specified, UTF8 is used. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of instances that are applied to the Batch service request after the . + /// A for controlling the lifetime of the asynchronous operation. + /// The contents of the file, as a string + public Task CopyNodeFileContentToStringAsync( + string jobId, + string taskId, + string filePath, + Encoding encoding = null, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null, + CancellationToken cancellationToken = default(CancellationToken)) + { + // set up behavior manager + BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors); + return CopyNodeFileContentToStringAsyncImpl(jobId, taskId, filePath, encoding, byteRange, bhMgr, cancellationToken); + } + + /// + /// Reads the contents of a file from the specified task's directory on its compute node into a string. + /// + /// The id of the job containing the task. + /// The id of the task. + /// The path of the file to retrieve. + /// The encoding to use. If no value or null is specified, UTF8 is used. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of instances that are applied to the Batch service request after the . + /// The contents of the file, as a string + public string CopyNodeFileContentToString( + string jobId, + string taskId, + string filePath, + Encoding encoding = null, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null) + { + Task asyncTask = this.CopyNodeFileContentToStringAsync(jobId, taskId, filePath, encoding, byteRange, additionalBehaviors); + return asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors); + } + /// /// Deletes the specified file from the task's directory on its compute node. /// diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/NodeFile.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/NodeFile.cs index 32a82e415bbcb..471543002072e 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/NodeFile.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/NodeFile.cs @@ -116,27 +116,18 @@ public string Url /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. /// A for controlling the lifetime of the asynchronous operation. /// A object that represents the asynchronous operation. - public async Task ReadAsStringAsync( + public Task ReadAsStringAsync( Encoding encoding = null, GetFileRequestByteRange byteRange = null, IEnumerable additionalBehaviors = null, CancellationToken cancellationToken = default(CancellationToken)) { - using(Stream streamToUse = new MemoryStream()) - { - // get the data - System.Threading.Tasks.Task asyncTask = CopyToStreamAsync(streamToUse, byteRange, additionalBehaviors, cancellationToken); - - // wait for completion - await asyncTask.ConfigureAwait(continueOnCapturedContext: false); - - streamToUse.Seek(0, SeekOrigin.Begin); //We just wrote to this stream, have to seek to the beginning - - // convert to string - string result = UtilitiesInternal.StreamToString(streamToUse, encoding); - - return result; - } + return UtilitiesInternal.ReadNodeFileAsStringAsync( + CopyToStreamAsync, + encoding, + byteRange, + additionalBehaviors, + cancellationToken); } /// diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/PoolOperations.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/PoolOperations.cs index af0eac0291091..0c9e90433be9a 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/PoolOperations.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/PoolOperations.cs @@ -1617,6 +1617,137 @@ public NodeFile GetNodeFile(string poolId, string computeNodeId, string filePath return asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors); } + internal async Task CopyNodeFileContentToStreamAsyncImpl( + string poolId, + string computeNodeId, + string filePath, + Stream stream, + GetFileRequestByteRange byteRange, + BehaviorManager bhMgr, + CancellationToken cancellationToken) + { + await this.ParentBatchClient.ProtocolLayer.GetNodeFileByNode( + poolId, + computeNodeId, + filePath, + stream, + byteRange, + bhMgr, + cancellationToken).ConfigureAwait(continueOnCapturedContext: false); + } + + /// + /// Copies the contents of a file from the specified node to the given . + /// + /// The id of the pool that contains the compute node. + /// The id of the compute node. + /// The path of the file to retrieve. + /// The stream to copy the file contents to. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of instances that are applied to the Batch service request after the . + /// A for controlling the lifetime of the asynchronous operation. + /// The get file operation runs asynchronously. + public Task CopyNodeFileContentToStreamAsync( + string poolId, + string computeNodeId, + string filePath, + Stream stream, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null, + CancellationToken cancellationToken = default(CancellationToken)) + { + // set up behavior manager + BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors); + return this.CopyNodeFileContentToStreamAsyncImpl(poolId, computeNodeId, filePath, stream, byteRange, bhMgr, cancellationToken); + } + + /// + /// Copies the contents of a file from the specified node to the given . + /// + /// The id of the pool that contains the compute node. + /// The id of the compute node. + /// The path of the file to retrieve. + /// The stream to copy the file contents to. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of instances that are applied to the Batch service request after the . + /// This is a blocking operation. For a non-blocking equivalent, see . + public void CopyNodeFileContentToStream( + string poolId, + string computeNodeId, + string filePath, + Stream stream, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null) + { + Task asyncTask = this.CopyNodeFileContentToStreamAsync(poolId, computeNodeId, filePath, stream, byteRange, additionalBehaviors); + asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors); + } + + internal Task CopyNodeFileContentToStringAsyncImpl( + string poolId, + string computeNodeId, + string filePath, + Encoding encoding, + GetFileRequestByteRange byteRange, + BehaviorManager bhMgr, + CancellationToken cancellationToken) + { + return UtilitiesInternal.ReadNodeFileAsStringAsync( + // Note that behaviors is purposefully dropped in the below call since it's already managed by the bhMgr + (stream, bRange, behaviors, ct) => this.CopyNodeFileContentToStreamAsyncImpl(poolId, computeNodeId, filePath, stream, bRange, bhMgr, ct), + encoding, + byteRange, + additionalBehaviors: null, + cancellationToken: cancellationToken); + } + + /// + /// Reads the contents of a file from the specified node into a string. + /// + /// The id of the pool that contains the compute node. + /// The id of the compute node. + /// The path of the file to retrieve. + /// The encoding to use. If no value or null is specified, UTF8 is used. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of instances that are applied to the Batch service request after the . + /// A for controlling the lifetime of the asynchronous operation. + /// The contents of the file, as a string + public Task CopyNodeFileContentToStringAsync( + string poolId, + string computeNodeId, + string filePath, + Encoding encoding = null, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null, + CancellationToken cancellationToken = default(CancellationToken)) + { + // set up behavior manager + BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors); + return CopyNodeFileContentToStringAsyncImpl(poolId, computeNodeId, filePath, encoding, byteRange, bhMgr, cancellationToken); + } + + /// + /// Reads the contents of a file from the specified node into a string. + /// + /// The id of the pool that contains the compute node. + /// The id of the compute node. + /// The path of the file to retrieve. + /// The encoding to use. If no value or null is specified, UTF8 is used. + /// A byte range defining what section of the file to copy. If omitted, the entire file is downloaded. + /// A collection of instances that are applied to the Batch service request after the . + /// The contents of the file, as a string + public string CopyNodeFileContentToString( + string poolId, + string computeNodeId, + string filePath, + Encoding encoding = null, + GetFileRequestByteRange byteRange = null, + IEnumerable additionalBehaviors = null) + { + Task asyncTask = this.CopyNodeFileContentToStringAsync(poolId, computeNodeId, filePath, encoding, byteRange, additionalBehaviors); + return asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors); + } + internal IPagedEnumerable ListNodeFilesImpl( string poolId, string computeNodeId, diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/UtilitiesInternal.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/UtilitiesInternal.cs index 3bafb2b9f5db6..fbce0e5e8b077 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/UtilitiesInternal.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/UtilitiesInternal.cs @@ -521,6 +521,36 @@ internal static TProtocol[] GetTransportObjectIfChanged return null; } } + + /// + /// Begins asynchronous call to return the contents of the file as a string. + /// + /// The stream copy function. + /// The encoding used to interpret the file data. If no value or null is specified, UTF8 is used. + /// The file byte range to retrieve. If null, the entire file is retrieved. + /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. + /// A for controlling the lifetime of the asynchronous operation. + /// A object that represents the asynchronous operation. + internal static async Task ReadNodeFileAsStringAsync( + Func, CancellationToken, Task> copyStreamFunc, + Encoding encoding, + GetFileRequestByteRange byteRange, + IEnumerable additionalBehaviors, + CancellationToken cancellationToken) + { + using (Stream streamToUse = new MemoryStream()) + { + // get the data + Task asyncTask = copyStreamFunc(streamToUse, byteRange, additionalBehaviors, cancellationToken); + + // wait for completion + await asyncTask.ConfigureAwait(continueOnCapturedContext: false); + + streamToUse.Seek(0, SeekOrigin.Begin); //We just wrote to this stream, have to seek to the beginning + // convert to string + return StreamToString(streamToUse, encoding); + } + } } } From 84ccb46df8fcd569447ec3cbbc76f67ec5e7a8e3 Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Thu, 2 Aug 2018 14:54:41 -0700 Subject: [PATCH 05/10] Add default retry policy on BatchClient --- .../IntegrationTestUtilities/TestUtilities.cs | 5 +- .../Azure.Batch.Unit.Tests/.gitignore | 1 - .../AddTaskCollectionUnitTests.cs | 8 +- .../ApplicationPackageReferencesUnitTests.cs | 57 ++++++-------- .../ApplicationPackageUnitTests.cs | 13 +--- .../BatchRequestUnitTests.cs | 28 ++----- .../BindingStateConstraintUnitTests.cs | 24 ++---- .../ClientUnitTestCommon.cs | 9 ++- .../ConcurrentChangeTrackedListUnitTests.cs | 2 +- .../GetFileRequestByteRangeTests.cs | 2 +- .../InterceptorUnitTests.cs | 6 +- .../JobAutoTerminationUnitTests.cs | 8 +- .../Azure.Batch.Unit.Tests/PoolUnitTests.cs | 18 ++--- .../PropertyUnitTests.cs | 16 ++-- .../RetryPolicyUnitTests.cs | 13 ++-- .../TaskDependenciesUnitTests.cs | 7 +- .../UtilitiesUnitTests.cs | 6 +- .../DataPlane/Azure.Batch/BatchClient.cs | 74 ++++--------------- .../DataPlane/Azure.Batch/ProtocolLayer.cs | 9 +-- 19 files changed, 100 insertions(+), 206 deletions(-) delete mode 100644 src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/.gitignore diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/IntegrationTestUtilities/TestUtilities.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/IntegrationTestUtilities/TestUtilities.cs index 8ba025b701659..416b00e4cb27e 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/IntegrationTestUtilities/TestUtilities.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/IntegrationTestUtilities/TestUtilities.cs @@ -48,10 +48,9 @@ public static async Task OpenBatchClientAsync(BatchSharedKeyCredent //TODO: Disabled for now because the swagger spec does not accurately reflect all properties returned by the server //SetDeserializationSettings(client); - //Set up some common stuff like a retry policy - if (addDefaultRetryPolicy) + if (!addDefaultRetryPolicy) { - client.CustomBehaviors.Add(RetryPolicyProvider.LinearRetryProvider(TimeSpan.FromSeconds(3), 5)); + client.CustomBehaviors = client.CustomBehaviors.Where(behavior => !(behavior is RetryPolicyProvider)).ToList(); } return client; diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/.gitignore b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/.gitignore deleted file mode 100644 index 3602361dafeea..0000000000000 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -temp \ No newline at end of file diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/AddTaskCollectionUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/AddTaskCollectionUnitTests.cs index 3ec0c0d3813fd..652621c5a5faa 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/AddTaskCollectionUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/AddTaskCollectionUnitTests.cs @@ -30,7 +30,7 @@ public AddTaskCollectionUnitTests(ITestOutputHelper testOutputHelper) public async Task AddTaskCollectionNoHandlerThrows() { const string dummyJobId = "Dummy"; - using (BatchClient batchCli = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient batchCli = ClientUnitTestCommon.CreateDummyClient()) { //Clear the behaviors so that there is no way there is a AddTaskResultHandler defined batchCli.CustomBehaviors.Clear(); @@ -48,7 +48,7 @@ public async Task AddTaskCollectionNoHandlerThrows() public async Task AddTaskCollectionNullTaskThrows() { const string dummyJobId = "Dummy"; - using (BatchClient batchCli = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient batchCli = ClientUnitTestCommon.CreateDummyClient()) { ArgumentNullException exception = await Assert.ThrowsAsync(() => batchCli.JobOperations.AddTaskAsync(dummyJobId, new List { null })); string expectedString = string.Format(BatchErrorMessages.CollectionMustNotContainNull); @@ -118,7 +118,7 @@ public async Task ExceptionOnClientError_ResultingExceptionContainsDetails() const string expectedCode = "badness"; const string failingTaskId = "baz"; - using (BatchClient batchCli = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient batchCli = ClientUnitTestCommon.CreateDummyClient()) { var tasksToAdd = new List { @@ -166,7 +166,7 @@ private async static Task IssueAddTaskCollectionAndAssertExceptionIsExpectedA const string dummyJobId = "Dummy"; int taskCountToAdd = operationCount * Constants.MaxTasksInSingleAddTaskCollectionRequest; - using (BatchClient batchCli = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient batchCli = ClientUnitTestCommon.CreateDummyClient()) { AddExceptionGeneratingBehavior(batchCli, exceptionFactory); diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ApplicationPackageReferencesUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ApplicationPackageReferencesUnitTests.cs index 4128d6b5a2784..591103967501d 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ApplicationPackageReferencesUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ApplicationPackageReferencesUnitTests.cs @@ -27,9 +27,7 @@ public void GetPoolWithApplicationReferencesTest() const string applicationId = "blender.exe"; const string version = "blender"; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor( baseRequest => @@ -76,30 +74,27 @@ public async Task UpdateAPoolWithNewApplicationPackages() const string poolId = "mock-pool"; const string osFamily = "3"; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { - - Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor( - baseRequest => - { - Protocol.BatchRequests.PoolGetBatchRequest request = (Protocol.BatchRequests.PoolGetBatchRequest)baseRequest; - - request.ServiceRequestFunc = (token) => + Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor( + baseRequest => { - var response = new AzureOperationResponse + Protocol.BatchRequests.PoolGetBatchRequest request = (Protocol.BatchRequests.PoolGetBatchRequest)baseRequest; + + request.ServiceRequestFunc = (token) => { - Body = new Protocol.Models.CloudPool + var response = new AzureOperationResponse { - CurrentDedicatedNodes = 4, - CloudServiceConfiguration = new Models.CloudServiceConfiguration(osFamily), - Id = poolId - } + Body = new Protocol.Models.CloudPool + { + CurrentDedicatedNodes = 4, + CloudServiceConfiguration = new Models.CloudServiceConfiguration(osFamily), + Id = poolId + } + }; + return Task.FromResult(response); }; - return Task.FromResult(response); - }; - }); + }); Microsoft.Azure.Batch.CloudPool cloudPool = client.PoolOperations.GetPool("pool-id", additionalBehaviors: new List { interceptor }); @@ -141,9 +136,7 @@ public void CreateJobWithApplicationReferencesTest() const string version = "blender"; const string jobId = "mock-job"; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Microsoft.Azure.Batch.PoolInformation autoPoolSpecification = new Microsoft.Azure.Batch.PoolInformation { @@ -180,9 +173,7 @@ public async Task CreateJobScheduleWithApplicationPackageReferences() const string version = "blender"; const string jobId = "mock-job"; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor( baseRequest => @@ -238,8 +229,7 @@ public async Task GetPoolWithApplicationPackageReferences() const string version = "blender"; const string poolName = "test-pool"; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(baseRequest => { @@ -283,8 +273,7 @@ public async Task GetJobScheduleWithApplicationPackageReferences() const string applicationId = "app-1"; const string version = "1.0"; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(baseRequest => { @@ -411,9 +400,7 @@ public void CheckIfGetApplicationPackageReferencesIsReadableButNotWritableOnABou const string applicationId = "blender.exe"; const string version = "blender"; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor( baseRequest => diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ApplicationPackageUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ApplicationPackageUnitTests.cs index 7698ba172e7ce..34e3d1c9ecd42 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ApplicationPackageUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ApplicationPackageUnitTests.cs @@ -29,9 +29,7 @@ public async Task CheckListApplicationSummariesIsReturningAValidList() IList versions = new[] { "1.0", "1.5" }; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = await BatchClient.OpenAsync(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(baseRequest => { @@ -77,9 +75,7 @@ public async Task GetApplicationSummaryAsyncTest() IList versions = new[] { "1.0", "1.5" }; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = await BatchClient.OpenAsync(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor( baseRequest => @@ -121,10 +117,7 @@ public void GetApplicationSummaryTest() IList versions = new[] { "1.0", "1.5" }; - - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(baseRequest => { diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BatchRequestUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BatchRequestUnitTests.cs index 8cc622f2f518c..53a7bbd995052 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BatchRequestUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BatchRequestUnitTests.cs @@ -38,12 +38,7 @@ public BatchRequestUnitTests(ITestOutputHelper testOutputHelper) [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public async Task TestBatchClientDefaultHttpClientTimeoutInfinite() { - BatchSharedKeyCredentials credentials = new BatchSharedKeyCredentials( - ClientUnitTestCommon.DummyBaseUrl, - ClientUnitTestCommon.DummyAccountName, - ClientUnitTestCommon.DummyAccountKey); - - BatchClient batchClient = await BatchClient.OpenAsync(credentials); + BatchClient batchClient = ClientUnitTestCommon.CreateDummyClient(); Protocol.BatchServiceClient restClient = (Protocol.BatchServiceClient)typeof(ProtocolLayer).GetField("_client", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(batchClient.ProtocolLayer); Assert.Equal(Timeout.InfiniteTimeSpan, restClient.HttpClient.Timeout); @@ -103,9 +98,8 @@ public async Task TestBatchRequestUserTokenCancellationWithRetries() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public async Task TestDefaultBatchRequestTimeoutSet() { - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); TimeSpan requestTimeout = TimeSpan.MinValue; - using (BatchClient client = await BatchClient.OpenAsync(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(req => { @@ -142,8 +136,7 @@ public async Task TestBatchRequestRetryPolicyNotCalledOnCustomTokenTimeout() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.ShortDuration)] public async Task TestCancellationViaParameter() { - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = await BatchClient.OpenAsync(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { List objectsToExamineForMethods = new List() { @@ -174,8 +167,7 @@ public async Task TestCancellationViaParameter() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.ShortDuration)] public async Task TestCancellationViaParameterForLists() { - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = await BatchClient.OpenAsync(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { List objectsToExamineForMethods = new List() { @@ -236,12 +228,7 @@ public void TestBatchExceptionCreatedFromBatchErrorWithNoBody() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public async Task TestBatchRequestCannotBeModifiedAfterExecutionStarted() { - BatchSharedKeyCredentials credentials = new BatchSharedKeyCredentials( - ClientUnitTestCommon.DummyBaseUrl, - ClientUnitTestCommon.DummyAccountName, - ClientUnitTestCommon.DummyAccountKey); - - using (BatchClient batchClient = await BatchClient.OpenAsync(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient batchClient = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(req => { @@ -288,9 +275,6 @@ private async Task BatchRequestCancellationViaInterceptorTestAsync( int? expectedMaxRetries = null) { TimeSpan timeoutViaCancellationTokenValue = clientRequestTimeoutViaCustomToken ?? TimeSpan.Zero; - - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - TimeSpan? cancellationDuration = null; DateTime startTime = DateTime.UtcNow; @@ -323,7 +307,7 @@ private async Task BatchRequestCancellationViaInterceptorTestAsync( Assert.True(false, "Both clientRequestTimeoutViaCustomToken and clientRequestTimeoutViaTimeout cannot be null"); } - using (BatchClient client = await BatchClient.OpenAsync(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { //Add a retry policy to the client if required if (retryPolicy != null) diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BindingStateConstraintUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BindingStateConstraintUnitTests.cs index a8e8a5f18619b..000e6bf7db826 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BindingStateConstraintUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BindingStateConstraintUnitTests.cs @@ -35,8 +35,7 @@ public void Pool_WhenReturnedFromServer_HasExpectedUnboundProperties() const string cloudPoolDisplayName = "pool-display-name-test"; MetadataItem metadataItem = new MetadataItem("foo", "bar"); - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { CloudPool cloudPool = client.PoolOperations.CreatePool(cloudPoolId, virtualMachineSize, new CloudServiceConfiguration(osFamily)); cloudPool.DisplayName = cloudPoolDisplayName; @@ -78,8 +77,7 @@ public void Pool_WhenReturnedFromServer_HasExpectedBoundProperties() const string cloudPoolDisplayName = "pool-display-name-test"; MetadataItem metadataItem = new MetadataItem("foo", "bar"); - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Models.CloudPool protoPool = new Models.CloudPool(id: cloudPoolId, displayName: cloudPoolDisplayName, metadata: new[] { @@ -114,8 +112,7 @@ public void CloudJobSchedule_WhenSendingToTheServer_HasExpectedUnboundProperties const string displayName = "DisplayNameFoo"; MetadataItem metadataItem = new MetadataItem("foo", "bar"); - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { CloudJobSchedule jobSchedule = client.JobScheduleOperations.CreateJobSchedule(); jobSchedule.Id = jobScheduleId; @@ -163,8 +160,7 @@ public void CloudJobSchedule_WhenReturnedFromServer_HasExpectedBoundProperties() const string displayName = "DisplayNameFoo"; MetadataItem metadataItem = new MetadataItem("foo", "bar"); - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { DateTime creationTime = DateTime.Now; @@ -216,8 +212,7 @@ public void CloudJob_WhenSendingToTheServer_HasExpectedUnboundProperties() const string applicationId = "testApp"; const string applicationVersion = "beta"; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { CloudJob cloudJob = client.JobOperations.CreateJob(jobId, new PoolInformation { AutoPoolSpecification = new AutoPoolSpecification { KeepAlive = false }}); cloudJob.Id = jobId; @@ -266,9 +261,7 @@ public void CloudJob_WhenReturnedFromServer_HasExpectedBoundProperties() const int priority = 0; var onAllTasksComplete = OnAllTasksComplete.TerminateJob; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { DateTime creationTime = DateTime.Now; @@ -287,8 +280,6 @@ public void CloudJob_WhenReturnedFromServer_HasExpectedBoundProperties() CloudJob boundJob = client.JobOperations.GetJob(jobId, additionalBehaviors: InterceptorFactory.CreateGetJobRequestInterceptor(protoJob)); - - Assert.Equal(jobId, boundJob.Id); // reading is allowed from a job that is returned from the server. Assert.Equal(creationTime, boundJob.CreationTime); Assert.Equal(displayName, boundJob.DisplayName); @@ -324,8 +315,7 @@ public void CloudTask_WhenReturnedFromServer_HasExpectedBoundProperties() DependencyAction = Models.DependencyAction.Satisfy }; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Models.CloudTask cloudTask = new Models.CloudTask() { diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ClientUnitTestCommon.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ClientUnitTestCommon.cs index 4078f9c2d6913..726d5008cc8ca 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ClientUnitTestCommon.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ClientUnitTestCommon.cs @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -namespace Azure.Batch.Unit.Tests +namespace Azure.Batch.Unit.Tests { using System; using System.Collections.Generic; + using System.Linq; using System.Threading.Tasks; using Microsoft.Azure.Batch; using Microsoft.Azure.Batch.Auth; @@ -31,9 +32,13 @@ public static BatchSharedKeyCredentials CreateDummySharedKeyCredential() public static BatchClient CreateDummyClient() { - return BatchClient.Open(CreateDummySharedKeyCredential()); + var client = BatchClient.Open(CreateDummySharedKeyCredential()); + client.CustomBehaviors = client.CustomBehaviors.Where(behavior => !(behavior is RetryPolicyProvider)).ToList(); + + return client; } + public static IList SimulateServiceResponse(Func simulator) where TOptions : IOptions, new() where TResponse : class, IAzureOperationResponse diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ConcurrentChangeTrackedListUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ConcurrentChangeTrackedListUnitTests.cs index 7762ac3db20ee..6e9217c832279 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ConcurrentChangeTrackedListUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/ConcurrentChangeTrackedListUnitTests.cs @@ -27,7 +27,7 @@ public void Bug1910530_ConcurrentChangeTrackedListThreadsafeTest() { const string testName = "Bug1910530_ConcurrentChangeTrackedListThreadsafeTest"; - using(BatchClient batchCli = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using(BatchClient batchCli = ClientUnitTestCommon.CreateDummyClient()) { JobScheduleOperations jobScheduleOperations = batchCli.JobScheduleOperations; diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/GetFileRequestByteRangeTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/GetFileRequestByteRangeTests.cs index 2a891662bd48c..a751e5c7fb144 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/GetFileRequestByteRangeTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/GetFileRequestByteRangeTests.cs @@ -124,7 +124,7 @@ private async Task VerifyOcpRangeSetWhenDownloadingFileAsync< // properties" call to the Batch service and instead builds a fake NodeFile. BatchClientBehavior getFakeNodeFile = CreateFakeNodeFileInterceptor(); - using (BatchClient client = await BatchClient.OpenAsync(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { client.CustomBehaviors.Add(confirmByteRangeIsSet); client.CustomBehaviors.Add(getFakeNodeFile); diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/InterceptorUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/InterceptorUnitTests.cs index f93ebe1ea321c..77842f04a27bb 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/InterceptorUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/InterceptorUnitTests.cs @@ -57,7 +57,7 @@ public async Task TestSetBatchRequestServerTimeout() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public async Task TestRequestWhichDoesntSupportFilter() { - using (BatchClient client = await BatchClient.OpenAsync(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { BatchClientBehavior behavior = new Protocol.RequestInterceptor(request => { @@ -79,7 +79,7 @@ public async Task TestRequestWhichDoesntSupportFilter() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public async Task TestRequestWhichDoesSupportSelect() { - using (BatchClient client = await BatchClient.OpenAsync(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { ODATADetailLevel detailLevel = new ODATADetailLevel(selectClause: "foo"); bool wasHit = false; @@ -112,7 +112,7 @@ private async Task TestSetBatchRequestServerTimeoutHelperAsync(TimeSpan? clientT ? TimeSpan.FromSeconds(serverTimeoutInSeconds.Value) : TimeSpan.FromSeconds(DefaultServerTimeoutInSeconds); - using (BatchClient batchCli = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient batchCli = ClientUnitTestCommon.CreateDummyClient()) { batchCli.CustomBehaviors.Add(new BatchRequestTimeout(serverTimeout, clientTimeout)); batchCli.CustomBehaviors.Add(new Protocol.RequestInterceptor((req) => ConfirmTimeoutWasSetInterceptor(req, expectedClientTimeout, expectedServerTimeoutInSeconds))); diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/JobAutoTerminationUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/JobAutoTerminationUnitTests.cs index d00317424d58a..ee8f4dadb0b74 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/JobAutoTerminationUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/JobAutoTerminationUnitTests.cs @@ -28,9 +28,7 @@ public class JobAutoTerminationUnitTests [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public async Task UpdateBoundJobWithNewAutoTerminationPropertiesTest() { - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = await BatchClient.OpenAsync(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Models.CloudJob protoJob = new Models.CloudJob(id: "id", onAllTasksComplete: Models.OnAllTasksComplete.NoAction, onTaskFailure: Models.OnTaskFailure.PerformExitOptionsJobAction); @@ -51,9 +49,7 @@ public async Task ExitConditionsAreSentOnTask() const string jobId = "id-123"; const string taskId = "id-001"; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = await BatchClient.OpenAsync(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Models.CloudJob protoJob = new Models.CloudJob(id: jobId, onAllTasksComplete: Models.OnAllTasksComplete.NoAction, onTaskFailure: Models.OnTaskFailure.PerformExitOptionsJobAction); diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PoolUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PoolUnitTests.cs index 1b4f180be33db..e0709ef2b8f84 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PoolUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PoolUnitTests.cs @@ -25,9 +25,7 @@ public class PoolUnitTests [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public void GetPoolsListTest() { - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(baseRequest => { @@ -68,10 +66,8 @@ public void GetPoolTestNonNullProperties() { DateTime currentDateTime = DateTime.UtcNow; DateTime dateTimeMinusAnHour = currentDateTime.AddHours(-1); - - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(baseRequest => { @@ -173,8 +169,7 @@ public void GetPoolResizeError() var autoScaleError = new Models.AutoScaleRun { Error = autoScaleRunError }; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(baseRequest => { @@ -224,9 +219,7 @@ public void GetPoolStartTask() WaitForSuccess = false }; - - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(baseRequest => { @@ -262,8 +255,7 @@ public void ListComputeNodes() { var dateTime = DateTime.UtcNow; - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(baseRequest => { diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PropertyUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PropertyUnitTests.cs index 97301632d0b5f..8e420d6e1d47e 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PropertyUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PropertyUnitTests.cs @@ -327,7 +327,7 @@ private Protocol.Models.AuthenticationTokenSettings BuildAuthenticationTokenSett [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public void TestRandomBoundCloudPoolProperties() { - using (BatchClient client = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { for (int i = 0; i < TestRunCount; i++) { @@ -345,7 +345,7 @@ public void TestRandomBoundCloudPoolProperties() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public void TestRandomBoundCloudJobProperties() { - using (BatchClient client = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { for (int i = 0; i < TestRunCount; i++) { @@ -365,7 +365,7 @@ public void TestRandomBoundCloudJobProperties() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public void TestRandomBoundCloudJobScheduleProperties() { - using (BatchClient client = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { for (int i = 0; i < TestRunCount; i++) { @@ -384,7 +384,7 @@ public void TestRandomBoundCloudJobScheduleProperties() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public void TestRandomBoundCloudTaskProperties() { - using (BatchClient client = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { for (int i = 0; i < TestRunCount; i++) { @@ -402,7 +402,7 @@ public void TestRandomBoundCloudTaskProperties() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public void TestRandomBoundComputeNodeProperties() { - using (BatchClient client = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { for (int i = 0; i < TestRunCount; i++) { @@ -421,7 +421,7 @@ public void TestRandomBoundComputeNodeProperties() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public void TestRandomBoundCertificateProperties() { - using (BatchClient client = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { for (int i = 0; i < TestRunCount; i++) { @@ -440,7 +440,7 @@ public void TestRandomBoundCertificateProperties() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public void TestRandomBoundPrepReleaseTaskExecutionInformationProperties() { - using (BatchClient client = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { for (int i = 0; i < TestRunCount; i++) { @@ -588,7 +588,7 @@ private static IEnumerable GetTypesWhichImplementInterface(Assembly assemb [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public void Bug1432987CloudTaskTaskConstraints() { - using (BatchClient batchCli = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient batchCli = ClientUnitTestCommon.CreateDummyClient()) { CloudTask badTask = new CloudTask("bug1432987TaskConstraints", "hostname"); diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/RetryPolicyUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/RetryPolicyUnitTests.cs index a282a5cb1ae16..df33cfdc267b2 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/RetryPolicyUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/RetryPolicyUnitTests.cs @@ -31,10 +31,7 @@ public class RetryPolicyUnitTests public RetryPolicyUnitTests(ITestOutputHelper testOutputHelper) { this.testOutputHelper = testOutputHelper; - this.credentials = new Microsoft.Azure.Batch.Auth.BatchSharedKeyCredentials( - ClientUnitTestCommon.DummyBaseUrl, - ClientUnitTestCommon.DummyAccountName, - ClientUnitTestCommon.DummyAccountKey); + this.credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); } #region Built in Retry Policy Tests @@ -64,7 +61,7 @@ public async Task LinearRetryRetriesOnNonBatchException() RetryDecision retryDecision = await linearRetry.ShouldRetryAsync(timeoutException, new OperationContext()); Assert.Equal(interval, retryDecision.RetryDelay); - Assert.Equal(true, retryDecision.ShouldRetry); + Assert.True(retryDecision.ShouldRetry); } [Fact] @@ -81,7 +78,7 @@ public async Task LinearRetryRetriesOnBatchException() RetryDecision retryDecision = await linearRetry.ShouldRetryAsync(batchException, new OperationContext()); Assert.Equal(interval, retryDecision.RetryDelay); - Assert.Equal(true, retryDecision.ShouldRetry); + Assert.True(retryDecision.ShouldRetry); } [Fact] @@ -175,7 +172,7 @@ public async Task ExponentialRetryRetriesOnNonBatchException() RetryDecision retryDecision = await exponentialRetry.ShouldRetryAsync(timeoutException, context); Assert.Equal(interval, retryDecision.RetryDelay); - Assert.Equal(true, retryDecision.ShouldRetry); + Assert.True(retryDecision.ShouldRetry); } [Fact] @@ -195,7 +192,7 @@ public async Task ExponentialRetryRetriesOnBatchException() RetryDecision retryDecision = await exponentialRetry.ShouldRetryAsync(batchException, context); Assert.Equal(interval, retryDecision.RetryDelay); - Assert.Equal(true, retryDecision.ShouldRetry); + Assert.True(retryDecision.ShouldRetry); } [Fact] diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/TaskDependenciesUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/TaskDependenciesUnitTests.cs index 6bfe331fd2e01..ba336355bbf3f 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/TaskDependenciesUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/TaskDependenciesUnitTests.cs @@ -28,9 +28,8 @@ public void CannotSetUsesTaskDependenciesFromABoundCloudJob() const string jobId = "id-123"; const bool usesTaskDependencies = true; // Bound - BatchSharedKeyCredentials credentials = ClientUnitTestCommon.CreateDummySharedKeyCredential(); - using (BatchClient client = BatchClient.Open(credentials)) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor( baseRequest => @@ -60,7 +59,7 @@ public void CanReadUsesTaskDependenciesFromABoundCloudJobScheduleTest() const string jobId = "id-123"; const bool usesTaskDependencies = true; - using (BatchClient client = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor( baseRequest => @@ -91,7 +90,7 @@ public void CannotModifyUsesTaskDependenciesOnAJobScheduleAfterItHasBeenCommitte const bool usesTaskDependencies = true; - using (BatchClient client = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient client = ClientUnitTestCommon.CreateDummyClient()) { Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor( baseRequest => diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/UtilitiesUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/UtilitiesUnitTests.cs index 29dc3a7d3f534..b9f92abbbf690 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/UtilitiesUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/UtilitiesUnitTests.cs @@ -33,7 +33,7 @@ public async Task TaskStateMonitorCancellation() { TimeSpan timeout = TimeSpan.FromSeconds(.5); const string dummyJobId = "Dummy"; - using (BatchClient batchCli = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient batchCli = ClientUnitTestCommon.CreateDummyClient()) { List taskIds = new List() { @@ -104,7 +104,7 @@ public async Task TaskStateMonitorTimedOut_ThrowsTimeoutException() TimeSpan timeout = TimeSpan.FromSeconds(0); const string dummyJobId = "Dummy"; - using (BatchClient batchCli = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient batchCli = ClientUnitTestCommon.CreateDummyClient()) { List taskIds = new List() { @@ -135,7 +135,7 @@ public async Task TaskStateMonitorCancelled_ThrowsCancellationException() TimeSpan timeout = TimeSpan.FromSeconds(0); const string dummyJobId = "Dummy"; - using (BatchClient batchCli = BatchClient.Open(ClientUnitTestCommon.CreateDummySharedKeyCredential())) + using (BatchClient batchCli = ClientUnitTestCommon.CreateDummyClient()) { List taskIds = new List() { diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/BatchClient.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/BatchClient.cs index b86adbaae67cb..810216b55c426 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/BatchClient.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/BatchClient.cs @@ -32,44 +32,22 @@ internal class BatchClientDisposableStateBox public BatchClientDisposableStateBox(BatchClient parentBatchClient) { this._parentBatchClient = parentBatchClient; - this._applicationOperations = new Lazy(() => new ApplicationOperations(this._parentBatchClient, this.CustomBehaviors)); this._certificateOperations = new Lazy(() => new CertificateOperations(this._parentBatchClient, this.CustomBehaviors)); this._jobOperations = new Lazy(() => new JobOperations(this._parentBatchClient, this.CustomBehaviors)); this._jobScheduleOperations = new Lazy(() => new JobScheduleOperations(this._parentBatchClient, this.CustomBehaviors)); this._poolOperations = new Lazy(() => new PoolOperations(this._parentBatchClient, this.CustomBehaviors)); this._utilities = new Lazy(() => new Utilities(this._parentBatchClient, this.CustomBehaviors)); - } - - public ApplicationOperations ApplicationOperations - { - get { return this._applicationOperations.Value; } - } - - public CertificateOperations CertificateOperations - { - get { return this._certificateOperations.Value; } - } - public JobOperations JobOperations - { - get { return this._jobOperations.Value; } - } - - public JobScheduleOperations JobScheduleOperations - { - get { return this._jobScheduleOperations.Value; } + this.CustomBehaviors = new List(); } - public PoolOperations PoolOperations - { - get { return this._poolOperations.Value; } - } - - public Utilities Utilities - { - get { return this._utilities.Value; } - } + public ApplicationOperations ApplicationOperations => this._applicationOperations.Value; + public CertificateOperations CertificateOperations => this._certificateOperations.Value; + public JobOperations JobOperations => this._jobOperations.Value; + public JobScheduleOperations JobScheduleOperations => this._jobScheduleOperations.Value; + public PoolOperations PoolOperations => this._poolOperations.Value; + public Utilities Utilities => this._utilities.Value; } /// @@ -79,7 +57,7 @@ public class BatchClient : IDisposable { private BatchClientDisposableStateBox _disposableStateBox; // null state box signals that the instance is closed private bool _disposed = false; // used for dispose pattern - private object _closeLocker = new object(); + private readonly object _closeLocker = new object(); #region // constructors @@ -87,12 +65,10 @@ private BatchClient() { _disposableStateBox = new BatchClientDisposableStateBox(this); - // prepopulate the custom behaviors - _disposableStateBox.CustomBehaviors = new List(); - // // Add custom behaviors which are by default on every batch client // + this.CustomBehaviors.Add(RetryPolicyProvider.ExponentialRetryProvider(TimeSpan.FromSeconds(1), 6)); //Add default AddTaskResultHandler this.CustomBehaviors.Add(new AddTaskCollectionResultHandler(AddTaskCollectionResultHandler.DefaultAddTaskCollectionResultHandler)); @@ -156,51 +132,33 @@ public IList CustomBehaviors /// /// Gets an for performing application-related operations on the associated account. /// - public ApplicationOperations ApplicationOperations - { - get { return GetStateThrowIfNotOpen().ApplicationOperations; } - } + public ApplicationOperations ApplicationOperations => GetStateThrowIfNotOpen().ApplicationOperations; /// /// Gets a for performing certificate-related operations on the associated account. /// - public CertificateOperations CertificateOperations - { - get { return GetStateThrowIfNotOpen().CertificateOperations; } - } + public CertificateOperations CertificateOperations => GetStateThrowIfNotOpen().CertificateOperations; /// /// Gets a for performing job-related operations on the associated account. /// - public JobOperations JobOperations - { - get { return GetStateThrowIfNotOpen().JobOperations; } - } + public JobOperations JobOperations => GetStateThrowIfNotOpen().JobOperations; /// /// Gets a for performing job schedule-related operations on the associated account. /// - public JobScheduleOperations JobScheduleOperations - { - get { return GetStateThrowIfNotOpen().JobScheduleOperations; } - } + public JobScheduleOperations JobScheduleOperations => GetStateThrowIfNotOpen().JobScheduleOperations; /// /// Gets a for performing pool-related operations on the associated account. /// - public PoolOperations PoolOperations - { - get { return GetStateThrowIfNotOpen().PoolOperations; } - } + public PoolOperations PoolOperations => GetStateThrowIfNotOpen().PoolOperations; /// /// Gets a object containing utility methods for orchestrating multiple Batch operations. /// - public Utilities Utilities - { - get { return GetStateThrowIfNotOpen().Utilities; } - } - + public Utilities Utilities => GetStateThrowIfNotOpen().Utilities; + /// /// Creates an instance of associated with the specified credentials. /// diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/ProtocolLayer.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/ProtocolLayer.cs index a6f85b974eed3..41ec311e68b01 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/ProtocolLayer.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/ProtocolLayer.cs @@ -46,18 +46,13 @@ private static Models.NodeFile CreateNodeFileFromHeadersType(string filePath, Mo } #region // constructors - private ProtocolLayer() - { - } /// /// instantiate based on creds and base url /// - /// - /// - internal ProtocolLayer(string baseURL, ServiceClientCredentials credentials) + internal ProtocolLayer(string baseUrl, ServiceClientCredentials credentials) { - this._client = new Protocol.BatchServiceClient(new Uri(baseURL), credentials); + this._client = new Protocol.BatchServiceClient(new Uri(baseUrl), credentials); this._client.HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(InternalConstants.UserAgentProductName, typeof(ProtocolLayer).GetTypeInfo().Assembly.GetName().Version.ToString())); this._client.HttpClient.Timeout = Timeout.InfiniteTimeSpan; //Client side timeout will be set per-request From 90ababd3cc9c44e8505d828293fbe9670154bff4 Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Thu, 2 Aug 2018 15:19:21 -0700 Subject: [PATCH 06/10] Correct FileConventions error string --- .../Src/AzureBatchFileConventions/StoragePath.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SDKs/Batch/Support/FileConventions/Src/AzureBatchFileConventions/StoragePath.cs b/src/SDKs/Batch/Support/FileConventions/Src/AzureBatchFileConventions/StoragePath.cs index 28f7436f67217..34c3a08b9f673 100644 --- a/src/SDKs/Batch/Support/FileConventions/Src/AzureBatchFileConventions/StoragePath.cs +++ b/src/SDKs/Batch/Support/FileConventions/Src/AzureBatchFileConventions/StoragePath.cs @@ -61,7 +61,7 @@ public async Task SaveAsync( if (Path.IsPathRooted(relativePath)) { - throw new ArgumentException($"{nameof(relativePath)} must not be a relative path", nameof(relativePath)); + throw new ArgumentException($"{nameof(relativePath)} must be a relative path", nameof(relativePath)); } string sourcePath = Path.Combine(baseFolder.FullName, relativePath); @@ -129,7 +129,7 @@ public async Task SaveTrackedAsync(IOutputKind kind, string relativ if (Path.IsPathRooted(relativePath)) { - throw new ArgumentException($"{nameof(relativePath)} must not be a relative path", nameof(relativePath)); + throw new ArgumentException($"{nameof(relativePath)} must be a relative path", nameof(relativePath)); } var destinationPath = GetDestinationBlobPath(relativePath); From e320fc959435897e02cb8daaf35acdd122b013c8 Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Thu, 2 Aug 2018 17:27:36 -0700 Subject: [PATCH 07/10] Remove OpenAsync since we don't make any async calls - Nor do we plan to. --- .../AuthenticationTest.cs | 2 +- .../IntegrationTestUtilities/TestUtilities.cs | 2 +- .../BatchClientUnitTest.cs | 2 +- .../Azure.Batch.Unit.Tests/FileUnitTests.cs | 8 +- .../DataPlane/Azure.Batch/BatchClient.cs | 121 +++--------------- 5 files changed, 25 insertions(+), 110 deletions(-) diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/AuthenticationTest.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/AuthenticationTest.cs index d4164662c76c1..9ea255340288f 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/AuthenticationTest.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/AuthenticationTest.cs @@ -25,7 +25,7 @@ public async Task CanAuthenticateToServiceWithAADToken() { Func> tokenProvider = () => IntegrationTestCommon.GetAuthenticationTokenAsync("https://batch.core.windows.net/"); - using (var client = await BatchClient.OpenAsync(new BatchTokenCredentials(TestCommon.Configuration.BatchAccountUrl, tokenProvider))) + using (var client = BatchClient.Open(new BatchTokenCredentials(TestCommon.Configuration.BatchAccountUrl, tokenProvider))) { await client.JobOperations.ListJobs().ToListAsync(); } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/IntegrationTestUtilities/TestUtilities.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/IntegrationTestUtilities/TestUtilities.cs index 416b00e4cb27e..a9bd8e4cc2890 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/IntegrationTestUtilities/TestUtilities.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/IntegrationTestUtilities/TestUtilities.cs @@ -39,7 +39,7 @@ public static BatchSharedKeyCredentials GetCredentialsFromEnvironment() public static async Task OpenBatchClientAsync(BatchSharedKeyCredentials sharedKeyCredentials, bool addDefaultRetryPolicy = true) { - BatchClient client = await BatchClient.OpenAsync(sharedKeyCredentials); + BatchClient client = BatchClient.Open(sharedKeyCredentials); //Force us to get exception if the server returns something we don't expect //TODO: To avoid including this test assembly via "InternalsVisibleTo" we resort to some reflection trickery... maybe this property diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BatchClientUnitTest.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BatchClientUnitTest.cs index ee92b15838333..d211e7d487b0c 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BatchClientUnitTest.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/BatchClientUnitTest.cs @@ -111,7 +111,7 @@ public void TestBatchClientThrowsAfterClose() BatchClient batchCli = ClientUnitTestCommon.CreateDummyClient(); // close client and test - batchCli.Close(); + batchCli.Dispose(); TestBatchClientIsClosed(batchCli); } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/FileUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/FileUnitTests.cs index 6229c42e82b14..1aa98f148f724 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/FileUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/FileUnitTests.cs @@ -31,7 +31,7 @@ public FileUnitTests(ITestOutputHelper testOutputHelper) [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public async Task GetFilePropertiesFromTaskDoesNotThrowOutOfMemoryException() { - using (BatchClient client = await CreateBatchClientWithHandlerAsync()) + using (BatchClient client = CreateBatchClientWithHandler()) { NodeFile file = await client.JobOperations.GetNodeFileAsync("Foo", "Bar", "Baz"); Assert.Equal(StreamUnitTests.StreamLengthInBytes, file.Properties.ContentLength); @@ -42,14 +42,14 @@ public async Task GetFilePropertiesFromTaskDoesNotThrowOutOfMemoryException() [Trait(TestTraits.Duration.TraitName, TestTraits.Duration.Values.VeryShortDuration)] public async Task GetFilePropertiesFromNodeDoesNotThrowOutOfMemoryException() { - using (BatchClient client = await CreateBatchClientWithHandlerAsync()) + using (BatchClient client = CreateBatchClientWithHandler()) { NodeFile file = await client.PoolOperations.GetNodeFileAsync("Foo", "Bar", "Baz"); Assert.Equal(StreamUnitTests.StreamLengthInBytes, file.Properties.ContentLength); } } - private static Task CreateBatchClientWithHandlerAsync() + private static BatchClient CreateBatchClientWithHandler() { HttpResponseMessage responseMessage = new HttpResponseMessage(HttpStatusCode.OK) { @@ -58,7 +58,7 @@ private static Task CreateBatchClientWithHandlerAsync() responseMessage.Content.Headers.ContentLength = StreamUnitTests.StreamLengthInBytes; ReplayDelegatingHandler handler = new ReplayDelegatingHandler(responseMessage); - return BatchClient.OpenAsync(new Protocol.BatchServiceClient(new TokenCredentials("xyz"), handler)); + return BatchClient.Open(new Protocol.BatchServiceClient(new TokenCredentials("xyz"), handler)); } private class ReplayDelegatingHandler : DelegatingHandler diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/BatchClient.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/BatchClient.cs index 810216b55c426..96ee5ea843c83 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/BatchClient.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/BatchClient.cs @@ -159,91 +159,34 @@ public IList CustomBehaviors /// public Utilities Utilities => GetStateThrowIfNotOpen().Utilities; - /// - /// Creates an instance of associated with the specified credentials. - /// - /// The Batch account credentials. - /// A object that represents the asynchronous operation. - public static System.Threading.Tasks.Task OpenAsync(Auth.BatchSharedKeyCredentials credentials) - { - if (null == credentials) - { - throw new ArgumentNullException(nameof(credentials)); - } - - BatchClient newBatchCli = new BatchClient(credentials); - System.Threading.Tasks.Task retTask = System.Threading.Tasks.Task.FromResult(newBatchCli); - - return retTask; - } - /// /// Creates an instance of . /// - /// - /// This is a blocking call. For a non-blocking equivalent, see - /// /// The Batch account credentials. /// An instance of . public static BatchClient Open(Auth.BatchSharedKeyCredentials credentials) - { - // wait for completion - BatchClient bc = OpenAsync(credentials).WaitAndUnaggregateException(); - - return bc; - } - - /// - /// Creates an instance of . - /// - /// The Azure Active Directory Batch account credentials. - /// A object that represents the asynchronous operation. - public static System.Threading.Tasks.Task OpenAsync(Auth.BatchTokenCredentials credentials) { if (null == credentials) { throw new ArgumentNullException(nameof(credentials)); } - BatchClient newBatchCli = new BatchClient(credentials); - System.Threading.Tasks.Task retTask = System.Threading.Tasks.Task.FromResult(newBatchCli); - return retTask; + return new BatchClient(credentials); } /// /// Creates an instance of . /// - /// - /// This is a blocking call. For a non-blocking equivalent, see - /// /// The Azure Active Directory Batch account credentials. /// An instance of . public static BatchClient Open(Auth.BatchTokenCredentials credentials) { - Task asyncTask = OpenAsync(credentials); - - // wait for completion - BatchClient bc = asyncTask.WaitAndUnaggregateException(); - - return bc; - } - - /// - /// Creates an instance of associated with the specified . - /// - /// The instance of to use for all calls made to the Batch Service. It will not be disposed when BatchClient is disposed. - /// A object that represents the asynchronous operation. - public static System.Threading.Tasks.Task OpenAsync(Protocol.BatchServiceClient restClient) - { - if (null == restClient) + if (null == credentials) { - throw new ArgumentNullException(nameof(restClient)); + throw new ArgumentNullException(nameof(credentials)); } - BatchClient newBatchCli = new BatchClient(restClient); - System.Threading.Tasks.Task retTask = System.Threading.Tasks.Task.FromResult(newBatchCli); - - return retTask; + return new BatchClient(credentials); } /// @@ -253,49 +196,12 @@ public static System.Threading.Tasks.Task OpenAsync(Protocol.BatchS /// An instance of . public static BatchClient Open(Protocol.BatchServiceClient restClient) { - Task asyncTask = OpenAsync(restClient); - - // wait for completion - BatchClient bc = asyncTask.WaitAndUnaggregateException(); - - return bc; - } - - /// - /// Starts an asynchronous operation to close the current instance of . - /// Closed instances of are unable to make calls to the Batch Service and the behavior and values of any other methods or properties are undefined. - /// These restrictions also apply immediately to any objects that can trace instantation back to this . - /// This method is threadsafe and can be called any number of times. - /// - /// A object that represents the asynchronous operation. - public System.Threading.Tasks.Task CloseAsync() - { - lock (this._closeLocker) + if (null == restClient) { - if (this._disposableStateBox != null) - { - IProtocolLayer localProto = this.ProtocolLayer; - localProto.Dispose(); - - this._disposableStateBox = null; // null state box signals that the instance is closed - } + throw new ArgumentNullException(nameof(restClient)); } - return Utils.Async.CompletedTask; - } - - /// - /// Closes the current instance of . - /// Closed instances of are unable to make calls to the Batch Service and the behavior and values of any other methods or properties are undefined. - /// These restrictions also apply immediately to any objects that can trace instantation back to this . - /// This method is threadsafe and can be called any number of times. - /// - public void Close() - { - Task asyncTask = CloseAsync(); - - // blocking wait for completion - asyncTask.WaitAndUnaggregateException(); + return new BatchClient(restClient); } #endregion // BatchClient @@ -303,7 +209,7 @@ public void Close() #region // IDisposable /// - /// Calls and releases the unmanaged resources and disposes of the managed resources used by the . + /// Releases the unmanaged resources and disposes of the managed resources used by the . /// public void Dispose() { @@ -329,7 +235,16 @@ protected virtual void Dispose(bool disposing) { // IDisposable only section - this.Close(); + lock (this._closeLocker) + { + if (this._disposableStateBox != null) + { + IProtocolLayer localProto = this.ProtocolLayer; + localProto.Dispose(); + + this._disposableStateBox = null; // null state box signals that the instance is closed + } + } } _disposed = true; From dd76a48e91a0cdd1585a20fc7548bfc9ef43d779 Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Tue, 7 Aug 2018 09:36:16 -0700 Subject: [PATCH 08/10] Fix confusing ResizeErrors documentation --- src/SDKs/Batch/DataPlane/Azure.Batch/Generated/CloudPool.cs | 4 +++- .../ObjectModelCodeGenerator/Spec/CloudPool.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/CloudPool.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/CloudPool.cs index d01b339204590..b61f58c70d276 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/CloudPool.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/CloudPool.cs @@ -10,6 +10,8 @@ // Do not modify it. // +using Microsoft.Azure.Batch.Common; + namespace Microsoft.Azure.Batch { using Models = Microsoft.Azure.Batch.Protocol.Models; @@ -513,7 +515,7 @@ public NetworkConfiguration NetworkConfiguration /// /// Gets a list of errors encountered while performing the last resize on the . Errors are /// returned only when the Batch service encountered an error while resizing the pool, and when the pool's - /// is Steady. + /// is Steady. /// public IReadOnlyList ResizeErrors { diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudPool.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudPool.json index 153f7a4516de4..98a39e7998107 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudPool.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudPool.json @@ -248,7 +248,7 @@ "Key": { "Type": "IReadOnlyList", "Name": "ResizeErrors", - "SummaryComment": "A list of errors encountered while performing the last resize on the . Errors are returned only when the Batch service encountered an error while resizing the pool, and when the pool's is Steady.", + "SummaryComment": "A list of errors encountered while performing the last resize on the . Errors are returned only when the Batch service encountered an error while resizing the pool, and when the pool's is Steady.", "RemarksComment": null, "BoundAccess": "read", "UnboundAccess": "none" From d64602e4d3a4e8f9ff313b16337121ec8547d878 Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Tue, 14 Aug 2018 09:32:31 -0700 Subject: [PATCH 09/10] Regenerate code based on 2018-08-01.7.0 Swagger spec - Update SDK version to 9.0. - Update changelog. --- .../CloudJobIntegrationTests.cs | 1 - .../CloudPoolIntegrationTests.cs | 3 +- .../Azure.Batch/AssemblyAttributes.cs | 4 +- .../DataPlane/Azure.Batch/Azure.Batch.csproj | 2 +- .../Enumerations/TaskCountValidationStatus.cs | 21 -- .../Azure.Batch/Generated/CloudPool.cs | 2 - .../Azure.Batch/Generated/ComputeNode.cs | 13 ++ .../Azure.Batch/Generated/DataDisk.cs | 2 +- .../Generated/NodeAgentInformation.cs | 78 +++++++ .../DataPlane/Azure.Batch/Generated/OSDisk.cs | 3 + .../Azure.Batch/Generated/TaskCounts.cs | 11 - .../GeneratedProtocol/BatchServiceClient.cs | 53 ++++- .../CertificateOperations.cs | 4 - .../ComputeNodeOperations.cs | 8 - .../GeneratedProtocol/IBatchServiceClient.cs | 11 +- .../GeneratedProtocol/IJobOperations.cs | 6 +- .../GeneratedProtocol/ITaskOperations.cs | 11 +- .../GeneratedProtocol/JobOperations.cs | 14 +- .../JobOperationsExtensions.cs | 12 +- .../JobScheduleOperations.cs | 8 - .../AccountListPoolNodeCountsOptions.cs | 8 +- .../Models/AffinityInformation.cs | 14 -- .../Models/ApplicationPackageReference.cs | 14 -- .../Models/ApplicationSummary.cs | 22 -- .../Models/AutoPoolSpecification.cs | 13 -- .../GeneratedProtocol/Models/AutoScaleRun.cs | 9 - .../Models/CertificateAddParameter.cs | 22 -- .../Models/CertificateReference.cs | 18 -- .../GeneratedProtocol/Models/CloudJob.cs | 53 ----- .../Models/CloudJobSchedule.cs | 27 --- .../GeneratedProtocol/Models/CloudPool.cs | 94 +------- .../Models/CloudServiceConfiguration.cs | 25 +-- .../GeneratedProtocol/Models/CloudTask.cs | 76 +------ .../GeneratedProtocol/Models/ComputeNode.cs | 66 ++---- .../ComputeNodeEndpointConfiguration.cs | 24 --- ...ComputeNodeGetRemoteLoginSettingsResult.cs | 14 -- .../Models/ComputeNodeUser.cs | 14 -- .../Models/ContainerConfiguration.cs | 2 +- .../Models/ContainerRegistry.cs | 18 -- .../GeneratedProtocol/Models/DataDisk.cs | 13 +- .../Models/EnvironmentSetting.cs | 14 -- .../Models/ExitCodeMapping.cs | 14 -- .../Models/ExitCodeRangeMapping.cs | 14 -- .../Models/FileProperties.cs | 10 - .../Models/InboundEndpoint.cs | 22 -- .../Models/InboundNatPool.cs | 24 --- .../Models/JobAddParameter.cs | 54 ----- .../Models/JobDisableParameter.cs | 9 - .../Models/JobExecutionInformation.cs | 13 -- .../Models/JobManagerTask.cs | 69 +----- .../Models/JobPatchParameter.cs | 23 -- ...ationAndReleaseTaskExecutionInformation.cs | 17 -- .../Models/JobPreparationTask.cs | 45 +--- .../JobPreparationTaskExecutionInformation.cs | 13 -- .../Models/JobReleaseTask.cs | 54 ++--- .../JobReleaseTaskExecutionInformation.cs | 13 -- .../Models/JobScheduleAddParameter.cs | 36 ---- .../Models/JobSchedulePatchParameter.cs | 23 -- .../Models/JobScheduleStatistics.cs | 14 -- .../Models/JobScheduleUpdateParameter.cs | 32 --- .../Models/JobSchedulingError.cs | 9 - .../Models/JobSpecification.cs | 50 ----- .../GeneratedProtocol/Models/JobStatistics.cs | 14 -- .../Models/JobUpdateParameter.cs | 28 --- .../GeneratedProtocol/Models/MetadataItem.cs | 18 -- .../Models/MultiInstanceSettings.cs | 31 +-- .../Models/NetworkConfiguration.cs | 13 -- .../Models/NetworkSecurityGroupRule.cs | 14 -- .../Models/NodeAgentInformation.cs | 76 +++++++ .../GeneratedProtocol/Models/NodeCounts.cs | 10 - .../GeneratedProtocol/Models/NodeFile.cs | 13 -- .../Models/NodeRemoveParameter.cs | 21 -- .../GeneratedProtocol/Models/OSDisk.cs | 4 +- .../GeneratedProtocol/Models/OutputFile.cs | 30 --- .../OutputFileBlobContainerDestination.cs | 14 -- .../Models/OutputFileDestination.cs | 13 -- .../Models/OutputFileUploadOptions.cs | 9 - .../Models/PoolAddParameter.cs | 78 ------- .../Models/PoolEndpointConfiguration.cs | 24 --- .../Models/PoolEvaluateAutoScaleParameter.cs | 14 -- .../Models/PoolInformation.cs | 13 -- .../Models/PoolNodeCounts.cs | 22 -- .../Models/PoolPatchParameter.cs | 43 ---- .../Models/PoolSpecification.cs | 96 +-------- .../Models/PoolStatistics.cs | 22 -- .../Models/PoolUpdatePropertiesParameter.cs | 56 ----- .../Models/PoolUpgradeOSParameter.cs | 14 -- .../Models/PoolUsageMetrics.cs | 31 +-- .../GeneratedProtocol/Models/ResourceFile.cs | 18 -- .../Models/ResourceStatistics.cs | 10 - .../GeneratedProtocol/Models/StartTask.cs | 54 ++--- .../Models/StartTaskInformation.cs | 13 -- .../Models/SubtaskInformation.cs | 13 -- .../Models/TaskAddCollectionParameter.cs | 38 +--- .../Models/TaskAddParameter.cs | 77 +------ .../GeneratedProtocol/Models/TaskAddResult.cs | 14 -- .../Models/TaskContainerSettings.cs | 18 -- .../Models/TaskCountValidationStatus.cs | 70 ------ .../GeneratedProtocol/Models/TaskCounts.cs | 23 +- .../Models/TaskExecutionInformation.cs | 13 -- .../Models/TaskFailureInformation.cs | 9 - .../GeneratedProtocol/Models/TaskIdRange.cs | 10 - .../Models/TaskInformation.cs | 13 -- .../Models/TaskSchedulingPolicy.cs | 9 - .../Models/TaskStatistics.cs | 14 -- .../UploadBatchServiceLogsConfiguration.cs | 14 -- .../Models/UploadBatchServiceLogsResult.cs | 14 -- .../Models/UsageStatistics.cs | 10 - .../GeneratedProtocol/Models/UserAccount.cs | 24 +-- .../Models/VirtualMachineConfiguration.cs | 28 --- .../GeneratedProtocol/PoolOperations.cs | 12 -- .../GeneratedProtocol/SdkInfo_BatchService.cs | 53 +++-- .../GeneratedProtocol/TaskOperations.cs | 28 +-- .../TaskOperationsExtensions.cs | 20 +- .../ObjectModelCodeGenerator/Program.cs | 2 +- .../Spec/CloudPool.json | 4 +- .../Spec/CloudTask.json | 2 +- .../Spec/ComputeNode.json | 14 ++ .../Spec/DataDisk.json | 2 +- .../Spec/JobManagerTask.json | 2 +- .../Spec/JobPreparationTask.json | 2 +- .../Spec/JobReleaseTask.json | 2 +- .../Spec/MultiInstanceSettings.json | 2 +- .../Spec/NodeAgentInformation.json | 31 +++ .../ObjectModelCodeGenerator/Spec/OSDisk.json | 2 +- .../Spec/PoolSpecification.json | 2 +- .../Spec/PoolUsageMetrics.json | 202 +++++++++--------- .../Spec/StartTask.json | 2 +- .../Spec/TaskCounts.json | 14 -- src/SDKs/Batch/DataPlane/changelog.md | 18 +- src/SDKs/_metadata/batch_data-plane.txt | 6 +- 131 files changed, 568 insertions(+), 2466 deletions(-) delete mode 100644 src/SDKs/Batch/DataPlane/Azure.Batch/Common/Enumerations/TaskCountValidationStatus.cs create mode 100644 src/SDKs/Batch/DataPlane/Azure.Batch/Generated/NodeAgentInformation.cs create mode 100644 src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeAgentInformation.cs delete mode 100644 src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskCountValidationStatus.cs create mode 100644 src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/NodeAgentInformation.json diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/CloudJobIntegrationTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/CloudJobIntegrationTests.cs index 0351ac73b82af..711355f5e6476 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/CloudJobIntegrationTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/CloudJobIntegrationTests.cs @@ -925,7 +925,6 @@ public async Task Job_GetTaskCounts_ReturnsCorrectCount() var counts = await unboundJob.GetTaskCountsAsync().ConfigureAwait(false); Assert.Equal(2, counts.Active); - Assert.Equal(TaskCountValidationStatus.Validated, counts.ValidationStatus); } finally { diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/CloudPoolIntegrationTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/CloudPoolIntegrationTests.cs index dc955929b6a3d..c724e4db24c08 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/CloudPoolIntegrationTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/CloudPoolIntegrationTests.cs @@ -615,7 +615,7 @@ public void TestPoolObjectResizeStopResize() CloudPool pool = batchCli.PoolOperations.CreatePool(poolId, PoolFixture.VMSize, new CloudServiceConfiguration(PoolFixture.OSFamily), targetDedicatedComputeNodes: targetDedicated); pool.Commit(); - this.testOutputHelper.WriteLine("Created pool {0}", poolId); + this.testOutputHelper.WriteLine($"Created pool {poolId}"); CloudPool boundPool = batchCli.PoolOperations.GetPool(poolId); @@ -630,6 +630,7 @@ public void TestPoolObjectResizeStopResize() boundPool.Refresh(); //The pool could be in stopping or steady state + this.testOutputHelper.WriteLine($"Pool allocation state: {boundPool.AllocationState}"); Assert.True(boundPool.AllocationState == AllocationState.Steady || boundPool.AllocationState == AllocationState.Stopping); } finally diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/AssemblyAttributes.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/AssemblyAttributes.cs index 20e88fe492657..f02618236689b 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/AssemblyAttributes.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/AssemblyAttributes.cs @@ -9,8 +9,8 @@ [assembly: AssemblyTitle("Microsoft.Azure.Batch")] [assembly: AssemblyDescription("Client library for interacting with the Azure Batch service.")] -[assembly: AssemblyVersion("8.0.0.0")] -[assembly: AssemblyFileVersion("8.1.1.0")] +[assembly: AssemblyVersion("9.0.0.0")] +[assembly: AssemblyFileVersion("9.0.0.0")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyProduct("Microsoft Azure")] [assembly: CLSCompliant(false)] diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Azure.Batch.csproj b/src/SDKs/Batch/DataPlane/Azure.Batch/Azure.Batch.csproj index 9b0afd4df4d20..7b62496e18fb4 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Azure.Batch.csproj +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Azure.Batch.csproj @@ -10,7 +10,7 @@ false Microsoft.Azure.Batch This client library provides access to the Microsoft Azure Batch service. - 8.1.2 + 9.0.0 $(DefineConstants);CODESIGN true Microsoft.Azure.Batch diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Common/Enumerations/TaskCountValidationStatus.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Common/Enumerations/TaskCountValidationStatus.cs deleted file mode 100644 index 7513c6c58e9d3..0000000000000 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Common/Enumerations/TaskCountValidationStatus.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -namespace Microsoft.Azure.Batch.Common -{ - /// - /// Whether the task counts have been validated. - /// - public enum TaskCountValidationStatus - { - /// - /// The task counts have been validated and are guaranteed to match the List Tasks results. - /// - Validated, - - /// - /// The Batch service has not been able to check state counts against the task states as reported in the List Tasks API. - /// - Unvalidated - } -} diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/CloudPool.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/CloudPool.cs index b61f58c70d276..beb548554bdb5 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/CloudPool.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/CloudPool.cs @@ -10,8 +10,6 @@ // Do not modify it. // -using Microsoft.Azure.Batch.Common; - namespace Microsoft.Azure.Batch { using Models = Microsoft.Azure.Batch.Protocol.Models; diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/ComputeNode.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/ComputeNode.cs index 9a4ba04afcba1..3f656c7ef1c83 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/ComputeNode.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/ComputeNode.cs @@ -33,6 +33,7 @@ private class PropertyContainer : PropertyCollection public readonly PropertyAccessor IPAddressProperty; public readonly PropertyAccessor IsDedicatedProperty; public readonly PropertyAccessor LastBootTimeProperty; + public readonly PropertyAccessor NodeAgentInformationProperty; public readonly PropertyAccessor> RecentTasksProperty; public readonly PropertyAccessor RunningTasksCountProperty; public readonly PropertyAccessor SchedulingStateProperty; @@ -82,6 +83,10 @@ public PropertyContainer(Models.ComputeNode protocolObject) : base(BindingState. protocolObject.LastBootTime, nameof(LastBootTime), BindingAccess.Read); + this.NodeAgentInformationProperty = this.CreatePropertyAccessor( + UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.NodeAgentInfo, o => new NodeAgentInformation(o).Freeze()), + nameof(NodeAgentInformation), + BindingAccess.Read); this.RecentTasksProperty = this.CreatePropertyAccessor( TaskInformation.ConvertFromProtocolCollectionReadOnly(protocolObject.RecentTasks), nameof(RecentTasks), @@ -246,6 +251,14 @@ public DateTime? LastBootTime get { return this.propertyContainer.LastBootTimeProperty.Value; } } + /// + /// Gets information about the node agent version and the time the node upgraded to a new version. + /// + public NodeAgentInformation NodeAgentInformation + { + get { return this.propertyContainer.NodeAgentInformationProperty.Value; } + } + /// /// Gets the execution information for the most recent tasks that ran on this compute node. Note that this element /// is only returned if at least one task was run on this compute node since the time it was assigned to its current diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/DataDisk.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/DataDisk.cs index 647a7598bb831..d1955cfd1b6ba 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/DataDisk.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/DataDisk.cs @@ -58,7 +58,7 @@ internal DataDisk(Models.DataDisk protocolObject) /// Gets the type of caching to enable for the OS disk. /// /// - /// If omitted, the default is . + /// If omitted, the default is . /// public Common.CachingType? Caching { get; } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/NodeAgentInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/NodeAgentInformation.cs new file mode 100644 index 0000000000000..3579d69919ce1 --- /dev/null +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/NodeAgentInformation.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// +// This file was autogenerated by a tool. +// Do not modify it. +// + +namespace Microsoft.Azure.Batch +{ + using Models = Microsoft.Azure.Batch.Protocol.Models; + using System; + using System.Collections.Generic; + using System.Linq; + + /// + /// Information about the node agent + /// + /// + /// The Batch node agent is a program that runs on each node in the pool and provides Batch capability on the compute + /// node. + /// + public partial class NodeAgentInformation : IPropertyMetadata + { + #region Constructors + + internal NodeAgentInformation(Models.NodeAgentInformation protocolObject) + { + this.LastUpdateTime = protocolObject.LastUpdateTime; + this.Version = protocolObject.Version; + } + + #endregion Constructors + + #region NodeAgentInformation + + /// + /// Gets the time when the node agent was updated on the compute node. + /// + /// + /// This is the most recent time that the node agent was updated to a new version. + /// + public DateTime LastUpdateTime { get; } + + /// + /// Gets the version of the Batch node agent running on the compute node. + /// + /// + /// This version number can be checked against the node agent release notes located at https://github.com/Azure/Batch/blob/master/changelogs/nodeagent/CHANGELOG.md. + /// + public string Version { get; } + + #endregion // NodeAgentInformation + + #region IPropertyMetadata + + bool IModifiable.HasBeenModified + { + //This class is compile time readonly so it cannot have been modified + get { return false; } + } + + bool IReadOnly.IsReadOnly + { + get { return true; } + set + { + // This class is compile time readonly already + } + } + + #endregion // IPropertyMetadata + } +} \ No newline at end of file diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/OSDisk.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/OSDisk.cs index 2311fea323856..3c69b189e75a6 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/OSDisk.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/OSDisk.cs @@ -45,6 +45,9 @@ internal OSDisk(Models.OSDisk protocolObject) /// /// Gets the type of caching to enable for the OS disk. /// + /// + /// If omitted, the default is . + /// public Common.CachingType? Caching { get; } #endregion // OSDisk diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/TaskCounts.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/TaskCounts.cs index 96ee115b524e0..f6f426b62c802 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/TaskCounts.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/Generated/TaskCounts.cs @@ -31,7 +31,6 @@ internal TaskCounts(Models.TaskCounts protocolObject) this.Failed = protocolObject.Failed; this.Running = protocolObject.Running; this.Succeeded = protocolObject.Succeeded; - this.ValidationStatus = UtilitiesInternal.MapEnum(protocolObject.ValidationStatus); } #endregion Constructors @@ -64,16 +63,6 @@ internal TaskCounts(Models.TaskCounts protocolObject) /// public int Succeeded { get; } - /// - /// Gets whether the task counts have been validated. If the is unvalidated, then - /// the Batch service has not been able to check state counts against the task states as reported in the List Tasks - /// API. - /// - /// - /// The may be unvalidated if the job contains more than 200,000 tasks. - /// - public Common.TaskCountValidationStatus ValidationStatus { get; } - #endregion // TaskCounts #region IPropertyMetadata diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/BatchServiceClient.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/BatchServiceClient.cs index a8c62c0beb580..274434a7f73dc 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/BatchServiceClient.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/BatchServiceClient.cs @@ -52,19 +52,20 @@ public partial class BatchServiceClient : ServiceClient, IBa public string ApiVersion { get; private set; } /// - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// public string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running Operations. - /// Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. /// public int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated and - /// included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. /// public bool? GenerateClientRequestId { get; set; } @@ -113,6 +114,19 @@ public partial class BatchServiceClient : ServiceClient, IBa /// public virtual IComputeNodeOperations ComputeNode { get; private set; } + /// + /// Initializes a new instance of the BatchServiceClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling BatchServiceClient.Dispose(). False: will not dispose provided httpClient + protected BatchServiceClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + /// /// Initializes a new instance of the BatchServiceClient class. /// @@ -208,6 +222,33 @@ public BatchServiceClient(ServiceClientCredentials credentials, params Delegatin } } + /// + /// Initializes a new instance of the BatchServiceClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling BatchServiceClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public BatchServiceClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + /// /// Initializes a new instance of the BatchServiceClient class. /// @@ -324,7 +365,7 @@ private void Initialize() Task = new TaskOperations(this); ComputeNode = new ComputeNodeOperations(this); BaseUri = new System.Uri("https://batch.core.windows.net"); - ApiVersion = "2018-03-01.6.1"; + ApiVersion = "2018-08-01.7.0"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/CertificateOperations.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/CertificateOperations.cs index 2f1d4afa9d632..cf5a46ebd067c 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/CertificateOperations.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/CertificateOperations.cs @@ -84,10 +84,6 @@ internal CertificateOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "certificate"); } - if (certificate != null) - { - certificate.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/ComputeNodeOperations.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/ComputeNodeOperations.cs index c4664cb24c19f..e1102c8571345 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/ComputeNodeOperations.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/ComputeNodeOperations.cs @@ -103,10 +103,6 @@ internal ComputeNodeOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "user"); } - if (user != null) - { - user.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -2648,10 +2644,6 @@ internal ComputeNodeOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "uploadBatchServiceLogsConfiguration"); } - if (uploadBatchServiceLogsConfiguration != null) - { - uploadBatchServiceLogsConfiguration.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/IBatchServiceClient.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/IBatchServiceClient.cs index c804ff6aeda08..1a56f4f2118d4 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/IBatchServiceClient.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/IBatchServiceClient.cs @@ -46,19 +46,20 @@ public partial interface IBatchServiceClient : System.IDisposable string ApiVersion { get; } /// - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running - /// Operations. Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. /// int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated - /// and included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/IJobOperations.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/IJobOperations.cs index 067987d9bc94c..63494cd557a34 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/IJobOperations.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/IJobOperations.cs @@ -401,11 +401,7 @@ public partial interface IJobOperations /// /// Task counts provide a count of the tasks by active, running or /// completed task state, and a count of tasks which succeeded or - /// failed. Tasks in the preparing state are counted as running. If the - /// validationStatus is unvalidated, then the Batch service has not - /// been able to check state counts against the task states as reported - /// in the List Tasks API. The validationStatus may be unvalidated if - /// the job contains more than 200,000 tasks. + /// failed. Tasks in the preparing state are counted as running. /// /// /// The ID of the job. diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/ITaskOperations.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/ITaskOperations.cs index 9dcfd401bc81b..99b806d03af75 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/ITaskOperations.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/ITaskOperations.cs @@ -110,11 +110,12 @@ public partial interface ITaskOperations /// The ID of the job to which the task collection is to be added. /// /// - /// The collection of tasks to add. The total serialized size of this - /// collection must be less than 4MB. If it is greater than 4MB (for - /// example if each task has 100's of resource files or environment - /// variables), the request will fail with code 'RequestBodyTooLarge' - /// and should be retried again with fewer tasks. + /// The collection of tasks to add. The maximum count of tasks is 100. + /// The total serialized size of this collection must be less than 1MB. + /// If it is greater than 1MB (for example if each task has 100's of + /// resource files or environment variables), the request will fail + /// with code 'RequestBodyTooLarge' and should be retried again with + /// fewer tasks. /// /// /// Additional parameters for the operation diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobOperations.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobOperations.cs index 5db816fb647a3..f52ff43f37273 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobOperations.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobOperations.cs @@ -1250,10 +1250,6 @@ internal JobOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "jobUpdateParameter"); } - if (jobUpdateParameter != null) - { - jobUpdateParameter.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -2449,10 +2445,6 @@ internal JobOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "job"); } - if (job != null) - { - job.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -3500,11 +3492,7 @@ internal JobOperations(BatchServiceClient client) /// /// Task counts provide a count of the tasks by active, running or completed /// task state, and a count of tasks which succeeded or failed. Tasks in the - /// preparing state are counted as running. If the validationStatus is - /// unvalidated, then the Batch service has not been able to check state counts - /// against the task states as reported in the List Tasks API. The - /// validationStatus may be unvalidated if the job contains more than 200,000 - /// tasks. + /// preparing state are counted as running. /// /// /// The ID of the job. diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobOperationsExtensions.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobOperationsExtensions.cs index 79c8a673fcd50..6359d49da90bd 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobOperationsExtensions.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobOperationsExtensions.cs @@ -673,11 +673,7 @@ public static partial class JobOperationsExtensions /// /// Task counts provide a count of the tasks by active, running or completed /// task state, and a count of tasks which succeeded or failed. Tasks in the - /// preparing state are counted as running. If the validationStatus is - /// unvalidated, then the Batch service has not been able to check state counts - /// against the task states as reported in the List Tasks API. The - /// validationStatus may be unvalidated if the job contains more than 200,000 - /// tasks. + /// preparing state are counted as running. /// /// /// The operations group for this extension method. @@ -699,11 +695,7 @@ public static partial class JobOperationsExtensions /// /// Task counts provide a count of the tasks by active, running or completed /// task state, and a count of tasks which succeeded or failed. Tasks in the - /// preparing state are counted as running. If the validationStatus is - /// unvalidated, then the Batch service has not been able to check state counts - /// against the task states as reported in the List Tasks API. The - /// validationStatus may be unvalidated if the job contains more than 200,000 - /// tasks. + /// preparing state are counted as running. /// /// /// The operations group for this extension method. diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobScheduleOperations.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobScheduleOperations.cs index 073a9d6e12e3f..17c97a571a115 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobScheduleOperations.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/JobScheduleOperations.cs @@ -1289,10 +1289,6 @@ internal JobScheduleOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "jobScheduleUpdateParameter"); } - if (jobScheduleUpdateParameter != null) - { - jobScheduleUpdateParameter.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -2423,10 +2419,6 @@ internal JobScheduleOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "cloudJobSchedule"); } - if (cloudJobSchedule != null) - { - cloudJobSchedule.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AccountListPoolNodeCountsOptions.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AccountListPoolNodeCountsOptions.cs index b59b21aac2a5b..5c2cf46d98fad 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AccountListPoolNodeCountsOptions.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AccountListPoolNodeCountsOptions.cs @@ -33,7 +33,9 @@ public AccountListPoolNodeCountsOptions() /// Initializes a new instance of the AccountListPoolNodeCountsOptions /// class. /// - /// An OData $filter clause. + /// An OData $filter clause. For more information + /// on constructing this filter, see + /// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch. /// The maximum number of items to return in /// the response. /// The maximum time that the server can spend @@ -64,7 +66,9 @@ public AccountListPoolNodeCountsOptions() partial void CustomInit(); /// - /// Gets or sets an OData $filter clause. + /// Gets or sets an OData $filter clause. For more information on + /// constructing this filter, see + /// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch. /// [Newtonsoft.Json.JsonIgnore] public string Filter { get; set; } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AffinityInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AffinityInformation.cs index 453fe8090bde8..32ee4f5e0f60b 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AffinityInformation.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AffinityInformation.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -58,18 +57,5 @@ public AffinityInformation(string affinityId) [JsonProperty(PropertyName = "affinityId")] public string AffinityId { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (AffinityId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AffinityId"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ApplicationPackageReference.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ApplicationPackageReference.cs index 696e8b17f7155..48c9f4d0d47e9 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ApplicationPackageReference.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ApplicationPackageReference.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -68,18 +67,5 @@ public ApplicationPackageReference() [JsonProperty(PropertyName = "version")] public string Version { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ApplicationId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ApplicationId"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ApplicationSummary.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ApplicationSummary.cs index c3ffc633f77f5..dc78c951c0644 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ApplicationSummary.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ApplicationSummary.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -70,26 +69,5 @@ public ApplicationSummary(string id, string displayName, IList versions) [JsonProperty(PropertyName = "versions")] public IList Versions { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (DisplayName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); - } - if (Versions == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Versions"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AutoPoolSpecification.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AutoPoolSpecification.cs index f8b6ba84871ee..87635588e7d86 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AutoPoolSpecification.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AutoPoolSpecification.cs @@ -96,18 +96,5 @@ public AutoPoolSpecification() [JsonProperty(PropertyName = "pool")] public PoolSpecification Pool { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Pool != null) - { - Pool.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AutoScaleRun.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AutoScaleRun.cs index 2f5be5d406b36..1648c10ad5e95 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AutoScaleRun.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/AutoScaleRun.cs @@ -74,14 +74,5 @@ public AutoScaleRun() [JsonProperty(PropertyName = "error")] public AutoScaleRunError Error { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CertificateAddParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CertificateAddParameter.cs index 71669fa1075bc..396e0031af9e1 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CertificateAddParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CertificateAddParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -98,26 +97,5 @@ public CertificateAddParameter() [JsonProperty(PropertyName = "password")] public string Password { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Thumbprint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Thumbprint"); - } - if (ThumbprintAlgorithm == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ThumbprintAlgorithm"); - } - if (Data == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Data"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CertificateReference.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CertificateReference.cs index ba4fa003c7ffb..63a6635ab4c2e 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CertificateReference.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CertificateReference.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -116,22 +115,5 @@ public CertificateReference() [JsonProperty(PropertyName = "visibility")] public IList Visibility { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Thumbprint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Thumbprint"); - } - if (ThumbprintAlgorithm == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ThumbprintAlgorithm"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudJob.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudJob.cs index 2a65e25a5d8e3..d77de9bf7b90b 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudJob.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudJob.cs @@ -315,58 +315,5 @@ public CloudJob() [JsonProperty(PropertyName = "stats")] public JobStatistics Stats { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (JobManagerTask != null) - { - JobManagerTask.Validate(); - } - if (JobPreparationTask != null) - { - JobPreparationTask.Validate(); - } - if (JobReleaseTask != null) - { - JobReleaseTask.Validate(); - } - if (CommonEnvironmentSettings != null) - { - foreach (var element in CommonEnvironmentSettings) - { - if (element != null) - { - element.Validate(); - } - } - } - if (PoolInfo != null) - { - PoolInfo.Validate(); - } - if (Metadata != null) - { - foreach (var element1 in Metadata) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (ExecutionInfo != null) - { - ExecutionInfo.Validate(); - } - if (Stats != null) - { - Stats.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudJobSchedule.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudJobSchedule.cs index 9b938c591e421..d7c6f9c12209f 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudJobSchedule.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudJobSchedule.cs @@ -215,32 +215,5 @@ public CloudJobSchedule() [JsonProperty(PropertyName = "stats")] public JobScheduleStatistics Stats { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (JobSpecification != null) - { - JobSpecification.Validate(); - } - if (Metadata != null) - { - foreach (var element in Metadata) - { - if (element != null) - { - element.Validate(); - } - } - } - if (Stats != null) - { - Stats.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudPool.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudPool.cs index b838d03ab659b..d4a184b4482f1 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudPool.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudPool.cs @@ -237,20 +237,9 @@ public CloudPool() /// machines in a pool are the same size. /// /// - /// For information about available sizes of virtual machines for Cloud - /// Services pools (pools created with cloudServiceConfiguration), see - /// Sizes for Cloud Services - /// (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). - /// Batch supports all Cloud Services VM sizes except ExtraSmall, A1V2 - /// and A2V2. For information about available VM sizes for pools using - /// images from the Virtual Machines Marketplace (pools created with - /// virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) - /// (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) - /// or Sizes for Virtual Machines (Windows) - /// (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). - /// Batch supports all Azure VM sizes except STANDARD_A0 and those with - /// premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 - /// series). + /// For information about available sizes of virtual machines in pools, + /// see Choose a VM size for compute nodes in an Azure Batch pool + /// (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). /// [JsonProperty(PropertyName = "vmSize")] public string VmSize { get; set; } @@ -477,82 +466,5 @@ public CloudPool() [JsonProperty(PropertyName = "stats")] public PoolStatistics Stats { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (CloudServiceConfiguration != null) - { - CloudServiceConfiguration.Validate(); - } - if (VirtualMachineConfiguration != null) - { - VirtualMachineConfiguration.Validate(); - } - if (AutoScaleRun != null) - { - AutoScaleRun.Validate(); - } - if (NetworkConfiguration != null) - { - NetworkConfiguration.Validate(); - } - if (StartTask != null) - { - StartTask.Validate(); - } - if (CertificateReferences != null) - { - foreach (var element in CertificateReferences) - { - if (element != null) - { - element.Validate(); - } - } - } - if (ApplicationPackageReferences != null) - { - foreach (var element1 in ApplicationPackageReferences) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (TaskSchedulingPolicy != null) - { - TaskSchedulingPolicy.Validate(); - } - if (UserAccounts != null) - { - foreach (var element2 in UserAccounts) - { - if (element2 != null) - { - element2.Validate(); - } - } - } - if (Metadata != null) - { - foreach (var element3 in Metadata) - { - if (element3 != null) - { - element3.Validate(); - } - } - } - if (Stats != null) - { - Stats.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudServiceConfiguration.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudServiceConfiguration.cs index 86d0d1110f2e8..0ad656e8df2d0 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudServiceConfiguration.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudServiceConfiguration.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -55,11 +54,12 @@ public CloudServiceConfiguration() /// virtual machines in the pool. /// /// - /// Possible values are: 2 - OS Family 2, equivalent to Windows Server - /// 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - /// - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family - /// 5, equivalent to Windows Server 2016. For more information, see - /// Azure Guest OS Releases + /// Possible values are: + /// 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. + /// 3 - OS Family 3, equivalent to Windows Server 2012. + /// 4 - OS Family 4, equivalent to Windows Server 2012 R2. + /// 5 - OS Family 5, equivalent to Windows Server 2016. For more + /// information, see Azure Guest OS Releases /// (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). /// [JsonProperty(PropertyName = "osFamily")] @@ -90,18 +90,5 @@ public CloudServiceConfiguration() [JsonProperty(PropertyName = "currentOSVersion")] public string CurrentOSVersion { get; private set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (OsFamily == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "OsFamily"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudTask.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudTask.cs index c4a0b750c6b3c..dd8499c39e353 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudTask.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/CloudTask.cs @@ -269,7 +269,12 @@ public CloudTask() /// /// For multi-instance tasks, the resource files will only be /// downloaded to the compute node on which the primary task is - /// executed. + /// executed. There is a maximum size for the list of resource files. + /// When the max size is exceeded, the request will fail and the + /// response error code will be RequestEntityTooLarge. If this occurs, + /// the collection of ResourceFiles must be reduced in size. This can + /// be achieved using .zip files, Application Packages, or Docker + /// Containers. /// [JsonProperty(PropertyName = "resourceFiles")] public IList ResourceFiles { get; set; } @@ -385,74 +390,5 @@ public CloudTask() [JsonProperty(PropertyName = "authenticationTokenSettings")] public AuthenticationTokenSettings AuthenticationTokenSettings { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ContainerSettings != null) - { - ContainerSettings.Validate(); - } - if (ResourceFiles != null) - { - foreach (var element in ResourceFiles) - { - if (element != null) - { - element.Validate(); - } - } - } - if (OutputFiles != null) - { - foreach (var element1 in OutputFiles) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (EnvironmentSettings != null) - { - foreach (var element2 in EnvironmentSettings) - { - if (element2 != null) - { - element2.Validate(); - } - } - } - if (AffinityInfo != null) - { - AffinityInfo.Validate(); - } - if (ExecutionInfo != null) - { - ExecutionInfo.Validate(); - } - if (MultiInstanceSettings != null) - { - MultiInstanceSettings.Validate(); - } - if (Stats != null) - { - Stats.Validate(); - } - if (ApplicationPackageReferences != null) - { - foreach (var element3 in ApplicationPackageReferences) - { - if (element3 != null) - { - element3.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNode.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNode.cs index 71a5f43534434..0ba2659699981 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNode.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNode.cs @@ -74,7 +74,9 @@ public ComputeNode() /// node. If false, the node is a low-priority node. /// The endpoint configuration for /// the compute node. - public ComputeNode(string id = default(string), string url = default(string), ComputeNodeState? state = default(ComputeNodeState?), SchedulingState? schedulingState = default(SchedulingState?), System.DateTime? stateTransitionTime = default(System.DateTime?), System.DateTime? lastBootTime = default(System.DateTime?), System.DateTime? allocationTime = default(System.DateTime?), string ipAddress = default(string), string affinityId = default(string), string vmSize = default(string), int? totalTasksRun = default(int?), int? runningTasksCount = default(int?), int? totalTasksSucceeded = default(int?), IList recentTasks = default(IList), StartTask startTask = default(StartTask), StartTaskInformation startTaskInfo = default(StartTaskInformation), IList certificateReferences = default(IList), IList errors = default(IList), bool? isDedicated = default(bool?), ComputeNodeEndpointConfiguration endpointConfiguration = default(ComputeNodeEndpointConfiguration)) + /// Information about the node agent + /// version and the time the node upgraded to a new version. + public ComputeNode(string id = default(string), string url = default(string), ComputeNodeState? state = default(ComputeNodeState?), SchedulingState? schedulingState = default(SchedulingState?), System.DateTime? stateTransitionTime = default(System.DateTime?), System.DateTime? lastBootTime = default(System.DateTime?), System.DateTime? allocationTime = default(System.DateTime?), string ipAddress = default(string), string affinityId = default(string), string vmSize = default(string), int? totalTasksRun = default(int?), int? runningTasksCount = default(int?), int? totalTasksSucceeded = default(int?), IList recentTasks = default(IList), StartTask startTask = default(StartTask), StartTaskInformation startTaskInfo = default(StartTaskInformation), IList certificateReferences = default(IList), IList errors = default(IList), bool? isDedicated = default(bool?), ComputeNodeEndpointConfiguration endpointConfiguration = default(ComputeNodeEndpointConfiguration), NodeAgentInformation nodeAgentInfo = default(NodeAgentInformation)) { Id = id; Url = url; @@ -96,6 +98,7 @@ public ComputeNode() Errors = errors; IsDedicated = isDedicated; EndpointConfiguration = endpointConfiguration; + NodeAgentInfo = nodeAgentInfo; CustomInit(); } @@ -198,20 +201,9 @@ public ComputeNode() /// node. /// /// - /// For information about available sizes of virtual machines for Cloud - /// Services pools (pools created with cloudServiceConfiguration), see - /// Sizes for Cloud Services - /// (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). - /// Batch supports all Cloud Services VM sizes except ExtraSmall, A1V2 - /// and A2V2. For information about available VM sizes for pools using - /// images from the Virtual Machines Marketplace (pools created with - /// virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) - /// (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) - /// or Sizes for Virtual Machines (Windows) - /// (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). - /// Batch supports all Azure VM sizes except STANDARD_A0 and those with - /// premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 - /// series). + /// For information about available sizes of virtual machines in pools, + /// see Choose a VM size for compute nodes in an Azure Batch pool + /// (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). /// [JsonProperty(PropertyName = "vmSize")] public string VmSize { get; set; } @@ -304,45 +296,11 @@ public ComputeNode() public ComputeNodeEndpointConfiguration EndpointConfiguration { get; set; } /// - /// Validate the object. + /// Gets or sets information about the node agent version and the time + /// the node upgraded to a new version. /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (RecentTasks != null) - { - foreach (var element in RecentTasks) - { - if (element != null) - { - element.Validate(); - } - } - } - if (StartTask != null) - { - StartTask.Validate(); - } - if (StartTaskInfo != null) - { - StartTaskInfo.Validate(); - } - if (CertificateReferences != null) - { - foreach (var element1 in CertificateReferences) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (EndpointConfiguration != null) - { - EndpointConfiguration.Validate(); - } - } + [JsonProperty(PropertyName = "nodeAgentInfo")] + public NodeAgentInformation NodeAgentInfo { get; set; } + } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeEndpointConfiguration.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeEndpointConfiguration.cs index 279f70e039286..8ac2a0f381eac 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeEndpointConfiguration.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeEndpointConfiguration.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -54,28 +53,5 @@ public ComputeNodeEndpointConfiguration(IList inboundEndpoints) [JsonProperty(PropertyName = "inboundEndpoints")] public IList InboundEndpoints { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (InboundEndpoints == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "InboundEndpoints"); - } - if (InboundEndpoints != null) - { - foreach (var element in InboundEndpoints) - { - if (element != null) - { - element.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeGetRemoteLoginSettingsResult.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeGetRemoteLoginSettingsResult.cs index 8d3e99dd9f830..51d384131d707 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeGetRemoteLoginSettingsResult.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeGetRemoteLoginSettingsResult.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -61,18 +60,5 @@ public ComputeNodeGetRemoteLoginSettingsResult(string remoteLoginIPAddress, int [JsonProperty(PropertyName = "remoteLoginPort")] public int RemoteLoginPort { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (RemoteLoginIPAddress == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "RemoteLoginIPAddress"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeUser.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeUser.cs index aa2be9b0b3ef4..7538545a2cbde 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeUser.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ComputeNodeUser.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -106,18 +105,5 @@ public ComputeNodeUser() [JsonProperty(PropertyName = "sshPublicKey")] public string SshPublicKey { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ContainerConfiguration.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ContainerConfiguration.cs index 8af71b5116c11..77ecd196147c2 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ContainerConfiguration.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ContainerConfiguration.cs @@ -46,7 +46,7 @@ public ContainerConfiguration() /// static ContainerConfiguration() { - Type = "docker"; + Type = "dockerCompatible"; } /// diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ContainerRegistry.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ContainerRegistry.cs index 8681f93276e82..78a1c6f9ca1eb 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ContainerRegistry.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ContainerRegistry.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -69,22 +68,5 @@ public ContainerRegistry() [JsonProperty(PropertyName = "password")] public string Password { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (UserName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "UserName"); - } - if (Password == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Password"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/DataDisk.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/DataDisk.cs index 3847756757655..0ac8b8d7b2fe9 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/DataDisk.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/DataDisk.cs @@ -65,8 +65,8 @@ public DataDisk() /// Gets or sets the type of caching to be enabled for the data disks. /// /// - /// The default value for caching is none. For information about the - /// caching options see: + /// The default value for caching is readwrite. For information about + /// the caching options see: /// https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. /// Possible values include: 'none', 'readOnly', 'readWrite' /// @@ -89,14 +89,5 @@ public DataDisk() [JsonProperty(PropertyName = "storageAccountType")] public StorageAccountType? StorageAccountType { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/EnvironmentSetting.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/EnvironmentSetting.cs index 30759607abeab..e8a492669a2c1 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/EnvironmentSetting.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/EnvironmentSetting.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -56,18 +55,5 @@ public EnvironmentSetting() [JsonProperty(PropertyName = "value")] public string Value { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ExitCodeMapping.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ExitCodeMapping.cs index 0ff466cea4834..7ee4246562fe1 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ExitCodeMapping.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ExitCodeMapping.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -59,18 +58,5 @@ public ExitCodeMapping(int code, ExitOptions exitOptions) [JsonProperty(PropertyName = "exitOptions")] public ExitOptions ExitOptions { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ExitOptions == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ExitOptions"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ExitCodeRangeMapping.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ExitCodeRangeMapping.cs index c77d92d3abd35..8dad55872e155 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ExitCodeRangeMapping.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ExitCodeRangeMapping.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -68,18 +67,5 @@ public ExitCodeRangeMapping(int start, int end, ExitOptions exitOptions) [JsonProperty(PropertyName = "exitOptions")] public ExitOptions ExitOptions { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ExitOptions == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ExitOptions"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/FileProperties.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/FileProperties.cs index 0ff8815c1132d..9e5963fb5cb63 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/FileProperties.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/FileProperties.cs @@ -87,15 +87,5 @@ public FileProperties() [JsonProperty(PropertyName = "fileMode")] public string FileMode { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/InboundEndpoint.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/InboundEndpoint.cs index c169880459365..0c1efe21c0373 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/InboundEndpoint.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/InboundEndpoint.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -96,26 +95,5 @@ public InboundEndpoint(string name, InboundEndpointProtocol protocol, string pub [JsonProperty(PropertyName = "backendPort")] public int BackendPort { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (PublicIPAddress == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PublicIPAddress"); - } - if (PublicFQDN == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PublicFQDN"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/InboundNatPool.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/InboundNatPool.cs index 196ac95db4057..15c60e4dbe4b6 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/InboundNatPool.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/InboundNatPool.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -140,28 +139,5 @@ public InboundNATPool() [JsonProperty(PropertyName = "networkSecurityGroupRules")] public IList NetworkSecurityGroupRules { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (NetworkSecurityGroupRules != null) - { - foreach (var element in NetworkSecurityGroupRules) - { - if (element != null) - { - element.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobAddParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobAddParameter.cs index 3e5e26306048e..879bb473e6523 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobAddParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobAddParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -238,58 +237,5 @@ public JobAddParameter() [JsonProperty(PropertyName = "usesTaskDependencies")] public bool? UsesTaskDependencies { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (PoolInfo == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PoolInfo"); - } - if (JobManagerTask != null) - { - JobManagerTask.Validate(); - } - if (JobPreparationTask != null) - { - JobPreparationTask.Validate(); - } - if (JobReleaseTask != null) - { - JobReleaseTask.Validate(); - } - if (CommonEnvironmentSettings != null) - { - foreach (var element in CommonEnvironmentSettings) - { - if (element != null) - { - element.Validate(); - } - } - } - if (PoolInfo != null) - { - PoolInfo.Validate(); - } - if (Metadata != null) - { - foreach (var element1 in Metadata) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobDisableParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobDisableParameter.cs index afd529969dce6..de6b2b61223c5 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobDisableParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobDisableParameter.cs @@ -51,14 +51,5 @@ public JobDisableParameter(DisableJobOption disableTasks) [JsonProperty(PropertyName = "disableTasks")] public DisableJobOption DisableTasks { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobExecutionInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobExecutionInformation.cs index ce9ef971aff7d..19f59f42435bd 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobExecutionInformation.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobExecutionInformation.cs @@ -117,18 +117,5 @@ public JobExecutionInformation() [JsonProperty(PropertyName = "terminateReason")] public string TerminateReason { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (SchedulingError != null) - { - SchedulingError.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobManagerTask.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobManagerTask.cs index 0b082bc55496e..baae94aa27d58 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobManagerTask.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobManagerTask.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -176,7 +175,12 @@ public JobManagerTask() /// /// /// Files listed under this element are located in the task's working - /// directory. + /// directory. There is a maximum size for the list of resource files. + /// When the max size is exceeded, the request will fail and the + /// response error code will be RequestEntityTooLarge. If this occurs, + /// the collection of ResourceFiles must be reduced in size. This can + /// be achieved using .zip files, Application Packages, or Docker + /// Containers. /// [JsonProperty(PropertyName = "resourceFiles")] public IList ResourceFiles { get; set; } @@ -296,66 +300,5 @@ public JobManagerTask() [JsonProperty(PropertyName = "allowLowPriorityNode")] public bool? AllowLowPriorityNode { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (CommandLine == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CommandLine"); - } - if (ContainerSettings != null) - { - ContainerSettings.Validate(); - } - if (ResourceFiles != null) - { - foreach (var element in ResourceFiles) - { - if (element != null) - { - element.Validate(); - } - } - } - if (OutputFiles != null) - { - foreach (var element1 in OutputFiles) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (EnvironmentSettings != null) - { - foreach (var element2 in EnvironmentSettings) - { - if (element2 != null) - { - element2.Validate(); - } - } - } - if (ApplicationPackageReferences != null) - { - foreach (var element3 in ApplicationPackageReferences) - { - if (element3 != null) - { - element3.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPatchParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPatchParameter.cs index 5a8bbb40fb237..20f467dde5eca 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPatchParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPatchParameter.cs @@ -118,28 +118,5 @@ public JobPatchParameter() [JsonProperty(PropertyName = "metadata")] public IList Metadata { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PoolInfo != null) - { - PoolInfo.Validate(); - } - if (Metadata != null) - { - foreach (var element in Metadata) - { - if (element != null) - { - element.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationAndReleaseTaskExecutionInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationAndReleaseTaskExecutionInformation.cs index 75f0c709af4f9..3f54e238c1ee2 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationAndReleaseTaskExecutionInformation.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationAndReleaseTaskExecutionInformation.cs @@ -97,22 +97,5 @@ public JobPreparationAndReleaseTaskExecutionInformation() [JsonProperty(PropertyName = "jobReleaseTaskExecutionInfo")] public JobReleaseTaskExecutionInformation JobReleaseTaskExecutionInfo { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (JobPreparationTaskExecutionInfo != null) - { - JobPreparationTaskExecutionInfo.Validate(); - } - if (JobReleaseTaskExecutionInfo != null) - { - JobReleaseTaskExecutionInfo.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationTask.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationTask.cs index 940c18674f64f..8e5fa70bdbf55 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationTask.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationTask.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -161,7 +160,12 @@ public JobPreparationTask() /// /// /// Files listed under this element are located in the task's working - /// directory. + /// directory. There is a maximum size for the list of resource files. + /// When the max size is exceeded, the request will fail and the + /// response error code will be RequestEntityTooLarge. If this occurs, + /// the collection of ResourceFiles must be reduced in size. This can + /// be achieved using .zip files, Application Packages, or Docker + /// Containers. /// [JsonProperty(PropertyName = "resourceFiles")] public IList ResourceFiles { get; set; } @@ -229,42 +233,5 @@ public JobPreparationTask() [JsonProperty(PropertyName = "rerunOnNodeRebootAfterSuccess")] public bool? RerunOnNodeRebootAfterSuccess { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (CommandLine == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CommandLine"); - } - if (ContainerSettings != null) - { - ContainerSettings.Validate(); - } - if (ResourceFiles != null) - { - foreach (var element in ResourceFiles) - { - if (element != null) - { - element.Validate(); - } - } - } - if (EnvironmentSettings != null) - { - foreach (var element1 in EnvironmentSettings) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationTaskExecutionInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationTaskExecutionInformation.cs index a37e1fe8f0525..ff52d04887db9 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationTaskExecutionInformation.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobPreparationTaskExecutionInformation.cs @@ -202,18 +202,5 @@ public JobPreparationTaskExecutionInformation() [JsonProperty(PropertyName = "result")] public TaskExecutionResult? Result { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (FailureInfo != null) - { - FailureInfo.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobReleaseTask.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobReleaseTask.cs index ae68586ddd2a2..fa7cabcbb9509 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobReleaseTask.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobReleaseTask.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -59,8 +58,13 @@ public JobReleaseTask() /// The settings for the container /// under which the Job Release task runs. /// A list of files that the Batch service - /// will download to the compute node before running the command - /// line. + /// will download to the compute node before running the command line. + /// There is a maximum size for the list of resource files. When the + /// max size is exceeded, the request will fail and the response error + /// code will be RequestEntityTooLarge. If this occurs, the collection + /// of ResourceFiles must be reduced in size. This can be achieved + /// using .zip files, Application Packages, or Docker + /// Containers. /// A list of environment variable /// settings for the Job Release task. /// The maximum elapsed time that the @@ -145,7 +149,12 @@ public JobReleaseTask() /// /// Gets or sets a list of files that the Batch service will download - /// to the compute node before running the command line. + /// to the compute node before running the command line. There is a + /// maximum size for the list of resource files. When the max size is + /// exceeded, the request will fail and the response error code will be + /// RequestEntityTooLarge. If this occurs, the collection of + /// ResourceFiles must be reduced in size. This can be achieved using + /// .zip files, Application Packages, or Docker Containers. /// /// /// Files listed under this element are located in the task's working @@ -196,42 +205,5 @@ public JobReleaseTask() [JsonProperty(PropertyName = "userIdentity")] public UserIdentity UserIdentity { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (CommandLine == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CommandLine"); - } - if (ContainerSettings != null) - { - ContainerSettings.Validate(); - } - if (ResourceFiles != null) - { - foreach (var element in ResourceFiles) - { - if (element != null) - { - element.Validate(); - } - } - } - if (EnvironmentSettings != null) - { - foreach (var element1 in EnvironmentSettings) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobReleaseTaskExecutionInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobReleaseTaskExecutionInformation.cs index d83f6442db517..99b3e23723383 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobReleaseTaskExecutionInformation.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobReleaseTaskExecutionInformation.cs @@ -161,18 +161,5 @@ public JobReleaseTaskExecutionInformation() [JsonProperty(PropertyName = "result")] public TaskExecutionResult? Result { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (FailureInfo != null) - { - FailureInfo.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleAddParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleAddParameter.cs index 0938f3b1a1635..966fdc886fcba 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleAddParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleAddParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -107,40 +106,5 @@ public JobScheduleAddParameter() [JsonProperty(PropertyName = "metadata")] public IList Metadata { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (Schedule == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Schedule"); - } - if (JobSpecification == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "JobSpecification"); - } - if (JobSpecification != null) - { - JobSpecification.Validate(); - } - if (Metadata != null) - { - foreach (var element in Metadata) - { - if (element != null) - { - element.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSchedulePatchParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSchedulePatchParameter.cs index 4469dba3459af..2cfd8d1892ea9 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSchedulePatchParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSchedulePatchParameter.cs @@ -83,28 +83,5 @@ public JobSchedulePatchParameter() [JsonProperty(PropertyName = "metadata")] public IList Metadata { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (JobSpecification != null) - { - JobSpecification.Validate(); - } - if (Metadata != null) - { - foreach (var element in Metadata) - { - if (element != null) - { - element.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleStatistics.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleStatistics.cs index bd23b66cb8558..f11ab592d4256 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleStatistics.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleStatistics.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -208,18 +207,5 @@ public JobScheduleStatistics(string url, System.DateTime startTime, System.DateT [JsonProperty(PropertyName = "waitTime")] public System.TimeSpan WaitTime { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Url == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Url"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleUpdateParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleUpdateParameter.cs index 19f461563af54..4541c8b39ad39 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleUpdateParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobScheduleUpdateParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -85,36 +84,5 @@ public JobScheduleUpdateParameter() [JsonProperty(PropertyName = "metadata")] public IList Metadata { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Schedule == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Schedule"); - } - if (JobSpecification == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "JobSpecification"); - } - if (JobSpecification != null) - { - JobSpecification.Validate(); - } - if (Metadata != null) - { - foreach (var element in Metadata) - { - if (element != null) - { - element.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSchedulingError.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSchedulingError.cs index e902a513ef55a..dd63ba57a0ca9 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSchedulingError.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSchedulingError.cs @@ -85,14 +85,5 @@ public JobSchedulingError() [JsonProperty(PropertyName = "details")] public IList Details { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSpecification.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSpecification.cs index 443c496ad4a22..7dd2b09e9d0d3 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSpecification.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobSpecification.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -229,54 +228,5 @@ public JobSpecification() [JsonProperty(PropertyName = "metadata")] public IList Metadata { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PoolInfo == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PoolInfo"); - } - if (JobManagerTask != null) - { - JobManagerTask.Validate(); - } - if (JobPreparationTask != null) - { - JobPreparationTask.Validate(); - } - if (JobReleaseTask != null) - { - JobReleaseTask.Validate(); - } - if (CommonEnvironmentSettings != null) - { - foreach (var element in CommonEnvironmentSettings) - { - if (element != null) - { - element.Validate(); - } - } - } - if (PoolInfo != null) - { - PoolInfo.Validate(); - } - if (Metadata != null) - { - foreach (var element1 in Metadata) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobStatistics.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobStatistics.cs index 85efb65dcd311..35b1996370878 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobStatistics.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobStatistics.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -202,18 +201,5 @@ public JobStatistics(string url, System.DateTime startTime, System.DateTime last [JsonProperty(PropertyName = "waitTime")] public System.TimeSpan WaitTime { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Url == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Url"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobUpdateParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobUpdateParameter.cs index 774cc57af2425..9fb01d8fa52e9 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobUpdateParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/JobUpdateParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -124,32 +123,5 @@ public JobUpdateParameter() [JsonProperty(PropertyName = "onAllTasksComplete")] public OnAllTasksComplete? OnAllTasksComplete { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PoolInfo == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PoolInfo"); - } - if (PoolInfo != null) - { - PoolInfo.Validate(); - } - if (Metadata != null) - { - foreach (var element in Metadata) - { - if (element != null) - { - element.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/MetadataItem.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/MetadataItem.cs index 4ccf15e2e9186..dfc97a91da6f0 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/MetadataItem.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/MetadataItem.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -60,22 +59,5 @@ public MetadataItem(string name, string value) [JsonProperty(PropertyName = "value")] public string Value { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Value == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/MultiInstanceSettings.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/MultiInstanceSettings.cs index 299d7322faede..dc3549acd42ef 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/MultiInstanceSettings.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/MultiInstanceSettings.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -89,33 +88,15 @@ public MultiInstanceSettings() /// only for the primary. Also note that these resource files are not /// downloaded to the task working directory, but instead are /// downloaded to the task root directory (one directory above the - /// working directory). + /// working directory). There is a maximum size for the list of + /// resource files. When the max size is exceeded, the request will + /// fail and the response error code will be RequestEntityTooLarge. If + /// this occurs, the collection of ResourceFiles must be reduced in + /// size. This can be achieved using .zip files, Application Packages, + /// or Docker Containers. /// [JsonProperty(PropertyName = "commonResourceFiles")] public IList CommonResourceFiles { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (CoordinationCommandLine == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CoordinationCommandLine"); - } - if (CommonResourceFiles != null) - { - foreach (var element in CommonResourceFiles) - { - if (element != null) - { - element.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NetworkConfiguration.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NetworkConfiguration.cs index f037e34616fcc..095d9563f0b58 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NetworkConfiguration.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NetworkConfiguration.cs @@ -95,18 +95,5 @@ public NetworkConfiguration() [JsonProperty(PropertyName = "endpointConfiguration")] public PoolEndpointConfiguration EndpointConfiguration { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (EndpointConfiguration != null) - { - EndpointConfiguration.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NetworkSecurityGroupRule.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NetworkSecurityGroupRule.cs index 58688b92d849d..118fbf4c053f3 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NetworkSecurityGroupRule.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NetworkSecurityGroupRule.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -86,18 +85,5 @@ public NetworkSecurityGroupRule(int priority, NetworkSecurityGroupRuleAccess acc [JsonProperty(PropertyName = "sourceAddressPrefix")] public string SourceAddressPrefix { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (SourceAddressPrefix == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SourceAddressPrefix"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeAgentInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeAgentInformation.cs new file mode 100644 index 0000000000000..f1da106b15069 --- /dev/null +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeAgentInformation.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Batch.Protocol.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about the node agent. + /// + /// + /// The Batch node agent is a program that runs on each node in the pool + /// and provides Batch capability on the compute node. + /// + public partial class NodeAgentInformation + { + /// + /// Initializes a new instance of the NodeAgentInformation class. + /// + public NodeAgentInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NodeAgentInformation class. + /// + /// The version of the Batch node agent running + /// on the compute node. + /// The time when the node agent was + /// updated on the compute node. + public NodeAgentInformation(string version, System.DateTime lastUpdateTime) + { + Version = version; + LastUpdateTime = lastUpdateTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the version of the Batch node agent running on the + /// compute node. + /// + /// + /// This version number can be checked against the node agent release + /// notes located at + /// https://github.com/Azure/Batch/blob/master/changelogs/nodeagent/CHANGELOG.md. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets or sets the time when the node agent was updated on the + /// compute node. + /// + /// + /// This is the most recent time that the node agent was updated to a + /// new version. + /// + [JsonProperty(PropertyName = "lastUpdateTime")] + public System.DateTime LastUpdateTime { get; set; } + + } +} diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeCounts.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeCounts.cs index 43b6bce374daf..3b6659c9b6553 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeCounts.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeCounts.cs @@ -163,15 +163,5 @@ public NodeCounts(int creating, int idle, int offline, int preempted, int reboot [JsonProperty(PropertyName = "total")] public int Total { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeFile.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeFile.cs index 0b2d983e50523..9348d477746c6 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeFile.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeFile.cs @@ -72,18 +72,5 @@ public NodeFile() [JsonProperty(PropertyName = "properties")] public FileProperties Properties { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Properties != null) - { - Properties.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeRemoveParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeRemoveParameter.cs index 09585f7649b56..1591f8607e802 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeRemoveParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/NodeRemoveParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -82,25 +81,5 @@ public NodeRemoveParameter() [JsonProperty(PropertyName = "nodeDeallocationOption")] public ComputeNodeDeallocationOption? NodeDeallocationOption { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (NodeList == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "NodeList"); - } - if (NodeList != null) - { - if (NodeList.Count > 100) - { - throw new ValidationException(ValidationRules.MaxItems, "NodeList", 100); - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OSDisk.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OSDisk.cs index 7f9b7f52d46a9..6530a20a1667e 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OSDisk.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OSDisk.cs @@ -46,8 +46,8 @@ public OSDisk() /// Gets or sets the type of caching to enable for the OS disk. /// /// - /// The default value for caching is none. For information about the - /// caching options see: + /// The default value for caching is readwrite. For information about + /// the caching options see: /// https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. /// Possible values include: 'none', 'readOnly', 'readWrite' /// diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFile.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFile.cs index 5ccf186fa9e24..203fa90df53d7 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFile.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFile.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -91,34 +90,5 @@ public OutputFile(string filePattern, OutputFileDestination destination, OutputF [JsonProperty(PropertyName = "uploadOptions")] public OutputFileUploadOptions UploadOptions { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (FilePattern == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "FilePattern"); - } - if (Destination == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Destination"); - } - if (UploadOptions == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "UploadOptions"); - } - if (Destination != null) - { - Destination.Validate(); - } - if (UploadOptions != null) - { - UploadOptions.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileBlobContainerDestination.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileBlobContainerDestination.cs index d34f9e1736aa7..cc581eb6b1599 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileBlobContainerDestination.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileBlobContainerDestination.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -77,18 +76,5 @@ public OutputFileBlobContainerDestination() [JsonProperty(PropertyName = "containerUrl")] public string ContainerUrl { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ContainerUrl == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ContainerUrl"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileDestination.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileDestination.cs index 55122685eb40e..9a7ed34b7116b 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileDestination.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileDestination.cs @@ -49,18 +49,5 @@ public OutputFileDestination() [JsonProperty(PropertyName = "container")] public OutputFileBlobContainerDestination Container { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Container != null) - { - Container.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileUploadOptions.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileUploadOptions.cs index f2b27409e78ac..ff13718032327 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileUploadOptions.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/OutputFileUploadOptions.cs @@ -54,14 +54,5 @@ public OutputFileUploadOptions(OutputFileUploadCondition uploadCondition) [JsonProperty(PropertyName = "uploadCondition")] public OutputFileUploadCondition UploadCondition { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolAddParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolAddParameter.cs index 9f6098fa1a8b7..bea3e5d8027d1 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolAddParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolAddParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -360,82 +359,5 @@ public PoolAddParameter() [JsonProperty(PropertyName = "metadata")] public IList Metadata { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (VmSize == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "VmSize"); - } - if (CloudServiceConfiguration != null) - { - CloudServiceConfiguration.Validate(); - } - if (VirtualMachineConfiguration != null) - { - VirtualMachineConfiguration.Validate(); - } - if (NetworkConfiguration != null) - { - NetworkConfiguration.Validate(); - } - if (StartTask != null) - { - StartTask.Validate(); - } - if (CertificateReferences != null) - { - foreach (var element in CertificateReferences) - { - if (element != null) - { - element.Validate(); - } - } - } - if (ApplicationPackageReferences != null) - { - foreach (var element1 in ApplicationPackageReferences) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (TaskSchedulingPolicy != null) - { - TaskSchedulingPolicy.Validate(); - } - if (UserAccounts != null) - { - foreach (var element2 in UserAccounts) - { - if (element2 != null) - { - element2.Validate(); - } - } - } - if (Metadata != null) - { - foreach (var element3 in Metadata) - { - if (element3 != null) - { - element3.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolEndpointConfiguration.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolEndpointConfiguration.cs index e801f90bc98de..500730b263485 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolEndpointConfiguration.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolEndpointConfiguration.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -58,28 +57,5 @@ public PoolEndpointConfiguration(IList inboundNATPools) [JsonProperty(PropertyName = "inboundNATPools")] public IList InboundNATPools { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (InboundNATPools == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "InboundNATPools"); - } - if (InboundNATPools != null) - { - foreach (var element in InboundNATPools) - { - if (element != null) - { - element.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolEvaluateAutoScaleParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolEvaluateAutoScaleParameter.cs index 99f5bc1bd5e56..0badce296db65 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolEvaluateAutoScaleParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolEvaluateAutoScaleParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -60,18 +59,5 @@ public PoolEvaluateAutoScaleParameter(string autoScaleFormula) [JsonProperty(PropertyName = "autoScaleFormula")] public string AutoScaleFormula { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (AutoScaleFormula == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AutoScaleFormula"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolInformation.cs index 6b5ef52d3bc34..dcb733356a457 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolInformation.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolInformation.cs @@ -79,18 +79,5 @@ public PoolInformation() [JsonProperty(PropertyName = "autoPoolSpecification")] public AutoPoolSpecification AutoPoolSpecification { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (AutoPoolSpecification != null) - { - AutoPoolSpecification.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolNodeCounts.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolNodeCounts.cs index 31c62e3263c1e..5387f45f2dcc0 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolNodeCounts.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolNodeCounts.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -66,26 +65,5 @@ public PoolNodeCounts() [JsonProperty(PropertyName = "lowPriority")] public NodeCounts LowPriority { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PoolId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PoolId"); - } - if (Dedicated != null) - { - Dedicated.Validate(); - } - if (LowPriority != null) - { - LowPriority.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolPatchParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolPatchParameter.cs index 270e7ea7396ff..42d2b4653be68 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolPatchParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolPatchParameter.cs @@ -116,48 +116,5 @@ public PoolPatchParameter() [JsonProperty(PropertyName = "metadata")] public IList Metadata { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (StartTask != null) - { - StartTask.Validate(); - } - if (CertificateReferences != null) - { - foreach (var element in CertificateReferences) - { - if (element != null) - { - element.Validate(); - } - } - } - if (ApplicationPackageReferences != null) - { - foreach (var element1 in ApplicationPackageReferences) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (Metadata != null) - { - foreach (var element2 in Metadata) - { - if (element2 != null) - { - element2.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolSpecification.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolSpecification.cs index 6a2a1ee023bde..3bccf61df55c8 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolSpecification.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolSpecification.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -119,20 +118,9 @@ public PoolSpecification() /// virtual machines in a pool are the same size. /// /// - /// For information about available sizes of virtual machines for Cloud - /// Services pools (pools created with cloudServiceConfiguration), see - /// Sizes for Cloud Services - /// (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). - /// Batch supports all Cloud Services VM sizes except ExtraSmall, A1V2 - /// and A2V2. For information about available VM sizes for pools using - /// images from the Virtual Machines Marketplace (pools created with - /// virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) - /// (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) - /// or Sizes for Virtual Machines (Windows) - /// (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). - /// Batch supports all Azure VM sizes except STANDARD_A0 and those with - /// premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 - /// series). + /// For information about available sizes of virtual machines in pools, + /// see Choose a VM size for compute nodes in an Azure Batch pool + /// (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). /// [JsonProperty(PropertyName = "vmSize")] public string VmSize { get; set; } @@ -325,7 +313,10 @@ public PoolSpecification() /// /// The list of application licenses must be a subset of available /// Batch service application licenses. If a license is requested which - /// is not supported, pool creation will fail. + /// is not supported, pool creation will fail. The permitted licenses + /// available on the pool are 'maya', 'vray', '3dsmax', 'arnold'. An + /// additional charge applies for each application license added to the + /// pool. /// [JsonProperty(PropertyName = "applicationLicenses")] public IList ApplicationLicenses { get; set; } @@ -348,78 +339,5 @@ public PoolSpecification() [JsonProperty(PropertyName = "metadata")] public IList Metadata { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (VmSize == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "VmSize"); - } - if (CloudServiceConfiguration != null) - { - CloudServiceConfiguration.Validate(); - } - if (VirtualMachineConfiguration != null) - { - VirtualMachineConfiguration.Validate(); - } - if (TaskSchedulingPolicy != null) - { - TaskSchedulingPolicy.Validate(); - } - if (NetworkConfiguration != null) - { - NetworkConfiguration.Validate(); - } - if (StartTask != null) - { - StartTask.Validate(); - } - if (CertificateReferences != null) - { - foreach (var element in CertificateReferences) - { - if (element != null) - { - element.Validate(); - } - } - } - if (ApplicationPackageReferences != null) - { - foreach (var element1 in ApplicationPackageReferences) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (UserAccounts != null) - { - foreach (var element2 in UserAccounts) - { - if (element2 != null) - { - element2.Validate(); - } - } - } - if (Metadata != null) - { - foreach (var element3 in Metadata) - { - if (element3 != null) - { - element3.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolStatistics.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolStatistics.cs index 89704e79f2b3d..83e28dfeb2cf1 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolStatistics.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolStatistics.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -91,26 +90,5 @@ public PoolStatistics() [JsonProperty(PropertyName = "resourceStats")] public ResourceStatistics ResourceStats { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Url == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Url"); - } - if (UsageStats != null) - { - UsageStats.Validate(); - } - if (ResourceStats != null) - { - ResourceStats.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUpdatePropertiesParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUpdatePropertiesParameter.cs index 3e09f57f31769..56e672570c4c8 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUpdatePropertiesParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUpdatePropertiesParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -116,60 +115,5 @@ public PoolUpdatePropertiesParameter() [JsonProperty(PropertyName = "metadata")] public IList Metadata { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (CertificateReferences == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CertificateReferences"); - } - if (ApplicationPackageReferences == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ApplicationPackageReferences"); - } - if (Metadata == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Metadata"); - } - if (StartTask != null) - { - StartTask.Validate(); - } - if (CertificateReferences != null) - { - foreach (var element in CertificateReferences) - { - if (element != null) - { - element.Validate(); - } - } - } - if (ApplicationPackageReferences != null) - { - foreach (var element1 in ApplicationPackageReferences) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (Metadata != null) - { - foreach (var element2 in Metadata) - { - if (element2 != null) - { - element2.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUpgradeOSParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUpgradeOSParameter.cs index ffc99c0413871..c2128f82b6c27 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUpgradeOSParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUpgradeOSParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -50,18 +49,5 @@ public PoolUpgradeOSParameter(string targetOSVersion) [JsonProperty(PropertyName = "targetOSVersion")] public string TargetOSVersion { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (TargetOSVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TargetOSVersion"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUsageMetrics.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUsageMetrics.cs index 721bebc2fabf5..ed80185b1aae2 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUsageMetrics.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/PoolUsageMetrics.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -89,18 +88,7 @@ public PoolUsageMetrics(string poolId, System.DateTime startTime, System.DateTim /// /// For information about available sizes of virtual machines in pools, /// see Choose a VM size for compute nodes in an Azure Batch pool - /// (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). Batch - /// supports all Cloud Services VM sizes except ExtraSmall, - /// STANDARD_A1_V2 and STANDARD_A2_V2. For information about available - /// VM sizes for pools using images from the Virtual Machines - /// Marketplace (pools created with virtualMachineConfiguration) see - /// Sizes for Virtual Machines (Linux) - /// (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) - /// or Sizes for Virtual Machines (Windows) - /// (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). - /// Batch supports all Azure VM sizes except STANDARD_A0 and those with - /// premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 - /// series). + /// (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). /// [JsonProperty(PropertyName = "vmSize")] public string VmSize { get; set; } @@ -126,22 +114,5 @@ public PoolUsageMetrics(string poolId, System.DateTime startTime, System.DateTim [JsonProperty(PropertyName = "dataEgressGiB")] public double DataEgressGiB { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PoolId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PoolId"); - } - if (VmSize == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "VmSize"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ResourceFile.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ResourceFile.cs index a8aebdf2a2309..2e8d349ccefee 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ResourceFile.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ResourceFile.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -84,22 +83,5 @@ public ResourceFile() [JsonProperty(PropertyName = "fileMode")] public string FileMode { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (BlobSource == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "BlobSource"); - } - if (FilePath == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "FilePath"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ResourceStatistics.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ResourceStatistics.cs index fc4f93c29c1a9..707558561157d 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ResourceStatistics.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/ResourceStatistics.cs @@ -171,15 +171,5 @@ public ResourceStatistics(System.DateTime startTime, System.DateTime lastUpdateT [JsonProperty(PropertyName = "networkWriteGiB")] public double NetworkWriteGiB { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/StartTask.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/StartTask.cs index 9cbc18373a907..adf0b850b4ce7 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/StartTask.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/StartTask.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -51,8 +50,13 @@ public StartTask() /// The settings for the container /// under which the start task runs. /// A list of files that the Batch service - /// will download to the compute node before running the command - /// line. + /// will download to the compute node before running the command line. + /// There is a maximum size for the list of resource files. When the + /// max size is exceeded, the request will fail and the response error + /// code will be RequestEntityTooLarge. If this occurs, the collection + /// of ResourceFiles must be reduced in size. This can be achieved + /// using .zip files, Application Packages, or Docker + /// Containers. /// A list of environment variable /// settings for the start task. /// The user identity under which the start @@ -113,7 +117,12 @@ public StartTask() /// /// Gets or sets a list of files that the Batch service will download - /// to the compute node before running the command line. + /// to the compute node before running the command line. There is a + /// maximum size for the list of resource files. When the max size is + /// exceeded, the request will fail and the response error code will be + /// RequestEntityTooLarge. If this occurs, the collection of + /// ResourceFiles must be reduced in size. This can be achieved using + /// .zip files, Application Packages, or Docker Containers. /// /// /// Files listed under this element are located in the task's working @@ -176,42 +185,5 @@ public StartTask() [JsonProperty(PropertyName = "waitForSuccess")] public bool? WaitForSuccess { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (CommandLine == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CommandLine"); - } - if (ContainerSettings != null) - { - ContainerSettings.Validate(); - } - if (ResourceFiles != null) - { - foreach (var element in ResourceFiles) - { - if (element != null) - { - element.Validate(); - } - } - } - if (EnvironmentSettings != null) - { - foreach (var element1 in EnvironmentSettings) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/StartTaskInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/StartTaskInformation.cs index 20b8b16484deb..b5ac3caf79018 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/StartTaskInformation.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/StartTaskInformation.cs @@ -173,18 +173,5 @@ public StartTaskInformation() [JsonProperty(PropertyName = "result")] public TaskExecutionResult? Result { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (FailureInfo != null) - { - FailureInfo.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/SubtaskInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/SubtaskInformation.cs index eac00d435be54..e81c3ecd0b2eb 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/SubtaskInformation.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/SubtaskInformation.cs @@ -188,18 +188,5 @@ public SubtaskInformation() [JsonProperty(PropertyName = "result")] public TaskExecutionResult? Result { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (FailureInfo != null) - { - FailureInfo.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddCollectionParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddCollectionParameter.cs index a6800d9f3dc03..ade0fa2f61fee 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddCollectionParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddCollectionParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -32,7 +31,8 @@ public TaskAddCollectionParameter() /// /// Initializes a new instance of the TaskAddCollectionParameter class. /// - /// The collection of tasks to add. + /// The collection of tasks to add. The maximum + /// count of tasks is 100. public TaskAddCollectionParameter(IList value) { Value = value; @@ -45,11 +45,12 @@ public TaskAddCollectionParameter(IList value) partial void CustomInit(); /// - /// Gets or sets the collection of tasks to add. + /// Gets or sets the collection of tasks to add. The maximum count of + /// tasks is 100. /// /// - /// The total serialized size of this collection must be less than 4MB. - /// If it is greater than 4MB (for example if each task has 100's of + /// The total serialized size of this collection must be less than 1MB. + /// If it is greater than 1MB (for example if each task has 100's of /// resource files or environment variables), the request will fail /// with code 'RequestBodyTooLarge' and should be retried again with /// fewer tasks. @@ -57,32 +58,5 @@ public TaskAddCollectionParameter(IList value) [JsonProperty(PropertyName = "value")] public IList Value { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Value == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); - } - if (Value != null) - { - if (Value.Count > 100) - { - throw new ValidationException(ValidationRules.MaxItems, "Value", 100); - } - foreach (var element in Value) - { - if (element != null) - { - element.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddParameter.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddParameter.cs index adb69cc1ba6cd..91bec8650e6c9 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddParameter.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddParameter.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -178,7 +177,12 @@ public TaskAddParameter() /// /// For multi-instance tasks, the resource files will only be /// downloaded to the compute node on which the primary task is - /// executed. + /// executed. There is a maximum size for the list of resource files. + /// When the max size is exceeded, the request will fail and the + /// response error code will be RequestEntityTooLarge. If this occurs, + /// the collection of ResourceFiles must be reduced in size. This can + /// be achieved using .zip files, Application Packages, or Docker + /// Containers. /// [JsonProperty(PropertyName = "resourceFiles")] public IList ResourceFiles { get; set; } @@ -283,74 +287,5 @@ public TaskAddParameter() [JsonProperty(PropertyName = "authenticationTokenSettings")] public AuthenticationTokenSettings AuthenticationTokenSettings { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (CommandLine == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CommandLine"); - } - if (ContainerSettings != null) - { - ContainerSettings.Validate(); - } - if (ResourceFiles != null) - { - foreach (var element in ResourceFiles) - { - if (element != null) - { - element.Validate(); - } - } - } - if (OutputFiles != null) - { - foreach (var element1 in OutputFiles) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (EnvironmentSettings != null) - { - foreach (var element2 in EnvironmentSettings) - { - if (element2 != null) - { - element2.Validate(); - } - } - } - if (AffinityInfo != null) - { - AffinityInfo.Validate(); - } - if (MultiInstanceSettings != null) - { - MultiInstanceSettings.Validate(); - } - if (ApplicationPackageReferences != null) - { - foreach (var element3 in ApplicationPackageReferences) - { - if (element3 != null) - { - element3.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddResult.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddResult.cs index 6c73cdb54590a..a035358179dc1 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddResult.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskAddResult.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -106,18 +105,5 @@ public TaskAddResult() [JsonProperty(PropertyName = "error")] public BatchError Error { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (TaskId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TaskId"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskContainerSettings.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskContainerSettings.cs index 3494a90aeda34..9a930958d04e9 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskContainerSettings.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskContainerSettings.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -83,22 +82,5 @@ public TaskContainerSettings() [JsonProperty(PropertyName = "registry")] public ContainerRegistry Registry { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ImageName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ImageName"); - } - if (Registry != null) - { - Registry.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskCountValidationStatus.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskCountValidationStatus.cs deleted file mode 100644 index b4e94575c4e05..0000000000000 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskCountValidationStatus.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Batch.Protocol.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for TaskCountValidationStatus. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum TaskCountValidationStatus - { - /// - /// The Batch service has validated the state counts against the task - /// states as reported in the List Tasks API. - /// - [EnumMember(Value = "validated")] - Validated, - /// - /// The Batch service has not been able to check state counts against - /// the task states as reported in the List Tasks API. The - /// validationStatus may be unvalidated if the job contains more than - /// 200,000 tasks. - /// - [EnumMember(Value = "unvalidated")] - Unvalidated - } - internal static class TaskCountValidationStatusEnumExtension - { - internal static string ToSerializedValue(this TaskCountValidationStatus? value) - { - return value == null ? null : ((TaskCountValidationStatus)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this TaskCountValidationStatus value) - { - switch( value ) - { - case TaskCountValidationStatus.Validated: - return "validated"; - case TaskCountValidationStatus.Unvalidated: - return "unvalidated"; - } - return null; - } - - internal static TaskCountValidationStatus? ParseTaskCountValidationStatus(this string value) - { - switch( value ) - { - case "validated": - return TaskCountValidationStatus.Validated; - case "unvalidated": - return TaskCountValidationStatus.Unvalidated; - } - return null; - } - } -} diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskCounts.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskCounts.cs index 58156e24ae4ac..38f04496c3a83 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskCounts.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskCounts.cs @@ -41,16 +41,13 @@ public TaskCounts() /// The number of tasks which failed. A task fails /// if its result (found in the executionInfo property) is /// 'failure'. - /// Whether the task counts have been - /// validated. - public TaskCounts(int active, int running, int completed, int succeeded, int failed, TaskCountValidationStatus validationStatus) + public TaskCounts(int active, int running, int completed, int succeeded, int failed) { Active = active; Running = running; Completed = completed; Succeeded = succeeded; Failed = failed; - ValidationStatus = validationStatus; CustomInit(); } @@ -91,23 +88,5 @@ public TaskCounts(int active, int running, int completed, int succeeded, int fai [JsonProperty(PropertyName = "failed")] public int Failed { get; set; } - /// - /// Gets or sets whether the task counts have been validated. - /// - /// - /// Possible values include: 'validated', 'unvalidated' - /// - [JsonProperty(PropertyName = "validationStatus")] - public TaskCountValidationStatus ValidationStatus { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskExecutionInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskExecutionInformation.cs index 9e1362aa34a4f..7ffdc3e8efc57 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskExecutionInformation.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskExecutionInformation.cs @@ -192,18 +192,5 @@ public TaskExecutionInformation() [JsonProperty(PropertyName = "result")] public TaskExecutionResult? Result { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (FailureInfo != null) - { - FailureInfo.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskFailureInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskFailureInformation.cs index d3c46f1363c2f..82ec8a54c0039 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskFailureInformation.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskFailureInformation.cs @@ -81,14 +81,5 @@ public TaskFailureInformation() [JsonProperty(PropertyName = "details")] public IList Details { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskIdRange.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskIdRange.cs index 9fc6bde0caf52..3d9059b933b29 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskIdRange.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskIdRange.cs @@ -62,15 +62,5 @@ public TaskIdRange(int start, int end) [JsonProperty(PropertyName = "end")] public int End { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskInformation.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskInformation.cs index 2562c752ee4b5..4534f0710dca6 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskInformation.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskInformation.cs @@ -95,18 +95,5 @@ public TaskInformation() [JsonProperty(PropertyName = "executionInfo")] public TaskExecutionInformation ExecutionInfo { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ExecutionInfo != null) - { - ExecutionInfo.Validate(); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskSchedulingPolicy.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskSchedulingPolicy.cs index b7338005b43bc..4103bafd17059 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskSchedulingPolicy.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskSchedulingPolicy.cs @@ -52,14 +52,5 @@ public TaskSchedulingPolicy(ComputeNodeFillType nodeFillType) [JsonProperty(PropertyName = "nodeFillType")] public ComputeNodeFillType NodeFillType { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskStatistics.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskStatistics.cs index ea6a0576e8dbc..b86ebc87b1741 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskStatistics.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/TaskStatistics.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -162,18 +161,5 @@ public TaskStatistics(string url, System.DateTime startTime, System.DateTime las [JsonProperty(PropertyName = "waitTime")] public System.TimeSpan WaitTime { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Url == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Url"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UploadBatchServiceLogsConfiguration.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UploadBatchServiceLogsConfiguration.cs index 4820b3b4929ba..9792e962e2750 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UploadBatchServiceLogsConfiguration.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UploadBatchServiceLogsConfiguration.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -95,18 +94,5 @@ public UploadBatchServiceLogsConfiguration() [JsonProperty(PropertyName = "endTime")] public System.DateTime? EndTime { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ContainerUrl == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ContainerUrl"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UploadBatchServiceLogsResult.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UploadBatchServiceLogsResult.cs index 50c73a1f75d09..a850b5c3c8840 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UploadBatchServiceLogsResult.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UploadBatchServiceLogsResult.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -68,18 +67,5 @@ public UploadBatchServiceLogsResult(string virtualDirectoryName, int numberOfFil [JsonProperty(PropertyName = "numberOfFilesUploaded")] public int NumberOfFilesUploaded { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (VirtualDirectoryName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "VirtualDirectoryName"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UsageStatistics.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UsageStatistics.cs index 3a71b6c3dc946..c2107e71be029 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UsageStatistics.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UsageStatistics.cs @@ -71,15 +71,5 @@ public UsageStatistics(System.DateTime startTime, System.DateTime lastUpdateTime [JsonProperty(PropertyName = "dedicatedCoreTime")] public System.TimeSpan DedicatedCoreTime { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UserAccount.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UserAccount.cs index 6b14ec530e4ae..38c06df63fdfe 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UserAccount.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/UserAccount.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -67,10 +66,8 @@ public UserAccount() /// Gets or sets the elevation level of the user account. /// /// - /// nonAdmin - The auto user is a standard user without elevated - /// access. admin - The auto user is a user with elevated access and - /// operates with full Administrator permissions. The default value is - /// nonAdmin. Possible values include: 'nonAdmin', 'admin' + /// The default value is nonAdmin. Possible values include: 'nonAdmin', + /// 'admin' /// [JsonProperty(PropertyName = "elevationLevel")] public ElevationLevel? ElevationLevel { get; set; } @@ -86,22 +83,5 @@ public UserAccount() [JsonProperty(PropertyName = "linuxUserConfiguration")] public LinuxUserConfiguration LinuxUserConfiguration { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Password == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Password"); - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/VirtualMachineConfiguration.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/VirtualMachineConfiguration.cs index 1933e49b5edd8..1d268301254bd 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/VirtualMachineConfiguration.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/Models/VirtualMachineConfiguration.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Batch.Protocol.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -158,32 +157,5 @@ public VirtualMachineConfiguration() [JsonProperty(PropertyName = "containerConfiguration")] public ContainerConfiguration ContainerConfiguration { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ImageReference == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ImageReference"); - } - if (NodeAgentSKUId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "NodeAgentSKUId"); - } - if (DataDisks != null) - { - foreach (var element in DataDisks) - { - if (element != null) - { - element.Validate(); - } - } - } - } } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/PoolOperations.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/PoolOperations.cs index e3e5938e4d033..77eedb9cafbe4 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/PoolOperations.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/PoolOperations.cs @@ -617,10 +617,6 @@ internal PoolOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "pool"); } - if (pool != null) - { - pool.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -3728,10 +3724,6 @@ internal PoolOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "poolUpdatePropertiesParameter"); } - if (poolUpdatePropertiesParameter != null) - { - poolUpdatePropertiesParameter.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -4293,10 +4285,6 @@ internal PoolOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "nodeRemoveParameter"); } - if (nodeRemoveParameter != null) - { - nodeRemoveParameter.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/SdkInfo_BatchService.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/SdkInfo_BatchService.cs index 0c67781b59de7..0bbd5a9cdfa12 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/SdkInfo_BatchService.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/SdkInfo_BatchService.cs @@ -1,26 +1,35 @@ -using System; -using System.Collections.Generic; -using System.Linq; +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// -internal static partial class SdkInfo +namespace Microsoft.Azure.Batch.Protocol { - public static IEnumerable> ApiInfo_BatchService - { - get - { - return new Tuple[] - { - new Tuple("BatchService", "Account", "2018-03-01.6.1"), - new Tuple("BatchService", "Application", "2018-03-01.6.1"), - new Tuple("BatchService", "Certificate", "2018-03-01.6.1"), - new Tuple("BatchService", "ComputeNode", "2018-03-01.6.1"), - new Tuple("BatchService", "File", "2018-03-01.6.1"), - new Tuple("BatchService", "Job", "2018-03-01.6.1"), - new Tuple("BatchService", "JobSchedule", "2018-03-01.6.1"), - new Tuple("BatchService", "Pool", "2018-03-01.6.1"), - new Tuple("BatchService", "Task", "2018-03-01.6.1"), - }.AsEnumerable(); - } - } + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_BatchService + { + get + { + return new Tuple[] + { + new Tuple("BatchService", "Account", "2018-08-01.7.0"), + new Tuple("BatchService", "Application", "2018-08-01.7.0"), + new Tuple("BatchService", "Certificate", "2018-08-01.7.0"), + new Tuple("BatchService", "ComputeNode", "2018-08-01.7.0"), + new Tuple("BatchService", "File", "2018-08-01.7.0"), + new Tuple("BatchService", "Job", "2018-08-01.7.0"), + new Tuple("BatchService", "JobSchedule", "2018-08-01.7.0"), + new Tuple("BatchService", "Pool", "2018-08-01.7.0"), + new Tuple("BatchService", "Task", "2018-08-01.7.0"), + }.AsEnumerable(); + } + } + } } diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/TaskOperations.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/TaskOperations.cs index b7e2ae4b8001f..d4d3654c4cf83 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/TaskOperations.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/TaskOperations.cs @@ -96,10 +96,6 @@ internal TaskOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "task"); } - if (task != null) - { - task.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -612,11 +608,11 @@ internal TaskOperations(BatchServiceClient client) /// The ID of the job to which the task collection is to be added. /// /// - /// The collection of tasks to add. The total serialized size of this - /// collection must be less than 4MB. If it is greater than 4MB (for example if - /// each task has 100's of resource files or environment variables), the - /// request will fail with code 'RequestBodyTooLarge' and should be retried - /// again with fewer tasks. + /// The collection of tasks to add. The maximum count of tasks is 100. The + /// total serialized size of this collection must be less than 1MB. If it is + /// greater than 1MB (for example if each task has 100's of resource files or + /// environment variables), the request will fail with code + /// 'RequestBodyTooLarge' and should be retried again with fewer tasks. /// /// /// Additional parameters for the operation @@ -656,20 +652,6 @@ internal TaskOperations(BatchServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "value"); } - if (value != null) - { - if (value.Count > 100) - { - throw new ValidationException(ValidationRules.MaxItems, "value", 100); - } - foreach (var element in value) - { - if (element != null) - { - element.Validate(); - } - } - } int? timeout = default(int?); if (taskAddCollectionOptions != null) { diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/TaskOperationsExtensions.cs b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/TaskOperationsExtensions.cs index b908b4597dd0d..be6c0c509fb89 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/TaskOperationsExtensions.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch/GeneratedProtocol/TaskOperationsExtensions.cs @@ -156,11 +156,11 @@ public static partial class TaskOperationsExtensions /// The ID of the job to which the task collection is to be added. /// /// - /// The collection of tasks to add. The total serialized size of this - /// collection must be less than 4MB. If it is greater than 4MB (for example if - /// each task has 100's of resource files or environment variables), the - /// request will fail with code 'RequestBodyTooLarge' and should be retried - /// again with fewer tasks. + /// The collection of tasks to add. The maximum count of tasks is 100. The + /// total serialized size of this collection must be less than 1MB. If it is + /// greater than 1MB (for example if each task has 100's of resource files or + /// environment variables), the request will fail with code + /// 'RequestBodyTooLarge' and should be retried again with fewer tasks. /// /// /// Additional parameters for the operation @@ -197,11 +197,11 @@ public static partial class TaskOperationsExtensions /// The ID of the job to which the task collection is to be added. /// /// - /// The collection of tasks to add. The total serialized size of this - /// collection must be less than 4MB. If it is greater than 4MB (for example if - /// each task has 100's of resource files or environment variables), the - /// request will fail with code 'RequestBodyTooLarge' and should be retried - /// again with fewer tasks. + /// The collection of tasks to add. The maximum count of tasks is 100. The + /// total serialized size of this collection must be less than 1MB. If it is + /// greater than 1MB (for example if each task has 100's of resource files or + /// environment variables), the request will fail with code + /// 'RequestBodyTooLarge' and should be retried again with fewer tasks. /// /// /// Additional parameters for the operation diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Program.cs b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Program.cs index 0589d88798b13..bdbc5b5d3b472 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Program.cs +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Program.cs @@ -34,7 +34,7 @@ private static void GenerateModelFiles() } seen.Add(type.Name); - string outputDirectory = "../../../Azure.Batch/Generated"; + string outputDirectory = "../../../../../../Azure.Batch/Generated"; string outputFilePath = Path.Combine(outputDirectory, type.Name + ".cs"); string innerClassString; diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudPool.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudPool.json index 98a39e7998107..fc4d1d9cc1c99 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudPool.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudPool.json @@ -396,7 +396,7 @@ "Type": "string", "Name": "VirtualMachineSize", "SummaryComment": "The size of the virtual machines in the pool. All virtual machines in a pool are the same size.", - "RemarksComment": "For information about available sizes of virtual machines for Cloud Services pools (pools created with a ), see https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/. Batch supports all Cloud Services VM sizes except ExtraSmall.For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with a ) see https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/ or https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/. Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (for example STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series).", + "RemarksComment": "For information about available sizes of virtual machines in pools, see Choose a VM size for compute nodes in an Azure Batch pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes).", "BoundAccess": "read", "UnboundAccess": "read,write" }, @@ -410,7 +410,7 @@ "Type": "IList", "Name": "ApplicationLicenses", "SummaryComment": "The list of application licenses the Batch service will make available on each compute node in the pool.", - "RemarksComment": "The list of application licenses must be a subset of available Batch service application licenses.", + "RemarksComment": "The list of application licenses must be a subset of available Batch service application licenses.The permitted licenses available on the pool are 'maya', 'vray', '3dsmax', 'arnold'. An additional charge applies for each application license added to the pool.", "BoundAccess": "read", "UnboundAccess": "read,write" }, diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudTask.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudTask.json index b2434125908dc..3205819c9e18d 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudTask.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/CloudTask.json @@ -206,7 +206,7 @@ "Type": "IList", "Name": "ResourceFiles", "SummaryComment": "A list of files that the Batch service will download to the compute node before running the command line.", - "RemarksComment": null, + "RemarksComment": "There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of resource files must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers.", "BoundAccess": "read", "UnboundAccess": "read,write" }, diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/ComputeNode.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/ComputeNode.json index 531ca515f7f47..f5dbff7a66b4e 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/ComputeNode.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/ComputeNode.json @@ -241,6 +241,20 @@ "UnboundAccess": "none" }, "Value": null + }, + { + "Key": { + "Type": "NodeAgentInformation", + "Name": "NodeAgentInformation", + "SummaryComment": "Information about the node agent version and the time the node upgraded to a new version.", + "RemarksComment": null, + "BoundAccess": "read", + "UnboundAccess": "none" + }, + "Value": { + "Type": "NodeAgentInformation", + "Name": "NodeAgentInfo" + } } ] } diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/DataDisk.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/DataDisk.json index 6846830e57db8..d512f77b803a2 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/DataDisk.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/DataDisk.json @@ -23,7 +23,7 @@ "Type": "Common.CachingType?", "Name": "Caching", "SummaryComment": "The type of caching to enable for the OS disk.", - "RemarksComment": "If omitted, the default is .", + "RemarksComment": "If omitted, the default is .", "BoundAccess": "read", "UnboundAccess": "read,write", "ConstructorArgumentType": "Optional", diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobManagerTask.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobManagerTask.json index e07858352fbae..089198f81d83c 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobManagerTask.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobManagerTask.json @@ -80,7 +80,7 @@ "Type": "IList", "Name": "ResourceFiles", "SummaryComment": "A list of files that the Batch service will download to the compute node before running the command line.", - "RemarksComment": null, + "RemarksComment": "There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of resource files must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers.", "BoundAccess": "read,write", "UnboundAccess": "read,write" }, diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobPreparationTask.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobPreparationTask.json index 70ba0118a1849..5d0d506edd18c 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobPreparationTask.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobPreparationTask.json @@ -32,7 +32,7 @@ "Type": "IList", "Name": "ResourceFiles", "SummaryComment": "A list of files that the Batch service will download to the compute node before running the command line.", - "RemarksComment": null, + "RemarksComment": "There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of resource files must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers.", "BoundAccess": "read,write", "UnboundAccess": "read,write" }, diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobReleaseTask.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobReleaseTask.json index 975953a0323c6..4be58609722c0 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobReleaseTask.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/JobReleaseTask.json @@ -31,7 +31,7 @@ "Type": "IList", "Name": "ResourceFiles", "SummaryComment": "A list of files that the Batch service will download to the compute node before running the command line.", - "RemarksComment": null, + "RemarksComment": "There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of resource files must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers.", "BoundAccess": "read,write", "UnboundAccess": "read,write" }, diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/MultiInstanceSettings.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/MultiInstanceSettings.json index ccb88e5b3089b..9f1c62e73cff6 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/MultiInstanceSettings.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/MultiInstanceSettings.json @@ -8,7 +8,7 @@ "Type": "IList", "Name": "CommonResourceFiles", "SummaryComment": "A list of files that the Batch service will download before running the coordination command line.", - "RemarksComment": "The difference between common resource files and task resource files is that common resource files are downloaded for all subtasks including the primary, whereas task resource files are downloaded only for the primary.", + "RemarksComment": "The difference between common resource files and task resource files is that common resource files are downloaded for all subtasks including the primary, whereas task resource files are downloaded only for the primary. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of resource files must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers.", "BoundAccess": "read", "UnboundAccess": "read,write" }, diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/NodeAgentInformation.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/NodeAgentInformation.json new file mode 100644 index 0000000000000..04574714c82c1 --- /dev/null +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/NodeAgentInformation.json @@ -0,0 +1,31 @@ +{ + "Name": "NodeAgentInformation", + "ProtocolName": "Models.NodeAgentInformation", + "SummaryComment": "Information about the node agent", + "RemarksComment": "The Batch node agent is a program that runs on each node in the pool and provides Batch capability on the compute node.", + "IsConstructorPublic": false, + "Properties": [ + { + "Key": { + "Type": "string", + "Name": "Version", + "SummaryComment": "The version of the Batch node agent running on the compute node.", + "RemarksComment": "This version number can be checked against the node agent release notes located at https://github.com/Azure/Batch/blob/master/changelogs/nodeagent/CHANGELOG.md.", + "BoundAccess": "read", + "UnboundAccess": "none" + }, + "Value": null + }, + { + "Key": { + "Type": "DateTime", + "Name": "LastUpdateTime", + "SummaryComment": "The time when the node agent was updated on the compute node.", + "RemarksComment": "This is the most recent time that the node agent was updated to a new version.", + "BoundAccess": "read", + "UnboundAccess": "none" + }, + "Value": null + } + ] +} diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/OSDisk.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/OSDisk.json index 65ce3b4abd184..9fa54b6779d60 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/OSDisk.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/OSDisk.json @@ -9,7 +9,7 @@ "Type": "Common.CachingType?", "Name": "Caching", "SummaryComment": "The type of caching to enable for the OS disk.", - "RemarksComment": null, + "RemarksComment": "If omitted, the default is .", "BoundAccess": "read", "UnboundAccess": "read,write", "ConstructorArgumentType": "Optional", diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/PoolSpecification.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/PoolSpecification.json index 5d5aa52040bd0..a23f6ef0fd708 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/PoolSpecification.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/PoolSpecification.json @@ -233,7 +233,7 @@ "Type": "string", "Name": "VirtualMachineSize", "SummaryComment": "The size of the virtual machines in the pool. All virtual machines in a pool are the same size.", - "RemarksComment": "For information about available sizes of virtual machines for Cloud Services pools (pools created with a ), see https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/. Batch supports all Cloud Services VM sizes except ExtraSmall.For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with a ) see https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/ or https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/. Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (for example STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series).", + "RemarksComment": "For information about available sizes of virtual machines in pools, see Choose a VM size for compute nodes in an Azure Batch pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes).", "BoundAccess": "read,write", "UnboundAccess": "read,write" }, diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/PoolUsageMetrics.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/PoolUsageMetrics.json index db948f733eab1..6adec825686b2 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/PoolUsageMetrics.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/PoolUsageMetrics.json @@ -1,103 +1,103 @@ +{ + "Name": "PoolUsageMetrics", + "ProtocolName": "Models.PoolUsageMetrics", + "SummaryComment": "The usage metrics for a single pool in a certain time range.", + "IsConstructorPublic": false, + "Properties": [ { - "Name": "PoolUsageMetrics", - "ProtocolName": "Models.PoolUsageMetrics", - "SummaryComment": "The usage metrics for a single pool in a certain time range.", - "IsConstructorPublic": false, - "Properties": [ - { - "Key": { - "Type": "double", - "Name": "DataEgressGiB", - "SummaryComment": "The cross data center network egress from the pool during this interval, in gibibytes.", - "RemarksComment": null, - "BoundAccess": "read", - "UnboundAccess": "none" - }, - "Value": { - "Type": "double", - "Name": "DataEgressGiB" - } - }, - { - "Key": { - "Type": "double", - "Name": "DataIngressGiB", - "SummaryComment": "The cross data center network ingress to the pool during this interval, in gibibytes.", - "RemarksComment": null, - "BoundAccess": "read", - "UnboundAccess": "none" - }, - "Value": { - "Type": "double", - "Name": "DataIngressGiB" - } - }, - { - "Key": { - "Type": "DateTime", - "Name": "EndTime", - "SummaryComment": "The end time of the aggregation interval for this entry.", - "RemarksComment": null, - "BoundAccess": "read", - "UnboundAccess": "none" - }, - "Value": { - "Type": "DateTime", - "Name": "EndTime" - } - }, - { - "Key": { - "Type": "string", - "Name": "PoolId", - "SummaryComment": "The id of the pool whose metrics are aggregated in this entry.", - "RemarksComment": null, - "BoundAccess": "read", - "UnboundAccess": "none" - }, - "Value": null - }, - { - "Key": { - "Type": "DateTime", - "Name": "StartTime", - "SummaryComment": "The start time of the aggregation interval covered by this entry.", - "RemarksComment": null, - "BoundAccess": "read", - "UnboundAccess": "none" - }, - "Value": { - "Type": "DateTime", - "Name": "StartTime" - } - }, - { - "Key": { - "Type": "double", - "Name": "TotalCoreHours", - "SummaryComment": "The total core hours used in the pool during this aggregation interval.", - "RemarksComment": null, - "BoundAccess": "read", - "UnboundAccess": "none" - }, - "Value": { - "Type": "double", - "Name": "TotalCoreHours" - } - }, - { - "Key": { - "Type": "string", - "Name": "VirtualMachineSize", - "SummaryComment": "The size of the virtual machines in the pool. All virtual machines in a pool are the same size.", - "RemarksComment": "For information about available sizes of virtual machines for Cloud Services pools (pools created with a ), see https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/. Batch supports all Cloud Services VM sizes except ExtraSmall.For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with a ) see https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/ or https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/. Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (for example STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series).", - "BoundAccess": "read", - "UnboundAccess": "none" - }, - "Value": { - "Type": "string", - "Name": "VmSize" - } - } - ] + "Key": { + "Type": "double", + "Name": "DataEgressGiB", + "SummaryComment": "The cross data center network egress from the pool during this interval, in gibibytes.", + "RemarksComment": null, + "BoundAccess": "read", + "UnboundAccess": "none" + }, + "Value": { + "Type": "double", + "Name": "DataEgressGiB" + } + }, + { + "Key": { + "Type": "double", + "Name": "DataIngressGiB", + "SummaryComment": "The cross data center network ingress to the pool during this interval, in gibibytes.", + "RemarksComment": null, + "BoundAccess": "read", + "UnboundAccess": "none" + }, + "Value": { + "Type": "double", + "Name": "DataIngressGiB" + } + }, + { + "Key": { + "Type": "DateTime", + "Name": "EndTime", + "SummaryComment": "The end time of the aggregation interval for this entry.", + "RemarksComment": null, + "BoundAccess": "read", + "UnboundAccess": "none" + }, + "Value": { + "Type": "DateTime", + "Name": "EndTime" + } + }, + { + "Key": { + "Type": "string", + "Name": "PoolId", + "SummaryComment": "The id of the pool whose metrics are aggregated in this entry.", + "RemarksComment": null, + "BoundAccess": "read", + "UnboundAccess": "none" + }, + "Value": null + }, + { + "Key": { + "Type": "DateTime", + "Name": "StartTime", + "SummaryComment": "The start time of the aggregation interval covered by this entry.", + "RemarksComment": null, + "BoundAccess": "read", + "UnboundAccess": "none" + }, + "Value": { + "Type": "DateTime", + "Name": "StartTime" + } + }, + { + "Key": { + "Type": "double", + "Name": "TotalCoreHours", + "SummaryComment": "The total core hours used in the pool during this aggregation interval.", + "RemarksComment": null, + "BoundAccess": "read", + "UnboundAccess": "none" + }, + "Value": { + "Type": "double", + "Name": "TotalCoreHours" + } + }, + { + "Key": { + "Type": "string", + "Name": "VirtualMachineSize", + "SummaryComment": "The size of the virtual machines in the pool. All virtual machines in a pool are the same size.", + "RemarksComment": "For information about available sizes of virtual machines in pools, see Choose a VM size for compute nodes in an Azure Batch pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes).", + "BoundAccess": "read", + "UnboundAccess": "none" + }, + "Value": { + "Type": "string", + "Name": "VmSize" + } } + ] +} diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/StartTask.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/StartTask.json index b11f026da2f46..e37dfb0b82a41 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/StartTask.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/StartTask.json @@ -46,7 +46,7 @@ "Type": "IList", "Name": "ResourceFiles", "SummaryComment": "A list of files that the Batch service will download to the compute node before running the command line.", - "RemarksComment": null, + "RemarksComment": "There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of resource files must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers.", "BoundAccess": "read,write", "UnboundAccess": "read,write" }, diff --git a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/TaskCounts.json b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/TaskCounts.json index e069bde241fb4..0c05baacfec08 100644 --- a/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/TaskCounts.json +++ b/src/SDKs/Batch/DataPlane/Tools/ObjectModelCodeGeneration/ObjectModelCodeGenerator/Spec/TaskCounts.json @@ -58,20 +58,6 @@ "UnboundAccess": "none" }, "Value": null - }, - { - "Key": { - "Type": "Common.TaskCountValidationStatus", - "Name": "ValidationStatus", - "SummaryComment": "Whether the task counts have been validated. If the is unvalidated, then the Batch service has not been able to check state counts against the task states as reported in the List Tasks API.", - "RemarksComment": "The may be unvalidated if the job contains more than 200,000 tasks.", - "BoundAccess": "read", - "UnboundAccess": "none" - }, - "Value": { - "Type": "Models.TaskCountValidationStatus", - "Name": "ValidationStatus" - } } ] } diff --git a/src/SDKs/Batch/DataPlane/changelog.md b/src/SDKs/Batch/DataPlane/changelog.md index 213f3f5403053..9c78a0443a7c3 100644 --- a/src/SDKs/Batch/DataPlane/changelog.md +++ b/src/SDKs/Batch/DataPlane/changelog.md @@ -1,6 +1,22 @@ # Microsoft.Azure.Batch release notes -## Change in 8.1.2 +## Changes in 9.0.0 +### Features +- Added the ability to see what version of the Azure Batch Node Agent is running on each of the VMs in a pool, via the new `NodeAgentInformation` property on `ComputeNode`. +- Added the ability to specify a `Filter` on the `Result` of a task. See [here](https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch) for more details. + - This enables the often requested scenario of performing a server-side query to find all tasks which failed. +- **[Breaking]** Added a default retry policy to `BatchClient`. + - Note that this policy may not be sufficient for every case. If the old behavior (a `BatchClient` that doesn't perform any retries) is desired, the default policy can be removed from a `BatchClient` with `client.CustomBehaviors = client.CustomBehaviors.Where(behavior => !(behavior is RetryPolicyProvider)).ToList()`. +- **[Breaking]** Removed the `ValidationStatus` property from `TaskCounts`, as well as the `TaskCountValidationStatus` enum. +- **[Breaking]** The default caching type for `DataDisk` and `OSDisk` is now `ReadWrite` instead of `None`. + +### Bug fixes +- Fixed bug when using `BatchSharedKeyCredentials` where some operations would fail with an `Unauthenticated` error in `netcoreapp2.1` even though the right shared key was used. + +### REST API version +This version of the Batch .NET client library targets version 2018-08-01.7.0 of the Azure Batch REST API. + +## Changes in 8.1.2 Rename Nuget package name from Azure.Batch to Microsoft.Azure.Batch # Prior to version 8.1.2, this package was named "Azure.Batch" on Nuget. The release notes below are for that package. diff --git a/src/SDKs/_metadata/batch_data-plane.txt b/src/SDKs/_metadata/batch_data-plane.txt index f4f5911191fbe..a803ef45fa9c5 100644 --- a/src/SDKs/_metadata/batch_data-plane.txt +++ b/src/SDKs/_metadata/batch_data-plane.txt @@ -1,11 +1,11 @@ -2018-04-24 22:42:09 UTC +2018-08-22 21:01:18 UTC 1) azure-rest-api-specs repository information GitHub user: Azure Branch: master -Commit: e6d46513662f00ab4d0d560ab710be4a849609c3 +Commit: 1fa48c252fe167c606a9799f03b81585ee549364 2) AutoRest information Requested version: latest -Bootstrapper version: C:\Users\matthchr\AppData\Roaming\npm `-- autorest@2.0.4262 +Bootstrapper version: C:\Users\matthchr\AppData\Roaming\npm `-- autorest@2.0.4283 Latest installed version: From 689a258123446665f2aad28ce11b04d850dc523a Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Thu, 16 Aug 2018 14:22:00 -0700 Subject: [PATCH 10/10] Fix tests --- .../Azure.Batch.IntegrationTests/NodeFileIntegrationTests.cs | 4 ++-- .../DataPlane/Azure.Batch.Unit.Tests/PropertyUnitTests.cs | 1 + .../DataPlane/Azure.Batch.Unit.Tests/RetryPolicyUnitTests.cs | 5 +---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/NodeFileIntegrationTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/NodeFileIntegrationTests.cs index 3ef54fe55343d..78aae161d9cb6 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/NodeFileIntegrationTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.IntegrationTests/NodeFileIntegrationTests.cs @@ -510,7 +510,7 @@ public void Bug1480491NodeFileFileProperties() this.testOutputHelper.WriteLine("File {0} has last modified time: {1}", Constants.StandardOutFileName, file.Properties.LastModified); Assert.Equal(expectedFileSize, file.Properties.ContentLength); - Assert.Equal("application/octet-stream", file.Properties.ContentType); + Assert.Equal("text/plain", file.Properties.ContentType); // // NodeFile by node @@ -538,7 +538,7 @@ public void Bug1480491NodeFileFileProperties() this.testOutputHelper.WriteLine("File {0} has last modified time: {1}", filePathToGet, file.Properties.LastModified); Assert.Equal(expectedFileSize, file.Properties.ContentLength); - Assert.Equal("application/octet-stream", file.Properties.ContentType); + Assert.Equal("text/plain", file.Properties.ContentType); } finally { diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PropertyUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PropertyUnitTests.cs index 8e420d6e1d47e..9a416cd050c6e 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PropertyUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/PropertyUnitTests.cs @@ -136,6 +136,7 @@ public PropertyUnitTests(ITestOutputHelper testOutputHelper) new ComparerPropertyMapping(typeof(ComputeNode), typeof(Protocol.Models.ComputeNode), "IPAddress", "IpAddress"), new ComparerPropertyMapping(typeof(ComputeNode), typeof(Protocol.Models.ComputeNode), "VirtualMachineSize", "VmSize"), new ComparerPropertyMapping(typeof(ComputeNode), typeof(Protocol.Models.ComputeNode), "StartTaskInformation", "StartTaskInfo"), + new ComparerPropertyMapping(typeof(ComputeNode), typeof(Protocol.Models.ComputeNode), "NodeAgentInformation", "NodeAgentInfo"), new ComparerPropertyMapping(typeof(ComputeNodeInformation), typeof(Protocol.Models.ComputeNodeInformation), "ComputeNodeId", "NodeId"), new ComparerPropertyMapping(typeof(ComputeNodeInformation), typeof(Protocol.Models.ComputeNodeInformation), "ComputeNodeUrl", "NodeUrl"), diff --git a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/RetryPolicyUnitTests.cs b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/RetryPolicyUnitTests.cs index df33cfdc267b2..40cfddb3a992a 100644 --- a/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/RetryPolicyUnitTests.cs +++ b/src/SDKs/Batch/DataPlane/Azure.Batch.Unit.Tests/RetryPolicyUnitTests.cs @@ -589,18 +589,15 @@ private async Task AssertPolicyDoesNotRetryOnValidationExceptions(IRetryPolicy p { var stronglyTypedRequest = (Microsoft.Azure.Batch.Protocol.BatchRequests.JobAddBatchRequest)req; - var originalServiceRequestFunc = stronglyTypedRequest.ServiceRequestFunc; - stronglyTypedRequest.ServiceRequestFunc = (token) => { ++callCount; - return originalServiceRequestFunc(token); + throw new Microsoft.Rest.ValidationException(); }; })); client.CustomBehaviors.Add(new RetryPolicyProvider(policy)); - //This will throw an exception since a job has required parameters such as id which are not specified CloudJob job = client.JobOperations.CreateJob(); await Assert.ThrowsAsync(async () => await job.CommitAsync());