diff --git a/sdk/batch/Azure.Batch/Azure.Compute.Batch.sln b/sdk/batch/Azure.Batch/Azure.Compute.Batch.sln
new file mode 100644
index 000000000000..55c0addd0d71
--- /dev/null
+++ b/sdk/batch/Azure.Batch/Azure.Compute.Batch.sln
@@ -0,0 +1,56 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Compute.Batch", "src\Azure.Compute.Batch.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Compute.Batch.Tests", "tests\Azure.Compute.Batch.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/sdk/batch/Azure.Batch/CHANGELOG.md b/sdk/batch/Azure.Batch/CHANGELOG.md
new file mode 100644
index 000000000000..13dd08af78ab
--- /dev/null
+++ b/sdk/batch/Azure.Batch/CHANGELOG.md
@@ -0,0 +1,11 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+### Features Added
+
+### Breaking Changes
+
+### Bugs Fixed
+
+### Other Changes
diff --git a/sdk/batch/Azure.Batch/Directory.Build.props b/sdk/batch/Azure.Batch/Directory.Build.props
new file mode 100644
index 000000000000..63bd836ad44b
--- /dev/null
+++ b/sdk/batch/Azure.Batch/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/sdk/batch/Azure.Batch/README.md b/sdk/batch/Azure.Batch/README.md
new file mode 100644
index 000000000000..c179cebcb51c
--- /dev/null
+++ b/sdk/batch/Azure.Batch/README.md
@@ -0,0 +1,107 @@
+# Azure.Compute.Batch client library for .NET
+
+Azure.Compute.Batch is a managed service that helps developers get secret simply and securely.
+
+Use the client library for to:
+
+* [Get secret](https://docs.microsoft.com/azure)
+
+[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples]
+
+ [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/batch/Azure.Compute.Batch/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure)
+
+## Getting started
+
+This section should include everything a developer needs to do to install and create their first client connection *very quickly*.
+
+### Install the package
+
+First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository.
+
+Install the client library for .NET with [NuGet](https://www.nuget.org/ ):
+
+```dotnetcli
+dotnet add package Azure.Compute.Batch --prerelease
+```
+
+### Prerequisites
+
+Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB:
+
+> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`.
+
+### Authenticate the client
+
+If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating.
+
+For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object.
+
+### Service API versions
+
+The client library targets the latest service API version by default. A client instance accepts an optional service API version parameter from its options to specify which API version service to communicate.
+
+#### Select a service API version
+
+You have the flexibility to explicitly select a supported service API version when instantiating a client by configuring its associated options. This ensures that the client can communicate with services using the specified API version.
+
+For example,
+
+```C# Snippet:CreateClientForSpecificApiVersion
+Uri endpoint = new Uri("");
+DefaultAzureCredential credential = new DefaultAzureCredential();
+ClientOptions options = new ClientOptions(ClientOptions.ServiceVersion.)
+var client = new Client(endpoint, credential, options);
+```
+
+When selecting an API version, it's important to verify that there are no breaking changes compared to the latest API version. If there are significant differences, API calls may fail due to incompatibility.
+
+Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy.
+
+## Key concepts
+
+The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity.
+
+Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of:
+
+### Thread safety
+
+We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads.
+
+### Additional concepts
+
+[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) |
+[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) |
+[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) |
+[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) |
+[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) |
+[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) |
+[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/)
+
+
+## Examples
+
+You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/batch/Azure.Compute.Batch/samples).
+
+## Troubleshooting
+
+Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery.
+
+Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API.
+
+If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code.
+
+## Next steps
+
+* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory.
+* If appropriate, point users to other packages that might be useful.
+* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for.
+
+## Contributing
+
+This is a template, but your SDK readme should include details on how to contribute code to the repo/package.
+
+
+[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization
+[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide
+
+
diff --git a/sdk/batch/Azure.Batch/src/Azure.Compute.Batch.csproj b/sdk/batch/Azure.Batch/src/Azure.Compute.Batch.csproj
new file mode 100644
index 000000000000..7675b3c6df6d
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Azure.Compute.Batch.csproj
@@ -0,0 +1,19 @@
+
+
+ This is the Azure.Compute.Batch client library for developing .NET applications with rich experience.
+ Azure SDK Code Generation Azure.Compute.Batch for Azure Data Plane
+ 1.0.0-beta.1
+ Azure.Compute.Batch
+ $(RequiredTargetFrameworks)
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/batch/Azure.Batch/src/Generated/AccessScope.cs b/sdk/batch/Azure.Batch/src/Generated/AccessScope.cs
new file mode 100644
index 000000000000..82f23d054230
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AccessScope.cs
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.Compute.Batch
+{
+ /// AccessScope enums.
+ public readonly partial struct AccessScope : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AccessScope(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string JobValue = "job";
+
+ /// Grants access to perform all operations on the Job containing the Task.
+ public static AccessScope Job { get; } = new AccessScope(JobValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AccessScope left, AccessScope right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AccessScope left, AccessScope right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AccessScope(string value) => new AccessScope(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AccessScope other && Equals(other);
+ ///
+ public bool Equals(AccessScope other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AffinityInfo.Serialization.cs b/sdk/batch/Azure.Batch/src/Generated/AffinityInfo.Serialization.cs
new file mode 100644
index 000000000000..f2b549e739c0
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AffinityInfo.Serialization.cs
@@ -0,0 +1,135 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Compute.Batch
+{
+ public partial class AffinityInfo : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AffinityInfo)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("affinityId"u8);
+ writer.WriteStringValue(AffinityId);
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ AffinityInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AffinityInfo)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAffinityInfo(document.RootElement, options);
+ }
+
+ internal static AffinityInfo DeserializeAffinityInfo(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string affinityId = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("affinityId"u8))
+ {
+ affinityId = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AffinityInfo(affinityId, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AffinityInfo)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AffinityInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeAffinityInfo(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AffinityInfo)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AffinityInfo FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAffinityInfo(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AffinityInfo.cs b/sdk/batch/Azure.Batch/src/Generated/AffinityInfo.cs
new file mode 100644
index 000000000000..340f6ac3f4eb
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AffinityInfo.cs
@@ -0,0 +1,78 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Compute.Batch
+{
+ ///
+ /// A locality hint that can be used by the Batch service to select a Compute Node
+ /// on which to start a Task.
+ ///
+ public partial class AffinityInfo
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// An opaque string representing the location of a Compute Node or a Task that has run previously. You can pass the affinityId of a Node to indicate that this Task needs to run on that Compute Node. Note that this is just a soft affinity. If the target Compute Node is busy or unavailable at the time the Task is scheduled, then the Task will be scheduled elsewhere.
+ /// is null.
+ public AffinityInfo(string affinityId)
+ {
+ Argument.AssertNotNull(affinityId, nameof(affinityId));
+
+ AffinityId = affinityId;
+ }
+
+ /// Initializes a new instance of .
+ /// An opaque string representing the location of a Compute Node or a Task that has run previously. You can pass the affinityId of a Node to indicate that this Task needs to run on that Compute Node. Note that this is just a soft affinity. If the target Compute Node is busy or unavailable at the time the Task is scheduled, then the Task will be scheduled elsewhere.
+ /// Keeps track of any properties unknown to the library.
+ internal AffinityInfo(string affinityId, IDictionary serializedAdditionalRawData)
+ {
+ AffinityId = affinityId;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AffinityInfo()
+ {
+ }
+
+ /// An opaque string representing the location of a Compute Node or a Task that has run previously. You can pass the affinityId of a Node to indicate that this Task needs to run on that Compute Node. Note that this is just a soft affinity. If the target Compute Node is busy or unavailable at the time the Task is scheduled, then the Task will be scheduled elsewhere.
+ public string AffinityId { get; set; }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AllocationState.cs b/sdk/batch/Azure.Batch/src/Generated/AllocationState.cs
new file mode 100644
index 000000000000..a934ae9590fe
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AllocationState.cs
@@ -0,0 +1,54 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.Compute.Batch
+{
+ /// AllocationState enums.
+ public readonly partial struct AllocationState : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AllocationState(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string SteadyValue = "steady";
+ private const string ResizingValue = "resizing";
+ private const string StoppingValue = "stopping";
+
+ /// The Pool is not resizing. There are no changes to the number of Compute Nodes in the Pool in progress. A Pool enters this state when it is created and when no operations are being performed on the Pool to change the number of Compute Nodes.
+ public static AllocationState Steady { get; } = new AllocationState(SteadyValue);
+ /// The Pool is resizing; that is, Compute Nodes are being added to or removed from the Pool.
+ public static AllocationState Resizing { get; } = new AllocationState(ResizingValue);
+ /// The Pool was resizing, but the user has requested that the resize be stopped, but the stop request has not yet been completed.
+ public static AllocationState Stopping { get; } = new AllocationState(StoppingValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AllocationState left, AllocationState right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AllocationState left, AllocationState right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AllocationState(string value) => new AllocationState(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AllocationState other && Equals(other);
+ ///
+ public bool Equals(AllocationState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AuthenticationTokenSettings.Serialization.cs b/sdk/batch/Azure.Batch/src/Generated/AuthenticationTokenSettings.Serialization.cs
new file mode 100644
index 000000000000..418b0c9f4ada
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AuthenticationTokenSettings.Serialization.cs
@@ -0,0 +1,152 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Compute.Batch
+{
+ public partial class AuthenticationTokenSettings : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AuthenticationTokenSettings)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsCollectionDefined(Access))
+ {
+ writer.WritePropertyName("access"u8);
+ writer.WriteStartArray();
+ foreach (var item in Access)
+ {
+ writer.WriteStringValue(item.ToString());
+ }
+ writer.WriteEndArray();
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ AuthenticationTokenSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AuthenticationTokenSettings)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAuthenticationTokenSettings(document.RootElement, options);
+ }
+
+ internal static AuthenticationTokenSettings DeserializeAuthenticationTokenSettings(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IList access = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("access"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(new AccessScope(item.GetString()));
+ }
+ access = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AuthenticationTokenSettings(access ?? new ChangeTrackingList(), serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AuthenticationTokenSettings)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AuthenticationTokenSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeAuthenticationTokenSettings(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AuthenticationTokenSettings)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AuthenticationTokenSettings FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAuthenticationTokenSettings(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AuthenticationTokenSettings.cs b/sdk/batch/Azure.Batch/src/Generated/AuthenticationTokenSettings.cs
new file mode 100644
index 000000000000..400d876d185f
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AuthenticationTokenSettings.cs
@@ -0,0 +1,69 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Compute.Batch
+{
+ ///
+ /// The settings for an authentication token that the Task can use to perform Batch
+ /// service operations.
+ ///
+ public partial class AuthenticationTokenSettings
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public AuthenticationTokenSettings()
+ {
+ Access = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of .
+ /// The Batch resources to which the token grants access. The authentication token grants access to a limited set of Batch service operations. Currently the only supported value for the access property is 'job', which grants access to all operations related to the Job which contains the Task.
+ /// Keeps track of any properties unknown to the library.
+ internal AuthenticationTokenSettings(IList access, IDictionary serializedAdditionalRawData)
+ {
+ Access = access;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The Batch resources to which the token grants access. The authentication token grants access to a limited set of Batch service operations. Currently the only supported value for the access property is 'job', which grants access to all operations related to the Job which contains the Task.
+ public IList Access { get; }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AutoScaleRun.Serialization.cs b/sdk/batch/Azure.Batch/src/Generated/AutoScaleRun.Serialization.cs
new file mode 100644
index 000000000000..48bc6352dae6
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AutoScaleRun.Serialization.cs
@@ -0,0 +1,161 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Compute.Batch
+{
+ public partial class AutoScaleRun : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutoScaleRun)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("timestamp"u8);
+ writer.WriteStringValue(Timestamp, "O");
+ if (Optional.IsDefined(Results))
+ {
+ writer.WritePropertyName("results"u8);
+ writer.WriteStringValue(Results);
+ }
+ if (Optional.IsDefined(Error))
+ {
+ writer.WritePropertyName("error"u8);
+ writer.WriteObjectValue(Error, options);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ AutoScaleRun IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutoScaleRun)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAutoScaleRun(document.RootElement, options);
+ }
+
+ internal static AutoScaleRun DeserializeAutoScaleRun(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ DateTimeOffset timestamp = default;
+ string results = default;
+ AutoScaleRunError error = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("timestamp"u8))
+ {
+ timestamp = property.Value.GetDateTimeOffset("O");
+ continue;
+ }
+ if (property.NameEquals("results"u8))
+ {
+ results = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("error"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ error = AutoScaleRunError.DeserializeAutoScaleRunError(property.Value, options);
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AutoScaleRun(timestamp, results, error, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AutoScaleRun)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AutoScaleRun IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeAutoScaleRun(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AutoScaleRun)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AutoScaleRun FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAutoScaleRun(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AutoScaleRun.cs b/sdk/batch/Azure.Batch/src/Generated/AutoScaleRun.cs
new file mode 100644
index 000000000000..663ba502f78f
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AutoScaleRun.cs
@@ -0,0 +1,80 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Compute.Batch
+{
+ /// The results and errors from an execution of a Pool autoscale formula.
+ public partial class AutoScaleRun
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The time at which the autoscale formula was last evaluated.
+ internal AutoScaleRun(DateTimeOffset timestamp)
+ {
+ Timestamp = timestamp;
+ }
+
+ /// Initializes a new instance of .
+ /// The time at which the autoscale formula was last evaluated.
+ /// The final values of all variables used in the evaluation of the autoscale formula. Each variable value is returned in the form $variable=value, and variables are separated by semicolons.
+ /// Details of the error encountered evaluating the autoscale formula on the Pool, if the evaluation was unsuccessful.
+ /// Keeps track of any properties unknown to the library.
+ internal AutoScaleRun(DateTimeOffset timestamp, string results, AutoScaleRunError error, IDictionary serializedAdditionalRawData)
+ {
+ Timestamp = timestamp;
+ Results = results;
+ Error = error;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AutoScaleRun()
+ {
+ }
+
+ /// The time at which the autoscale formula was last evaluated.
+ public DateTimeOffset Timestamp { get; }
+ /// The final values of all variables used in the evaluation of the autoscale formula. Each variable value is returned in the form $variable=value, and variables are separated by semicolons.
+ public string Results { get; }
+ /// Details of the error encountered evaluating the autoscale formula on the Pool, if the evaluation was unsuccessful.
+ public AutoScaleRunError Error { get; }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AutoScaleRunError.Serialization.cs b/sdk/batch/Azure.Batch/src/Generated/AutoScaleRunError.Serialization.cs
new file mode 100644
index 000000000000..d8cb62f788ff
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AutoScaleRunError.Serialization.cs
@@ -0,0 +1,174 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Compute.Batch
+{
+ public partial class AutoScaleRunError : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutoScaleRunError)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(Code))
+ {
+ writer.WritePropertyName("code"u8);
+ writer.WriteStringValue(Code);
+ }
+ if (Optional.IsDefined(Message))
+ {
+ writer.WritePropertyName("message"u8);
+ writer.WriteStringValue(Message);
+ }
+ if (Optional.IsCollectionDefined(Values))
+ {
+ writer.WritePropertyName("values"u8);
+ writer.WriteStartArray();
+ foreach (var item in Values)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ AutoScaleRunError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutoScaleRunError)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAutoScaleRunError(document.RootElement, options);
+ }
+
+ internal static AutoScaleRunError DeserializeAutoScaleRunError(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string code = default;
+ string message = default;
+ IReadOnlyList values = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("code"u8))
+ {
+ code = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("message"u8))
+ {
+ message = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("values"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(NameValuePair.DeserializeNameValuePair(item, options));
+ }
+ values = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AutoScaleRunError(code, message, values ?? new ChangeTrackingList(), serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AutoScaleRunError)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AutoScaleRunError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeAutoScaleRunError(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AutoScaleRunError)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AutoScaleRunError FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAutoScaleRunError(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AutoScaleRunError.cs b/sdk/batch/Azure.Batch/src/Generated/AutoScaleRunError.cs
new file mode 100644
index 000000000000..6d52456551fb
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AutoScaleRunError.cs
@@ -0,0 +1,74 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Compute.Batch
+{
+ /// An error that occurred when executing or evaluating a Pool autoscale formula.
+ public partial class AutoScaleRunError
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ internal AutoScaleRunError()
+ {
+ Values = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of .
+ /// An identifier for the autoscale error. Codes are invariant and are intended to be consumed programmatically.
+ /// A message describing the autoscale error, intended to be suitable for display in a user interface.
+ /// A list of additional error details related to the autoscale error.
+ /// Keeps track of any properties unknown to the library.
+ internal AutoScaleRunError(string code, string message, IReadOnlyList values, IDictionary serializedAdditionalRawData)
+ {
+ Code = code;
+ Message = message;
+ Values = values;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// An identifier for the autoscale error. Codes are invariant and are intended to be consumed programmatically.
+ public string Code { get; }
+ /// A message describing the autoscale error, intended to be suitable for display in a user interface.
+ public string Message { get; }
+ /// A list of additional error details related to the autoscale error.
+ public IReadOnlyList Values { get; }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AutoUserScope.cs b/sdk/batch/Azure.Batch/src/Generated/AutoUserScope.cs
new file mode 100644
index 000000000000..15ed2106e2f2
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AutoUserScope.cs
@@ -0,0 +1,51 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.Compute.Batch
+{
+ /// AutoUserScope enums.
+ public readonly partial struct AutoUserScope : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AutoUserScope(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string TaskValue = "task";
+ private const string PoolValue = "pool";
+
+ /// Specifies that the service should create a new user for the Task.
+ public static AutoUserScope Task { get; } = new AutoUserScope(TaskValue);
+ /// Specifies that the Task runs as the common auto user Account which is created on every Compute Node in a Pool.
+ public static AutoUserScope Pool { get; } = new AutoUserScope(PoolValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AutoUserScope left, AutoUserScope right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AutoUserScope left, AutoUserScope right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AutoUserScope(string value) => new AutoUserScope(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AutoUserScope other && Equals(other);
+ ///
+ public bool Equals(AutoUserScope other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AutoUserSpecification.Serialization.cs b/sdk/batch/Azure.Batch/src/Generated/AutoUserSpecification.Serialization.cs
new file mode 100644
index 000000000000..17a5690247ce
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AutoUserSpecification.Serialization.cs
@@ -0,0 +1,157 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Compute.Batch
+{
+ public partial class AutoUserSpecification : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutoUserSpecification)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(Scope))
+ {
+ writer.WritePropertyName("scope"u8);
+ writer.WriteStringValue(Scope.Value.ToString());
+ }
+ if (Optional.IsDefined(ElevationLevel))
+ {
+ writer.WritePropertyName("elevationLevel"u8);
+ writer.WriteStringValue(ElevationLevel.Value.ToString());
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ AutoUserSpecification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutoUserSpecification)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAutoUserSpecification(document.RootElement, options);
+ }
+
+ internal static AutoUserSpecification DeserializeAutoUserSpecification(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ AutoUserScope? scope = default;
+ ElevationLevel? elevationLevel = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("scope"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ scope = new AutoUserScope(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("elevationLevel"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ elevationLevel = new ElevationLevel(property.Value.GetString());
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AutoUserSpecification(scope, elevationLevel, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AutoUserSpecification)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AutoUserSpecification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeAutoUserSpecification(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AutoUserSpecification)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AutoUserSpecification FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAutoUserSpecification(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AutoUserSpecification.cs b/sdk/batch/Azure.Batch/src/Generated/AutoUserSpecification.cs
new file mode 100644
index 000000000000..655ea827b2ca
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AutoUserSpecification.cs
@@ -0,0 +1,69 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Compute.Batch
+{
+ /// Specifies the options for the auto user that runs an Azure Batch Task.
+ public partial class AutoUserSpecification
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public AutoUserSpecification()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// The scope for the auto user. The default value is pool. If the pool is running Windows, a value of Task should be specified if stricter isolation between tasks is required, such as if the task mutates the registry in a way which could impact other tasks.
+ /// The elevation level of the auto user. The default value is nonAdmin.
+ /// Keeps track of any properties unknown to the library.
+ internal AutoUserSpecification(AutoUserScope? scope, ElevationLevel? elevationLevel, IDictionary serializedAdditionalRawData)
+ {
+ Scope = scope;
+ ElevationLevel = elevationLevel;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The scope for the auto user. The default value is pool. If the pool is running Windows, a value of Task should be specified if stricter isolation between tasks is required, such as if the task mutates the registry in a way which could impact other tasks.
+ public AutoUserScope? Scope { get; set; }
+ /// The elevation level of the auto user. The default value is nonAdmin.
+ public ElevationLevel? ElevationLevel { get; set; }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AutomaticOsUpgradePolicy.Serialization.cs b/sdk/batch/Azure.Batch/src/Generated/AutomaticOsUpgradePolicy.Serialization.cs
new file mode 100644
index 000000000000..1c83efe2f9a7
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AutomaticOsUpgradePolicy.Serialization.cs
@@ -0,0 +1,187 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Compute.Batch
+{
+ public partial class AutomaticOsUpgradePolicy : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutomaticOsUpgradePolicy)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(DisableAutomaticRollback))
+ {
+ writer.WritePropertyName("disableAutomaticRollback"u8);
+ writer.WriteBooleanValue(DisableAutomaticRollback.Value);
+ }
+ if (Optional.IsDefined(EnableAutomaticOsUpgrade))
+ {
+ writer.WritePropertyName("enableAutomaticOSUpgrade"u8);
+ writer.WriteBooleanValue(EnableAutomaticOsUpgrade.Value);
+ }
+ if (Optional.IsDefined(UseRollingUpgradePolicy))
+ {
+ writer.WritePropertyName("useRollingUpgradePolicy"u8);
+ writer.WriteBooleanValue(UseRollingUpgradePolicy.Value);
+ }
+ if (Optional.IsDefined(OsRollingUpgradeDeferral))
+ {
+ writer.WritePropertyName("osRollingUpgradeDeferral"u8);
+ writer.WriteBooleanValue(OsRollingUpgradeDeferral.Value);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ AutomaticOsUpgradePolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutomaticOsUpgradePolicy)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAutomaticOsUpgradePolicy(document.RootElement, options);
+ }
+
+ internal static AutomaticOsUpgradePolicy DeserializeAutomaticOsUpgradePolicy(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ bool? disableAutomaticRollback = default;
+ bool? enableAutomaticOSUpgrade = default;
+ bool? useRollingUpgradePolicy = default;
+ bool? osRollingUpgradeDeferral = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("disableAutomaticRollback"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ disableAutomaticRollback = property.Value.GetBoolean();
+ continue;
+ }
+ if (property.NameEquals("enableAutomaticOSUpgrade"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ enableAutomaticOSUpgrade = property.Value.GetBoolean();
+ continue;
+ }
+ if (property.NameEquals("useRollingUpgradePolicy"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ useRollingUpgradePolicy = property.Value.GetBoolean();
+ continue;
+ }
+ if (property.NameEquals("osRollingUpgradeDeferral"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ osRollingUpgradeDeferral = property.Value.GetBoolean();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AutomaticOsUpgradePolicy(disableAutomaticRollback, enableAutomaticOSUpgrade, useRollingUpgradePolicy, osRollingUpgradeDeferral, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AutomaticOsUpgradePolicy)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AutomaticOsUpgradePolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeAutomaticOsUpgradePolicy(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AutomaticOsUpgradePolicy)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AutomaticOsUpgradePolicy FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAutomaticOsUpgradePolicy(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AutomaticOsUpgradePolicy.cs b/sdk/batch/Azure.Batch/src/Generated/AutomaticOsUpgradePolicy.cs
new file mode 100644
index 000000000000..c3b9be08a2f0
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AutomaticOsUpgradePolicy.cs
@@ -0,0 +1,77 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Compute.Batch
+{
+ /// The configuration parameters used for performing automatic OS upgrade.
+ public partial class AutomaticOsUpgradePolicy
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public AutomaticOsUpgradePolicy()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// Whether OS image rollback feature should be disabled.
+ /// Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. <br /><br /> If this is set to true for Windows based pools, [WindowsConfiguration.enableAutomaticUpdates](https://learn.microsoft.com/rest/api/batchservice/pool/add?tabs=HTTP#windowsconfiguration) cannot be set to true.
+ /// Indicates whether rolling upgrade policy should be used during Auto OS Upgrade. Auto OS Upgrade will fallback to the default policy if no policy is defined on the VMSS.
+ /// Defer OS upgrades on the TVMs if they are running tasks.
+ /// Keeps track of any properties unknown to the library.
+ internal AutomaticOsUpgradePolicy(bool? disableAutomaticRollback, bool? enableAutomaticOsUpgrade, bool? useRollingUpgradePolicy, bool? osRollingUpgradeDeferral, IDictionary serializedAdditionalRawData)
+ {
+ DisableAutomaticRollback = disableAutomaticRollback;
+ EnableAutomaticOsUpgrade = enableAutomaticOsUpgrade;
+ UseRollingUpgradePolicy = useRollingUpgradePolicy;
+ OsRollingUpgradeDeferral = osRollingUpgradeDeferral;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Whether OS image rollback feature should be disabled.
+ public bool? DisableAutomaticRollback { get; set; }
+ /// Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. <br /><br /> If this is set to true for Windows based pools, [WindowsConfiguration.enableAutomaticUpdates](https://learn.microsoft.com/rest/api/batchservice/pool/add?tabs=HTTP#windowsconfiguration) cannot be set to true.
+ public bool? EnableAutomaticOsUpgrade { get; set; }
+ /// Indicates whether rolling upgrade policy should be used during Auto OS Upgrade. Auto OS Upgrade will fallback to the default policy if no policy is defined on the VMSS.
+ public bool? UseRollingUpgradePolicy { get; set; }
+ /// Defer OS upgrades on the TVMs if they are running tasks.
+ public bool? OsRollingUpgradeDeferral { get; set; }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AzureBlobFileSystemConfiguration.Serialization.cs b/sdk/batch/Azure.Batch/src/Generated/AzureBlobFileSystemConfiguration.Serialization.cs
new file mode 100644
index 000000000000..d7170869ed0b
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AzureBlobFileSystemConfiguration.Serialization.cs
@@ -0,0 +1,207 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Compute.Batch
+{
+ public partial class AzureBlobFileSystemConfiguration : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureBlobFileSystemConfiguration)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("accountName"u8);
+ writer.WriteStringValue(AccountName);
+ writer.WritePropertyName("containerName"u8);
+ writer.WriteStringValue(ContainerName);
+ if (Optional.IsDefined(AccountKey))
+ {
+ writer.WritePropertyName("accountKey"u8);
+ writer.WriteStringValue(AccountKey);
+ }
+ if (Optional.IsDefined(SasKey))
+ {
+ writer.WritePropertyName("sasKey"u8);
+ writer.WriteStringValue(SasKey);
+ }
+ if (Optional.IsDefined(BlobfuseOptions))
+ {
+ writer.WritePropertyName("blobfuseOptions"u8);
+ writer.WriteStringValue(BlobfuseOptions);
+ }
+ writer.WritePropertyName("relativeMountPath"u8);
+ writer.WriteStringValue(RelativeMountPath);
+ if (Optional.IsDefined(IdentityReference))
+ {
+ writer.WritePropertyName("identityReference"u8);
+ writer.WriteObjectValue(IdentityReference, options);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ AzureBlobFileSystemConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureBlobFileSystemConfiguration)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAzureBlobFileSystemConfiguration(document.RootElement, options);
+ }
+
+ internal static AzureBlobFileSystemConfiguration DeserializeAzureBlobFileSystemConfiguration(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string accountName = default;
+ string containerName = default;
+ string accountKey = default;
+ string sasKey = default;
+ string blobfuseOptions = default;
+ string relativeMountPath = default;
+ BatchNodeIdentityReference identityReference = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("accountName"u8))
+ {
+ accountName = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("containerName"u8))
+ {
+ containerName = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("accountKey"u8))
+ {
+ accountKey = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("sasKey"u8))
+ {
+ sasKey = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("blobfuseOptions"u8))
+ {
+ blobfuseOptions = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("relativeMountPath"u8))
+ {
+ relativeMountPath = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("identityReference"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ identityReference = BatchNodeIdentityReference.DeserializeBatchNodeIdentityReference(property.Value, options);
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AzureBlobFileSystemConfiguration(
+ accountName,
+ containerName,
+ accountKey,
+ sasKey,
+ blobfuseOptions,
+ relativeMountPath,
+ identityReference,
+ serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AzureBlobFileSystemConfiguration)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AzureBlobFileSystemConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeAzureBlobFileSystemConfiguration(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AzureBlobFileSystemConfiguration)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AzureBlobFileSystemConfiguration FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAzureBlobFileSystemConfiguration(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AzureBlobFileSystemConfiguration.cs b/sdk/batch/Azure.Batch/src/Generated/AzureBlobFileSystemConfiguration.cs
new file mode 100644
index 000000000000..bf6bd8b45665
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AzureBlobFileSystemConfiguration.cs
@@ -0,0 +1,105 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Compute.Batch
+{
+ /// Information used to connect to an Azure Storage Container using Blobfuse.
+ public partial class AzureBlobFileSystemConfiguration
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The Azure Storage Account name.
+ /// The Azure Blob Storage Container name.
+ /// The relative path on the compute node where the file system will be mounted. All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable.
+ /// , or is null.
+ public AzureBlobFileSystemConfiguration(string accountName, string containerName, string relativeMountPath)
+ {
+ Argument.AssertNotNull(accountName, nameof(accountName));
+ Argument.AssertNotNull(containerName, nameof(containerName));
+ Argument.AssertNotNull(relativeMountPath, nameof(relativeMountPath));
+
+ AccountName = accountName;
+ ContainerName = containerName;
+ RelativeMountPath = relativeMountPath;
+ }
+
+ /// Initializes a new instance of .
+ /// The Azure Storage Account name.
+ /// The Azure Blob Storage Container name.
+ /// The Azure Storage Account key. This property is mutually exclusive with both sasKey and identity; exactly one must be specified.
+ /// The Azure Storage SAS token. This property is mutually exclusive with both accountKey and identity; exactly one must be specified.
+ /// Additional command line options to pass to the mount command. These are 'net use' options in Windows and 'mount' options in Linux.
+ /// The relative path on the compute node where the file system will be mounted. All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable.
+ /// The reference to the user assigned identity to use to access containerName. This property is mutually exclusive with both accountKey and sasKey; exactly one must be specified.
+ /// Keeps track of any properties unknown to the library.
+ internal AzureBlobFileSystemConfiguration(string accountName, string containerName, string accountKey, string sasKey, string blobfuseOptions, string relativeMountPath, BatchNodeIdentityReference identityReference, IDictionary serializedAdditionalRawData)
+ {
+ AccountName = accountName;
+ ContainerName = containerName;
+ AccountKey = accountKey;
+ SasKey = sasKey;
+ BlobfuseOptions = blobfuseOptions;
+ RelativeMountPath = relativeMountPath;
+ IdentityReference = identityReference;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AzureBlobFileSystemConfiguration()
+ {
+ }
+
+ /// The Azure Storage Account name.
+ public string AccountName { get; set; }
+ /// The Azure Blob Storage Container name.
+ public string ContainerName { get; set; }
+ /// The Azure Storage Account key. This property is mutually exclusive with both sasKey and identity; exactly one must be specified.
+ public string AccountKey { get; set; }
+ /// The Azure Storage SAS token. This property is mutually exclusive with both accountKey and identity; exactly one must be specified.
+ public string SasKey { get; set; }
+ /// Additional command line options to pass to the mount command. These are 'net use' options in Windows and 'mount' options in Linux.
+ public string BlobfuseOptions { get; set; }
+ /// The relative path on the compute node where the file system will be mounted. All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable.
+ public string RelativeMountPath { get; set; }
+ /// The reference to the user assigned identity to use to access containerName. This property is mutually exclusive with both accountKey and sasKey; exactly one must be specified.
+ public BatchNodeIdentityReference IdentityReference { get; set; }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AzureFileShareConfiguration.Serialization.cs b/sdk/batch/Azure.Batch/src/Generated/AzureFileShareConfiguration.Serialization.cs
new file mode 100644
index 000000000000..62c45e62098f
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AzureFileShareConfiguration.Serialization.cs
@@ -0,0 +1,176 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Compute.Batch
+{
+ public partial class AzureFileShareConfiguration : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureFileShareConfiguration)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("accountName"u8);
+ writer.WriteStringValue(AccountName);
+ writer.WritePropertyName("azureFileUrl"u8);
+ writer.WriteStringValue(AzureFileUrl);
+ writer.WritePropertyName("accountKey"u8);
+ writer.WriteStringValue(AccountKey);
+ writer.WritePropertyName("relativeMountPath"u8);
+ writer.WriteStringValue(RelativeMountPath);
+ if (Optional.IsDefined(MountOptions))
+ {
+ writer.WritePropertyName("mountOptions"u8);
+ writer.WriteStringValue(MountOptions);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ AzureFileShareConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureFileShareConfiguration)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAzureFileShareConfiguration(document.RootElement, options);
+ }
+
+ internal static AzureFileShareConfiguration DeserializeAzureFileShareConfiguration(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string accountName = default;
+ string azureFileUrl = default;
+ string accountKey = default;
+ string relativeMountPath = default;
+ string mountOptions = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("accountName"u8))
+ {
+ accountName = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("azureFileUrl"u8))
+ {
+ azureFileUrl = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("accountKey"u8))
+ {
+ accountKey = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("relativeMountPath"u8))
+ {
+ relativeMountPath = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("mountOptions"u8))
+ {
+ mountOptions = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AzureFileShareConfiguration(
+ accountName,
+ azureFileUrl,
+ accountKey,
+ relativeMountPath,
+ mountOptions,
+ serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AzureFileShareConfiguration)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AzureFileShareConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeAzureFileShareConfiguration(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AzureFileShareConfiguration)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AzureFileShareConfiguration FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAzureFileShareConfiguration(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/AzureFileShareConfiguration.cs b/sdk/batch/Azure.Batch/src/Generated/AzureFileShareConfiguration.cs
new file mode 100644
index 000000000000..76049a45e428
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/AzureFileShareConfiguration.cs
@@ -0,0 +1,100 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Compute.Batch
+{
+ /// Information used to connect to an Azure Fileshare.
+ public partial class AzureFileShareConfiguration
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The Azure Storage account name.
+ /// The Azure Files URL. This is of the form 'https://{account}.file.core.windows.net/'.
+ /// The Azure Storage account key.
+ /// The relative path on the compute node where the file system will be mounted. All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable.
+ /// , , or is null.
+ public AzureFileShareConfiguration(string accountName, string azureFileUrl, string accountKey, string relativeMountPath)
+ {
+ Argument.AssertNotNull(accountName, nameof(accountName));
+ Argument.AssertNotNull(azureFileUrl, nameof(azureFileUrl));
+ Argument.AssertNotNull(accountKey, nameof(accountKey));
+ Argument.AssertNotNull(relativeMountPath, nameof(relativeMountPath));
+
+ AccountName = accountName;
+ AzureFileUrl = azureFileUrl;
+ AccountKey = accountKey;
+ RelativeMountPath = relativeMountPath;
+ }
+
+ /// Initializes a new instance of .
+ /// The Azure Storage account name.
+ /// The Azure Files URL. This is of the form 'https://{account}.file.core.windows.net/'.
+ /// The Azure Storage account key.
+ /// The relative path on the compute node where the file system will be mounted. All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable.
+ /// Additional command line options to pass to the mount command. These are 'net use' options in Windows and 'mount' options in Linux.
+ /// Keeps track of any properties unknown to the library.
+ internal AzureFileShareConfiguration(string accountName, string azureFileUrl, string accountKey, string relativeMountPath, string mountOptions, IDictionary serializedAdditionalRawData)
+ {
+ AccountName = accountName;
+ AzureFileUrl = azureFileUrl;
+ AccountKey = accountKey;
+ RelativeMountPath = relativeMountPath;
+ MountOptions = mountOptions;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AzureFileShareConfiguration()
+ {
+ }
+
+ /// The Azure Storage account name.
+ public string AccountName { get; set; }
+ /// The Azure Files URL. This is of the form 'https://{account}.file.core.windows.net/'.
+ public string AzureFileUrl { get; set; }
+ /// The Azure Storage account key.
+ public string AccountKey { get; set; }
+ /// The relative path on the compute node where the file system will be mounted. All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable.
+ public string RelativeMountPath { get; set; }
+ /// Additional command line options to pass to the mount command. These are 'net use' options in Windows and 'mount' options in Linux.
+ public string MountOptions { get; set; }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/BatchApplication.Serialization.cs b/sdk/batch/Azure.Batch/src/Generated/BatchApplication.Serialization.cs
new file mode 100644
index 000000000000..ecc68700eb6c
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/BatchApplication.Serialization.cs
@@ -0,0 +1,161 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Compute.Batch
+{
+ public partial class BatchApplication : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(BatchApplication)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("id"u8);
+ writer.WriteStringValue(Id);
+ writer.WritePropertyName("displayName"u8);
+ writer.WriteStringValue(DisplayName);
+ writer.WritePropertyName("versions"u8);
+ writer.WriteStartArray();
+ foreach (var item in Versions)
+ {
+ writer.WriteStringValue(item);
+ }
+ writer.WriteEndArray();
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ BatchApplication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(BatchApplication)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeBatchApplication(document.RootElement, options);
+ }
+
+ internal static BatchApplication DeserializeBatchApplication(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ string displayName = default;
+ IReadOnlyList versions = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("displayName"u8))
+ {
+ displayName = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("versions"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(item.GetString());
+ }
+ versions = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new BatchApplication(id, displayName, versions, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(BatchApplication)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ BatchApplication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeBatchApplication(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(BatchApplication)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static BatchApplication FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeBatchApplication(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/BatchApplication.cs b/sdk/batch/Azure.Batch/src/Generated/BatchApplication.cs
new file mode 100644
index 000000000000..32618e1d9891
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/BatchApplication.cs
@@ -0,0 +1,90 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Azure.Compute.Batch
+{
+ /// Contains information about an application in an Azure Batch Account.
+ public partial class BatchApplication
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// A string that uniquely identifies the application within the Account.
+ /// The display name for the application.
+ /// The list of available versions of the application.
+ /// , or is null.
+ internal BatchApplication(string id, string displayName, IEnumerable versions)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+ Argument.AssertNotNull(displayName, nameof(displayName));
+ Argument.AssertNotNull(versions, nameof(versions));
+
+ Id = id;
+ DisplayName = displayName;
+ Versions = versions.ToList();
+ }
+
+ /// Initializes a new instance of .
+ /// A string that uniquely identifies the application within the Account.
+ /// The display name for the application.
+ /// The list of available versions of the application.
+ /// Keeps track of any properties unknown to the library.
+ internal BatchApplication(string id, string displayName, IReadOnlyList versions, IDictionary serializedAdditionalRawData)
+ {
+ Id = id;
+ DisplayName = displayName;
+ Versions = versions;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal BatchApplication()
+ {
+ }
+
+ /// A string that uniquely identifies the application within the Account.
+ public string Id { get; }
+ /// The display name for the application.
+ public string DisplayName { get; }
+ /// The list of available versions of the application.
+ public IReadOnlyList Versions { get; }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/BatchApplicationPackageReference.Serialization.cs b/sdk/batch/Azure.Batch/src/Generated/BatchApplicationPackageReference.Serialization.cs
new file mode 100644
index 000000000000..3aae3911ba24
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/BatchApplicationPackageReference.Serialization.cs
@@ -0,0 +1,146 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Compute.Batch
+{
+ public partial class BatchApplicationPackageReference : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(BatchApplicationPackageReference)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("applicationId"u8);
+ writer.WriteStringValue(ApplicationId);
+ if (Optional.IsDefined(Version))
+ {
+ writer.WritePropertyName("version"u8);
+ writer.WriteStringValue(Version);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ BatchApplicationPackageReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(BatchApplicationPackageReference)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeBatchApplicationPackageReference(document.RootElement, options);
+ }
+
+ internal static BatchApplicationPackageReference DeserializeBatchApplicationPackageReference(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string applicationId = default;
+ string version = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("applicationId"u8))
+ {
+ applicationId = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("version"u8))
+ {
+ version = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new BatchApplicationPackageReference(applicationId, version, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(BatchApplicationPackageReference)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ BatchApplicationPackageReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeBatchApplicationPackageReference(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(BatchApplicationPackageReference)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static BatchApplicationPackageReference FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeBatchApplicationPackageReference(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/BatchApplicationPackageReference.cs b/sdk/batch/Azure.Batch/src/Generated/BatchApplicationPackageReference.cs
new file mode 100644
index 000000000000..f7d288b19740
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/BatchApplicationPackageReference.cs
@@ -0,0 +1,79 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Compute.Batch
+{
+ /// A reference to an Package to be deployed to Compute Nodes.
+ public partial class BatchApplicationPackageReference
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The ID of the application to deploy. When creating a pool, the package's application ID must be fully qualified (/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}).
+ /// is null.
+ public BatchApplicationPackageReference(string applicationId)
+ {
+ Argument.AssertNotNull(applicationId, nameof(applicationId));
+
+ ApplicationId = applicationId;
+ }
+
+ /// Initializes a new instance of .
+ /// The ID of the application to deploy. When creating a pool, the package's application ID must be fully qualified (/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}).
+ /// The version of the application to deploy. If omitted, the default version is deployed. If this is omitted on a Pool, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences and HTTP status code 409. If this is omitted on a Task, and no default version is specified for this application, the Task fails with a pre-processing error.
+ /// Keeps track of any properties unknown to the library.
+ internal BatchApplicationPackageReference(string applicationId, string version, IDictionary serializedAdditionalRawData)
+ {
+ ApplicationId = applicationId;
+ Version = version;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal BatchApplicationPackageReference()
+ {
+ }
+
+ /// The ID of the application to deploy. When creating a pool, the package's application ID must be fully qualified (/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}).
+ public string ApplicationId { get; set; }
+ /// The version of the application to deploy. If omitted, the default version is deployed. If this is omitted on a Pool, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences and HTTP status code 409. If this is omitted on a Task, and no default version is specified for this application, the Task fails with a pre-processing error.
+ public string Version { get; set; }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/BatchAutoPoolSpecification.Serialization.cs b/sdk/batch/Azure.Batch/src/Generated/BatchAutoPoolSpecification.Serialization.cs
new file mode 100644
index 000000000000..cde73fe11666
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/BatchAutoPoolSpecification.Serialization.cs
@@ -0,0 +1,176 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Compute.Batch
+{
+ public partial class BatchAutoPoolSpecification : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(BatchAutoPoolSpecification)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(AutoPoolIdPrefix))
+ {
+ writer.WritePropertyName("autoPoolIdPrefix"u8);
+ writer.WriteStringValue(AutoPoolIdPrefix);
+ }
+ writer.WritePropertyName("poolLifetimeOption"u8);
+ writer.WriteStringValue(PoolLifetimeOption.ToString());
+ if (Optional.IsDefined(KeepAlive))
+ {
+ writer.WritePropertyName("keepAlive"u8);
+ writer.WriteBooleanValue(KeepAlive.Value);
+ }
+ if (Optional.IsDefined(Pool))
+ {
+ writer.WritePropertyName("pool"u8);
+ writer.WriteObjectValue(Pool, options);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ BatchAutoPoolSpecification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(BatchAutoPoolSpecification)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeBatchAutoPoolSpecification(document.RootElement, options);
+ }
+
+ internal static BatchAutoPoolSpecification DeserializeBatchAutoPoolSpecification(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string autoPoolIdPrefix = default;
+ BatchPoolLifetimeOption poolLifetimeOption = default;
+ bool? keepAlive = default;
+ BatchPoolSpecification pool = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("autoPoolIdPrefix"u8))
+ {
+ autoPoolIdPrefix = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("poolLifetimeOption"u8))
+ {
+ poolLifetimeOption = new BatchPoolLifetimeOption(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("keepAlive"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ keepAlive = property.Value.GetBoolean();
+ continue;
+ }
+ if (property.NameEquals("pool"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ pool = BatchPoolSpecification.DeserializeBatchPoolSpecification(property.Value, options);
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new BatchAutoPoolSpecification(autoPoolIdPrefix, poolLifetimeOption, keepAlive, pool, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(BatchAutoPoolSpecification)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ BatchAutoPoolSpecification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeBatchAutoPoolSpecification(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(BatchAutoPoolSpecification)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static BatchAutoPoolSpecification FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeBatchAutoPoolSpecification(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/BatchAutoPoolSpecification.cs b/sdk/batch/Azure.Batch/src/Generated/BatchAutoPoolSpecification.cs
new file mode 100644
index 000000000000..3b9554463013
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/BatchAutoPoolSpecification.cs
@@ -0,0 +1,87 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Compute.Batch
+{
+ ///
+ /// Specifies characteristics for a temporary 'auto pool'. The Batch service will
+ /// create this auto Pool when the Job is submitted.
+ ///
+ public partial class BatchAutoPoolSpecification
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The minimum lifetime of created auto Pools, and how multiple Jobs on a schedule are assigned to Pools.
+ public BatchAutoPoolSpecification(BatchPoolLifetimeOption poolLifetimeOption)
+ {
+ PoolLifetimeOption = poolLifetimeOption;
+ }
+
+ /// Initializes a new instance of .
+ /// A prefix to be added to the unique identifier when a Pool is automatically created. The Batch service assigns each auto Pool a unique identifier on creation. To distinguish between Pools created for different purposes, you can specify this element to add a prefix to the ID that is assigned. The prefix can be up to 20 characters long.
+ /// The minimum lifetime of created auto Pools, and how multiple Jobs on a schedule are assigned to Pools.
+ /// Whether to keep an auto Pool alive after its lifetime expires. If false, the Batch service deletes the Pool once its lifetime (as determined by the poolLifetimeOption setting) expires; that is, when the Job or Job Schedule completes. If true, the Batch service does not delete the Pool automatically. It is up to the user to delete auto Pools created with this option.
+ /// The Pool specification for the auto Pool.
+ /// Keeps track of any properties unknown to the library.
+ internal BatchAutoPoolSpecification(string autoPoolIdPrefix, BatchPoolLifetimeOption poolLifetimeOption, bool? keepAlive, BatchPoolSpecification pool, IDictionary serializedAdditionalRawData)
+ {
+ AutoPoolIdPrefix = autoPoolIdPrefix;
+ PoolLifetimeOption = poolLifetimeOption;
+ KeepAlive = keepAlive;
+ Pool = pool;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal BatchAutoPoolSpecification()
+ {
+ }
+
+ /// A prefix to be added to the unique identifier when a Pool is automatically created. The Batch service assigns each auto Pool a unique identifier on creation. To distinguish between Pools created for different purposes, you can specify this element to add a prefix to the ID that is assigned. The prefix can be up to 20 characters long.
+ public string AutoPoolIdPrefix { get; set; }
+ /// The minimum lifetime of created auto Pools, and how multiple Jobs on a schedule are assigned to Pools.
+ public BatchPoolLifetimeOption PoolLifetimeOption { get; set; }
+ /// Whether to keep an auto Pool alive after its lifetime expires. If false, the Batch service deletes the Pool once its lifetime (as determined by the poolLifetimeOption setting) expires; that is, when the Job or Job Schedule completes. If true, the Batch service does not delete the Pool automatically. It is up to the user to delete auto Pools created with this option.
+ public bool? KeepAlive { get; set; }
+ /// The Pool specification for the auto Pool.
+ public BatchPoolSpecification Pool { get; set; }
+ }
+}
diff --git a/sdk/batch/Azure.Batch/src/Generated/BatchClient.cs b/sdk/batch/Azure.Batch/src/Generated/BatchClient.cs
new file mode 100644
index 000000000000..dfa8007a2658
--- /dev/null
+++ b/sdk/batch/Azure.Batch/src/Generated/BatchClient.cs
@@ -0,0 +1,12377 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using Autorest.CSharp.Core;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Azure.Compute.Batch
+{
+ // Data plane generated client.
+ /// The Batch service client.
+ public partial class BatchClient
+ {
+ private static readonly string[] AuthorizationScopes = new string[] { "https://batch.core.windows.net//.default" };
+ private readonly TokenCredential _tokenCredential;
+ private readonly HttpPipeline _pipeline;
+ private readonly Uri _endpoint;
+ private readonly string _apiVersion;
+
+ /// The ClientDiagnostics is used to provide tracing support for the client library.
+ internal ClientDiagnostics ClientDiagnostics { get; }
+
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ public virtual HttpPipeline Pipeline => _pipeline;
+
+ /// Initializes a new instance of BatchClient for mocking.
+ protected BatchClient()
+ {
+ }
+
+ /// Initializes a new instance of BatchClient.
+ /// Batch account endpoint (for example: https://batchaccount.eastus2.batch.azure.com).
+ /// A credential used to authenticate to an Azure Service.
+ /// or is null.
+ public BatchClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new BatchClientOptions())
+ {
+ }
+
+ /// Initializes a new instance of BatchClient.
+ /// Batch account endpoint (for example: https://batchaccount.eastus2.batch.azure.com).
+ /// A credential used to authenticate to an Azure Service.
+ /// The options for configuring the client.
+ /// or is null.
+ public BatchClient(Uri endpoint, TokenCredential credential, BatchClientOptions options)
+ {
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ Argument.AssertNotNull(credential, nameof(credential));
+ options ??= new BatchClientOptions();
+
+ ClientDiagnostics = new ClientDiagnostics(options, true);
+ _tokenCredential = credential;
+ _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier());
+ _endpoint = endpoint;
+ _apiVersion = options.Version;
+ }
+
+ /// Gets information about the specified Application.
+ /// The ID of the Application.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// This operation returns only Applications and versions that are available for
+ /// use on Compute Nodes; that is, that can be used in an Package reference. For
+ /// administrator information about Applications and versions that are not yet
+ /// available to Compute Nodes, use the Azure portal or the Azure Resource Manager
+ /// API.
+ ///
+ ///
+ public virtual async Task> GetApplicationAsync(string applicationId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(applicationId, nameof(applicationId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetApplicationAsync(applicationId, timeOutInSeconds, ocpdate, context).ConfigureAwait(false);
+ return Response.FromValue(BatchApplication.FromResponse(response), response);
+ }
+
+ /// Gets information about the specified Application.
+ /// The ID of the Application.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// This operation returns only Applications and versions that are available for
+ /// use on Compute Nodes; that is, that can be used in an Package reference. For
+ /// administrator information about Applications and versions that are not yet
+ /// available to Compute Nodes, use the Azure portal or the Azure Resource Manager
+ /// API.
+ ///
+ ///
+ public virtual Response GetApplication(string applicationId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(applicationId, nameof(applicationId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetApplication(applicationId, timeOutInSeconds, ocpdate, context);
+ return Response.FromValue(BatchApplication.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets information about the specified Application.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Application.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task GetApplicationAsync(string applicationId, int? timeOutInSeconds, DateTimeOffset? ocpdate, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(applicationId, nameof(applicationId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.GetApplication");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetApplicationRequest(applicationId, timeOutInSeconds, ocpdate, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets information about the specified Application.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Application.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response GetApplication(string applicationId, int? timeOutInSeconds, DateTimeOffset? ocpdate, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(applicationId, nameof(applicationId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.GetApplication");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetApplicationRequest(applicationId, timeOutInSeconds, ocpdate, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates a Pool to the specified Account.
+ /// The Pool to be created.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The cancellation token to use.
+ /// is null.
+ ///
+ /// When naming Pools, avoid including sensitive information such as user names or
+ /// secret project names. This information may appear in telemetry logs accessible
+ /// to Microsoft Support engineers.
+ ///
+ ///
+ public virtual async Task CreatePoolAsync(BatchPoolCreateContent pool, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(pool, nameof(pool));
+
+ using RequestContent content = pool.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await CreatePoolAsync(content, timeOutInSeconds, ocpdate, context).ConfigureAwait(false);
+ return response;
+ }
+
+ /// Creates a Pool to the specified Account.
+ /// The Pool to be created.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The cancellation token to use.
+ /// is null.
+ ///
+ /// When naming Pools, avoid including sensitive information such as user names or
+ /// secret project names. This information may appear in telemetry logs accessible
+ /// to Microsoft Support engineers.
+ ///
+ ///
+ public virtual Response CreatePool(BatchPoolCreateContent pool, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(pool, nameof(pool));
+
+ using RequestContent content = pool.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = CreatePool(content, timeOutInSeconds, ocpdate, context);
+ return response;
+ }
+
+ ///
+ /// [Protocol Method] Creates a Pool to the specified Account.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task CreatePoolAsync(RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.CreatePool");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreatePoolRequest(content, timeOutInSeconds, ocpdate, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates a Pool to the specified Account.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response CreatePool(RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.CreatePool");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreatePoolRequest(content, timeOutInSeconds, ocpdate, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a Pool from the specified Account.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task DeletePoolAsync(string poolId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.DeletePool");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeletePoolRequest(poolId, timeOutInSeconds, ocpdate, requestConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a Pool from the specified Account.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response DeletePool(string poolId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.DeletePool");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeletePoolRequest(poolId, timeOutInSeconds, ocpdate, requestConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Gets basic properties of a Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual async Task PoolExistsAsync(string poolId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.PoolExists");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreatePoolExistsRequest(poolId, timeOutInSeconds, ocpdate, requestConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Gets basic properties of a Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual Response PoolExists(string poolId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.PoolExists");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreatePoolExistsRequest(poolId, timeOutInSeconds, ocpdate, requestConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets information about the specified Pool.
+ /// The ID of the Pool to get.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// An OData $select clause.
+ /// An OData $expand clause.
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetPoolAsync(string poolId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, IEnumerable select = null, IEnumerable expand = null, RequestConditions requestConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetPoolAsync(poolId, timeOutInSeconds, ocpdate, select, expand, requestConditions, context).ConfigureAwait(false);
+ return Response.FromValue(BatchPool.FromResponse(response), response);
+ }
+
+ /// Gets information about the specified Pool.
+ /// The ID of the Pool to get.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// An OData $select clause.
+ /// An OData $expand clause.
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetPool(string poolId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, IEnumerable select = null, IEnumerable expand = null, RequestConditions requestConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetPool(poolId, timeOutInSeconds, ocpdate, select, expand, requestConditions, context);
+ return Response.FromValue(BatchPool.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets information about the specified Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// An OData $select clause.
+ /// An OData $expand clause.
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task GetPoolAsync(string poolId, int? timeOutInSeconds, DateTimeOffset? ocpdate, IEnumerable select, IEnumerable expand, RequestConditions requestConditions, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.GetPool");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetPoolRequest(poolId, timeOutInSeconds, ocpdate, select, expand, requestConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets information about the specified Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// An OData $select clause.
+ /// An OData $expand clause.
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response GetPool(string poolId, int? timeOutInSeconds, DateTimeOffset? ocpdate, IEnumerable select, IEnumerable expand, RequestConditions requestConditions, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.GetPool");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetPoolRequest(poolId, timeOutInSeconds, ocpdate, select, expand, requestConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Updates the properties of the specified Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task UpdatePoolAsync(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.UpdatePool");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdatePoolRequest(poolId, content, timeOutInSeconds, ocpdate, requestConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Updates the properties of the specified Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response UpdatePool(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.UpdatePool");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateUpdatePoolRequest(poolId, content, timeOutInSeconds, ocpdate, requestConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Disables automatic scaling for a Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool on which to disable automatic scaling.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task DisablePoolAutoScaleAsync(string poolId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.DisablePoolAutoScale");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDisablePoolAutoScaleRequest(poolId, timeOutInSeconds, ocpdate, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Disables automatic scaling for a Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool on which to disable automatic scaling.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response DisablePoolAutoScale(string poolId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.DisablePoolAutoScale");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDisablePoolAutoScaleRequest(poolId, timeOutInSeconds, ocpdate, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Enables automatic scaling for a Pool.
+ /// The ID of the Pool to get.
+ /// The options to use for enabling automatic scaling.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// You cannot enable automatic scaling on a Pool if a resize operation is in
+ /// progress on the Pool. If automatic scaling of the Pool is currently disabled,
+ /// you must specify a valid autoscale formula as part of the request. If automatic
+ /// scaling of the Pool is already enabled, you may specify a new autoscale formula
+ /// and/or a new evaluation interval. You cannot call this API for the same Pool
+ /// more than once every 30 seconds.
+ ///
+ ///
+ public virtual async Task EnablePoolAutoScaleAsync(string poolId, BatchPoolEnableAutoScaleContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using RequestContent content0 = content.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await EnablePoolAutoScaleAsync(poolId, content0, timeOutInSeconds, ocpdate, requestConditions, context).ConfigureAwait(false);
+ return response;
+ }
+
+ /// Enables automatic scaling for a Pool.
+ /// The ID of the Pool to get.
+ /// The options to use for enabling automatic scaling.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// You cannot enable automatic scaling on a Pool if a resize operation is in
+ /// progress on the Pool. If automatic scaling of the Pool is currently disabled,
+ /// you must specify a valid autoscale formula as part of the request. If automatic
+ /// scaling of the Pool is already enabled, you may specify a new autoscale formula
+ /// and/or a new evaluation interval. You cannot call this API for the same Pool
+ /// more than once every 30 seconds.
+ ///
+ ///
+ public virtual Response EnablePoolAutoScale(string poolId, BatchPoolEnableAutoScaleContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using RequestContent content0 = content.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = EnablePoolAutoScale(poolId, content0, timeOutInSeconds, ocpdate, requestConditions, context);
+ return response;
+ }
+
+ ///
+ /// [Protocol Method] Enables automatic scaling for a Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task EnablePoolAutoScaleAsync(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.EnablePoolAutoScale");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateEnablePoolAutoScaleRequest(poolId, content, timeOutInSeconds, ocpdate, requestConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Enables automatic scaling for a Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response EnablePoolAutoScale(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.EnablePoolAutoScale");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateEnablePoolAutoScaleRequest(poolId, content, timeOutInSeconds, ocpdate, requestConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets the result of evaluating an automatic scaling formula on the Pool.
+ /// The ID of the Pool on which to evaluate the automatic scaling formula.
+ /// The options to use for evaluating the automatic scaling formula.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// This API is primarily for validating an autoscale formula, as it simply returns
+ /// the result without applying the formula to the Pool. The Pool must have auto
+ /// scaling enabled in order to evaluate a formula.
+ ///
+ ///
+ public virtual async Task> EvaluatePoolAutoScaleAsync(string poolId, BatchPoolEvaluateAutoScaleContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using RequestContent content0 = content.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await EvaluatePoolAutoScaleAsync(poolId, content0, timeOutInSeconds, ocpdate, context).ConfigureAwait(false);
+ return Response.FromValue(AutoScaleRun.FromResponse(response), response);
+ }
+
+ /// Gets the result of evaluating an automatic scaling formula on the Pool.
+ /// The ID of the Pool on which to evaluate the automatic scaling formula.
+ /// The options to use for evaluating the automatic scaling formula.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// This API is primarily for validating an autoscale formula, as it simply returns
+ /// the result without applying the formula to the Pool. The Pool must have auto
+ /// scaling enabled in order to evaluate a formula.
+ ///
+ ///
+ public virtual Response EvaluatePoolAutoScale(string poolId, BatchPoolEvaluateAutoScaleContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using RequestContent content0 = content.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = EvaluatePoolAutoScale(poolId, content0, timeOutInSeconds, ocpdate, context);
+ return Response.FromValue(AutoScaleRun.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets the result of evaluating an automatic scaling formula on the Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool on which to evaluate the automatic scaling formula.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task EvaluatePoolAutoScaleAsync(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.EvaluatePoolAutoScale");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateEvaluatePoolAutoScaleRequest(poolId, content, timeOutInSeconds, ocpdate, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets the result of evaluating an automatic scaling formula on the Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool on which to evaluate the automatic scaling formula.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response EvaluatePoolAutoScale(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.EvaluatePoolAutoScale");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateEvaluatePoolAutoScaleRequest(poolId, content, timeOutInSeconds, ocpdate, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Changes the number of Compute Nodes that are assigned to a Pool.
+ /// The ID of the Pool to get.
+ /// The options to use for resizing the pool.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// You can only resize a Pool when its allocation state is steady. If the Pool is
+ /// already resizing, the request fails with status code 409. When you resize a
+ /// Pool, the Pool's allocation state changes from steady to resizing. You cannot
+ /// resize Pools which are configured for automatic scaling. If you try to do this,
+ /// the Batch service returns an error 409. If you resize a Pool downwards, the
+ /// Batch service chooses which Compute Nodes to remove. To remove specific Compute
+ /// Nodes, use the Pool remove Compute Nodes API instead.
+ ///
+ ///
+ public virtual async Task ResizePoolAsync(string poolId, BatchPoolResizeContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using RequestContent content0 = content.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await ResizePoolAsync(poolId, content0, timeOutInSeconds, ocpdate, requestConditions, context).ConfigureAwait(false);
+ return response;
+ }
+
+ /// Changes the number of Compute Nodes that are assigned to a Pool.
+ /// The ID of the Pool to get.
+ /// The options to use for resizing the pool.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// You can only resize a Pool when its allocation state is steady. If the Pool is
+ /// already resizing, the request fails with status code 409. When you resize a
+ /// Pool, the Pool's allocation state changes from steady to resizing. You cannot
+ /// resize Pools which are configured for automatic scaling. If you try to do this,
+ /// the Batch service returns an error 409. If you resize a Pool downwards, the
+ /// Batch service chooses which Compute Nodes to remove. To remove specific Compute
+ /// Nodes, use the Pool remove Compute Nodes API instead.
+ ///
+ ///
+ public virtual Response ResizePool(string poolId, BatchPoolResizeContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using RequestContent content0 = content.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = ResizePool(poolId, content0, timeOutInSeconds, ocpdate, requestConditions, context);
+ return response;
+ }
+
+ ///
+ /// [Protocol Method] Changes the number of Compute Nodes that are assigned to a Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task ResizePoolAsync(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.ResizePool");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateResizePoolRequest(poolId, content, timeOutInSeconds, ocpdate, requestConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Changes the number of Compute Nodes that are assigned to a Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response ResizePool(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.ResizePool");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateResizePoolRequest(poolId, content, timeOutInSeconds, ocpdate, requestConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Stops an ongoing resize operation on the Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task StopPoolResizeAsync(string poolId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.StopPoolResize");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateStopPoolResizeRequest(poolId, timeOutInSeconds, ocpdate, requestConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Stops an ongoing resize operation on the Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response StopPoolResize(string poolId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.StopPoolResize");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateStopPoolResizeRequest(poolId, timeOutInSeconds, ocpdate, requestConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates the properties of the specified Pool.
+ /// The ID of the Pool to update.
+ /// The options to use for replacing properties on the pool.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// This fully replaces all the updatable properties of the Pool. For example, if
+ /// the Pool has a StartTask associated with it and if StartTask is not specified
+ /// with this request, then the Batch service will remove the existing StartTask.
+ ///
+ ///
+ public virtual async Task ReplacePoolPropertiesAsync(string poolId, BatchPoolReplaceContent pool, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(pool, nameof(pool));
+
+ using RequestContent content = pool.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await ReplacePoolPropertiesAsync(poolId, content, timeOutInSeconds, ocpdate, context).ConfigureAwait(false);
+ return response;
+ }
+
+ /// Updates the properties of the specified Pool.
+ /// The ID of the Pool to update.
+ /// The options to use for replacing properties on the pool.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// This fully replaces all the updatable properties of the Pool. For example, if
+ /// the Pool has a StartTask associated with it and if StartTask is not specified
+ /// with this request, then the Batch service will remove the existing StartTask.
+ ///
+ ///
+ public virtual Response ReplacePoolProperties(string poolId, BatchPoolReplaceContent pool, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(pool, nameof(pool));
+
+ using RequestContent content = pool.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = ReplacePoolProperties(poolId, content, timeOutInSeconds, ocpdate, context);
+ return response;
+ }
+
+ ///
+ /// [Protocol Method] Updates the properties of the specified Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to update.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task ReplacePoolPropertiesAsync(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.ReplacePoolProperties");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateReplacePoolPropertiesRequest(poolId, content, timeOutInSeconds, ocpdate, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Updates the properties of the specified Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to update.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response ReplacePoolProperties(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.ReplacePoolProperties");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateReplacePoolPropertiesRequest(poolId, content, timeOutInSeconds, ocpdate, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Removes Compute Nodes from the specified Pool.
+ /// The ID of the Pool to get.
+ /// The options to use for removing the node.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// This operation can only run when the allocation state of the Pool is steady.
+ /// When this operation runs, the allocation state changes from steady to resizing.
+ /// Each request may remove up to 100 nodes.
+ ///
+ ///
+ public virtual async Task RemoveNodesAsync(string poolId, BatchNodeRemoveContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using RequestContent content0 = content.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await RemoveNodesAsync(poolId, content0, timeOutInSeconds, ocpdate, requestConditions, context).ConfigureAwait(false);
+ return response;
+ }
+
+ /// Removes Compute Nodes from the specified Pool.
+ /// The ID of the Pool to get.
+ /// The options to use for removing the node.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ /// This operation can only run when the allocation state of the Pool is steady.
+ /// When this operation runs, the allocation state changes from steady to resizing.
+ /// Each request may remove up to 100 nodes.
+ ///
+ ///
+ public virtual Response RemoveNodes(string poolId, BatchNodeRemoveContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using RequestContent content0 = content.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = RemoveNodes(poolId, content0, timeOutInSeconds, ocpdate, requestConditions, context);
+ return response;
+ }
+
+ ///
+ /// [Protocol Method] Removes Compute Nodes from the specified Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task RemoveNodesAsync(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.RemoveNodes");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateRemoveNodesRequest(poolId, content, timeOutInSeconds, ocpdate, requestConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Removes Compute Nodes from the specified Pool.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Pool to get.
+ /// The content to send as the body of the request.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response RemoveNodes(string poolId, RequestContent content, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(poolId, nameof(poolId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.RemoveNodes");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateRemoveNodesRequest(poolId, content, timeOutInSeconds, ocpdate, requestConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a Job.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Job to delete.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// If true, the server will delete the Job even if the corresponding nodes have not fully processed the deletion. The default value is false.
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task DeleteJobAsync(string jobId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, bool? force = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.DeleteJob");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeleteJobRequest(jobId, timeOutInSeconds, ocpdate, force, requestConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a Job.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Job to delete.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// If true, the server will delete the Job even if the corresponding nodes have not fully processed the deletion. The default value is false.
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response DeleteJob(string jobId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, bool? force = null, RequestConditions requestConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.DeleteJob");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeleteJobRequest(jobId, timeOutInSeconds, ocpdate, force, requestConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets information about the specified Job.
+ /// The ID of the Job.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// An OData $select clause.
+ /// An OData $expand clause.
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetJobAsync(string jobId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, IEnumerable select = null, IEnumerable expand = null, RequestConditions requestConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetJobAsync(jobId, timeOutInSeconds, ocpdate, select, expand, requestConditions, context).ConfigureAwait(false);
+ return Response.FromValue(BatchJob.FromResponse(response), response);
+ }
+
+ /// Gets information about the specified Job.
+ /// The ID of the Job.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// An OData $select clause.
+ /// An OData $expand clause.
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetJob(string jobId, int? timeOutInSeconds = null, DateTimeOffset? ocpdate = null, IEnumerable select = null, IEnumerable expand = null, RequestConditions requestConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetJob(jobId, timeOutInSeconds, ocpdate, select, expand, requestConditions, context);
+ return Response.FromValue(BatchJob.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets information about the specified Job.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Job.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// An OData $select clause.
+ /// An OData $expand clause.
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task GetJobAsync(string jobId, int? timeOutInSeconds, DateTimeOffset? ocpdate, IEnumerable select, IEnumerable expand, RequestConditions requestConditions, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.GetJob");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetJobRequest(jobId, timeOutInSeconds, ocpdate, select, expand, requestConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets information about the specified Job.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The ID of the Job.
+ /// The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
+ ///
+ /// The time the request was issued. Client libraries typically set this to the
+ /// current system clock time; set it explicitly if you are calling the REST API
+ /// directly.
+ ///
+ /// An OData $select clause.
+ /// An OData $expand clause.
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response GetJob(string jobId, int? timeOutInSeconds, DateTimeOffset? ocpdate, IEnumerable select, IEnumerable expand, RequestConditions requestConditions, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
+
+ using var scope = ClientDiagnostics.CreateScope("BatchClient.GetJob");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetJobRequest(jobId, timeOutInSeconds, ocpdate, select, expand, requestConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Updates the properties of the specified Job.
+ ///
+ /// -
+ ///