diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs index 546d614966d87..c31eb49ed837e 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs @@ -621,300 +621,5 @@ public static VectorStoreFileBatch VectorStoreFileBatch(string id = null, Vector fileCounts, serializedAdditionalRawData: null); } - - /// Initializes a new instance of . - /// The identifier of the message, which can be referenced in API endpoints. - /// The object type, which is always `thread.message.delta`. - /// The delta containing the fields that have changed on the Message. - /// A new instance for mocking. - public static MessageDeltaChunk MessageDeltaChunk(string id = null, MessageDeltaChunkObject @object = default, MessageDelta delta = null) - { - return new MessageDeltaChunk(id, @object, delta, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The entity that produced the message. - /// - /// The content of the message as an array of text and/or images. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// A new instance for mocking. - public static MessageDelta MessageDelta(MessageRole role = default, IEnumerable content = null) - { - content ??= new List(); - - return new MessageDelta(role, content?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The index of the content part of the message. - /// The type of content for this content part. - /// A new instance for mocking. - public static MessageDeltaContent MessageDeltaContent(int index = default, string type = null) - { - return new UnknownMessageDeltaContent(index, type, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The index of the content part of the message. - /// The image_file data. - /// A new instance for mocking. - public static MessageDeltaImageFileContent MessageDeltaImageFileContent(int index = default, MessageDeltaImageFileContentObject imageFile = null) - { - return new MessageDeltaImageFileContent(index, "image_file", serializedAdditionalRawData: null, imageFile); - } - - /// Initializes a new instance of . - /// The file ID of the image in the message content. - /// A new instance for mocking. - public static MessageDeltaImageFileContentObject MessageDeltaImageFileContentObject(string fileId = null) - { - return new MessageDeltaImageFileContentObject(fileId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The index of the content part of the message. - /// The text content details. - /// A new instance for mocking. - public static MessageDeltaTextContent MessageDeltaTextContent(int index = default, MessageDeltaTextContentObject text = null) - { - return new MessageDeltaTextContent(index, "text", serializedAdditionalRawData: null, text); - } - - /// Initializes a new instance of . - /// The data that makes up the text. - /// - /// Annotations for the text. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// A new instance for mocking. - public static MessageDeltaTextContentObject MessageDeltaTextContentObject(string value = null, IEnumerable annotations = null) - { - annotations ??= new List(); - - return new MessageDeltaTextContentObject(value, annotations?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The index of the annotation within a text content part. - /// The type of the text content annotation. - /// A new instance for mocking. - public static MessageDeltaTextAnnotation MessageDeltaTextAnnotation(int index = default, string type = null) - { - return new UnknownMessageDeltaTextAnnotation(index, type, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The index of the annotation within a text content part. - /// The file citation information. - /// The text in the message content that needs to be replaced. - /// The start index of this annotation in the content text. - /// The end index of this annotation in the content text. - /// A new instance for mocking. - public static MessageDeltaTextFileCitationAnnotation MessageDeltaTextFileCitationAnnotation(int index = default, MessageDeltaTextFileCitationAnnotationObject fileCitation = null, string text = null, int? startIndex = null, int? endIndex = null) - { - return new MessageDeltaTextFileCitationAnnotation( - index, - "file_citation", - serializedAdditionalRawData: null, - fileCitation, - text, - startIndex, - endIndex); - } - - /// Initializes a new instance of . - /// The ID of the specific file the citation is from. - /// The specific quote in the cited file. - /// A new instance for mocking. - public static MessageDeltaTextFileCitationAnnotationObject MessageDeltaTextFileCitationAnnotationObject(string fileId = null, string quote = null) - { - return new MessageDeltaTextFileCitationAnnotationObject(fileId, quote, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The index of the annotation within a text content part. - /// The file path information. - /// The start index of this annotation in the content text. - /// The end index of this annotation in the content text. - /// The text in the message content that needs to be replaced. - /// A new instance for mocking. - public static MessageDeltaTextFilePathAnnotation MessageDeltaTextFilePathAnnotation(int index = default, MessageDeltaTextFilePathAnnotationObject filePath = null, int? startIndex = null, int? endIndex = null, string text = null) - { - return new MessageDeltaTextFilePathAnnotation( - index, - "file_path", - serializedAdditionalRawData: null, - filePath, - startIndex, - endIndex, - text); - } - - /// Initializes a new instance of . - /// The file ID for the annotation. - /// A new instance for mocking. - public static MessageDeltaTextFilePathAnnotationObject MessageDeltaTextFilePathAnnotationObject(string fileId = null) - { - return new MessageDeltaTextFilePathAnnotationObject(fileId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The identifier of the run step, which can be referenced in API endpoints. - /// The object type, which is always `thread.run.step.delta`. - /// The delta containing the fields that have changed on the run step. - /// A new instance for mocking. - public static RunStepDeltaChunk RunStepDeltaChunk(string id = null, RunStepDeltaChunkObject @object = default, RunStepDelta delta = null) - { - return new RunStepDeltaChunk(id, @object, delta, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// The details of the run step. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// A new instance for mocking. - public static RunStepDelta RunStepDelta(RunStepDeltaDetail stepDetails = null) - { - return new RunStepDelta(stepDetails, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The message creation data. - /// A new instance for mocking. - public static RunStepDeltaMessageCreation RunStepDeltaMessageCreation(RunStepDeltaMessageCreationObject messageCreation = null) - { - return new RunStepDeltaMessageCreation("message_creation", serializedAdditionalRawData: null, messageCreation); - } - - /// Initializes a new instance of . - /// The ID of the newly-created message. - /// A new instance for mocking. - public static RunStepDeltaMessageCreationObject RunStepDeltaMessageCreationObject(string messageId = null) - { - return new RunStepDeltaMessageCreationObject(messageId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// The collection of tool calls for the tool call detail item. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - /// A new instance for mocking. - public static RunStepDeltaToolCallObject RunStepDeltaToolCallObject(IEnumerable toolCalls = null) - { - toolCalls ??= new List(); - - return new RunStepDeltaToolCallObject("tool_calls", serializedAdditionalRawData: null, toolCalls?.ToList()); - } - - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// The type of the tool call detail item in a streaming run step's details. - /// A new instance for mocking. - public static RunStepDeltaToolCall RunStepDeltaToolCall(int index = default, string id = null, string type = null) - { - return new UnknownRunStepDeltaToolCall(index, id, type, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// The function data for the tool call. - /// A new instance for mocking. - public static RunStepDeltaFunctionToolCall RunStepDeltaFunctionToolCall(int index = default, string id = null, RunStepDeltaFunction function = null) - { - return new RunStepDeltaFunctionToolCall(index, id, "function", serializedAdditionalRawData: null, function); - } - - /// Initializes a new instance of . - /// The name of the function. - /// The arguments passed to the function as input. - /// The output of the function, null if outputs have not yet been submitted. - /// A new instance for mocking. - public static RunStepDeltaFunction RunStepDeltaFunction(string name = null, string arguments = null, string output = null) - { - return new RunStepDeltaFunction(name, arguments, output, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// Reserved for future use. - /// A new instance for mocking. - public static RunStepDeltaFileSearchToolCall RunStepDeltaFileSearchToolCall(int index = default, string id = null, IReadOnlyDictionary fileSearch = null) - { - fileSearch ??= new Dictionary(); - - return new RunStepDeltaFileSearchToolCall(index, id, "file_search", serializedAdditionalRawData: null, fileSearch); - } - - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// The Code Interpreter data for the tool call. - /// A new instance for mocking. - public static RunStepDeltaCodeInterpreterToolCall RunStepDeltaCodeInterpreterToolCall(int index = default, string id = null, RunStepDeltaCodeInterpreterDetailItemObject codeInterpreter = null) - { - return new RunStepDeltaCodeInterpreterToolCall(index, id, "code_interpreter", serializedAdditionalRawData: null, codeInterpreter); - } - - /// Initializes a new instance of . - /// The input into the Code Interpreter tool call. - /// - /// The outputs from the Code Interpreter tool call. Code Interpreter can output one or more - /// items, including text (`logs`) or images (`image`). Each of these are represented by a - /// different object type. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// A new instance for mocking. - public static RunStepDeltaCodeInterpreterDetailItemObject RunStepDeltaCodeInterpreterDetailItemObject(string input = null, IEnumerable outputs = null) - { - outputs ??= new List(); - - return new RunStepDeltaCodeInterpreterDetailItemObject(input, outputs?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. - /// The type of the streaming run step tool call's Code Interpreter output. - /// A new instance for mocking. - public static RunStepDeltaCodeInterpreterOutput RunStepDeltaCodeInterpreterOutput(int index = default, string type = null) - { - return new UnknownRunStepDeltaCodeInterpreterOutput(index, type, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. - /// The text output from the Code Interpreter tool call. - /// A new instance for mocking. - public static RunStepDeltaCodeInterpreterLogOutput RunStepDeltaCodeInterpreterLogOutput(int index = default, string logs = null) - { - return new RunStepDeltaCodeInterpreterLogOutput(index, "logs", serializedAdditionalRawData: null, logs); - } - - /// Initializes a new instance of . - /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. - /// The image data for the Code Interpreter tool call output. - /// A new instance for mocking. - public static RunStepDeltaCodeInterpreterImageOutput RunStepDeltaCodeInterpreterImageOutput(int index = default, RunStepDeltaCodeInterpreterImageOutputObject image = null) - { - return new RunStepDeltaCodeInterpreterImageOutput(index, "image", serializedAdditionalRawData: null, image); - } - - /// Initializes a new instance of . - /// The file ID for the image. - /// A new instance for mocking. - public static RunStepDeltaCodeInterpreterImageOutputObject RunStepDeltaCodeInterpreterImageOutputObject(string fileId = null) - { - return new RunStepDeltaCodeInterpreterImageOutputObject(fileId, serializedAdditionalRawData: null); - } } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AgentStreamEvent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AgentStreamEvent.cs deleted file mode 100644 index 97c4efa2a29ed..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AgentStreamEvent.cs +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Projects -{ - /// - /// Each event in a server-sent events stream has an `event` and `data` property: - /// - /// ``` - /// event: thread.created - /// data: {"id": "thread_123", "object": "thread", ...} - /// ``` - /// - /// We emit events whenever a new object is created, transitions to a new state, or is being - /// streamed in parts (deltas). For example, we emit `thread.run.created` when a new run - /// is created, `thread.run.completed` when a run completes, and so on. When an Agent chooses - /// to create a message during a run, we emit a `thread.message.created event`, a - /// `thread.message.in_progress` event, many `thread.message.delta` events, and finally a - /// `thread.message.completed` event. - /// - /// We may add additional events over time, so we recommend handling unknown events gracefully - /// in your code. - /// - public readonly partial struct AgentStreamEvent : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AgentStreamEvent(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadCreatedValue = "thread.created"; - private const string ThreadRunCreatedValue = "thread.run.created"; - private const string ThreadRunQueuedValue = "thread.run.queued"; - private const string ThreadRunInProgressValue = "thread.run.in_progress"; - private const string ThreadRunRequiresActionValue = "thread.run.requires_action"; - private const string ThreadRunCompletedValue = "thread.run.completed"; - private const string ThreadRunIncompleteValue = "thread.run.incomplete"; - private const string ThreadRunFailedValue = "thread.run.failed"; - private const string ThreadRunCancellingValue = "thread.run.cancelling"; - private const string ThreadRunCancelledValue = "thread.run.cancelled"; - private const string ThreadRunExpiredValue = "thread.run.expired"; - private const string ThreadRunStepCreatedValue = "thread.run.step.created"; - private const string ThreadRunStepInProgressValue = "thread.run.step.in_progress"; - private const string ThreadRunStepDeltaValue = "thread.run.step.delta"; - private const string ThreadRunStepCompletedValue = "thread.run.step.completed"; - private const string ThreadRunStepFailedValue = "thread.run.step.failed"; - private const string ThreadRunStepCancelledValue = "thread.run.step.cancelled"; - private const string ThreadRunStepExpiredValue = "thread.run.step.expired"; - private const string ThreadMessageCreatedValue = "thread.message.created"; - private const string ThreadMessageInProgressValue = "thread.message.in_progress"; - private const string ThreadMessageDeltaValue = "thread.message.delta"; - private const string ThreadMessageCompletedValue = "thread.message.completed"; - private const string ThreadMessageIncompleteValue = "thread.message.incomplete"; - private const string ErrorValue = "error"; - private const string DoneValue = "done"; - - /// Event sent when a new thread is created. The data of this event is of type AgentThread. - public static AgentStreamEvent ThreadCreated { get; } = new AgentStreamEvent(ThreadCreatedValue); - /// Event sent when a new run is created. The data of this event is of type ThreadRun. - public static AgentStreamEvent ThreadRunCreated { get; } = new AgentStreamEvent(ThreadRunCreatedValue); - /// Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun. - public static AgentStreamEvent ThreadRunQueued { get; } = new AgentStreamEvent(ThreadRunQueuedValue); - /// Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun. - public static AgentStreamEvent ThreadRunInProgress { get; } = new AgentStreamEvent(ThreadRunInProgressValue); - /// Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun. - public static AgentStreamEvent ThreadRunRequiresAction { get; } = new AgentStreamEvent(ThreadRunRequiresActionValue); - /// Event sent when a run is completed. The data of this event is of type ThreadRun. - public static AgentStreamEvent ThreadRunCompleted { get; } = new AgentStreamEvent(ThreadRunCompletedValue); - /// Event sent when a run ends incomplete. The data of this event is of type ThreadRun. - public static AgentStreamEvent ThreadRunIncomplete { get; } = new AgentStreamEvent(ThreadRunIncompleteValue); - /// Event sent when a run fails. The data of this event is of type ThreadRun. - public static AgentStreamEvent ThreadRunFailed { get; } = new AgentStreamEvent(ThreadRunFailedValue); - /// Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun. - public static AgentStreamEvent ThreadRunCancelling { get; } = new AgentStreamEvent(ThreadRunCancellingValue); - /// Event sent when a run is cancelled. The data of this event is of type ThreadRun. - public static AgentStreamEvent ThreadRunCancelled { get; } = new AgentStreamEvent(ThreadRunCancelledValue); - /// Event sent when a run is expired. The data of this event is of type ThreadRun. - public static AgentStreamEvent ThreadRunExpired { get; } = new AgentStreamEvent(ThreadRunExpiredValue); - /// Event sent when a new thread run step is created. The data of this event is of type RunStep. - public static AgentStreamEvent ThreadRunStepCreated { get; } = new AgentStreamEvent(ThreadRunStepCreatedValue); - /// Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep. - public static AgentStreamEvent ThreadRunStepInProgress { get; } = new AgentStreamEvent(ThreadRunStepInProgressValue); - /// Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk. - public static AgentStreamEvent ThreadRunStepDelta { get; } = new AgentStreamEvent(ThreadRunStepDeltaValue); - /// Event sent when a run step is completed. The data of this event is of type RunStep. - public static AgentStreamEvent ThreadRunStepCompleted { get; } = new AgentStreamEvent(ThreadRunStepCompletedValue); - /// Event sent when a run step fails. The data of this event is of type RunStep. - public static AgentStreamEvent ThreadRunStepFailed { get; } = new AgentStreamEvent(ThreadRunStepFailedValue); - /// Event sent when a run step is cancelled. The data of this event is of type RunStep. - public static AgentStreamEvent ThreadRunStepCancelled { get; } = new AgentStreamEvent(ThreadRunStepCancelledValue); - /// Event sent when a run step is expired. The data of this event is of type RunStep. - public static AgentStreamEvent ThreadRunStepExpired { get; } = new AgentStreamEvent(ThreadRunStepExpiredValue); - /// Event sent when a new message is created. The data of this event is of type ThreadMessage. - public static AgentStreamEvent ThreadMessageCreated { get; } = new AgentStreamEvent(ThreadMessageCreatedValue); - /// Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage. - public static AgentStreamEvent ThreadMessageInProgress { get; } = new AgentStreamEvent(ThreadMessageInProgressValue); - /// Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk. - public static AgentStreamEvent ThreadMessageDelta { get; } = new AgentStreamEvent(ThreadMessageDeltaValue); - /// Event sent when a message is completed. The data of this event is of type ThreadMessage. - public static AgentStreamEvent ThreadMessageCompleted { get; } = new AgentStreamEvent(ThreadMessageCompletedValue); - /// Event sent before a message is completed. The data of this event is of type ThreadMessage. - public static AgentStreamEvent ThreadMessageIncomplete { get; } = new AgentStreamEvent(ThreadMessageIncompleteValue); - /// Event sent when an error occurs, such as an internal server error or a timeout. - public static AgentStreamEvent Error { get; } = new AgentStreamEvent(ErrorValue); - /// Event sent when the stream is done. - public static AgentStreamEvent Done { get; } = new AgentStreamEvent(DoneValue); - /// Determines if two values are the same. - public static bool operator ==(AgentStreamEvent left, AgentStreamEvent right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AgentStreamEvent left, AgentStreamEvent right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AgentStreamEvent(string value) => new AgentStreamEvent(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AgentStreamEvent other && Equals(other); - /// - public bool Equals(AgentStreamEvent 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/ai/Azure.AI.Projects/src/Generated/DoneEvent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/DoneEvent.cs deleted file mode 100644 index 9f658de4258c7..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/DoneEvent.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Projects -{ - /// Terminal event indicating the successful end of a stream. - public readonly partial struct DoneEvent : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public DoneEvent(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DoneValue = "done"; - - /// Event sent when the stream is done. - public static DoneEvent Done { get; } = new DoneEvent(DoneValue); - /// Determines if two values are the same. - public static bool operator ==(DoneEvent left, DoneEvent right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(DoneEvent left, DoneEvent right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator DoneEvent(string value) => new DoneEvent(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is DoneEvent other && Equals(other); - /// - public bool Equals(DoneEvent 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/ai/Azure.AI.Projects/src/Generated/ErrorEvent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ErrorEvent.cs deleted file mode 100644 index ea570033f684a..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ErrorEvent.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Projects -{ - /// Terminal event indicating a server side error while streaming. - public readonly partial struct ErrorEvent : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ErrorEvent(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ErrorValue = "error"; - - /// Event sent when an error occurs, such as an internal server error or a timeout. - public static ErrorEvent Error { get; } = new ErrorEvent(ErrorValue); - /// Determines if two values are the same. - public static bool operator ==(ErrorEvent left, ErrorEvent right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ErrorEvent left, ErrorEvent right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ErrorEvent(string value) => new ErrorEvent(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ErrorEvent other && Equals(other); - /// - public bool Equals(ErrorEvent 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/ai/Azure.AI.Projects/src/Generated/MessageDelta.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDelta.Serialization.cs deleted file mode 100644 index 2131a64f0c1c6..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDelta.Serialization.cs +++ /dev/null @@ -1,160 +0,0 @@ -// 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.AI.Projects -{ - public partial class MessageDelta : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDelta)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("role"u8); - writer.WriteStringValue(Role.ToString()); - writer.WritePropertyName("content"u8); - writer.WriteStartArray(); - foreach (var item in Content) - { - 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 - } - } - } - - MessageDelta 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(MessageDelta)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDelta(document.RootElement, options); - } - - internal static MessageDelta DeserializeMessageDelta(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MessageRole role = default; - IReadOnlyList content = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("role"u8)) - { - role = new MessageRole(property.Value.GetString()); - continue; - } - if (property.NameEquals("content"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MessageDeltaContent.DeserializeMessageDeltaContent(item, options)); - } - content = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageDelta(role, content, 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(MessageDelta)} does not support writing '{options.Format}' format."); - } - } - - MessageDelta 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 DeserializeMessageDelta(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDelta)} 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 MessageDelta FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDelta(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/ai/Azure.AI.Projects/src/Generated/MessageDelta.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDelta.cs deleted file mode 100644 index 764571c6aa112..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDelta.cs +++ /dev/null @@ -1,94 +0,0 @@ -// 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.AI.Projects -{ - /// Represents the typed 'delta' payload within a streaming message delta chunk. - public partial class MessageDelta - { - /// - /// 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 entity that produced the message. - /// - /// The content of the message as an array of text and/or images. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// is null. - internal MessageDelta(MessageRole role, IEnumerable content) - { - Argument.AssertNotNull(content, nameof(content)); - - Role = role; - Content = content.ToList(); - } - - /// Initializes a new instance of . - /// The entity that produced the message. - /// - /// The content of the message as an array of text and/or images. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// Keeps track of any properties unknown to the library. - internal MessageDelta(MessageRole role, IReadOnlyList content, IDictionary serializedAdditionalRawData) - { - Role = role; - Content = content; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MessageDelta() - { - } - - /// The entity that produced the message. - public MessageRole Role { get; } - /// - /// The content of the message as an array of text and/or images. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public IReadOnlyList Content { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaChunk.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaChunk.Serialization.cs deleted file mode 100644 index b672132912cc3..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaChunk.Serialization.cs +++ /dev/null @@ -1,158 +0,0 @@ -// 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.AI.Projects -{ - public partial class MessageDeltaChunk : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaChunk)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object.ToString()); - writer.WritePropertyName("delta"u8); - writer.WriteObjectValue(Delta, 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 - } - } - } - - MessageDeltaChunk 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(MessageDeltaChunk)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaChunk(document.RootElement, options); - } - - internal static MessageDeltaChunk DeserializeMessageDeltaChunk(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - MessageDeltaChunkObject @object = default; - MessageDelta delta = 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("object"u8)) - { - @object = new MessageDeltaChunkObject(property.Value.GetString()); - continue; - } - if (property.NameEquals("delta"u8)) - { - delta = MessageDelta.DeserializeMessageDelta(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageDeltaChunk(id, @object, delta, 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(MessageDeltaChunk)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaChunk 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 DeserializeMessageDeltaChunk(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaChunk)} 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 MessageDeltaChunk FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDeltaChunk(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/ai/Azure.AI.Projects/src/Generated/MessageDeltaChunk.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaChunk.cs deleted file mode 100644 index cf40d797394f5..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaChunk.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents a message delta i.e. any changed fields on a message during streaming. - public partial class MessageDeltaChunk - { - /// - /// 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 identifier of the message, which can be referenced in API endpoints. - /// The delta containing the fields that have changed on the Message. - /// or is null. - internal MessageDeltaChunk(string id, MessageDelta delta) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(delta, nameof(delta)); - - Id = id; - Delta = delta; - } - - /// Initializes a new instance of . - /// The identifier of the message, which can be referenced in API endpoints. - /// The object type, which is always `thread.message.delta`. - /// The delta containing the fields that have changed on the Message. - /// Keeps track of any properties unknown to the library. - internal MessageDeltaChunk(string id, MessageDeltaChunkObject @object, MessageDelta delta, IDictionary serializedAdditionalRawData) - { - Id = id; - Object = @object; - Delta = delta; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MessageDeltaChunk() - { - } - - /// The identifier of the message, which can be referenced in API endpoints. - public string Id { get; } - /// The object type, which is always `thread.message.delta`. - public MessageDeltaChunkObject Object { get; } = MessageDeltaChunkObject.ThreadMessageDelta; - - /// The delta containing the fields that have changed on the Message. - public MessageDelta Delta { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaChunkObject.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaChunkObject.cs deleted file mode 100644 index d21c2b7731b40..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaChunkObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Projects -{ - /// The MessageDeltaChunk_object. - public readonly partial struct MessageDeltaChunkObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MessageDeltaChunkObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadMessageDeltaValue = "thread.message.delta"; - - /// thread.message.delta. - public static MessageDeltaChunkObject ThreadMessageDelta { get; } = new MessageDeltaChunkObject(ThreadMessageDeltaValue); - /// Determines if two values are the same. - public static bool operator ==(MessageDeltaChunkObject left, MessageDeltaChunkObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MessageDeltaChunkObject left, MessageDeltaChunkObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator MessageDeltaChunkObject(string value) => new MessageDeltaChunkObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MessageDeltaChunkObject other && Equals(other); - /// - public bool Equals(MessageDeltaChunkObject 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/ai/Azure.AI.Projects/src/Generated/MessageDeltaContent.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaContent.Serialization.cs deleted file mode 100644 index 86bc3e76c4a9d..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaContent.Serialization.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Projects -{ - [PersistableModelProxy(typeof(UnknownMessageDeltaContent))] - public partial class MessageDeltaContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("index"u8); - writer.WriteNumberValue(Index); - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - 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 - } - } - } - - MessageDeltaContent 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(MessageDeltaContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaContent(document.RootElement, options); - } - - internal static MessageDeltaContent DeserializeMessageDeltaContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "image_file": return MessageDeltaImageFileContent.DeserializeMessageDeltaImageFileContent(element, options); - case "text": return MessageDeltaTextContent.DeserializeMessageDeltaTextContent(element, options); - } - } - return UnknownMessageDeltaContent.DeserializeUnknownMessageDeltaContent(element, options); - } - - 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(MessageDeltaContent)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaContent 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 DeserializeMessageDeltaContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaContent)} 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 MessageDeltaContent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDeltaContent(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/ai/Azure.AI.Projects/src/Generated/MessageDeltaContent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaContent.cs deleted file mode 100644 index 367980dcb8a0e..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaContent.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// - /// The abstract base representation of a partial streamed message content payload. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public abstract partial class MessageDeltaContent - { - /// - /// 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 protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The index of the content part of the message. - protected MessageDeltaContent(int index) - { - Index = index; - } - - /// Initializes a new instance of . - /// The index of the content part of the message. - /// The type of content for this content part. - /// Keeps track of any properties unknown to the library. - internal MessageDeltaContent(int index, string type, IDictionary serializedAdditionalRawData) - { - Index = index; - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MessageDeltaContent() - { - } - - /// The index of the content part of the message. - public int Index { get; } - /// The type of content for this content part. - internal string Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContent.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContent.Serialization.cs deleted file mode 100644 index 80ef6edf733c4..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContent.Serialization.cs +++ /dev/null @@ -1,147 +0,0 @@ -// 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.AI.Projects -{ - public partial class MessageDeltaImageFileContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaImageFileContent)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(ImageFile)) - { - writer.WritePropertyName("image_file"u8); - writer.WriteObjectValue(ImageFile, options); - } - } - - MessageDeltaImageFileContent 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(MessageDeltaImageFileContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaImageFileContent(document.RootElement, options); - } - - internal static MessageDeltaImageFileContent DeserializeMessageDeltaImageFileContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MessageDeltaImageFileContentObject imageFile = default; - int index = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("image_file"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - imageFile = MessageDeltaImageFileContentObject.DeserializeMessageDeltaImageFileContentObject(property.Value, options); - continue; - } - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageDeltaImageFileContent(index, type, serializedAdditionalRawData, imageFile); - } - - 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(MessageDeltaImageFileContent)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaImageFileContent 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 DeserializeMessageDeltaImageFileContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaImageFileContent)} 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 new MessageDeltaImageFileContent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDeltaImageFileContent(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContent.cs deleted file mode 100644 index 782ee27b4b558..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContent.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents a streamed image file content part within a streaming message delta chunk. - public partial class MessageDeltaImageFileContent : MessageDeltaContent - { - /// Initializes a new instance of . - /// The index of the content part of the message. - internal MessageDeltaImageFileContent(int index) : base(index) - { - Type = "image_file"; - } - - /// Initializes a new instance of . - /// The index of the content part of the message. - /// The type of content for this content part. - /// Keeps track of any properties unknown to the library. - /// The image_file data. - internal MessageDeltaImageFileContent(int index, string type, IDictionary serializedAdditionalRawData, MessageDeltaImageFileContentObject imageFile) : base(index, type, serializedAdditionalRawData) - { - ImageFile = imageFile; - } - - /// Initializes a new instance of for deserialization. - internal MessageDeltaImageFileContent() - { - } - - /// The image_file data. - public MessageDeltaImageFileContentObject ImageFile { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContentObject.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContentObject.Serialization.cs deleted file mode 100644 index 0772f9b9743f9..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContentObject.Serialization.cs +++ /dev/null @@ -1,145 +0,0 @@ -// 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.AI.Projects -{ - public partial class MessageDeltaImageFileContentObject : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaImageFileContentObject)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(FileId)) - { - writer.WritePropertyName("file_id"u8); - writer.WriteStringValue(FileId); - } - 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 - } - } - } - - MessageDeltaImageFileContentObject 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(MessageDeltaImageFileContentObject)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaImageFileContentObject(document.RootElement, options); - } - - internal static MessageDeltaImageFileContentObject DeserializeMessageDeltaImageFileContentObject(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string fileId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_id"u8)) - { - fileId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageDeltaImageFileContentObject(fileId, 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(MessageDeltaImageFileContentObject)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaImageFileContentObject 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 DeserializeMessageDeltaImageFileContentObject(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaImageFileContentObject)} 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 MessageDeltaImageFileContentObject FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDeltaImageFileContentObject(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/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContentObject.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContentObject.cs deleted file mode 100644 index e62ccc339207e..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaImageFileContentObject.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents the 'image_file' payload within streaming image file content. - public partial class MessageDeltaImageFileContentObject - { - /// - /// 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 MessageDeltaImageFileContentObject() - { - } - - /// Initializes a new instance of . - /// The file ID of the image in the message content. - /// Keeps track of any properties unknown to the library. - internal MessageDeltaImageFileContentObject(string fileId, IDictionary serializedAdditionalRawData) - { - FileId = fileId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The file ID of the image in the message content. - public string FileId { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextAnnotation.Serialization.cs deleted file mode 100644 index 3b315583ceb77..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextAnnotation.Serialization.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Projects -{ - [PersistableModelProxy(typeof(UnknownMessageDeltaTextAnnotation))] - public partial class MessageDeltaTextAnnotation : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("index"u8); - writer.WriteNumberValue(Index); - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - 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 - } - } - } - - MessageDeltaTextAnnotation 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(MessageDeltaTextAnnotation)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaTextAnnotation(document.RootElement, options); - } - - internal static MessageDeltaTextAnnotation DeserializeMessageDeltaTextAnnotation(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "file_citation": return MessageDeltaTextFileCitationAnnotation.DeserializeMessageDeltaTextFileCitationAnnotation(element, options); - case "file_path": return MessageDeltaTextFilePathAnnotation.DeserializeMessageDeltaTextFilePathAnnotation(element, options); - } - } - return UnknownMessageDeltaTextAnnotation.DeserializeUnknownMessageDeltaTextAnnotation(element, options); - } - - 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(MessageDeltaTextAnnotation)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaTextAnnotation 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 DeserializeMessageDeltaTextAnnotation(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} 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 MessageDeltaTextAnnotation FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDeltaTextAnnotation(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/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextAnnotation.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextAnnotation.cs deleted file mode 100644 index a283e7754283d..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextAnnotation.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// - /// The abstract base representation of a streamed text content part's text annotation. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public abstract partial class MessageDeltaTextAnnotation - { - /// - /// 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 protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The index of the annotation within a text content part. - protected MessageDeltaTextAnnotation(int index) - { - Index = index; - } - - /// Initializes a new instance of . - /// The index of the annotation within a text content part. - /// The type of the text content annotation. - /// Keeps track of any properties unknown to the library. - internal MessageDeltaTextAnnotation(int index, string type, IDictionary serializedAdditionalRawData) - { - Index = index; - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MessageDeltaTextAnnotation() - { - } - - /// The index of the annotation within a text content part. - public int Index { get; } - /// The type of the text content annotation. - internal string Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContent.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContent.Serialization.cs deleted file mode 100644 index f3dbe17210d1b..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContent.Serialization.cs +++ /dev/null @@ -1,147 +0,0 @@ -// 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.AI.Projects -{ - public partial class MessageDeltaTextContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaTextContent)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Text)) - { - writer.WritePropertyName("text"u8); - writer.WriteObjectValue(Text, options); - } - } - - MessageDeltaTextContent 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(MessageDeltaTextContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaTextContent(document.RootElement, options); - } - - internal static MessageDeltaTextContent DeserializeMessageDeltaTextContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MessageDeltaTextContentObject text = default; - int index = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("text"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - text = MessageDeltaTextContentObject.DeserializeMessageDeltaTextContentObject(property.Value, options); - continue; - } - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageDeltaTextContent(index, type, serializedAdditionalRawData, text); - } - - 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(MessageDeltaTextContent)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaTextContent 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 DeserializeMessageDeltaTextContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaTextContent)} 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 new MessageDeltaTextContent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDeltaTextContent(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContent.cs deleted file mode 100644 index af3ed70f6d9c5..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContent.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents a streamed text content part within a streaming message delta chunk. - public partial class MessageDeltaTextContent : MessageDeltaContent - { - /// Initializes a new instance of . - /// The index of the content part of the message. - internal MessageDeltaTextContent(int index) : base(index) - { - Type = "text"; - } - - /// Initializes a new instance of . - /// The index of the content part of the message. - /// The type of content for this content part. - /// Keeps track of any properties unknown to the library. - /// The text content details. - internal MessageDeltaTextContent(int index, string type, IDictionary serializedAdditionalRawData, MessageDeltaTextContentObject text) : base(index, type, serializedAdditionalRawData) - { - Text = text; - } - - /// Initializes a new instance of for deserialization. - internal MessageDeltaTextContent() - { - } - - /// The text content details. - public MessageDeltaTextContentObject Text { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContentObject.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContentObject.Serialization.cs deleted file mode 100644 index 4604c724436c0..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContentObject.Serialization.cs +++ /dev/null @@ -1,170 +0,0 @@ -// 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.AI.Projects -{ - public partial class MessageDeltaTextContentObject : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaTextContentObject)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Value)) - { - writer.WritePropertyName("value"u8); - writer.WriteStringValue(Value); - } - if (Optional.IsCollectionDefined(Annotations)) - { - writer.WritePropertyName("annotations"u8); - writer.WriteStartArray(); - foreach (var item in Annotations) - { - 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 - } - } - } - - MessageDeltaTextContentObject 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(MessageDeltaTextContentObject)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaTextContentObject(document.RootElement, options); - } - - internal static MessageDeltaTextContentObject DeserializeMessageDeltaTextContentObject(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string value = default; - IReadOnlyList annotations = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - value = property.Value.GetString(); - continue; - } - if (property.NameEquals("annotations"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MessageDeltaTextAnnotation.DeserializeMessageDeltaTextAnnotation(item, options)); - } - annotations = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageDeltaTextContentObject(value, annotations ?? 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(MessageDeltaTextContentObject)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaTextContentObject 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 DeserializeMessageDeltaTextContentObject(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaTextContentObject)} 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 MessageDeltaTextContentObject FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDeltaTextContentObject(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/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContentObject.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContentObject.cs deleted file mode 100644 index c7965b213a24f..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextContentObject.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents the data of a streamed text content part within a streaming message delta chunk. - public partial class MessageDeltaTextContentObject - { - /// - /// 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 MessageDeltaTextContentObject() - { - Annotations = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The data that makes up the text. - /// - /// Annotations for the text. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// Keeps track of any properties unknown to the library. - internal MessageDeltaTextContentObject(string value, IReadOnlyList annotations, IDictionary serializedAdditionalRawData) - { - Value = value; - Annotations = annotations; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The data that makes up the text. - public string Value { get; } - /// - /// Annotations for the text. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public IReadOnlyList Annotations { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotation.Serialization.cs deleted file mode 100644 index d7a6b18301d14..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotation.Serialization.cs +++ /dev/null @@ -1,195 +0,0 @@ -// 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.AI.Projects -{ - public partial class MessageDeltaTextFileCitationAnnotation : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotation)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(FileCitation)) - { - writer.WritePropertyName("file_citation"u8); - writer.WriteObjectValue(FileCitation, options); - } - if (Optional.IsDefined(Text)) - { - writer.WritePropertyName("text"u8); - writer.WriteStringValue(Text); - } - if (Optional.IsDefined(StartIndex)) - { - writer.WritePropertyName("start_index"u8); - writer.WriteNumberValue(StartIndex.Value); - } - if (Optional.IsDefined(EndIndex)) - { - writer.WritePropertyName("end_index"u8); - writer.WriteNumberValue(EndIndex.Value); - } - } - - MessageDeltaTextFileCitationAnnotation 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(MessageDeltaTextFileCitationAnnotation)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaTextFileCitationAnnotation(document.RootElement, options); - } - - internal static MessageDeltaTextFileCitationAnnotation DeserializeMessageDeltaTextFileCitationAnnotation(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MessageDeltaTextFileCitationAnnotationObject fileCitation = default; - string text = default; - int? startIndex = default; - int? endIndex = default; - int index = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_citation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fileCitation = MessageDeltaTextFileCitationAnnotationObject.DeserializeMessageDeltaTextFileCitationAnnotationObject(property.Value, options); - continue; - } - if (property.NameEquals("text"u8)) - { - text = property.Value.GetString(); - continue; - } - if (property.NameEquals("start_index"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - startIndex = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("end_index"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - endIndex = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageDeltaTextFileCitationAnnotation( - index, - type, - serializedAdditionalRawData, - fileCitation, - text, - startIndex, - endIndex); - } - - 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(MessageDeltaTextFileCitationAnnotation)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaTextFileCitationAnnotation 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 DeserializeMessageDeltaTextFileCitationAnnotation(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotation)} 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 new MessageDeltaTextFileCitationAnnotation FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDeltaTextFileCitationAnnotation(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotation.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotation.cs deleted file mode 100644 index f22164e3a330b..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotation.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents a streamed file citation applied to a streaming text content part. - public partial class MessageDeltaTextFileCitationAnnotation : MessageDeltaTextAnnotation - { - /// Initializes a new instance of . - /// The index of the annotation within a text content part. - internal MessageDeltaTextFileCitationAnnotation(int index) : base(index) - { - Type = "file_citation"; - } - - /// Initializes a new instance of . - /// The index of the annotation within a text content part. - /// The type of the text content annotation. - /// Keeps track of any properties unknown to the library. - /// The file citation information. - /// The text in the message content that needs to be replaced. - /// The start index of this annotation in the content text. - /// The end index of this annotation in the content text. - internal MessageDeltaTextFileCitationAnnotation(int index, string type, IDictionary serializedAdditionalRawData, MessageDeltaTextFileCitationAnnotationObject fileCitation, string text, int? startIndex, int? endIndex) : base(index, type, serializedAdditionalRawData) - { - FileCitation = fileCitation; - Text = text; - StartIndex = startIndex; - EndIndex = endIndex; - } - - /// Initializes a new instance of for deserialization. - internal MessageDeltaTextFileCitationAnnotation() - { - } - - /// The file citation information. - public MessageDeltaTextFileCitationAnnotationObject FileCitation { get; } - /// The text in the message content that needs to be replaced. - public string Text { get; } - /// The start index of this annotation in the content text. - public int? StartIndex { get; } - /// The end index of this annotation in the content text. - public int? EndIndex { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotationObject.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotationObject.Serialization.cs deleted file mode 100644 index a82c41d59813a..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotationObject.Serialization.cs +++ /dev/null @@ -1,156 +0,0 @@ -// 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.AI.Projects -{ - public partial class MessageDeltaTextFileCitationAnnotationObject : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotationObject)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(FileId)) - { - writer.WritePropertyName("file_id"u8); - writer.WriteStringValue(FileId); - } - if (Optional.IsDefined(Quote)) - { - writer.WritePropertyName("quote"u8); - writer.WriteStringValue(Quote); - } - 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 - } - } - } - - MessageDeltaTextFileCitationAnnotationObject 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(MessageDeltaTextFileCitationAnnotationObject)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaTextFileCitationAnnotationObject(document.RootElement, options); - } - - internal static MessageDeltaTextFileCitationAnnotationObject DeserializeMessageDeltaTextFileCitationAnnotationObject(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string fileId = default; - string quote = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_id"u8)) - { - fileId = property.Value.GetString(); - continue; - } - if (property.NameEquals("quote"u8)) - { - quote = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageDeltaTextFileCitationAnnotationObject(fileId, quote, 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(MessageDeltaTextFileCitationAnnotationObject)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaTextFileCitationAnnotationObject 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 DeserializeMessageDeltaTextFileCitationAnnotationObject(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaTextFileCitationAnnotationObject)} 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 MessageDeltaTextFileCitationAnnotationObject FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDeltaTextFileCitationAnnotationObject(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/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotationObject.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotationObject.cs deleted file mode 100644 index ef326afe631bc..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFileCitationAnnotationObject.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents the data of a streamed file citation as applied to a streaming text content part. - public partial class MessageDeltaTextFileCitationAnnotationObject - { - /// - /// 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 MessageDeltaTextFileCitationAnnotationObject() - { - } - - /// Initializes a new instance of . - /// The ID of the specific file the citation is from. - /// The specific quote in the cited file. - /// Keeps track of any properties unknown to the library. - internal MessageDeltaTextFileCitationAnnotationObject(string fileId, string quote, IDictionary serializedAdditionalRawData) - { - FileId = fileId; - Quote = quote; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The ID of the specific file the citation is from. - public string FileId { get; } - /// The specific quote in the cited file. - public string Quote { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotation.Serialization.cs deleted file mode 100644 index c6258fb194864..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotation.Serialization.cs +++ /dev/null @@ -1,195 +0,0 @@ -// 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.AI.Projects -{ - public partial class MessageDeltaTextFilePathAnnotation : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotation)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(FilePath)) - { - writer.WritePropertyName("file_path"u8); - writer.WriteObjectValue(FilePath, options); - } - if (Optional.IsDefined(StartIndex)) - { - writer.WritePropertyName("start_index"u8); - writer.WriteNumberValue(StartIndex.Value); - } - if (Optional.IsDefined(EndIndex)) - { - writer.WritePropertyName("end_index"u8); - writer.WriteNumberValue(EndIndex.Value); - } - if (Optional.IsDefined(Text)) - { - writer.WritePropertyName("text"u8); - writer.WriteStringValue(Text); - } - } - - MessageDeltaTextFilePathAnnotation 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(MessageDeltaTextFilePathAnnotation)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaTextFilePathAnnotation(document.RootElement, options); - } - - internal static MessageDeltaTextFilePathAnnotation DeserializeMessageDeltaTextFilePathAnnotation(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MessageDeltaTextFilePathAnnotationObject filePath = default; - int? startIndex = default; - int? endIndex = default; - string text = default; - int index = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_path"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - filePath = MessageDeltaTextFilePathAnnotationObject.DeserializeMessageDeltaTextFilePathAnnotationObject(property.Value, options); - continue; - } - if (property.NameEquals("start_index"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - startIndex = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("end_index"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - endIndex = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("text"u8)) - { - text = property.Value.GetString(); - continue; - } - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageDeltaTextFilePathAnnotation( - index, - type, - serializedAdditionalRawData, - filePath, - startIndex, - endIndex, - text); - } - - 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(MessageDeltaTextFilePathAnnotation)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaTextFilePathAnnotation 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 DeserializeMessageDeltaTextFilePathAnnotation(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotation)} 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 new MessageDeltaTextFilePathAnnotation FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDeltaTextFilePathAnnotation(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotation.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotation.cs deleted file mode 100644 index 90bf54d5059b2..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotation.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents a streamed file path annotation applied to a streaming text content part. - public partial class MessageDeltaTextFilePathAnnotation : MessageDeltaTextAnnotation - { - /// Initializes a new instance of . - /// The index of the annotation within a text content part. - internal MessageDeltaTextFilePathAnnotation(int index) : base(index) - { - Type = "file_path"; - } - - /// Initializes a new instance of . - /// The index of the annotation within a text content part. - /// The type of the text content annotation. - /// Keeps track of any properties unknown to the library. - /// The file path information. - /// The start index of this annotation in the content text. - /// The end index of this annotation in the content text. - /// The text in the message content that needs to be replaced. - internal MessageDeltaTextFilePathAnnotation(int index, string type, IDictionary serializedAdditionalRawData, MessageDeltaTextFilePathAnnotationObject filePath, int? startIndex, int? endIndex, string text) : base(index, type, serializedAdditionalRawData) - { - FilePath = filePath; - StartIndex = startIndex; - EndIndex = endIndex; - Text = text; - } - - /// Initializes a new instance of for deserialization. - internal MessageDeltaTextFilePathAnnotation() - { - } - - /// The file path information. - public MessageDeltaTextFilePathAnnotationObject FilePath { get; } - /// The start index of this annotation in the content text. - public int? StartIndex { get; } - /// The end index of this annotation in the content text. - public int? EndIndex { get; } - /// The text in the message content that needs to be replaced. - public string Text { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotationObject.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotationObject.Serialization.cs deleted file mode 100644 index 76ebcc5ed6237..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotationObject.Serialization.cs +++ /dev/null @@ -1,145 +0,0 @@ -// 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.AI.Projects -{ - public partial class MessageDeltaTextFilePathAnnotationObject : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotationObject)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(FileId)) - { - writer.WritePropertyName("file_id"u8); - writer.WriteStringValue(FileId); - } - 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 - } - } - } - - MessageDeltaTextFilePathAnnotationObject 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(MessageDeltaTextFilePathAnnotationObject)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaTextFilePathAnnotationObject(document.RootElement, options); - } - - internal static MessageDeltaTextFilePathAnnotationObject DeserializeMessageDeltaTextFilePathAnnotationObject(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string fileId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_id"u8)) - { - fileId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MessageDeltaTextFilePathAnnotationObject(fileId, 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(MessageDeltaTextFilePathAnnotationObject)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaTextFilePathAnnotationObject 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 DeserializeMessageDeltaTextFilePathAnnotationObject(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaTextFilePathAnnotationObject)} 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 MessageDeltaTextFilePathAnnotationObject FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMessageDeltaTextFilePathAnnotationObject(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/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotationObject.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotationObject.cs deleted file mode 100644 index 0bc0e8a005175..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageDeltaTextFilePathAnnotationObject.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents the data of a streamed file path annotation as applied to a streaming text content part. - public partial class MessageDeltaTextFilePathAnnotationObject - { - /// - /// 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 MessageDeltaTextFilePathAnnotationObject() - { - } - - /// Initializes a new instance of . - /// The file ID for the annotation. - /// Keeps track of any properties unknown to the library. - internal MessageDeltaTextFilePathAnnotationObject(string fileId, IDictionary serializedAdditionalRawData) - { - FileId = fileId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The file ID for the annotation. - public string FileId { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MessageStreamEvent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MessageStreamEvent.cs deleted file mode 100644 index 333c12b43a3f3..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/MessageStreamEvent.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Projects -{ - /// Message operation related streaming events. - public readonly partial struct MessageStreamEvent : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MessageStreamEvent(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadMessageCreatedValue = "thread.message.created"; - private const string ThreadMessageInProgressValue = "thread.message.in_progress"; - private const string ThreadMessageDeltaValue = "thread.message.delta"; - private const string ThreadMessageCompletedValue = "thread.message.completed"; - private const string ThreadMessageIncompleteValue = "thread.message.incomplete"; - - /// Event sent when a new message is created. The data of this event is of type ThreadMessage. - public static MessageStreamEvent ThreadMessageCreated { get; } = new MessageStreamEvent(ThreadMessageCreatedValue); - /// Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage. - public static MessageStreamEvent ThreadMessageInProgress { get; } = new MessageStreamEvent(ThreadMessageInProgressValue); - /// Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk. - public static MessageStreamEvent ThreadMessageDelta { get; } = new MessageStreamEvent(ThreadMessageDeltaValue); - /// Event sent when a message is completed. The data of this event is of type ThreadMessage. - public static MessageStreamEvent ThreadMessageCompleted { get; } = new MessageStreamEvent(ThreadMessageCompletedValue); - /// Event sent before a message is completed. The data of this event is of type ThreadMessage. - public static MessageStreamEvent ThreadMessageIncomplete { get; } = new MessageStreamEvent(ThreadMessageIncompleteValue); - /// Determines if two values are the same. - public static bool operator ==(MessageStreamEvent left, MessageStreamEvent right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MessageStreamEvent left, MessageStreamEvent right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator MessageStreamEvent(string value) => new MessageStreamEvent(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MessageStreamEvent other && Equals(other); - /// - public bool Equals(MessageStreamEvent 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/ai/Azure.AI.Projects/src/Generated/RunStepDelta.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDelta.Serialization.cs deleted file mode 100644 index 41df1f3c90b75..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDelta.Serialization.cs +++ /dev/null @@ -1,149 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDelta : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDelta)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(StepDetails)) - { - writer.WritePropertyName("step_details"u8); - writer.WriteObjectValue(StepDetails, 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 - } - } - } - - RunStepDelta 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(RunStepDelta)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDelta(document.RootElement, options); - } - - internal static RunStepDelta DeserializeRunStepDelta(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RunStepDeltaDetail stepDetails = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("step_details"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - stepDetails = RunStepDeltaDetail.DeserializeRunStepDeltaDetail(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDelta(stepDetails, 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(RunStepDelta)} does not support writing '{options.Format}' format."); - } - } - - RunStepDelta 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 DeserializeRunStepDelta(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDelta)} 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 RunStepDelta FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDelta(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/ai/Azure.AI.Projects/src/Generated/RunStepDelta.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDelta.cs deleted file mode 100644 index 0f601698841df..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDelta.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents the delta payload in a streaming run step delta chunk. - public partial class RunStepDelta - { - /// - /// 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 RunStepDelta() - { - } - - /// Initializes a new instance of . - /// - /// The details of the run step. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// Keeps track of any properties unknown to the library. - internal RunStepDelta(RunStepDeltaDetail stepDetails, IDictionary serializedAdditionalRawData) - { - StepDetails = stepDetails; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// - /// The details of the run step. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public RunStepDeltaDetail StepDetails { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaChunk.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaChunk.Serialization.cs deleted file mode 100644 index bd86667370fcc..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaChunk.Serialization.cs +++ /dev/null @@ -1,158 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaChunk : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaChunk)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object.ToString()); - writer.WritePropertyName("delta"u8); - writer.WriteObjectValue(Delta, 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 - } - } - } - - RunStepDeltaChunk 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(RunStepDeltaChunk)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaChunk(document.RootElement, options); - } - - internal static RunStepDeltaChunk DeserializeRunStepDeltaChunk(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - RunStepDeltaChunkObject @object = default; - RunStepDelta delta = 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("object"u8)) - { - @object = new RunStepDeltaChunkObject(property.Value.GetString()); - continue; - } - if (property.NameEquals("delta"u8)) - { - delta = RunStepDelta.DeserializeRunStepDelta(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaChunk(id, @object, delta, 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(RunStepDeltaChunk)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaChunk 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 DeserializeRunStepDeltaChunk(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaChunk)} 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 RunStepDeltaChunk FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaChunk(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/ai/Azure.AI.Projects/src/Generated/RunStepDeltaChunk.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaChunk.cs deleted file mode 100644 index bd48db51e72c1..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaChunk.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents a run step delta i.e. any changed fields on a run step during streaming. - public partial class RunStepDeltaChunk - { - /// - /// 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 identifier of the run step, which can be referenced in API endpoints. - /// The delta containing the fields that have changed on the run step. - /// or is null. - internal RunStepDeltaChunk(string id, RunStepDelta delta) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(delta, nameof(delta)); - - Id = id; - Delta = delta; - } - - /// Initializes a new instance of . - /// The identifier of the run step, which can be referenced in API endpoints. - /// The object type, which is always `thread.run.step.delta`. - /// The delta containing the fields that have changed on the run step. - /// Keeps track of any properties unknown to the library. - internal RunStepDeltaChunk(string id, RunStepDeltaChunkObject @object, RunStepDelta delta, IDictionary serializedAdditionalRawData) - { - Id = id; - Object = @object; - Delta = delta; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RunStepDeltaChunk() - { - } - - /// The identifier of the run step, which can be referenced in API endpoints. - public string Id { get; } - /// The object type, which is always `thread.run.step.delta`. - public RunStepDeltaChunkObject Object { get; } = RunStepDeltaChunkObject.ThreadRunStepDelta; - - /// The delta containing the fields that have changed on the run step. - public RunStepDelta Delta { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaChunkObject.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaChunkObject.cs deleted file mode 100644 index 3f217f5436611..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaChunkObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Projects -{ - /// The RunStepDeltaChunk_object. - public readonly partial struct RunStepDeltaChunkObject : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RunStepDeltaChunkObject(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadRunStepDeltaValue = "thread.run.step.delta"; - - /// thread.run.step.delta. - public static RunStepDeltaChunkObject ThreadRunStepDelta { get; } = new RunStepDeltaChunkObject(ThreadRunStepDeltaValue); - /// Determines if two values are the same. - public static bool operator ==(RunStepDeltaChunkObject left, RunStepDeltaChunkObject right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RunStepDeltaChunkObject left, RunStepDeltaChunkObject right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RunStepDeltaChunkObject(string value) => new RunStepDeltaChunkObject(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RunStepDeltaChunkObject other && Equals(other); - /// - public bool Equals(RunStepDeltaChunkObject 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/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.Serialization.cs deleted file mode 100644 index 2d242dc345aab..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.Serialization.cs +++ /dev/null @@ -1,170 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaCodeInterpreterDetailItemObject : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterDetailItemObject)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Input)) - { - writer.WritePropertyName("input"u8); - writer.WriteStringValue(Input); - } - if (Optional.IsCollectionDefined(Outputs)) - { - writer.WritePropertyName("outputs"u8); - writer.WriteStartArray(); - foreach (var item in Outputs) - { - 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 - } - } - } - - RunStepDeltaCodeInterpreterDetailItemObject 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(RunStepDeltaCodeInterpreterDetailItemObject)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaCodeInterpreterDetailItemObject(document.RootElement, options); - } - - internal static RunStepDeltaCodeInterpreterDetailItemObject DeserializeRunStepDeltaCodeInterpreterDetailItemObject(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string input = default; - IReadOnlyList outputs = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("input"u8)) - { - input = property.Value.GetString(); - continue; - } - if (property.NameEquals("outputs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RunStepDeltaCodeInterpreterOutput.DeserializeRunStepDeltaCodeInterpreterOutput(item, options)); - } - outputs = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaCodeInterpreterDetailItemObject(input, outputs ?? 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(RunStepDeltaCodeInterpreterDetailItemObject)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaCodeInterpreterDetailItemObject 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 DeserializeRunStepDeltaCodeInterpreterDetailItemObject(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterDetailItemObject)} 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 RunStepDeltaCodeInterpreterDetailItemObject FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaCodeInterpreterDetailItemObject(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/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.cs deleted file mode 100644 index a76ab9ec7a094..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterDetailItemObject.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents the Code Interpreter tool call data in a streaming run step's tool calls. - public partial class RunStepDeltaCodeInterpreterDetailItemObject - { - /// - /// 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 RunStepDeltaCodeInterpreterDetailItemObject() - { - Outputs = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The input into the Code Interpreter tool call. - /// - /// The outputs from the Code Interpreter tool call. Code Interpreter can output one or more - /// items, including text (`logs`) or images (`image`). Each of these are represented by a - /// different object type. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// Keeps track of any properties unknown to the library. - internal RunStepDeltaCodeInterpreterDetailItemObject(string input, IReadOnlyList outputs, IDictionary serializedAdditionalRawData) - { - Input = input; - Outputs = outputs; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The input into the Code Interpreter tool call. - public string Input { get; } - /// - /// The outputs from the Code Interpreter tool call. Code Interpreter can output one or more - /// items, including text (`logs`) or images (`image`). Each of these are represented by a - /// different object type. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public IReadOnlyList Outputs { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutput.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutput.Serialization.cs deleted file mode 100644 index 338949150f43d..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutput.Serialization.cs +++ /dev/null @@ -1,147 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaCodeInterpreterImageOutput : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutput)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Image)) - { - writer.WritePropertyName("image"u8); - writer.WriteObjectValue(Image, options); - } - } - - RunStepDeltaCodeInterpreterImageOutput 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(RunStepDeltaCodeInterpreterImageOutput)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaCodeInterpreterImageOutput(document.RootElement, options); - } - - internal static RunStepDeltaCodeInterpreterImageOutput DeserializeRunStepDeltaCodeInterpreterImageOutput(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RunStepDeltaCodeInterpreterImageOutputObject image = default; - int index = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("image"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - image = RunStepDeltaCodeInterpreterImageOutputObject.DeserializeRunStepDeltaCodeInterpreterImageOutputObject(property.Value, options); - continue; - } - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaCodeInterpreterImageOutput(index, type, serializedAdditionalRawData, image); - } - - 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(RunStepDeltaCodeInterpreterImageOutput)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaCodeInterpreterImageOutput 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 DeserializeRunStepDeltaCodeInterpreterImageOutput(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutput)} 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 new RunStepDeltaCodeInterpreterImageOutput FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaCodeInterpreterImageOutput(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutput.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutput.cs deleted file mode 100644 index de128c6b86884..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutput.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection. - public partial class RunStepDeltaCodeInterpreterImageOutput : RunStepDeltaCodeInterpreterOutput - { - /// Initializes a new instance of . - /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. - internal RunStepDeltaCodeInterpreterImageOutput(int index) : base(index) - { - Type = "image"; - } - - /// Initializes a new instance of . - /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. - /// The type of the streaming run step tool call's Code Interpreter output. - /// Keeps track of any properties unknown to the library. - /// The image data for the Code Interpreter tool call output. - internal RunStepDeltaCodeInterpreterImageOutput(int index, string type, IDictionary serializedAdditionalRawData, RunStepDeltaCodeInterpreterImageOutputObject image) : base(index, type, serializedAdditionalRawData) - { - Image = image; - } - - /// Initializes a new instance of for deserialization. - internal RunStepDeltaCodeInterpreterImageOutput() - { - } - - /// The image data for the Code Interpreter tool call output. - public RunStepDeltaCodeInterpreterImageOutputObject Image { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.Serialization.cs deleted file mode 100644 index ede94b51ecb9a..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.Serialization.cs +++ /dev/null @@ -1,145 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaCodeInterpreterImageOutputObject : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutputObject)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(FileId)) - { - writer.WritePropertyName("file_id"u8); - writer.WriteStringValue(FileId); - } - 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 - } - } - } - - RunStepDeltaCodeInterpreterImageOutputObject 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(RunStepDeltaCodeInterpreterImageOutputObject)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaCodeInterpreterImageOutputObject(document.RootElement, options); - } - - internal static RunStepDeltaCodeInterpreterImageOutputObject DeserializeRunStepDeltaCodeInterpreterImageOutputObject(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string fileId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_id"u8)) - { - fileId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaCodeInterpreterImageOutputObject(fileId, 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(RunStepDeltaCodeInterpreterImageOutputObject)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaCodeInterpreterImageOutputObject 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 DeserializeRunStepDeltaCodeInterpreterImageOutputObject(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterImageOutputObject)} 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 RunStepDeltaCodeInterpreterImageOutputObject FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaCodeInterpreterImageOutputObject(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/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.cs deleted file mode 100644 index 8089067be9d74..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterImageOutputObject.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents the data for a streaming run step's Code Interpreter tool call image output. - public partial class RunStepDeltaCodeInterpreterImageOutputObject - { - /// - /// 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 RunStepDeltaCodeInterpreterImageOutputObject() - { - } - - /// Initializes a new instance of . - /// The file ID for the image. - /// Keeps track of any properties unknown to the library. - internal RunStepDeltaCodeInterpreterImageOutputObject(string fileId, IDictionary serializedAdditionalRawData) - { - FileId = fileId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The file ID for the image. - public string FileId { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterLogOutput.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterLogOutput.Serialization.cs deleted file mode 100644 index f280d68e3eb77..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterLogOutput.Serialization.cs +++ /dev/null @@ -1,143 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaCodeInterpreterLogOutput : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterLogOutput)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Logs)) - { - writer.WritePropertyName("logs"u8); - writer.WriteStringValue(Logs); - } - } - - RunStepDeltaCodeInterpreterLogOutput 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(RunStepDeltaCodeInterpreterLogOutput)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaCodeInterpreterLogOutput(document.RootElement, options); - } - - internal static RunStepDeltaCodeInterpreterLogOutput DeserializeRunStepDeltaCodeInterpreterLogOutput(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string logs = default; - int index = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("logs"u8)) - { - logs = property.Value.GetString(); - continue; - } - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaCodeInterpreterLogOutput(index, type, serializedAdditionalRawData, logs); - } - - 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(RunStepDeltaCodeInterpreterLogOutput)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaCodeInterpreterLogOutput 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 DeserializeRunStepDeltaCodeInterpreterLogOutput(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterLogOutput)} 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 new RunStepDeltaCodeInterpreterLogOutput FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaCodeInterpreterLogOutput(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterLogOutput.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterLogOutput.cs deleted file mode 100644 index 31f3284b073f7..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterLogOutput.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection. - public partial class RunStepDeltaCodeInterpreterLogOutput : RunStepDeltaCodeInterpreterOutput - { - /// Initializes a new instance of . - /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. - internal RunStepDeltaCodeInterpreterLogOutput(int index) : base(index) - { - Type = "logs"; - } - - /// Initializes a new instance of . - /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. - /// The type of the streaming run step tool call's Code Interpreter output. - /// Keeps track of any properties unknown to the library. - /// The text output from the Code Interpreter tool call. - internal RunStepDeltaCodeInterpreterLogOutput(int index, string type, IDictionary serializedAdditionalRawData, string logs) : base(index, type, serializedAdditionalRawData) - { - Logs = logs; - } - - /// Initializes a new instance of for deserialization. - internal RunStepDeltaCodeInterpreterLogOutput() - { - } - - /// The text output from the Code Interpreter tool call. - public string Logs { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterOutput.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterOutput.Serialization.cs deleted file mode 100644 index 2acd096c6a7e4..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterOutput.Serialization.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Projects -{ - [PersistableModelProxy(typeof(UnknownRunStepDeltaCodeInterpreterOutput))] - public partial class RunStepDeltaCodeInterpreterOutput : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("index"u8); - writer.WriteNumberValue(Index); - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - 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 - } - } - } - - RunStepDeltaCodeInterpreterOutput 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(RunStepDeltaCodeInterpreterOutput)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaCodeInterpreterOutput(document.RootElement, options); - } - - internal static RunStepDeltaCodeInterpreterOutput DeserializeRunStepDeltaCodeInterpreterOutput(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "image": return RunStepDeltaCodeInterpreterImageOutput.DeserializeRunStepDeltaCodeInterpreterImageOutput(element, options); - case "logs": return RunStepDeltaCodeInterpreterLogOutput.DeserializeRunStepDeltaCodeInterpreterLogOutput(element, options); - } - } - return UnknownRunStepDeltaCodeInterpreterOutput.DeserializeUnknownRunStepDeltaCodeInterpreterOutput(element, options); - } - - 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(RunStepDeltaCodeInterpreterOutput)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaCodeInterpreterOutput 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 DeserializeRunStepDeltaCodeInterpreterOutput(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} 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 RunStepDeltaCodeInterpreterOutput FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaCodeInterpreterOutput(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/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterOutput.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterOutput.cs deleted file mode 100644 index 656ea7ded2c36..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterOutput.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// - /// The abstract base representation of a streaming run step tool call's Code Interpreter tool output. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public abstract partial class RunStepDeltaCodeInterpreterOutput - { - /// - /// 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 protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. - protected RunStepDeltaCodeInterpreterOutput(int index) - { - Index = index; - } - - /// Initializes a new instance of . - /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. - /// The type of the streaming run step tool call's Code Interpreter output. - /// Keeps track of any properties unknown to the library. - internal RunStepDeltaCodeInterpreterOutput(int index, string type, IDictionary serializedAdditionalRawData) - { - Index = index; - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RunStepDeltaCodeInterpreterOutput() - { - } - - /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. - public int Index { get; } - /// The type of the streaming run step tool call's Code Interpreter output. - internal string Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterToolCall.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterToolCall.Serialization.cs deleted file mode 100644 index 3b5ed23998204..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterToolCall.Serialization.cs +++ /dev/null @@ -1,153 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaCodeInterpreterToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(CodeInterpreter)) - { - writer.WritePropertyName("code_interpreter"u8); - writer.WriteObjectValue(CodeInterpreter, options); - } - } - - RunStepDeltaCodeInterpreterToolCall 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(RunStepDeltaCodeInterpreterToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaCodeInterpreterToolCall(document.RootElement, options); - } - - internal static RunStepDeltaCodeInterpreterToolCall DeserializeRunStepDeltaCodeInterpreterToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RunStepDeltaCodeInterpreterDetailItemObject codeInterpreter = default; - int index = default; - string id = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code_interpreter"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - codeInterpreter = RunStepDeltaCodeInterpreterDetailItemObject.DeserializeRunStepDeltaCodeInterpreterDetailItemObject(property.Value, options); - continue; - } - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaCodeInterpreterToolCall(index, id, type, serializedAdditionalRawData, codeInterpreter); - } - - 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(RunStepDeltaCodeInterpreterToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaCodeInterpreterToolCall 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 DeserializeRunStepDeltaCodeInterpreterToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterToolCall)} 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 new RunStepDeltaCodeInterpreterToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaCodeInterpreterToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterToolCall.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterToolCall.cs deleted file mode 100644 index 8483fa22d47fa..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaCodeInterpreterToolCall.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents a Code Interpreter tool call within a streaming run step's tool call details. - public partial class RunStepDeltaCodeInterpreterToolCall : RunStepDeltaToolCall - { - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// is null. - internal RunStepDeltaCodeInterpreterToolCall(int index, string id) : base(index, id) - { - Argument.AssertNotNull(id, nameof(id)); - - Type = "code_interpreter"; - } - - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// The type of the tool call detail item in a streaming run step's details. - /// Keeps track of any properties unknown to the library. - /// The Code Interpreter data for the tool call. - internal RunStepDeltaCodeInterpreterToolCall(int index, string id, string type, IDictionary serializedAdditionalRawData, RunStepDeltaCodeInterpreterDetailItemObject codeInterpreter) : base(index, id, type, serializedAdditionalRawData) - { - CodeInterpreter = codeInterpreter; - } - - /// Initializes a new instance of for deserialization. - internal RunStepDeltaCodeInterpreterToolCall() - { - } - - /// The Code Interpreter data for the tool call. - public RunStepDeltaCodeInterpreterDetailItemObject CodeInterpreter { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaDetail.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaDetail.Serialization.cs deleted file mode 100644 index bdbed54464d49..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaDetail.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Projects -{ - [PersistableModelProxy(typeof(UnknownRunStepDeltaDetail))] - public partial class RunStepDeltaDetail : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaDetail)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - 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 - } - } - } - - RunStepDeltaDetail 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(RunStepDeltaDetail)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaDetail(document.RootElement, options); - } - - internal static RunStepDeltaDetail DeserializeRunStepDeltaDetail(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "message_creation": return RunStepDeltaMessageCreation.DeserializeRunStepDeltaMessageCreation(element, options); - case "tool_calls": return RunStepDeltaToolCallObject.DeserializeRunStepDeltaToolCallObject(element, options); - } - } - return UnknownRunStepDeltaDetail.DeserializeUnknownRunStepDeltaDetail(element, options); - } - - 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(RunStepDeltaDetail)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaDetail 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 DeserializeRunStepDeltaDetail(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaDetail)} 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 RunStepDeltaDetail FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaDetail(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/ai/Azure.AI.Projects/src/Generated/RunStepDeltaDetail.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaDetail.cs deleted file mode 100644 index 68de601fb5370..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaDetail.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// - /// Represents a single run step detail item in a streaming run step's delta payload. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public abstract partial class RunStepDeltaDetail - { - /// - /// 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 protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - protected RunStepDeltaDetail() - { - } - - /// Initializes a new instance of . - /// The object type for the run step detail object. - /// Keeps track of any properties unknown to the library. - internal RunStepDeltaDetail(string type, IDictionary serializedAdditionalRawData) - { - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The object type for the run step detail object. - internal string Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFileSearchToolCall.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFileSearchToolCall.Serialization.cs deleted file mode 100644 index 91ba8b9552801..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFileSearchToolCall.Serialization.cs +++ /dev/null @@ -1,164 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaFileSearchToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaFileSearchToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsCollectionDefined(FileSearch)) - { - writer.WritePropertyName("file_search"u8); - writer.WriteStartObject(); - foreach (var item in FileSearch) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - } - - RunStepDeltaFileSearchToolCall 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(RunStepDeltaFileSearchToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaFileSearchToolCall(document.RootElement, options); - } - - internal static RunStepDeltaFileSearchToolCall DeserializeRunStepDeltaFileSearchToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary fileSearch = default; - int index = default; - string id = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("file_search"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - fileSearch = dictionary; - continue; - } - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaFileSearchToolCall(index, id, type, serializedAdditionalRawData, fileSearch ?? new ChangeTrackingDictionary()); - } - - 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(RunStepDeltaFileSearchToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaFileSearchToolCall 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 DeserializeRunStepDeltaFileSearchToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaFileSearchToolCall)} 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 new RunStepDeltaFileSearchToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaFileSearchToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFileSearchToolCall.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFileSearchToolCall.cs deleted file mode 100644 index f29a6476bedd8..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFileSearchToolCall.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents a file search tool call within a streaming run step's tool call details. - public partial class RunStepDeltaFileSearchToolCall : RunStepDeltaToolCall - { - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// is null. - internal RunStepDeltaFileSearchToolCall(int index, string id) : base(index, id) - { - Argument.AssertNotNull(id, nameof(id)); - - Type = "file_search"; - FileSearch = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// The type of the tool call detail item in a streaming run step's details. - /// Keeps track of any properties unknown to the library. - /// Reserved for future use. - internal RunStepDeltaFileSearchToolCall(int index, string id, string type, IDictionary serializedAdditionalRawData, IReadOnlyDictionary fileSearch) : base(index, id, type, serializedAdditionalRawData) - { - FileSearch = fileSearch; - } - - /// Initializes a new instance of for deserialization. - internal RunStepDeltaFileSearchToolCall() - { - } - - /// Reserved for future use. - public IReadOnlyDictionary FileSearch { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunction.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunction.Serialization.cs deleted file mode 100644 index 6c735eb7a2e51..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunction.Serialization.cs +++ /dev/null @@ -1,179 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaFunction : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaFunction)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Arguments)) - { - writer.WritePropertyName("arguments"u8); - writer.WriteStringValue(Arguments); - } - if (Optional.IsDefined(Output)) - { - if (Output != null) - { - writer.WritePropertyName("output"u8); - writer.WriteStringValue(Output); - } - else - { - writer.WriteNull("output"); - } - } - 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 - } - } - } - - RunStepDeltaFunction 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(RunStepDeltaFunction)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaFunction(document.RootElement, options); - } - - internal static RunStepDeltaFunction DeserializeRunStepDeltaFunction(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - string arguments = default; - string output = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("arguments"u8)) - { - arguments = property.Value.GetString(); - continue; - } - if (property.NameEquals("output"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - output = null; - continue; - } - output = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaFunction(name, arguments, output, 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(RunStepDeltaFunction)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaFunction 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 DeserializeRunStepDeltaFunction(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaFunction)} 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 RunStepDeltaFunction FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaFunction(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/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunction.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunction.cs deleted file mode 100644 index 70f21095badd3..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunction.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents the function data in a streaming run step delta's function tool call. - public partial class RunStepDeltaFunction - { - /// - /// 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 RunStepDeltaFunction() - { - } - - /// Initializes a new instance of . - /// The name of the function. - /// The arguments passed to the function as input. - /// The output of the function, null if outputs have not yet been submitted. - /// Keeps track of any properties unknown to the library. - internal RunStepDeltaFunction(string name, string arguments, string output, IDictionary serializedAdditionalRawData) - { - Name = name; - Arguments = arguments; - Output = output; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The name of the function. - public string Name { get; } - /// The arguments passed to the function as input. - public string Arguments { get; } - /// The output of the function, null if outputs have not yet been submitted. - public string Output { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunctionToolCall.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunctionToolCall.Serialization.cs deleted file mode 100644 index b22a5a375395a..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunctionToolCall.Serialization.cs +++ /dev/null @@ -1,153 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaFunctionToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaFunctionToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Function)) - { - writer.WritePropertyName("function"u8); - writer.WriteObjectValue(Function, options); - } - } - - RunStepDeltaFunctionToolCall 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(RunStepDeltaFunctionToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaFunctionToolCall(document.RootElement, options); - } - - internal static RunStepDeltaFunctionToolCall DeserializeRunStepDeltaFunctionToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RunStepDeltaFunction function = default; - int index = default; - string id = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("function"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - function = RunStepDeltaFunction.DeserializeRunStepDeltaFunction(property.Value, options); - continue; - } - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaFunctionToolCall(index, id, type, serializedAdditionalRawData, function); - } - - 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(RunStepDeltaFunctionToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaFunctionToolCall 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 DeserializeRunStepDeltaFunctionToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaFunctionToolCall)} 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 new RunStepDeltaFunctionToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaFunctionToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunctionToolCall.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunctionToolCall.cs deleted file mode 100644 index 1347a2ce39bf3..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaFunctionToolCall.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents a function tool call within a streaming run step's tool call details. - public partial class RunStepDeltaFunctionToolCall : RunStepDeltaToolCall - { - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// is null. - internal RunStepDeltaFunctionToolCall(int index, string id) : base(index, id) - { - Argument.AssertNotNull(id, nameof(id)); - - Type = "function"; - } - - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// The type of the tool call detail item in a streaming run step's details. - /// Keeps track of any properties unknown to the library. - /// The function data for the tool call. - internal RunStepDeltaFunctionToolCall(int index, string id, string type, IDictionary serializedAdditionalRawData, RunStepDeltaFunction function) : base(index, id, type, serializedAdditionalRawData) - { - Function = function; - } - - /// Initializes a new instance of for deserialization. - internal RunStepDeltaFunctionToolCall() - { - } - - /// The function data for the tool call. - public RunStepDeltaFunction Function { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreation.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreation.Serialization.cs deleted file mode 100644 index 5183116f42612..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreation.Serialization.cs +++ /dev/null @@ -1,141 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaMessageCreation : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaMessageCreation)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(MessageCreation)) - { - writer.WritePropertyName("message_creation"u8); - writer.WriteObjectValue(MessageCreation, options); - } - } - - RunStepDeltaMessageCreation 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(RunStepDeltaMessageCreation)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaMessageCreation(document.RootElement, options); - } - - internal static RunStepDeltaMessageCreation DeserializeRunStepDeltaMessageCreation(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RunStepDeltaMessageCreationObject messageCreation = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("message_creation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - messageCreation = RunStepDeltaMessageCreationObject.DeserializeRunStepDeltaMessageCreationObject(property.Value, options); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaMessageCreation(type, serializedAdditionalRawData, messageCreation); - } - - 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(RunStepDeltaMessageCreation)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaMessageCreation 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 DeserializeRunStepDeltaMessageCreation(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaMessageCreation)} 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 new RunStepDeltaMessageCreation FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaMessageCreation(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreation.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreation.cs deleted file mode 100644 index c455f53269175..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreation.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents a message creation within a streaming run step delta. - public partial class RunStepDeltaMessageCreation : RunStepDeltaDetail - { - /// Initializes a new instance of . - internal RunStepDeltaMessageCreation() - { - Type = "message_creation"; - } - - /// Initializes a new instance of . - /// The object type for the run step detail object. - /// Keeps track of any properties unknown to the library. - /// The message creation data. - internal RunStepDeltaMessageCreation(string type, IDictionary serializedAdditionalRawData, RunStepDeltaMessageCreationObject messageCreation) : base(type, serializedAdditionalRawData) - { - MessageCreation = messageCreation; - } - - /// The message creation data. - public RunStepDeltaMessageCreationObject MessageCreation { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreationObject.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreationObject.Serialization.cs deleted file mode 100644 index c9a526ba9412f..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreationObject.Serialization.cs +++ /dev/null @@ -1,145 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaMessageCreationObject : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaMessageCreationObject)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(MessageId)) - { - writer.WritePropertyName("message_id"u8); - writer.WriteStringValue(MessageId); - } - 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 - } - } - } - - RunStepDeltaMessageCreationObject 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(RunStepDeltaMessageCreationObject)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaMessageCreationObject(document.RootElement, options); - } - - internal static RunStepDeltaMessageCreationObject DeserializeRunStepDeltaMessageCreationObject(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string messageId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("message_id"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaMessageCreationObject(messageId, 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(RunStepDeltaMessageCreationObject)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaMessageCreationObject 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 DeserializeRunStepDeltaMessageCreationObject(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaMessageCreationObject)} 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 RunStepDeltaMessageCreationObject FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaMessageCreationObject(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/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreationObject.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreationObject.cs deleted file mode 100644 index 076a5a1114fc4..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaMessageCreationObject.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents the data within a streaming run step message creation response object. - public partial class RunStepDeltaMessageCreationObject - { - /// - /// 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 RunStepDeltaMessageCreationObject() - { - } - - /// Initializes a new instance of . - /// The ID of the newly-created message. - /// Keeps track of any properties unknown to the library. - internal RunStepDeltaMessageCreationObject(string messageId, IDictionary serializedAdditionalRawData) - { - MessageId = messageId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The ID of the newly-created message. - public string MessageId { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCall.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCall.Serialization.cs deleted file mode 100644 index ffe44e8ef4641..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCall.Serialization.cs +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Projects -{ - [PersistableModelProxy(typeof(UnknownRunStepDeltaToolCall))] - public partial class RunStepDeltaToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("index"u8); - writer.WriteNumberValue(Index); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - 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 - } - } - } - - RunStepDeltaToolCall 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(RunStepDeltaToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaToolCall(document.RootElement, options); - } - - internal static RunStepDeltaToolCall DeserializeRunStepDeltaToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "code_interpreter": return RunStepDeltaCodeInterpreterToolCall.DeserializeRunStepDeltaCodeInterpreterToolCall(element, options); - case "file_search": return RunStepDeltaFileSearchToolCall.DeserializeRunStepDeltaFileSearchToolCall(element, options); - case "function": return RunStepDeltaFunctionToolCall.DeserializeRunStepDeltaFunctionToolCall(element, options); - } - } - return UnknownRunStepDeltaToolCall.DeserializeUnknownRunStepDeltaToolCall(element, options); - } - - 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(RunStepDeltaToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaToolCall 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 DeserializeRunStepDeltaToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} 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 RunStepDeltaToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaToolCall(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/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCall.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCall.cs deleted file mode 100644 index 198aae90f407c..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCall.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// - /// The abstract base representation of a single tool call within a streaming run step's delta tool call details. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - public abstract partial class RunStepDeltaToolCall - { - /// - /// 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 protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// is null. - protected RunStepDeltaToolCall(int index, string id) - { - Argument.AssertNotNull(id, nameof(id)); - - Index = index; - Id = id; - } - - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// The type of the tool call detail item in a streaming run step's details. - /// Keeps track of any properties unknown to the library. - internal RunStepDeltaToolCall(int index, string id, string type, IDictionary serializedAdditionalRawData) - { - Index = index; - Id = id; - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RunStepDeltaToolCall() - { - } - - /// The index of the tool call detail in the run step's tool_calls array. - public int Index { get; } - /// The ID of the tool call, used when submitting outputs to the run. - public string Id { get; } - /// The type of the tool call detail item in a streaming run step's details. - internal string Type { get; set; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCallObject.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCallObject.Serialization.cs deleted file mode 100644 index 01ec769d0882b..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCallObject.Serialization.cs +++ /dev/null @@ -1,151 +0,0 @@ -// 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.AI.Projects -{ - public partial class RunStepDeltaToolCallObject : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaToolCallObject)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsCollectionDefined(ToolCalls)) - { - writer.WritePropertyName("tool_calls"u8); - writer.WriteStartArray(); - foreach (var item in ToolCalls) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - } - - RunStepDeltaToolCallObject 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(RunStepDeltaToolCallObject)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaToolCallObject(document.RootElement, options); - } - - internal static RunStepDeltaToolCallObject DeserializeRunStepDeltaToolCallObject(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList toolCalls = default; - string type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tool_calls"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RunStepDeltaToolCall.DeserializeRunStepDeltaToolCall(item, options)); - } - toolCalls = array; - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RunStepDeltaToolCallObject(type, serializedAdditionalRawData, toolCalls ?? new ChangeTrackingList()); - } - - 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(RunStepDeltaToolCallObject)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaToolCallObject 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 DeserializeRunStepDeltaToolCallObject(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaToolCallObject)} 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 new RunStepDeltaToolCallObject FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRunStepDeltaToolCallObject(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCallObject.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCallObject.cs deleted file mode 100644 index 5778fcda8a0b1..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepDeltaToolCallObject.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Represents an invocation of tool calls as part of a streaming run step. - public partial class RunStepDeltaToolCallObject : RunStepDeltaDetail - { - /// Initializes a new instance of . - internal RunStepDeltaToolCallObject() - { - Type = "tool_calls"; - ToolCalls = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The object type for the run step detail object. - /// Keeps track of any properties unknown to the library. - /// - /// The collection of tool calls for the tool call detail item. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - internal RunStepDeltaToolCallObject(string type, IDictionary serializedAdditionalRawData, IReadOnlyList toolCalls) : base(type, serializedAdditionalRawData) - { - ToolCalls = toolCalls; - } - - /// - /// The collection of tool calls for the tool call detail item. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - public IReadOnlyList ToolCalls { get; } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepStreamEvent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStepStreamEvent.cs deleted file mode 100644 index 423b575c14a94..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStepStreamEvent.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Projects -{ - /// Run step operation related streaming events. - public readonly partial struct RunStepStreamEvent : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RunStepStreamEvent(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadRunStepCreatedValue = "thread.run.step.created"; - private const string ThreadRunStepInProgressValue = "thread.run.step.in_progress"; - private const string ThreadRunStepDeltaValue = "thread.run.step.delta"; - private const string ThreadRunStepCompletedValue = "thread.run.step.completed"; - private const string ThreadRunStepFailedValue = "thread.run.step.failed"; - private const string ThreadRunStepCancelledValue = "thread.run.step.cancelled"; - private const string ThreadRunStepExpiredValue = "thread.run.step.expired"; - - /// Event sent when a new thread run step is created. The data of this event is of type RunStep. - public static RunStepStreamEvent ThreadRunStepCreated { get; } = new RunStepStreamEvent(ThreadRunStepCreatedValue); - /// Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep. - public static RunStepStreamEvent ThreadRunStepInProgress { get; } = new RunStepStreamEvent(ThreadRunStepInProgressValue); - /// Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk. - public static RunStepStreamEvent ThreadRunStepDelta { get; } = new RunStepStreamEvent(ThreadRunStepDeltaValue); - /// Event sent when a run step is completed. The data of this event is of type RunStep. - public static RunStepStreamEvent ThreadRunStepCompleted { get; } = new RunStepStreamEvent(ThreadRunStepCompletedValue); - /// Event sent when a run step fails. The data of this event is of type RunStep. - public static RunStepStreamEvent ThreadRunStepFailed { get; } = new RunStepStreamEvent(ThreadRunStepFailedValue); - /// Event sent when a run step is cancelled. The data of this event is of type RunStep. - public static RunStepStreamEvent ThreadRunStepCancelled { get; } = new RunStepStreamEvent(ThreadRunStepCancelledValue); - /// Event sent when a run step is expired. The data of this event is of type RunStep. - public static RunStepStreamEvent ThreadRunStepExpired { get; } = new RunStepStreamEvent(ThreadRunStepExpiredValue); - /// Determines if two values are the same. - public static bool operator ==(RunStepStreamEvent left, RunStepStreamEvent right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RunStepStreamEvent left, RunStepStreamEvent right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RunStepStreamEvent(string value) => new RunStepStreamEvent(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RunStepStreamEvent other && Equals(other); - /// - public bool Equals(RunStepStreamEvent 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/ai/Azure.AI.Projects/src/Generated/RunStreamEvent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/RunStreamEvent.cs deleted file mode 100644 index b3fd0dcab2ef8..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/RunStreamEvent.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Projects -{ - /// Run operation related streaming events. - public readonly partial struct RunStreamEvent : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RunStreamEvent(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadRunCreatedValue = "thread.run.created"; - private const string ThreadRunQueuedValue = "thread.run.queued"; - private const string ThreadRunInProgressValue = "thread.run.in_progress"; - private const string ThreadRunRequiresActionValue = "thread.run.requires_action"; - private const string ThreadRunCompletedValue = "thread.run.completed"; - private const string ThreadRunIncompleteValue = "thread.run.incomplete"; - private const string ThreadRunFailedValue = "thread.run.failed"; - private const string ThreadRunCancellingValue = "thread.run.cancelling"; - private const string ThreadRunCancelledValue = "thread.run.cancelled"; - private const string ThreadRunExpiredValue = "thread.run.expired"; - - /// Event sent when a new run is created. The data of this event is of type ThreadRun. - public static RunStreamEvent ThreadRunCreated { get; } = new RunStreamEvent(ThreadRunCreatedValue); - /// Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun. - public static RunStreamEvent ThreadRunQueued { get; } = new RunStreamEvent(ThreadRunQueuedValue); - /// Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun. - public static RunStreamEvent ThreadRunInProgress { get; } = new RunStreamEvent(ThreadRunInProgressValue); - /// Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun. - public static RunStreamEvent ThreadRunRequiresAction { get; } = new RunStreamEvent(ThreadRunRequiresActionValue); - /// Event sent when a run is completed. The data of this event is of type ThreadRun. - public static RunStreamEvent ThreadRunCompleted { get; } = new RunStreamEvent(ThreadRunCompletedValue); - /// Event sent when a run ends incomplete. The data of this event is of type ThreadRun. - public static RunStreamEvent ThreadRunIncomplete { get; } = new RunStreamEvent(ThreadRunIncompleteValue); - /// Event sent when a run fails. The data of this event is of type ThreadRun. - public static RunStreamEvent ThreadRunFailed { get; } = new RunStreamEvent(ThreadRunFailedValue); - /// Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun. - public static RunStreamEvent ThreadRunCancelling { get; } = new RunStreamEvent(ThreadRunCancellingValue); - /// Event sent when a run is cancelled. The data of this event is of type ThreadRun. - public static RunStreamEvent ThreadRunCancelled { get; } = new RunStreamEvent(ThreadRunCancelledValue); - /// Event sent when a run is expired. The data of this event is of type ThreadRun. - public static RunStreamEvent ThreadRunExpired { get; } = new RunStreamEvent(ThreadRunExpiredValue); - /// Determines if two values are the same. - public static bool operator ==(RunStreamEvent left, RunStreamEvent right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RunStreamEvent left, RunStreamEvent right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RunStreamEvent(string value) => new RunStreamEvent(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RunStreamEvent other && Equals(other); - /// - public bool Equals(RunStreamEvent 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/ai/Azure.AI.Projects/src/Generated/ThreadStreamEvent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ThreadStreamEvent.cs deleted file mode 100644 index 446ffec4a4b9d..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ThreadStreamEvent.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Projects -{ - /// Thread operation related streaming events. - public readonly partial struct ThreadStreamEvent : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ThreadStreamEvent(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ThreadCreatedValue = "thread.created"; - - /// Event sent when a new thread is created. The data of this event is of type AgentThread. - public static ThreadStreamEvent ThreadCreated { get; } = new ThreadStreamEvent(ThreadCreatedValue); - /// Determines if two values are the same. - public static bool operator ==(ThreadStreamEvent left, ThreadStreamEvent right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ThreadStreamEvent left, ThreadStreamEvent right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ThreadStreamEvent(string value) => new ThreadStreamEvent(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ThreadStreamEvent other && Equals(other); - /// - public bool Equals(ThreadStreamEvent 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/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaContent.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaContent.Serialization.cs deleted file mode 100644 index 76352db2197eb..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaContent.Serialization.cs +++ /dev/null @@ -1,132 +0,0 @@ -// 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.AI.Projects -{ - internal partial class UnknownMessageDeltaContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaContent)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MessageDeltaContent 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(MessageDeltaContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaContent(document.RootElement, options); - } - - internal static UnknownMessageDeltaContent DeserializeUnknownMessageDeltaContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int index = default; - string type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownMessageDeltaContent(index, type, 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(MessageDeltaContent)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaContent 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 DeserializeMessageDeltaContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaContent)} 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 new UnknownMessageDeltaContent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeUnknownMessageDeltaContent(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaContent.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaContent.cs deleted file mode 100644 index 9aa9dd56098fb..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaContent.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Unknown version of MessageDeltaContent. - internal partial class UnknownMessageDeltaContent : MessageDeltaContent - { - /// Initializes a new instance of . - /// The index of the content part of the message. - /// The type of content for this content part. - /// Keeps track of any properties unknown to the library. - internal UnknownMessageDeltaContent(int index, string type, IDictionary serializedAdditionalRawData) : base(index, type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownMessageDeltaContent() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaTextAnnotation.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaTextAnnotation.Serialization.cs deleted file mode 100644 index 3e73c295a5aba..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaTextAnnotation.Serialization.cs +++ /dev/null @@ -1,132 +0,0 @@ -// 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.AI.Projects -{ - internal partial class UnknownMessageDeltaTextAnnotation : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MessageDeltaTextAnnotation 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(MessageDeltaTextAnnotation)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMessageDeltaTextAnnotation(document.RootElement, options); - } - - internal static UnknownMessageDeltaTextAnnotation DeserializeUnknownMessageDeltaTextAnnotation(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int index = default; - string type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownMessageDeltaTextAnnotation(index, type, 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(MessageDeltaTextAnnotation)} does not support writing '{options.Format}' format."); - } - } - - MessageDeltaTextAnnotation 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 DeserializeMessageDeltaTextAnnotation(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MessageDeltaTextAnnotation)} 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 new UnknownMessageDeltaTextAnnotation FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeUnknownMessageDeltaTextAnnotation(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaTextAnnotation.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaTextAnnotation.cs deleted file mode 100644 index c1a702e2bfb25..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownMessageDeltaTextAnnotation.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Unknown version of MessageDeltaTextAnnotation. - internal partial class UnknownMessageDeltaTextAnnotation : MessageDeltaTextAnnotation - { - /// Initializes a new instance of . - /// The index of the annotation within a text content part. - /// The type of the text content annotation. - /// Keeps track of any properties unknown to the library. - internal UnknownMessageDeltaTextAnnotation(int index, string type, IDictionary serializedAdditionalRawData) : base(index, type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownMessageDeltaTextAnnotation() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.Serialization.cs deleted file mode 100644 index 8df010fe02d9b..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.Serialization.cs +++ /dev/null @@ -1,132 +0,0 @@ -// 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.AI.Projects -{ - internal partial class UnknownRunStepDeltaCodeInterpreterOutput : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - RunStepDeltaCodeInterpreterOutput 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(RunStepDeltaCodeInterpreterOutput)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaCodeInterpreterOutput(document.RootElement, options); - } - - internal static UnknownRunStepDeltaCodeInterpreterOutput DeserializeUnknownRunStepDeltaCodeInterpreterOutput(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int index = default; - string type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownRunStepDeltaCodeInterpreterOutput(index, type, 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(RunStepDeltaCodeInterpreterOutput)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaCodeInterpreterOutput 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 DeserializeRunStepDeltaCodeInterpreterOutput(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaCodeInterpreterOutput)} 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 new UnknownRunStepDeltaCodeInterpreterOutput FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeUnknownRunStepDeltaCodeInterpreterOutput(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.cs deleted file mode 100644 index 2aaf69a1c20b3..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaCodeInterpreterOutput.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Unknown version of RunStepDeltaCodeInterpreterOutput. - internal partial class UnknownRunStepDeltaCodeInterpreterOutput : RunStepDeltaCodeInterpreterOutput - { - /// Initializes a new instance of . - /// The index of the output in the streaming run step tool call's Code Interpreter outputs array. - /// The type of the streaming run step tool call's Code Interpreter output. - /// Keeps track of any properties unknown to the library. - internal UnknownRunStepDeltaCodeInterpreterOutput(int index, string type, IDictionary serializedAdditionalRawData) : base(index, type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownRunStepDeltaCodeInterpreterOutput() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaDetail.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaDetail.Serialization.cs deleted file mode 100644 index ae6db6695c967..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaDetail.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// 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.AI.Projects -{ - internal partial class UnknownRunStepDeltaDetail : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaDetail)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - RunStepDeltaDetail 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(RunStepDeltaDetail)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaDetail(document.RootElement, options); - } - - internal static UnknownRunStepDeltaDetail DeserializeUnknownRunStepDeltaDetail(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownRunStepDeltaDetail(type, 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(RunStepDeltaDetail)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaDetail 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 DeserializeRunStepDeltaDetail(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaDetail)} 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 new UnknownRunStepDeltaDetail FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeUnknownRunStepDeltaDetail(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaDetail.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaDetail.cs deleted file mode 100644 index a5ac9c43bae45..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaDetail.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Unknown version of RunStepDeltaDetail. - internal partial class UnknownRunStepDeltaDetail : RunStepDeltaDetail - { - /// Initializes a new instance of . - /// The object type for the run step detail object. - /// Keeps track of any properties unknown to the library. - internal UnknownRunStepDeltaDetail(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownRunStepDeltaDetail() - { - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaToolCall.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaToolCall.Serialization.cs deleted file mode 100644 index 8febd536f2b14..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaToolCall.Serialization.cs +++ /dev/null @@ -1,138 +0,0 @@ -// 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.AI.Projects -{ - internal partial class UnknownRunStepDeltaToolCall : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - RunStepDeltaToolCall 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(RunStepDeltaToolCall)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRunStepDeltaToolCall(document.RootElement, options); - } - - internal static UnknownRunStepDeltaToolCall DeserializeUnknownRunStepDeltaToolCall(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int index = default; - string id = default; - string type = "Unknown"; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("index"u8)) - { - index = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownRunStepDeltaToolCall(index, id, type, 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(RunStepDeltaToolCall)} does not support writing '{options.Format}' format."); - } - } - - RunStepDeltaToolCall 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 DeserializeRunStepDeltaToolCall(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RunStepDeltaToolCall)} 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 new UnknownRunStepDeltaToolCall FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeUnknownRunStepDeltaToolCall(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaToolCall.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaToolCall.cs deleted file mode 100644 index 2c31d5c2b1740..0000000000000 --- a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownRunStepDeltaToolCall.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Projects -{ - /// Unknown version of RunStepDeltaToolCall. - internal partial class UnknownRunStepDeltaToolCall : RunStepDeltaToolCall - { - /// Initializes a new instance of . - /// The index of the tool call detail in the run step's tool_calls array. - /// The ID of the tool call, used when submitting outputs to the run. - /// The type of the tool call detail item in a streaming run step's details. - /// Keeps track of any properties unknown to the library. - internal UnknownRunStepDeltaToolCall(int index, string id, string type, IDictionary serializedAdditionalRawData) : base(index, id, type, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownRunStepDeltaToolCall() - { - } - } -} diff --git a/sdk/batch/Azure.Compute.Batch/src/Generated/Docs/BatchClient.xml b/sdk/batch/Azure.Compute.Batch/src/Generated/Docs/BatchClient.xml index 2106f52e75e05..105b119931537 100644 --- a/sdk/batch/Azure.Compute.Batch/src/Generated/Docs/BatchClient.xml +++ b/sdk/batch/Azure.Compute.Batch/src/Generated/Docs/BatchClient.xml @@ -63,7 +63,21 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool01", "Standard_D1_v2") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TargetDedicatedNodes = 2, + NetworkConfiguration = new NetworkConfiguration + { + EnableAcceleratedNetworking = true, + }, +}; Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -72,7 +86,46 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04"), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + MountConfiguration = {new MountConfiguration + { + AzureBlobFileSystemConfiguration = new AzureBlobFileSystemConfiguration("accountName", "blobContainerName", "bfusepath") + { + AccountKey = "accountKey", + }, + }, new MountConfiguration + { + AzureFileShareConfiguration = new AzureFileShareConfiguration("accountName", "https://myaccount.file.core.windows.net/fileshare", "accountKey", "filesharepath") + { + MountOptions = "mount options ver=1.0", + }, + }, new MountConfiguration + { + NfsMountConfiguration = new NfsMountConfiguration("somesource nfs url", "mountpath") + { + MountOptions = "mount options ver=1.0", + }, + }, new MountConfiguration + { + CifsMountConfiguration = new CifsMountConfiguration("accountName", "//myaccount.file.core.windows.net/file", "mountpath", "password") + { + MountOptions = "mount options ver=1.0", + }, + }}, +}; Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -81,7 +134,32 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "standard_d2s_v3") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04") + { + OsDisk = new OSDisk + { + EphemeralOSDiskSettings = new DiffDiskSettings + { + Placement = DiffDiskPlacement.CacheDisk, + }, + Caching = CachingType.ReadWrite, + DiskSizeGB = 100, + ManagedDisk = new ManagedDisk(StorageAccountType.StandardSSDLRS), + }, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 1, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 1, +}; Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -90,7 +168,22 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "18_04-lts-gen2", + Version = "latest", + }, "batch.node.ubuntu 18.04"), + ResourceTags = + { + ["TagName1"] = "TagValue1", + ["TagName2"] = "TagValue2" + }, + TargetDedicatedNodes = 1, +}; Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -99,7 +192,23 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "18_04-lts-gen2", + Version = "latest", + }, "batch.node.ubuntu 18.04") + { + SecurityProfile = new SecurityProfile(true, SecurityTypes.TrustedLaunch, new UefiSettings + { + SecureBootEnabled = false, + }), + }, + TargetDedicatedNodes = 1, +}; Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -108,7 +217,23 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04"), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + Metadata = { new MetadataItem("myproperty", "myvalue") }, +}; Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -117,7 +242,27 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "120_04-lts", + }, "batch.node.ubuntu 20.04") + { + ContainerConfiguration = new ContainerConfiguration(ContainerType.DockerCompatible) + { + ContainerImageNames = { "busybox" }, + }, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), +}; Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -126,7 +271,37 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04") + { + Extensions = {new VMExtension("batchextension1", "Microsoft.Azure.KeyVault", "KeyVaultForLinux") + { + TypeHandlerVersion = "2.0", + AutoUpgradeMinorVersion = true, + EnableAutomaticUpgrade = true, + Settings = + { + ["secretsManagementSettingsKey"] = "secretsManagementSettingsValue", + ["authenticationSettingsKey"] = "authenticationSettingsValue" + }, + }}, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Simplified, +}; Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -135,7 +310,24 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool002", "Standard_A1_v2") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64") + { + WindowsConfiguration = new WindowsConfiguration + { + EnableAutomaticUpdates = false, + }, + ServiceArtifactReference = new ServiceArtifactReference("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"), + }, + TargetDedicatedNodes = 2, +}; Response response = await client.CreatePoolAsync(pool); ]]> @@ -147,7 +339,21 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool01", "Standard_D1_v2") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TargetDedicatedNodes = 2, + NetworkConfiguration = new NetworkConfiguration + { + EnableAcceleratedNetworking = true, + }, +}; Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -156,7 +362,46 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04"), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + MountConfiguration = {new MountConfiguration + { + AzureBlobFileSystemConfiguration = new AzureBlobFileSystemConfiguration("accountName", "blobContainerName", "bfusepath") + { + AccountKey = "accountKey", + }, + }, new MountConfiguration + { + AzureFileShareConfiguration = new AzureFileShareConfiguration("accountName", "https://myaccount.file.core.windows.net/fileshare", "accountKey", "filesharepath") + { + MountOptions = "mount options ver=1.0", + }, + }, new MountConfiguration + { + NfsMountConfiguration = new NfsMountConfiguration("somesource nfs url", "mountpath") + { + MountOptions = "mount options ver=1.0", + }, + }, new MountConfiguration + { + CifsMountConfiguration = new CifsMountConfiguration("accountName", "//myaccount.file.core.windows.net/file", "mountpath", "password") + { + MountOptions = "mount options ver=1.0", + }, + }}, +}; Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -165,7 +410,32 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "standard_d2s_v3") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04") + { + OsDisk = new OSDisk + { + EphemeralOSDiskSettings = new DiffDiskSettings + { + Placement = DiffDiskPlacement.CacheDisk, + }, + Caching = CachingType.ReadWrite, + DiskSizeGB = 100, + ManagedDisk = new ManagedDisk(StorageAccountType.StandardSSDLRS), + }, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 1, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 1, +}; Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -174,7 +444,22 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "18_04-lts-gen2", + Version = "latest", + }, "batch.node.ubuntu 18.04"), + ResourceTags = + { + ["TagName1"] = "TagValue1", + ["TagName2"] = "TagValue2" + }, + TargetDedicatedNodes = 1, +}; Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -183,7 +468,23 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "18_04-lts-gen2", + Version = "latest", + }, "batch.node.ubuntu 18.04") + { + SecurityProfile = new SecurityProfile(true, SecurityTypes.TrustedLaunch, new UefiSettings + { + SecureBootEnabled = false, + }), + }, + TargetDedicatedNodes = 1, +}; Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -192,7 +493,23 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04"), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + Metadata = { new MetadataItem("myproperty", "myvalue") }, +}; Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -201,7 +518,27 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "120_04-lts", + }, "batch.node.ubuntu 20.04") + { + ContainerConfiguration = new ContainerConfiguration(ContainerType.DockerCompatible) + { + ContainerImageNames = { "busybox" }, + }, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), +}; Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -210,7 +547,37 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04") + { + Extensions = {new VMExtension("batchextension1", "Microsoft.Azure.KeyVault", "KeyVaultForLinux") + { + TypeHandlerVersion = "2.0", + AutoUpgradeMinorVersion = true, + EnableAutomaticUpgrade = true, + Settings = + { + ["secretsManagementSettingsKey"] = "secretsManagementSettingsValue", + ["authenticationSettingsKey"] = "authenticationSettingsValue" + }, + }}, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Simplified, +}; Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -219,7 +586,24 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); +BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool002", "Standard_A1_v2") +{ + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64") + { + WindowsConfiguration = new WindowsConfiguration + { + EnableAutomaticUpdates = false, + }, + ServiceArtifactReference = new ServiceArtifactReference("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"), + }, + TargetDedicatedNodes = 2, +}; Response response = client.CreatePool(pool); ]]> @@ -231,7 +615,27 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "mypool01", + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + targetDedicatedNodes = 2, + networkConfiguration = new + { + enableAcceleratedNetworking = true, + }, +}); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -242,7 +646,74 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + mountConfiguration = new object[] + { + new + { + azureBlobFileSystemConfiguration = new + { + accountName = "accountName", + containerName = "blobContainerName", + accountKey = "accountKey", + relativeMountPath = "bfusepath", + }, + }, + new + { + azureFileShareConfiguration = new + { + accountName = "accountName", + azureFileUrl = "https://myaccount.file.core.windows.net/fileshare", + accountKey = "accountKey", + relativeMountPath = "filesharepath", + mountOptions = "mount options ver=1.0", + }, + }, + new + { + nfsMountConfiguration = new + { + source = "somesource nfs url", + relativeMountPath = "mountpath", + mountOptions = "mount options ver=1.0", + }, + }, + new + { + cifsMountConfiguration = new + { + username = "accountName", + password = "password", + source = "//myaccount.file.core.windows.net/file", + relativeMountPath = "mountpath", + mountOptions = "mount options ver=1.0", + }, + } + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, +}); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -253,7 +724,39 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "mypool001", + vmSize = "standard_d2s_v3", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + osDisk = new + { + diskSizeGB = 100, + managedDisk = new + { + storageAccountType = "standardssd_lrs", + }, + caching = "readwrite", + ephemeralOSDiskSettings = new + { + placement = "cachedisk", + }, + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 1, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 1, + enableAutoScale = false, +}); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -264,7 +767,28 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "mypool001", + vmSize = "STANDARD_DC2s_V2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "18_04-lts-gen2", + version = "latest", + }, + nodeAgentSKUId = "batch.node.ubuntu 18.04", + }, + targetDedicatedNodes = 1, + resourceTags = new + { + TagName1 = "TagValue1", + TagName2 = "TagValue2", + }, +}); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -275,7 +799,32 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "mypool001", + vmSize = "STANDARD_DC2s_V2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "18_04-lts-gen2", + version = "latest", + }, + nodeAgentSKUId = "batch.node.ubuntu 18.04", + securityProfile = new + { + securityType = "trustedLaunch", + encryptionAtHost = true, + uefiSettings = new + { + secureBootEnabled = false, + }, + }, + }, + targetDedicatedNodes = 1, +}); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -286,7 +835,39 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, +}); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -297,7 +878,38 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "120_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + containerConfiguration = new + { + type = "dockerCompatible", + containerImageNames = new object[] + { + "busybox" + }, + }, + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, +}); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -308,7 +920,57 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + extensions = new object[] + { + new + { + name = "batchextension1", + type = "KeyVaultForLinux", + publisher = "Microsoft.Azure.KeyVault", + typeHandlerVersion = "2.0", + autoUpgradeMinorVersion = true, + enableAutomaticUpgrade = true, + settings = new + { + secretsManagementSettingsKey = "secretsManagementSettingsValue", + authenticationSettingsKey = "authenticationSettingsValue", + }, + } + }, + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, + targetNodeCommunicationMode = "simplified", +}); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -319,7 +981,31 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "mypool002", + vmSize = "Standard_A1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + windowsConfiguration = new + { + enableAutomaticUpdates = false, + }, + serviceArtifactReference = new + { + id = "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + targetDedicatedNodes = 2, +}); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -333,7 +1019,27 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "mypool01", + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + targetDedicatedNodes = 2, + networkConfiguration = new + { + enableAcceleratedNetworking = true, + }, +}); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -344,7 +1050,74 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + mountConfiguration = new object[] + { + new + { + azureBlobFileSystemConfiguration = new + { + accountName = "accountName", + containerName = "blobContainerName", + accountKey = "accountKey", + relativeMountPath = "bfusepath", + }, + }, + new + { + azureFileShareConfiguration = new + { + accountName = "accountName", + azureFileUrl = "https://myaccount.file.core.windows.net/fileshare", + accountKey = "accountKey", + relativeMountPath = "filesharepath", + mountOptions = "mount options ver=1.0", + }, + }, + new + { + nfsMountConfiguration = new + { + source = "somesource nfs url", + relativeMountPath = "mountpath", + mountOptions = "mount options ver=1.0", + }, + }, + new + { + cifsMountConfiguration = new + { + username = "accountName", + password = "password", + source = "//myaccount.file.core.windows.net/file", + relativeMountPath = "mountpath", + mountOptions = "mount options ver=1.0", + }, + } + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, +}); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -355,7 +1128,39 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "mypool001", + vmSize = "standard_d2s_v3", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + osDisk = new + { + diskSizeGB = 100, + managedDisk = new + { + storageAccountType = "standardssd_lrs", + }, + caching = "readwrite", + ephemeralOSDiskSettings = new + { + placement = "cachedisk", + }, + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 1, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 1, + enableAutoScale = false, +}); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -366,7 +1171,28 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "mypool001", + vmSize = "STANDARD_DC2s_V2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "18_04-lts-gen2", + version = "latest", + }, + nodeAgentSKUId = "batch.node.ubuntu 18.04", + }, + targetDedicatedNodes = 1, + resourceTags = new + { + TagName1 = "TagValue1", + TagName2 = "TagValue2", + }, +}); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -377,7 +1203,32 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "mypool001", + vmSize = "STANDARD_DC2s_V2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "18_04-lts-gen2", + version = "latest", + }, + nodeAgentSKUId = "batch.node.ubuntu 18.04", + securityProfile = new + { + securityType = "trustedLaunch", + encryptionAtHost = true, + uefiSettings = new + { + secureBootEnabled = false, + }, + }, + }, + targetDedicatedNodes = 1, +}); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -388,7 +1239,39 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, +}); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -399,7 +1282,38 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "120_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + containerConfiguration = new + { + type = "dockerCompatible", + containerImageNames = new object[] + { + "busybox" + }, + }, + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, +}); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -410,7 +1324,57 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + extensions = new object[] + { + new + { + name = "batchextension1", + type = "KeyVaultForLinux", + publisher = "Microsoft.Azure.KeyVault", + typeHandlerVersion = "2.0", + autoUpgradeMinorVersion = true, + enableAutomaticUpgrade = true, + settings = new + { + secretsManagementSettingsKey = "secretsManagementSettingsValue", + authenticationSettingsKey = "authenticationSettingsValue", + }, + } + }, + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, + targetNodeCommunicationMode = "simplified", +}); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -421,7 +1385,31 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "mypool002", + vmSize = "Standard_A1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + windowsConfiguration = new + { + enableAutomaticUpdates = false, + }, + serviceArtifactReference = new + { + id = "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + targetDedicatedNodes = 2, +}); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -701,7 +1689,13 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + startTask = new + { + commandLine = "/bin/bash -c 'echo start task'", + }, +}); Response response = await client.UpdatePoolAsync("poolId", content); Console.WriteLine(response.Status); @@ -715,7 +1709,13 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + startTask = new + { + commandLine = "/bin/bash -c 'echo start task'", + }, +}); Response response = client.UpdatePool("poolId", content); Console.WriteLine(response.Status); @@ -755,7 +1755,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent(); +BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent +{ + AutoScaleFormula = "$TargetDedicated=0", + AutoScaleEvaluationInterval = XmlConvert.ToTimeSpan("PT8M"), +}; Response response = await client.EnablePoolAutoScaleAsync("poolId", content); ]]> @@ -767,7 +1771,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent(); +BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent +{ + AutoScaleFormula = "$TargetDedicated=0", + AutoScaleEvaluationInterval = XmlConvert.ToTimeSpan("PT8M"), +}; Response response = client.EnablePoolAutoScale("poolId", content); ]]> @@ -779,7 +1787,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + autoScaleFormula = "$TargetDedicated=0", + autoScaleEvaluationInterval = "PT8M", +}); Response response = await client.EnablePoolAutoScaleAsync("poolId", content); Console.WriteLine(response.Status); @@ -793,7 +1805,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + autoScaleFormula = "$TargetDedicated=0", + autoScaleEvaluationInterval = "PT8M", +}); Response response = client.EnablePoolAutoScale("poolId", content); Console.WriteLine(response.Status); @@ -807,7 +1823,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent(null); +BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent("$TargetDedicated=1"); Response response = await client.EvaluatePoolAutoScaleAsync("poolId", content); ]]> @@ -819,7 +1835,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent(null); +BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent("$TargetDedicated=1"); Response response = client.EvaluatePoolAutoScale("poolId", content); ]]> @@ -831,7 +1847,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + autoScaleFormula = "$TargetDedicated=1", +}); Response response = await client.EvaluatePoolAutoScaleAsync("poolId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -846,7 +1865,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + autoScaleFormula = "$TargetDedicated=1", +}); Response response = client.EvaluatePoolAutoScale("poolId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -861,7 +1883,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolResizeContent content = new BatchPoolResizeContent(); +BatchPoolResizeContent content = new BatchPoolResizeContent +{ + TargetDedicatedNodes = 1, + TargetLowPriorityNodes = 0, +}; Response response = await client.ResizePoolAsync("resizePool", content); ]]> @@ -873,7 +1899,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolResizeContent content = new BatchPoolResizeContent(); +BatchPoolResizeContent content = new BatchPoolResizeContent +{ + TargetDedicatedNodes = 1, + TargetLowPriorityNodes = 0, +}; Response response = client.ResizePool("resizePool", content); ]]> @@ -885,7 +1915,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + targetDedicatedNodes = 1, + targetLowPriorityNodes = 0, +}); Response response = await client.ResizePoolAsync("resizePool", content); Console.WriteLine(response.Status); @@ -899,7 +1933,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + targetDedicatedNodes = 1, + targetLowPriorityNodes = 0, +}); Response response = client.ResizePool("resizePool", content); Console.WriteLine(response.Status); @@ -939,7 +1977,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolReplaceContent pool = new BatchPoolReplaceContent(null, null); +BatchPoolReplaceContent pool = new BatchPoolReplaceContent(Array.Empty(), Array.Empty()) +{ + StartTask = new BatchStartTask("/bin/bash -c 'echo start task'"), +}; Response response = await client.ReplacePoolPropertiesAsync("poolId", pool); ]]> @@ -951,7 +1992,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolReplaceContent pool = new BatchPoolReplaceContent(null, null); +BatchPoolReplaceContent pool = new BatchPoolReplaceContent(Array.Empty(), Array.Empty()) +{ + StartTask = new BatchStartTask("/bin/bash -c 'echo start task'"), +}; Response response = client.ReplacePoolProperties("poolId", pool); ]]> @@ -963,7 +2007,15 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + startTask = new + { + commandLine = "/bin/bash -c 'echo start task'", + }, + applicationPackageReferences = Array.Empty(), + metadata = Array.Empty(), +}); Response response = await client.ReplacePoolPropertiesAsync("poolId", content); Console.WriteLine(response.Status); @@ -977,7 +2029,15 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + startTask = new + { + commandLine = "/bin/bash -c 'echo start task'", + }, + applicationPackageReferences = Array.Empty(), + metadata = Array.Empty(), +}); Response response = client.ReplacePoolProperties("poolId", content); Console.WriteLine(response.Status); @@ -991,7 +2051,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeRemoveContent content = new BatchNodeRemoveContent(null); +BatchNodeRemoveContent content = new BatchNodeRemoveContent(new string[] { "tvm-1695681911_1-20161122t224741z", "tvm-1695681911_2-20161122t224741z" }); Response response = await client.RemoveNodesAsync("poolId", content); ]]> @@ -1003,7 +2063,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeRemoveContent content = new BatchNodeRemoveContent(null); +BatchNodeRemoveContent content = new BatchNodeRemoveContent(new string[] { "tvm-1695681911_1-20161122t224741z", "tvm-1695681911_2-20161122t224741z" }); Response response = client.RemoveNodes("poolId", content); ]]> @@ -1015,7 +2075,14 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + nodeList = new object[] + { + "tvm-1695681911_1-20161122t224741z", + "tvm-1695681911_2-20161122t224741z" + }, +}); Response response = await client.RemoveNodesAsync("poolId", content); Console.WriteLine(response.Status); @@ -1029,7 +2096,14 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + nodeList = new object[] + { + "tvm-1695681911_1-20161122t224741z", + "tvm-1695681911_2-20161122t224741z" + }, +}); Response response = client.RemoveNodes("poolId", content); Console.WriteLine(response.Status); @@ -1119,7 +2193,19 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + poolInfo = new + { + poolId = "poolId", + }, +}); Response response = await client.UpdateJobAsync("jobId", content); Console.WriteLine(response.Status); @@ -1133,7 +2219,19 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + poolInfo = new + { + poolId = "poolId", + }, +}); Response response = client.UpdateJob("jobId", content); Console.WriteLine(response.Status); @@ -1245,7 +2343,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobDisableContent content = new BatchJobDisableContent(default); +BatchJobDisableContent content = new BatchJobDisableContent(DisableBatchJobOption.Terminate); Response response = await client.DisableJobAsync("jobId", content); ]]> @@ -1257,7 +2355,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobDisableContent content = new BatchJobDisableContent(default); +BatchJobDisableContent content = new BatchJobDisableContent(DisableBatchJobOption.Terminate); Response response = client.DisableJob("jobId", content); ]]> @@ -1269,7 +2367,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + disableTasks = "terminate", +}); Response response = await client.DisableJobAsync("jobId", content); Console.WriteLine(response.Status); @@ -1283,7 +2384,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + disableTasks = "terminate", +}); Response response = client.DisableJob("jobId", content); Console.WriteLine(response.Status); @@ -1373,7 +2477,13 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobCreateContent job = new BatchJobCreateContent(null, null); +BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo +{ + PoolId = "poolId", +}) +{ + Priority = 0, +}; Response response = await client.CreateJobAsync(job); ]]> This sample shows how to call CreateJobAsync. @@ -1382,7 +2492,96 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobCreateContent job = new BatchJobCreateContent(null, null); +BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo +{ + AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.Job) + { + AutoPoolIdPrefix = "mypool", + Pool = new BatchPoolSpecification("Standard_D1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TaskSlotsPerNode = 2, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 3, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + StartTask = new BatchStartTask("myprogram2.exe") + { + ResourceFiles = {new ResourceFile + { + HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", + FilePath = "myprogram2.exe", + }}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") + { + Value = "myvalue", + }}, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + MaxTaskRetryCount = 2, + WaitForSuccess = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, + }, + }, +}) +{ + Priority = 100, + Constraints = new BatchJobConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = -1, + }, + JobManagerTask = new BatchJobManagerTask("taskId", "myprogram.exe") + { + ResourceFiles = {new ResourceFile + { + HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", + FilePath = "myprogram.exe", + }, new ResourceFile + { + StorageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", + FilePath = "datafolder", + }}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") + { + Value = "myvalue", + }}, + Constraints = new BatchTaskConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + RetentionTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = 0, + }, + RequiredSlots = 2, + KillJobOnCompletion = false, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + RunExclusive = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, +}; Response response = await client.CreateJobAsync(job); ]]> @@ -1394,7 +2593,13 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobCreateContent job = new BatchJobCreateContent(null, null); +BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo +{ + PoolId = "poolId", +}) +{ + Priority = 0, +}; Response response = client.CreateJob(job); ]]> This sample shows how to call CreateJob. @@ -1403,7 +2608,96 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobCreateContent job = new BatchJobCreateContent(null, null); +BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo +{ + AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.Job) + { + AutoPoolIdPrefix = "mypool", + Pool = new BatchPoolSpecification("Standard_D1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TaskSlotsPerNode = 2, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 3, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + StartTask = new BatchStartTask("myprogram2.exe") + { + ResourceFiles = {new ResourceFile + { + HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", + FilePath = "myprogram2.exe", + }}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") + { + Value = "myvalue", + }}, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + MaxTaskRetryCount = 2, + WaitForSuccess = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, + }, + }, +}) +{ + Priority = 100, + Constraints = new BatchJobConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = -1, + }, + JobManagerTask = new BatchJobManagerTask("taskId", "myprogram.exe") + { + ResourceFiles = {new ResourceFile + { + HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", + FilePath = "myprogram.exe", + }, new ResourceFile + { + StorageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", + FilePath = "datafolder", + }}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") + { + Value = "myvalue", + }}, + Constraints = new BatchTaskConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + RetentionTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = 0, + }, + RequiredSlots = 2, + KillJobOnCompletion = false, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + RunExclusive = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, +}; Response response = client.CreateJob(job); ]]> @@ -1415,7 +2709,15 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "jobId", + priority = 0, + poolInfo = new + { + poolId = "poolId", + }, +}); Response response = await client.CreateJobAsync(content); Console.WriteLine(response.Status); @@ -1426,7 +2728,139 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "jobId", + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + jobManagerTask = new + { + id = "taskId", + commandLine = "myprogram.exe", + resourceFiles = new object[] + { + new + { + httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", + filePath = "myprogram.exe", + }, + new + { + storageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", + filePath = "datafolder", + } + }, + environmentSettings = new object[] + { + new + { + name = "myvariable", + value = "myvalue", + } + }, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = 0, + retentionTime = "PT1H", + }, + requiredSlots = 2, + killJobOnCompletion = false, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + runExclusive = true, + }, + poolInfo = new + { + autoPoolSpecification = new + { + autoPoolIdPrefix = "mypool", + poolLifetimeOption = "job", + pool = new + { + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 3, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 2, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + startTask = new + { + commandLine = "myprogram2.exe", + resourceFiles = new object[] + { + new + { + httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", + filePath = "myprogram2.exe", + } + }, + environmentSettings = new object[] + { + new + { + name = "myvariable", + value = "myvalue", + } + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + maxTaskRetryCount = 2, + waitForSuccess = true, + }, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, + targetNodeCommunicationMode = "default", + }, + }, + }, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, +}); Response response = await client.CreateJobAsync(content); Console.WriteLine(response.Status); @@ -1440,7 +2874,15 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "jobId", + priority = 0, + poolInfo = new + { + poolId = "poolId", + }, +}); Response response = client.CreateJob(content); Console.WriteLine(response.Status); @@ -1451,7 +2893,139 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "jobId", + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + jobManagerTask = new + { + id = "taskId", + commandLine = "myprogram.exe", + resourceFiles = new object[] + { + new + { + httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", + filePath = "myprogram.exe", + }, + new + { + storageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", + filePath = "datafolder", + } + }, + environmentSettings = new object[] + { + new + { + name = "myvariable", + value = "myvalue", + } + }, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = 0, + retentionTime = "PT1H", + }, + requiredSlots = 2, + killJobOnCompletion = false, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + runExclusive = true, + }, + poolInfo = new + { + autoPoolSpecification = new + { + autoPoolIdPrefix = "mypool", + poolLifetimeOption = "job", + pool = new + { + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 3, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 2, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + startTask = new + { + commandLine = "myprogram2.exe", + resourceFiles = new object[] + { + new + { + httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", + filePath = "myprogram2.exe", + } + }, + environmentSettings = new object[] + { + new + { + name = "myvariable", + value = "myvalue", + } + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + maxTaskRetryCount = 2, + waitForSuccess = true, + }, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, + targetNodeCommunicationMode = "default", + }, + }, + }, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, +}); Response response = client.CreateJob(content); Console.WriteLine(response.Status); @@ -1609,7 +3183,27 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + schedule = new + { + doNotRunUntil = "2025-01-01T12:30:00Z", + }, + jobSpecification = new + { + priority = 0, + usesTaskDependencies = false, + constraints = new + { + maxWallClockTime = "P10675199DT2H48M5.4775807S", + maxTaskRetryCount = 0, + }, + poolInfo = new + { + poolId = "poolId", + }, + }, +}); Response response = await client.UpdateJobScheduleAsync("jobScheduleId", content); Console.WriteLine(response.Status); @@ -1623,7 +3217,27 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + schedule = new + { + doNotRunUntil = "2025-01-01T12:30:00Z", + }, + jobSpecification = new + { + priority = 0, + usesTaskDependencies = false, + constraints = new + { + maxWallClockTime = "P10675199DT2H48M5.4775807S", + maxTaskRetryCount = 0, + }, + poolInfo = new + { + poolId = "poolId", + }, + }, +}); Response response = client.UpdateJobSchedule("jobScheduleId", content); Console.WriteLine(response.Status); @@ -1843,7 +3457,13 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); +BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration +{ + RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), +}, new BatchJobSpecification(new BatchPoolInfo +{ + PoolId = "poolId", +})); Response response = await client.CreateJobScheduleAsync(jobSchedule); ]]> This sample shows how to call CreateJobScheduleAsync. @@ -1852,7 +3472,104 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); +BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration +{ + DoNotRunUntil = DateTimeOffset.Parse("2014-09-10T02:30:00.000Z"), + DoNotRunAfter = DateTimeOffset.Parse("2014-09-10T06:30:00.000Z"), + StartWindow = XmlConvert.ToTimeSpan("PT1M"), + RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), +}, new BatchJobSpecification(new BatchPoolInfo +{ + AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.JobSchedule) + { + AutoPoolIdPrefix = "mypool", + Pool = new BatchPoolSpecification("Standard_D1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TaskSlotsPerNode = 2, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 3, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + StartTask = new BatchStartTask("myprogram2.exe") + { + ResourceFiles = {new ResourceFile + { + HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", + FilePath = "myprogram2.exe", + }}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") + { + Value = "myvalue", + }}, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + MaxTaskRetryCount = 2, + WaitForSuccess = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, + }, + }, +}) +{ + Priority = 100, + Constraints = new BatchJobConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = -1, + }, + JobManagerTask = new BatchJobManagerTask("mytask1", "myprogram.exe") + { + ResourceFiles = {new ResourceFile + { + HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", + FilePath = "myprogram.exe", + }, new ResourceFile + { + HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", + FilePath = "test.txt", + }}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") + { + Value = "myvalue", + }}, + Constraints = new BatchTaskConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + RetentionTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = 0, + }, + RequiredSlots = 2, + KillJobOnCompletion = true, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, + RunExclusive = true, + }, +}) +{ + Metadata = { new MetadataItem("myproperty", "myvalue") }, +}; Response response = await client.CreateJobScheduleAsync(jobSchedule); ]]> @@ -1864,7 +3581,13 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); +BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration +{ + RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), +}, new BatchJobSpecification(new BatchPoolInfo +{ + PoolId = "poolId", +})); Response response = client.CreateJobSchedule(jobSchedule); ]]> This sample shows how to call CreateJobSchedule. @@ -1873,7 +3596,104 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); +BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration +{ + DoNotRunUntil = DateTimeOffset.Parse("2014-09-10T02:30:00.000Z"), + DoNotRunAfter = DateTimeOffset.Parse("2014-09-10T06:30:00.000Z"), + StartWindow = XmlConvert.ToTimeSpan("PT1M"), + RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), +}, new BatchJobSpecification(new BatchPoolInfo +{ + AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.JobSchedule) + { + AutoPoolIdPrefix = "mypool", + Pool = new BatchPoolSpecification("Standard_D1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TaskSlotsPerNode = 2, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 3, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + StartTask = new BatchStartTask("myprogram2.exe") + { + ResourceFiles = {new ResourceFile + { + HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", + FilePath = "myprogram2.exe", + }}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") + { + Value = "myvalue", + }}, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + MaxTaskRetryCount = 2, + WaitForSuccess = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, + }, + }, +}) +{ + Priority = 100, + Constraints = new BatchJobConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = -1, + }, + JobManagerTask = new BatchJobManagerTask("mytask1", "myprogram.exe") + { + ResourceFiles = {new ResourceFile + { + HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", + FilePath = "myprogram.exe", + }, new ResourceFile + { + HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", + FilePath = "test.txt", + }}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") + { + Value = "myvalue", + }}, + Constraints = new BatchTaskConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + RetentionTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = 0, + }, + RequiredSlots = 2, + KillJobOnCompletion = true, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, + RunExclusive = true, + }, +}) +{ + Metadata = { new MetadataItem("myproperty", "myvalue") }, +}; Response response = client.CreateJobSchedule(jobSchedule); ]]> @@ -1885,7 +3705,21 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "jobScheduleId", + schedule = new + { + recurrenceInterval = "PT5M", + }, + jobSpecification = new + { + poolInfo = new + { + poolId = "poolId", + }, + }, +}); Response response = await client.CreateJobScheduleAsync(content); Console.WriteLine(response.Status); @@ -1896,7 +3730,149 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "jobScheduleId", + schedule = new + { + doNotRunUntil = "2014-09-10T02:30:00.000Z", + doNotRunAfter = "2014-09-10T06:30:00.000Z", + startWindow = "PT1M", + recurrenceInterval = "PT5M", + }, + jobSpecification = new + { + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + jobManagerTask = new + { + id = "mytask1", + commandLine = "myprogram.exe", + resourceFiles = new object[] + { + new + { + httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", + filePath = "myprogram.exe", + }, + new + { + httpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", + filePath = "test.txt", + } + }, + environmentSettings = new object[] + { + new + { + name = "myvariable", + value = "myvalue", + } + }, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = 0, + retentionTime = "PT1H", + }, + requiredSlots = 2, + killJobOnCompletion = true, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, + runExclusive = true, + }, + poolInfo = new + { + autoPoolSpecification = new + { + autoPoolIdPrefix = "mypool", + poolLifetimeOption = "jobschedule", + pool = new + { + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 3, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 2, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + startTask = new + { + commandLine = "myprogram2.exe", + resourceFiles = new object[] + { + new + { + httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", + filePath = "myprogram2.exe", + } + }, + environmentSettings = new object[] + { + new + { + name = "myvariable", + value = "myvalue", + } + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + maxTaskRetryCount = 2, + waitForSuccess = true, + }, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, + targetNodeCommunicationMode = "default", + }, + }, + }, + }, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, +}); Response response = await client.CreateJobScheduleAsync(content); Console.WriteLine(response.Status); @@ -1910,7 +3886,21 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "jobScheduleId", + schedule = new + { + recurrenceInterval = "PT5M", + }, + jobSpecification = new + { + poolInfo = new + { + poolId = "poolId", + }, + }, +}); Response response = client.CreateJobSchedule(content); Console.WriteLine(response.Status); @@ -1921,7 +3911,149 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "jobScheduleId", + schedule = new + { + doNotRunUntil = "2014-09-10T02:30:00.000Z", + doNotRunAfter = "2014-09-10T06:30:00.000Z", + startWindow = "PT1M", + recurrenceInterval = "PT5M", + }, + jobSpecification = new + { + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + jobManagerTask = new + { + id = "mytask1", + commandLine = "myprogram.exe", + resourceFiles = new object[] + { + new + { + httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", + filePath = "myprogram.exe", + }, + new + { + httpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", + filePath = "test.txt", + } + }, + environmentSettings = new object[] + { + new + { + name = "myvariable", + value = "myvalue", + } + }, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = 0, + retentionTime = "PT1H", + }, + requiredSlots = 2, + killJobOnCompletion = true, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, + runExclusive = true, + }, + poolInfo = new + { + autoPoolSpecification = new + { + autoPoolIdPrefix = "mypool", + poolLifetimeOption = "jobschedule", + pool = new + { + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 3, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 2, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + startTask = new + { + commandLine = "myprogram2.exe", + resourceFiles = new object[] + { + new + { + httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", + filePath = "myprogram2.exe", + } + }, + environmentSettings = new object[] + { + new + { + name = "myvariable", + value = "myvalue", + } + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + maxTaskRetryCount = 2, + waitForSuccess = true, + }, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, + targetNodeCommunicationMode = "default", + }, + }, + }, + }, + metadata = new object[] + { + new + { + name = "myproperty", + value = "myvalue", + } + }, +}); Response response = client.CreateJobSchedule(content); Console.WriteLine(response.Status); @@ -1935,7 +4067,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); +BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1"); Response response = await client.CreateTaskAsync("jobId", task); ]]> This sample shows how to call CreateTaskAsync. @@ -1944,7 +4076,21 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); +BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "bash -c 'echo hello'") +{ + ContainerSettings = new BatchTaskContainerSettings("ubuntu") + { + ContainerRunOptions = "--rm", + }, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, +}; Response response = await client.CreateTaskAsync("jobId", task); ]]> This sample shows how to call CreateTaskAsync. @@ -1953,7 +4099,24 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); +BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "cmd /c exit 3") +{ + ExitConditions = new ExitConditions + { + ExitCodeRanges = {new ExitCodeRangeMapping(2, 4, new ExitOptions + { + JobAction = BatchJobAction.Terminate, + })}, + }, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, +}; Response response = await client.CreateTaskAsync("jobId", task); ]]> This sample shows how to call CreateTaskAsync. @@ -1962,7 +4125,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); +BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1") +{ + RequiredSlots = 2, +}; Response response = await client.CreateTaskAsync("jobId", task); ]]> @@ -1974,7 +4140,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); +BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1"); Response response = client.CreateTask("jobId", task); ]]> This sample shows how to call CreateTask. @@ -1983,7 +4149,21 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); +BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "bash -c 'echo hello'") +{ + ContainerSettings = new BatchTaskContainerSettings("ubuntu") + { + ContainerRunOptions = "--rm", + }, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, +}; Response response = client.CreateTask("jobId", task); ]]> This sample shows how to call CreateTask. @@ -1992,7 +4172,24 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); +BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "cmd /c exit 3") +{ + ExitConditions = new ExitConditions + { + ExitCodeRanges = {new ExitCodeRangeMapping(2, 4, new ExitOptions + { + JobAction = BatchJobAction.Terminate, + })}, + }, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, +}; Response response = client.CreateTask("jobId", task); ]]> This sample shows how to call CreateTask. @@ -2001,7 +4198,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); +BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1") +{ + RequiredSlots = 2, +}; Response response = client.CreateTask("jobId", task); ]]> @@ -2013,7 +4213,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "task1", + commandLine = "cmd /c echo task1", +}); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -2024,7 +4228,24 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "taskId", + commandLine = "bash -c 'echo hello'", + containerSettings = new + { + imageName = "ubuntu", + containerRunOptions = "--rm", + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, +}); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -2035,7 +4256,34 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "taskId", + commandLine = "cmd /c exit 3", + exitConditions = new + { + exitCodeRanges = new object[] + { + new + { + start = 2, + end = 4, + exitOptions = new + { + jobAction = "terminate", + }, + } + }, + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, +}); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -2046,7 +4294,12 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "task1", + requiredSlots = 2, + commandLine = "cmd /c echo task1", +}); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -2060,7 +4313,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "task1", + commandLine = "cmd /c echo task1", +}); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -2071,7 +4328,24 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "taskId", + commandLine = "bash -c 'echo hello'", + containerSettings = new + { + imageName = "ubuntu", + containerRunOptions = "--rm", + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, +}); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -2082,7 +4356,34 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "taskId", + commandLine = "cmd /c exit 3", + exitConditions = new + { + exitCodeRanges = new object[] + { + new + { + start = 2, + end = 4, + exitOptions = new + { + jobAction = "terminate", + }, + } + }, + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, +}); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -2093,7 +4394,12 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + id = "task1", + requiredSlots = 2, + commandLine = "cmd /c echo task1", +}); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -2107,7 +4413,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskGroup taskCollection = new BatchTaskGroup(null); +BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] +{ + new BatchTaskCreateContent("simple1", "cmd /c dir /s"), + new BatchTaskCreateContent("simple2", "cmd /c dir /s") +}); Response response = await client.CreateTaskCollectionAsync("jobId", taskCollection); ]]> This sample shows how to call CreateTaskCollectionAsync. @@ -2116,7 +4426,42 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskGroup taskCollection = new BatchTaskGroup(null); +BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] +{ + new BatchTaskCreateContent("complex1", "cmd /c dir /s") + { + ResourceFiles = {new ResourceFile + { + AutoStorageContainerName = "containerName", + FilePath = "data", + }}, + EnvironmentSettings = {new EnvironmentSetting("env1") + { + Value = "value1", + }, new EnvironmentSetting("env2") + { + Value = "value2", + }}, + AffinityInfo = new AffinityInfo("affinityId"), + Constraints = new BatchTaskConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("P1D"), + RetentionTime = XmlConvert.ToTimeSpan("P2D"), + MaxTaskRetryCount = 5, + }, + RequiredSlots = 2, + MultiInstanceSettings = new MultiInstanceSettings("cmd /c echo coordinating") + { + NumberOfInstances = 3, + CommonResourceFiles = {new ResourceFile + { + HttpUrl = "https://common.blob.core.windows.net/", + FilePath = "common.exe", + }}, + }, + }, + new BatchTaskCreateContent("simple3", "cmd /c dir /s") +}); Response response = await client.CreateTaskCollectionAsync("jobId", taskCollection); ]]> @@ -2128,7 +4473,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskGroup taskCollection = new BatchTaskGroup(null); +BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] +{ + new BatchTaskCreateContent("simple1", "cmd /c dir /s"), + new BatchTaskCreateContent("simple2", "cmd /c dir /s") +}); Response response = client.CreateTaskCollection("jobId", taskCollection); ]]> This sample shows how to call CreateTaskCollection. @@ -2137,7 +4486,42 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskGroup taskCollection = new BatchTaskGroup(null); +BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] +{ + new BatchTaskCreateContent("complex1", "cmd /c dir /s") + { + ResourceFiles = {new ResourceFile + { + AutoStorageContainerName = "containerName", + FilePath = "data", + }}, + EnvironmentSettings = {new EnvironmentSetting("env1") + { + Value = "value1", + }, new EnvironmentSetting("env2") + { + Value = "value2", + }}, + AffinityInfo = new AffinityInfo("affinityId"), + Constraints = new BatchTaskConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("P1D"), + RetentionTime = XmlConvert.ToTimeSpan("P2D"), + MaxTaskRetryCount = 5, + }, + RequiredSlots = 2, + MultiInstanceSettings = new MultiInstanceSettings("cmd /c echo coordinating") + { + NumberOfInstances = 3, + CommonResourceFiles = {new ResourceFile + { + HttpUrl = "https://common.blob.core.windows.net/", + FilePath = "common.exe", + }}, + }, + }, + new BatchTaskCreateContent("simple3", "cmd /c dir /s") +}); Response response = client.CreateTaskCollection("jobId", taskCollection); ]]> @@ -2149,7 +4533,22 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + value = new object[] + { + new + { + id = "simple1", + commandLine = "cmd /c dir /s", + }, + new + { + id = "simple2", + commandLine = "cmd /c dir /s", + } + }, +}); Response response = await client.CreateTaskCollectionAsync("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -2161,7 +4560,67 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + value = new object[] + { + new + { + id = "complex1", + commandLine = "cmd /c dir /s", + resourceFiles = new object[] + { + new + { + autoStorageContainerName = "containerName", + filePath = "data", + } + }, + environmentSettings = new object[] + { + new + { + name = "env1", + value = "value1", + }, + new + { + name = "env2", + value = "value2", + } + }, + affinityInfo = new + { + affinityId = "affinityId", + }, + constraints = new + { + maxWallClockTime = "P1D", + retentionTime = "P2D", + maxTaskRetryCount = 5, + }, + requiredSlots = 2, + multiInstanceSettings = new + { + numberOfInstances = 3, + coordinationCommandLine = "cmd /c echo coordinating", + commonResourceFiles = new object[] + { + new + { + httpUrl = "https://common.blob.core.windows.net/", + filePath = "common.exe", + } + }, + }, + }, + new + { + id = "simple3", + commandLine = "cmd /c dir /s", + } + }, +}); Response response = await client.CreateTaskCollectionAsync("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -2176,7 +4635,22 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + value = new object[] + { + new + { + id = "simple1", + commandLine = "cmd /c dir /s", + }, + new + { + id = "simple2", + commandLine = "cmd /c dir /s", + } + }, +}); Response response = client.CreateTaskCollection("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -2188,7 +4662,67 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + value = new object[] + { + new + { + id = "complex1", + commandLine = "cmd /c dir /s", + resourceFiles = new object[] + { + new + { + autoStorageContainerName = "containerName", + filePath = "data", + } + }, + environmentSettings = new object[] + { + new + { + name = "env1", + value = "value1", + }, + new + { + name = "env2", + value = "value2", + } + }, + affinityInfo = new + { + affinityId = "affinityId", + }, + constraints = new + { + maxWallClockTime = "P1D", + retentionTime = "P2D", + maxTaskRetryCount = 5, + }, + requiredSlots = 2, + multiInstanceSettings = new + { + numberOfInstances = 3, + coordinationCommandLine = "cmd /c echo coordinating", + commonResourceFiles = new object[] + { + new + { + httpUrl = "https://common.blob.core.windows.net/", + filePath = "common.exe", + } + }, + }, + }, + new + { + id = "simple3", + commandLine = "cmd /c dir /s", + } + }, +}); Response response = client.CreateTaskCollection("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -2491,7 +5025,12 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeUserCreateContent user = new BatchNodeUserCreateContent(null); +BatchNodeUserCreateContent user = new BatchNodeUserCreateContent("userName") +{ + IsAdmin = false, + ExpiryTime = DateTimeOffset.Parse("2017-08-01T00:00:00Z"), + Password = "Password", +}; Response response = await client.CreateNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", user); ]]> @@ -2503,7 +5042,12 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeUserCreateContent user = new BatchNodeUserCreateContent(null); +BatchNodeUserCreateContent user = new BatchNodeUserCreateContent("userName") +{ + IsAdmin = false, + ExpiryTime = DateTimeOffset.Parse("2017-08-01T00:00:00Z"), + Password = "Password", +}; Response response = client.CreateNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", user); ]]> @@ -2515,7 +5059,13 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + name = "userName", + isAdmin = false, + expiryTime = "2017-08-01T00:00:00Z", + password = "Password", +}); Response response = await client.CreateNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); Console.WriteLine(response.Status); @@ -2529,7 +5079,13 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + name = "userName", + isAdmin = false, + expiryTime = "2017-08-01T00:00:00Z", + password = "Password", +}); Response response = client.CreateNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", content); Console.WriteLine(response.Status); @@ -2569,7 +5125,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent(); +BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent +{ + Password = "12345", + ExpiryTime = DateTimeOffset.Parse("2016-11-27T00:45:48.7320857Z"), +}; Response response = await client.ReplaceNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); ]]> @@ -2581,7 +5141,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent(); +BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent +{ + Password = "12345", + ExpiryTime = DateTimeOffset.Parse("2016-11-27T00:45:48.7320857Z"), +}; Response response = client.ReplaceNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); ]]> @@ -2593,7 +5157,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + password = "12345", + expiryTime = "2016-11-27T00:45:48.7320857Z", +}); Response response = await client.ReplaceNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); Console.WriteLine(response.Status); @@ -2607,7 +5175,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + password = "12345", + expiryTime = "2016-11-27T00:45:48.7320857Z", +}); Response response = client.ReplaceNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); Console.WriteLine(response.Status); @@ -2849,7 +5421,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent(null, default); +UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent("https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", DateTimeOffset.Parse("2017-11-27T00:00:00Z")); Response response = await client.UploadNodeLogsAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); ]]> @@ -2861,7 +5433,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent(null, default); +UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent("https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", DateTimeOffset.Parse("2017-11-27T00:00:00Z")); Response response = client.UploadNodeLogs("poolId", "tvm-1695681911_1-20161121t182739z", content); ]]> @@ -2873,7 +5445,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + containerUrl = "https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", + startTime = "2017-11-27T00:00:00Z", +}); Response response = await client.UploadNodeLogsAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -2889,7 +5465,11 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new object()); +using RequestContent content = RequestContent.Create(new +{ + containerUrl = "https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", + startTime = "2017-11-27T00:00:00Z", +}); Response response = client.UploadNodeLogs("poolId", "tvm-1695681911_1-20161121t182739z", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; diff --git a/sdk/batch/Azure.Compute.Batch/tests/Generated/Samples/Samples_BatchClient.cs b/sdk/batch/Azure.Compute.Batch/tests/Generated/Samples/Samples_BatchClient.cs index 30ce0376ee756..274be47c20ed9 100644 --- a/sdk/batch/Azure.Compute.Batch/tests/Generated/Samples/Samples_BatchClient.cs +++ b/sdk/batch/Azure.Compute.Batch/tests/Generated/Samples/Samples_BatchClient.cs @@ -80,7 +80,27 @@ public void Example_Batch_CreatePool_CreatesAPoolWithAcceleratedNetworking() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "mypool01", + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + targetDedicatedNodes = 2, + networkConfiguration = new + { + enableAcceleratedNetworking = true, + }, + }); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -94,7 +114,27 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithAcceleratedNetworking TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "mypool01", + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + targetDedicatedNodes = 2, + networkConfiguration = new + { + enableAcceleratedNetworking = true, + }, + }); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -108,7 +148,21 @@ public void Example_Batch_CreatePool_CreatesAPoolWithAcceleratedNetworking_Conve TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool01", "Standard_D1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TargetDedicatedNodes = 2, + NetworkConfiguration = new NetworkConfiguration + { + EnableAcceleratedNetworking = true, + }, + }; Response response = client.CreatePool(pool); } @@ -120,7 +174,21 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithAcceleratedNetworking TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool01", "Standard_D1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TargetDedicatedNodes = 2, + NetworkConfiguration = new NetworkConfiguration + { + EnableAcceleratedNetworking = true, + }, + }; Response response = await client.CreatePoolAsync(pool); } @@ -132,7 +200,74 @@ public void Example_Batch_CreatePool_CreatesAPoolWithMountDriveSpecified() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + mountConfiguration = new object[] + { +new +{ +azureBlobFileSystemConfiguration = new +{ +accountName = "accountName", +containerName = "blobContainerName", +accountKey = "accountKey", +relativeMountPath = "bfusepath", +}, +}, +new +{ +azureFileShareConfiguration = new +{ +accountName = "accountName", +azureFileUrl = "https://myaccount.file.core.windows.net/fileshare", +accountKey = "accountKey", +relativeMountPath = "filesharepath", +mountOptions = "mount options ver=1.0", +}, +}, +new +{ +nfsMountConfiguration = new +{ +source = "somesource nfs url", +relativeMountPath = "mountpath", +mountOptions = "mount options ver=1.0", +}, +}, +new +{ +cifsMountConfiguration = new +{ +username = "accountName", +password = "password", +source = "//myaccount.file.core.windows.net/file", +relativeMountPath = "mountpath", +mountOptions = "mount options ver=1.0", +}, +} + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + }); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -146,7 +281,74 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithMountDriveSpecified_A TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + mountConfiguration = new object[] + { +new +{ +azureBlobFileSystemConfiguration = new +{ +accountName = "accountName", +containerName = "blobContainerName", +accountKey = "accountKey", +relativeMountPath = "bfusepath", +}, +}, +new +{ +azureFileShareConfiguration = new +{ +accountName = "accountName", +azureFileUrl = "https://myaccount.file.core.windows.net/fileshare", +accountKey = "accountKey", +relativeMountPath = "filesharepath", +mountOptions = "mount options ver=1.0", +}, +}, +new +{ +nfsMountConfiguration = new +{ +source = "somesource nfs url", +relativeMountPath = "mountpath", +mountOptions = "mount options ver=1.0", +}, +}, +new +{ +cifsMountConfiguration = new +{ +username = "accountName", +password = "password", +source = "//myaccount.file.core.windows.net/file", +relativeMountPath = "mountpath", +mountOptions = "mount options ver=1.0", +}, +} + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + }); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -160,7 +362,46 @@ public void Example_Batch_CreatePool_CreatesAPoolWithMountDriveSpecified_Conveni TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04"), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + MountConfiguration = {new MountConfiguration +{ +AzureBlobFileSystemConfiguration = new AzureBlobFileSystemConfiguration("accountName", "blobContainerName", "bfusepath") +{ +AccountKey = "accountKey", +}, +}, new MountConfiguration +{ +AzureFileShareConfiguration = new AzureFileShareConfiguration("accountName", "https://myaccount.file.core.windows.net/fileshare", "accountKey", "filesharepath") +{ +MountOptions = "mount options ver=1.0", +}, +}, new MountConfiguration +{ +NfsMountConfiguration = new NfsMountConfiguration("somesource nfs url", "mountpath") +{ +MountOptions = "mount options ver=1.0", +}, +}, new MountConfiguration +{ +CifsMountConfiguration = new CifsMountConfiguration("accountName", "//myaccount.file.core.windows.net/file", "mountpath", "password") +{ +MountOptions = "mount options ver=1.0", +}, +}}, + }; Response response = client.CreatePool(pool); } @@ -172,7 +413,46 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithMountDriveSpecified_C TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04"), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + MountConfiguration = {new MountConfiguration +{ +AzureBlobFileSystemConfiguration = new AzureBlobFileSystemConfiguration("accountName", "blobContainerName", "bfusepath") +{ +AccountKey = "accountKey", +}, +}, new MountConfiguration +{ +AzureFileShareConfiguration = new AzureFileShareConfiguration("accountName", "https://myaccount.file.core.windows.net/fileshare", "accountKey", "filesharepath") +{ +MountOptions = "mount options ver=1.0", +}, +}, new MountConfiguration +{ +NfsMountConfiguration = new NfsMountConfiguration("somesource nfs url", "mountpath") +{ +MountOptions = "mount options ver=1.0", +}, +}, new MountConfiguration +{ +CifsMountConfiguration = new CifsMountConfiguration("accountName", "//myaccount.file.core.windows.net/file", "mountpath", "password") +{ +MountOptions = "mount options ver=1.0", +}, +}}, + }; Response response = await client.CreatePoolAsync(pool); } @@ -184,7 +464,39 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "mypool001", + vmSize = "standard_d2s_v3", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + osDisk = new + { + diskSizeGB = 100, + managedDisk = new + { + storageAccountType = "standardssd_lrs", + }, + caching = "readwrite", + ephemeralOSDiskSettings = new + { + placement = "cachedisk", + }, + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 1, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 1, + enableAutoScale = false, + }); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -198,7 +510,39 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "mypool001", + vmSize = "standard_d2s_v3", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + osDisk = new + { + diskSizeGB = 100, + managedDisk = new + { + storageAccountType = "standardssd_lrs", + }, + caching = "readwrite", + ephemeralOSDiskSettings = new + { + placement = "cachedisk", + }, + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 1, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 1, + enableAutoScale = false, + }); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -212,7 +556,32 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "standard_d2s_v3") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04") + { + OsDisk = new OSDisk + { + EphemeralOSDiskSettings = new DiffDiskSettings + { + Placement = DiffDiskPlacement.CacheDisk, + }, + Caching = CachingType.ReadWrite, + DiskSizeGB = 100, + ManagedDisk = new ManagedDisk(StorageAccountType.StandardSSDLRS), + }, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 1, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 1, + }; Response response = client.CreatePool(pool); } @@ -224,7 +593,32 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "standard_d2s_v3") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04") + { + OsDisk = new OSDisk + { + EphemeralOSDiskSettings = new DiffDiskSettings + { + Placement = DiffDiskPlacement.CacheDisk, + }, + Caching = CachingType.ReadWrite, + DiskSizeGB = 100, + ManagedDisk = new ManagedDisk(StorageAccountType.StandardSSDLRS), + }, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 1, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 1, + }; Response response = await client.CreatePoolAsync(pool); } @@ -236,7 +630,28 @@ public void Example_Batch_CreatePool_CreatesASimplePoolWithResourceTags() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "mypool001", + vmSize = "STANDARD_DC2s_V2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "18_04-lts-gen2", + version = "latest", + }, + nodeAgentSKUId = "batch.node.ubuntu 18.04", + }, + targetDedicatedNodes = 1, + resourceTags = new + { + TagName1 = "TagValue1", + TagName2 = "TagValue2", + }, + }); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -250,7 +665,28 @@ public async Task Example_Batch_CreatePool_CreatesASimplePoolWithResourceTags_As TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "mypool001", + vmSize = "STANDARD_DC2s_V2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "18_04-lts-gen2", + version = "latest", + }, + nodeAgentSKUId = "batch.node.ubuntu 18.04", + }, + targetDedicatedNodes = 1, + resourceTags = new + { + TagName1 = "TagValue1", + TagName2 = "TagValue2", + }, + }); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -264,7 +700,22 @@ public void Example_Batch_CreatePool_CreatesASimplePoolWithResourceTags_Convenie TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "18_04-lts-gen2", + Version = "latest", + }, "batch.node.ubuntu 18.04"), + ResourceTags = +{ +["TagName1"] = "TagValue1", +["TagName2"] = "TagValue2" +}, + TargetDedicatedNodes = 1, + }; Response response = client.CreatePool(pool); } @@ -276,7 +727,22 @@ public async Task Example_Batch_CreatePool_CreatesASimplePoolWithResourceTags_Co TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "18_04-lts-gen2", + Version = "latest", + }, "batch.node.ubuntu 18.04"), + ResourceTags = +{ +["TagName1"] = "TagValue1", +["TagName2"] = "TagValue2" +}, + TargetDedicatedNodes = 1, + }; Response response = await client.CreatePoolAsync(pool); } @@ -288,7 +754,32 @@ public void Example_Batch_CreatePool_CreatesAPoolWithSecurityProfile() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "mypool001", + vmSize = "STANDARD_DC2s_V2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "18_04-lts-gen2", + version = "latest", + }, + nodeAgentSKUId = "batch.node.ubuntu 18.04", + securityProfile = new + { + securityType = "trustedLaunch", + encryptionAtHost = true, + uefiSettings = new + { + secureBootEnabled = false, + }, + }, + }, + targetDedicatedNodes = 1, + }); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -302,7 +793,32 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithSecurityProfile_Async TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "mypool001", + vmSize = "STANDARD_DC2s_V2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "UbuntuServer", + sku = "18_04-lts-gen2", + version = "latest", + }, + nodeAgentSKUId = "batch.node.ubuntu 18.04", + securityProfile = new + { + securityType = "trustedLaunch", + encryptionAtHost = true, + uefiSettings = new + { + secureBootEnabled = false, + }, + }, + }, + targetDedicatedNodes = 1, + }); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -316,7 +832,23 @@ public void Example_Batch_CreatePool_CreatesAPoolWithSecurityProfile_Convenience TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "18_04-lts-gen2", + Version = "latest", + }, "batch.node.ubuntu 18.04") + { + SecurityProfile = new SecurityProfile(true, SecurityTypes.TrustedLaunch, new UefiSettings + { + SecureBootEnabled = false, + }), + }, + TargetDedicatedNodes = 1, + }; Response response = client.CreatePool(pool); } @@ -328,7 +860,23 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithSecurityProfile_Conve TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "UbuntuServer", + Sku = "18_04-lts-gen2", + Version = "latest", + }, "batch.node.ubuntu 18.04") + { + SecurityProfile = new SecurityProfile(true, SecurityTypes.TrustedLaunch, new UefiSettings + { + SecureBootEnabled = false, + }), + }, + TargetDedicatedNodes = 1, + }; Response response = await client.CreatePoolAsync(pool); } @@ -340,7 +888,39 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPool() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + }); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -354,7 +934,39 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + }); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -368,7 +980,23 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPool_Con TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04"), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + Metadata = { new MetadataItem("myproperty", "myvalue") }, + }; Response response = client.CreatePool(pool); } @@ -380,7 +1008,23 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04"), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + Metadata = { new MetadataItem("myproperty", "myvalue") }, + }; Response response = await client.CreatePoolAsync(pool); } @@ -392,7 +1036,38 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "120_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + containerConfiguration = new + { + type = "dockerCompatible", + containerImageNames = new object[] + { +"busybox" + }, + }, + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + }); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -406,7 +1081,38 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "120_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + containerConfiguration = new + { + type = "dockerCompatible", + containerImageNames = new object[] + { +"busybox" + }, + }, + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + }); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -420,7 +1126,27 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "120_04-lts", + }, "batch.node.ubuntu 20.04") + { + ContainerConfiguration = new ContainerConfiguration(ContainerType.DockerCompatible) + { + ContainerImageNames = { "busybox" }, + }, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + }; Response response = client.CreatePool(pool); } @@ -432,7 +1158,27 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "120_04-lts", + }, "batch.node.ubuntu 20.04") + { + ContainerConfiguration = new ContainerConfiguration(ContainerType.DockerCompatible) + { + ContainerImageNames = { "busybox" }, + }, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + }; Response response = await client.CreatePoolAsync(pool); } @@ -444,7 +1190,57 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + extensions = new object[] + { +new +{ +name = "batchextension1", +type = "KeyVaultForLinux", +publisher = "Microsoft.Azure.KeyVault", +typeHandlerVersion = "2.0", +autoUpgradeMinorVersion = true, +enableAutomaticUpgrade = true, +settings = new +{ +secretsManagementSettingsKey = "secretsManagementSettingsValue", +authenticationSettingsKey = "authenticationSettingsValue", +}, +} + }, + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + targetNodeCommunicationMode = "simplified", + }); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -458,7 +1254,57 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "pool2", + vmSize = "standard_a1", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "Canonical", + offer = "0001-com-ubuntu-server-focal", + sku = "20_04-lts", + }, + nodeAgentSKUId = "batch.node.ubuntu 20.04", + extensions = new object[] + { +new +{ +name = "batchextension1", +type = "KeyVaultForLinux", +publisher = "Microsoft.Azure.KeyVault", +typeHandlerVersion = "2.0", +autoUpgradeMinorVersion = true, +enableAutomaticUpgrade = true, +settings = new +{ +secretsManagementSettingsKey = "secretsManagementSettingsValue", +authenticationSettingsKey = "authenticationSettingsValue", +}, +} + }, + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 5, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 3, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + targetNodeCommunicationMode = "simplified", + }); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -472,7 +1318,37 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04") + { + Extensions = {new VMExtension("batchextension1", "Microsoft.Azure.KeyVault", "KeyVaultForLinux") +{ +TypeHandlerVersion = "2.0", +AutoUpgradeMinorVersion = true, +EnableAutomaticUpgrade = true, +Settings = +{ +["secretsManagementSettingsKey"] = "secretsManagementSettingsValue", +["authenticationSettingsKey"] = "authenticationSettingsValue" +}, +}}, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Simplified, + }; Response response = client.CreatePool(pool); } @@ -484,7 +1360,37 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "Canonical", + Offer = "0001-com-ubuntu-server-focal", + Sku = "20_04-lts", + }, "batch.node.ubuntu 20.04") + { + Extensions = {new VMExtension("batchextension1", "Microsoft.Azure.KeyVault", "KeyVaultForLinux") +{ +TypeHandlerVersion = "2.0", +AutoUpgradeMinorVersion = true, +EnableAutomaticUpgrade = true, +Settings = +{ +["secretsManagementSettingsKey"] = "secretsManagementSettingsValue", +["authenticationSettingsKey"] = "authenticationSettingsValue" +}, +}}, + }, + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 5, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + TaskSlotsPerNode = 3, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Simplified, + }; Response response = await client.CreatePoolAsync(pool); } @@ -496,7 +1402,31 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "mypool002", + vmSize = "Standard_A1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + windowsConfiguration = new + { + enableAutomaticUpdates = false, + }, + serviceArtifactReference = new + { + id = "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + targetDedicatedNodes = 2, + }); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -510,7 +1440,31 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "mypool002", + vmSize = "Standard_A1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + windowsConfiguration = new + { + enableAutomaticUpdates = false, + }, + serviceArtifactReference = new + { + id = "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + targetDedicatedNodes = 2, + }); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -524,7 +1478,24 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool002", "Standard_A1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64") + { + WindowsConfiguration = new WindowsConfiguration + { + EnableAutomaticUpdates = false, + }, + ServiceArtifactReference = new ServiceArtifactReference("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"), + }, + TargetDedicatedNodes = 2, + }; Response response = client.CreatePool(pool); } @@ -536,7 +1507,24 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); + BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool002", "Standard_A1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64") + { + WindowsConfiguration = new WindowsConfiguration + { + EnableAutomaticUpdates = false, + }, + ServiceArtifactReference = new ServiceArtifactReference("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"), + }, + TargetDedicatedNodes = 2, + }; Response response = await client.CreatePoolAsync(pool); } @@ -874,7 +1862,13 @@ public void Example_Batch_UpdatePool_PatchThePool() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + startTask = new + { + commandLine = "/bin/bash -c 'echo start task'", + }, + }); Response response = client.UpdatePool("poolId", content); Console.WriteLine(response.Status); @@ -888,7 +1882,13 @@ public async Task Example_Batch_UpdatePool_PatchThePool_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + startTask = new + { + commandLine = "/bin/bash -c 'echo start task'", + }, + }); Response response = await client.UpdatePoolAsync("poolId", content); Console.WriteLine(response.Status); @@ -928,7 +1928,11 @@ public void Example_Batch_EnablePoolAutoScale_PoolEnableAutoscale() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + autoScaleFormula = "$TargetDedicated=0", + autoScaleEvaluationInterval = "PT8M", + }); Response response = client.EnablePoolAutoScale("poolId", content); Console.WriteLine(response.Status); @@ -942,7 +1946,11 @@ public async Task Example_Batch_EnablePoolAutoScale_PoolEnableAutoscale_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + autoScaleFormula = "$TargetDedicated=0", + autoScaleEvaluationInterval = "PT8M", + }); Response response = await client.EnablePoolAutoScaleAsync("poolId", content); Console.WriteLine(response.Status); @@ -956,7 +1964,11 @@ public void Example_Batch_EnablePoolAutoScale_PoolEnableAutoscale_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent(); + BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent + { + AutoScaleFormula = "$TargetDedicated=0", + AutoScaleEvaluationInterval = XmlConvert.ToTimeSpan("PT8M"), + }; Response response = client.EnablePoolAutoScale("poolId", content); } @@ -968,7 +1980,11 @@ public async Task Example_Batch_EnablePoolAutoScale_PoolEnableAutoscale_Convenie TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent(); + BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent + { + AutoScaleFormula = "$TargetDedicated=0", + AutoScaleEvaluationInterval = XmlConvert.ToTimeSpan("PT8M"), + }; Response response = await client.EnablePoolAutoScaleAsync("poolId", content); } @@ -980,7 +1996,10 @@ public void Example_Batch_EvaluatePoolAutoScale_PoolEvaluateAutoscale() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + autoScaleFormula = "$TargetDedicated=1", + }); Response response = client.EvaluatePoolAutoScale("poolId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -995,7 +2014,10 @@ public async Task Example_Batch_EvaluatePoolAutoScale_PoolEvaluateAutoscale_Asyn TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + autoScaleFormula = "$TargetDedicated=1", + }); Response response = await client.EvaluatePoolAutoScaleAsync("poolId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -1010,7 +2032,7 @@ public void Example_Batch_EvaluatePoolAutoScale_PoolEvaluateAutoscale_Convenienc TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent(null); + BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent("$TargetDedicated=1"); Response response = client.EvaluatePoolAutoScale("poolId", content); } @@ -1022,7 +2044,7 @@ public async Task Example_Batch_EvaluatePoolAutoScale_PoolEvaluateAutoscale_Conv TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent(null); + BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent("$TargetDedicated=1"); Response response = await client.EvaluatePoolAutoScaleAsync("poolId", content); } @@ -1034,7 +2056,11 @@ public void Example_Batch_ResizePool_PoolResize() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + targetDedicatedNodes = 1, + targetLowPriorityNodes = 0, + }); Response response = client.ResizePool("resizePool", content); Console.WriteLine(response.Status); @@ -1048,7 +2074,11 @@ public async Task Example_Batch_ResizePool_PoolResize_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + targetDedicatedNodes = 1, + targetLowPriorityNodes = 0, + }); Response response = await client.ResizePoolAsync("resizePool", content); Console.WriteLine(response.Status); @@ -1062,7 +2092,11 @@ public void Example_Batch_ResizePool_PoolResize_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolResizeContent content = new BatchPoolResizeContent(); + BatchPoolResizeContent content = new BatchPoolResizeContent + { + TargetDedicatedNodes = 1, + TargetLowPriorityNodes = 0, + }; Response response = client.ResizePool("resizePool", content); } @@ -1074,7 +2108,11 @@ public async Task Example_Batch_ResizePool_PoolResize_Convenience_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolResizeContent content = new BatchPoolResizeContent(); + BatchPoolResizeContent content = new BatchPoolResizeContent + { + TargetDedicatedNodes = 1, + TargetLowPriorityNodes = 0, + }; Response response = await client.ResizePoolAsync("resizePool", content); } @@ -1112,7 +2150,15 @@ public void Example_Batch_ReplacePoolProperties_PoolUpdate() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + startTask = new + { + commandLine = "/bin/bash -c 'echo start task'", + }, + applicationPackageReferences = Array.Empty(), + metadata = Array.Empty(), + }); Response response = client.ReplacePoolProperties("poolId", content); Console.WriteLine(response.Status); @@ -1126,7 +2172,15 @@ public async Task Example_Batch_ReplacePoolProperties_PoolUpdate_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + startTask = new + { + commandLine = "/bin/bash -c 'echo start task'", + }, + applicationPackageReferences = Array.Empty(), + metadata = Array.Empty(), + }); Response response = await client.ReplacePoolPropertiesAsync("poolId", content); Console.WriteLine(response.Status); @@ -1140,7 +2194,10 @@ public void Example_Batch_ReplacePoolProperties_PoolUpdate_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolReplaceContent pool = new BatchPoolReplaceContent(null, null); + BatchPoolReplaceContent pool = new BatchPoolReplaceContent(Array.Empty(), Array.Empty()) + { + StartTask = new BatchStartTask("/bin/bash -c 'echo start task'"), + }; Response response = client.ReplacePoolProperties("poolId", pool); } @@ -1152,7 +2209,10 @@ public async Task Example_Batch_ReplacePoolProperties_PoolUpdate_Convenience_Asy TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolReplaceContent pool = new BatchPoolReplaceContent(null, null); + BatchPoolReplaceContent pool = new BatchPoolReplaceContent(Array.Empty(), Array.Empty()) + { + StartTask = new BatchStartTask("/bin/bash -c 'echo start task'"), + }; Response response = await client.ReplacePoolPropertiesAsync("poolId", pool); } @@ -1164,7 +2224,14 @@ public void Example_Batch_RemoveNodes_PoolRemoveNodes() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + nodeList = new object[] + { +"tvm-1695681911_1-20161122t224741z", +"tvm-1695681911_2-20161122t224741z" + }, + }); Response response = client.RemoveNodes("poolId", content); Console.WriteLine(response.Status); @@ -1178,7 +2245,14 @@ public async Task Example_Batch_RemoveNodes_PoolRemoveNodes_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + nodeList = new object[] + { +"tvm-1695681911_1-20161122t224741z", +"tvm-1695681911_2-20161122t224741z" + }, + }); Response response = await client.RemoveNodesAsync("poolId", content); Console.WriteLine(response.Status); @@ -1192,7 +2266,7 @@ public void Example_Batch_RemoveNodes_PoolRemoveNodes_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeRemoveContent content = new BatchNodeRemoveContent(null); + BatchNodeRemoveContent content = new BatchNodeRemoveContent(new string[] { "tvm-1695681911_1-20161122t224741z", "tvm-1695681911_2-20161122t224741z" }); Response response = client.RemoveNodes("poolId", content); } @@ -1204,7 +2278,7 @@ public async Task Example_Batch_RemoveNodes_PoolRemoveNodes_Convenience_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeRemoveContent content = new BatchNodeRemoveContent(null); + BatchNodeRemoveContent content = new BatchNodeRemoveContent(new string[] { "tvm-1695681911_1-20161122t224741z", "tvm-1695681911_2-20161122t224741z" }); Response response = await client.RemoveNodesAsync("poolId", content); } @@ -1292,7 +2366,19 @@ public void Example_Batch_UpdateJob_JobPatch() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + poolInfo = new + { + poolId = "poolId", + }, + }); Response response = client.UpdateJob("jobId", content); Console.WriteLine(response.Status); @@ -1306,7 +2392,19 @@ public async Task Example_Batch_UpdateJob_JobPatch_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + poolInfo = new + { + poolId = "poolId", + }, + }); Response response = await client.UpdateJobAsync("jobId", content); Console.WriteLine(response.Status); @@ -1418,7 +2516,10 @@ public void Example_Batch_DisableJob_JobDisable() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + disableTasks = "terminate", + }); Response response = client.DisableJob("jobId", content); Console.WriteLine(response.Status); @@ -1432,7 +2533,10 @@ public async Task Example_Batch_DisableJob_JobDisable_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + disableTasks = "terminate", + }); Response response = await client.DisableJobAsync("jobId", content); Console.WriteLine(response.Status); @@ -1446,7 +2550,7 @@ public void Example_Batch_DisableJob_JobDisable_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobDisableContent content = new BatchJobDisableContent(default); + BatchJobDisableContent content = new BatchJobDisableContent(DisableBatchJobOption.Terminate); Response response = client.DisableJob("jobId", content); } @@ -1458,7 +2562,7 @@ public async Task Example_Batch_DisableJob_JobDisable_Convenience_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobDisableContent content = new BatchJobDisableContent(default); + BatchJobDisableContent content = new BatchJobDisableContent(DisableBatchJobOption.Terminate); Response response = await client.DisableJobAsync("jobId", content); } @@ -1546,7 +2650,15 @@ public void Example_Batch_CreateJob_CreatesABasicJob() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "jobId", + priority = 0, + poolInfo = new + { + poolId = "poolId", + }, + }); Response response = client.CreateJob(content); Console.WriteLine(response.Status); @@ -1560,7 +2672,15 @@ public async Task Example_Batch_CreateJob_CreatesABasicJob_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "jobId", + priority = 0, + poolInfo = new + { + poolId = "poolId", + }, + }); Response response = await client.CreateJobAsync(content); Console.WriteLine(response.Status); @@ -1574,7 +2694,13 @@ public void Example_Batch_CreateJob_CreatesABasicJob_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobCreateContent job = new BatchJobCreateContent(null, null); + BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo + { + PoolId = "poolId", + }) + { + Priority = 0, + }; Response response = client.CreateJob(job); } @@ -1586,7 +2712,13 @@ public async Task Example_Batch_CreateJob_CreatesABasicJob_Convenience_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobCreateContent job = new BatchJobCreateContent(null, null); + BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo + { + PoolId = "poolId", + }) + { + Priority = 0, + }; Response response = await client.CreateJobAsync(job); } @@ -1598,7 +2730,139 @@ public void Example_Batch_CreateJob_CreatesAComplexJob() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "jobId", + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + jobManagerTask = new + { + id = "taskId", + commandLine = "myprogram.exe", + resourceFiles = new object[] + { +new +{ +httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", +filePath = "myprogram.exe", +}, +new +{ +storageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", +filePath = "datafolder", +} + }, + environmentSettings = new object[] + { +new +{ +name = "myvariable", +value = "myvalue", +} + }, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = 0, + retentionTime = "PT1H", + }, + requiredSlots = 2, + killJobOnCompletion = false, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + runExclusive = true, + }, + poolInfo = new + { + autoPoolSpecification = new + { + autoPoolIdPrefix = "mypool", + poolLifetimeOption = "job", + pool = new + { + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 3, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 2, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + startTask = new + { + commandLine = "myprogram2.exe", + resourceFiles = new object[] + { +new +{ +httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", +filePath = "myprogram2.exe", +} + }, + environmentSettings = new object[] + { +new +{ +name = "myvariable", +value = "myvalue", +} + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + maxTaskRetryCount = 2, + waitForSuccess = true, + }, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + targetNodeCommunicationMode = "default", + }, + }, + }, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + }); Response response = client.CreateJob(content); Console.WriteLine(response.Status); @@ -1612,7 +2876,139 @@ public async Task Example_Batch_CreateJob_CreatesAComplexJob_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "jobId", + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + jobManagerTask = new + { + id = "taskId", + commandLine = "myprogram.exe", + resourceFiles = new object[] + { +new +{ +httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", +filePath = "myprogram.exe", +}, +new +{ +storageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", +filePath = "datafolder", +} + }, + environmentSettings = new object[] + { +new +{ +name = "myvariable", +value = "myvalue", +} + }, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = 0, + retentionTime = "PT1H", + }, + requiredSlots = 2, + killJobOnCompletion = false, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + runExclusive = true, + }, + poolInfo = new + { + autoPoolSpecification = new + { + autoPoolIdPrefix = "mypool", + poolLifetimeOption = "job", + pool = new + { + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 3, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 2, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + startTask = new + { + commandLine = "myprogram2.exe", + resourceFiles = new object[] + { +new +{ +httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", +filePath = "myprogram2.exe", +} + }, + environmentSettings = new object[] + { +new +{ +name = "myvariable", +value = "myvalue", +} + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + maxTaskRetryCount = 2, + waitForSuccess = true, + }, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + targetNodeCommunicationMode = "default", + }, + }, + }, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + }); Response response = await client.CreateJobAsync(content); Console.WriteLine(response.Status); @@ -1626,7 +3022,96 @@ public void Example_Batch_CreateJob_CreatesAComplexJob_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobCreateContent job = new BatchJobCreateContent(null, null); + BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo + { + AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.Job) + { + AutoPoolIdPrefix = "mypool", + Pool = new BatchPoolSpecification("Standard_D1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TaskSlotsPerNode = 2, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 3, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + StartTask = new BatchStartTask("myprogram2.exe") + { + ResourceFiles = {new ResourceFile +{ +HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", +FilePath = "myprogram2.exe", +}}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") +{ +Value = "myvalue", +}}, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + MaxTaskRetryCount = 2, + WaitForSuccess = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, + }, + }, + }) + { + Priority = 100, + Constraints = new BatchJobConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = -1, + }, + JobManagerTask = new BatchJobManagerTask("taskId", "myprogram.exe") + { + ResourceFiles = {new ResourceFile +{ +HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", +FilePath = "myprogram.exe", +}, new ResourceFile +{ +StorageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", +FilePath = "datafolder", +}}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") +{ +Value = "myvalue", +}}, + Constraints = new BatchTaskConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + RetentionTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = 0, + }, + RequiredSlots = 2, + KillJobOnCompletion = false, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + RunExclusive = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, + }; Response response = client.CreateJob(job); } @@ -1638,7 +3123,96 @@ public async Task Example_Batch_CreateJob_CreatesAComplexJob_Convenience_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobCreateContent job = new BatchJobCreateContent(null, null); + BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo + { + AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.Job) + { + AutoPoolIdPrefix = "mypool", + Pool = new BatchPoolSpecification("Standard_D1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TaskSlotsPerNode = 2, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 3, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + StartTask = new BatchStartTask("myprogram2.exe") + { + ResourceFiles = {new ResourceFile +{ +HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", +FilePath = "myprogram2.exe", +}}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") +{ +Value = "myvalue", +}}, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + MaxTaskRetryCount = 2, + WaitForSuccess = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, + }, + }, + }) + { + Priority = 100, + Constraints = new BatchJobConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = -1, + }, + JobManagerTask = new BatchJobManagerTask("taskId", "myprogram.exe") + { + ResourceFiles = {new ResourceFile +{ +HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", +FilePath = "myprogram.exe", +}, new ResourceFile +{ +StorageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", +FilePath = "datafolder", +}}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") +{ +Value = "myvalue", +}}, + Constraints = new BatchTaskConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + RetentionTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = 0, + }, + RequiredSlots = 2, + KillJobOnCompletion = false, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + RunExclusive = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, + }; Response response = await client.CreateJobAsync(job); } @@ -1794,7 +3368,27 @@ public void Example_Batch_UpdateJobSchedule_JobSchedulePatch() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + schedule = new + { + doNotRunUntil = "2025-01-01T12:30:00Z", + }, + jobSpecification = new + { + priority = 0, + usesTaskDependencies = false, + constraints = new + { + maxWallClockTime = "P10675199DT2H48M5.4775807S", + maxTaskRetryCount = 0, + }, + poolInfo = new + { + poolId = "poolId", + }, + }, + }); Response response = client.UpdateJobSchedule("jobScheduleId", content); Console.WriteLine(response.Status); @@ -1808,7 +3402,27 @@ public async Task Example_Batch_UpdateJobSchedule_JobSchedulePatch_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + schedule = new + { + doNotRunUntil = "2025-01-01T12:30:00Z", + }, + jobSpecification = new + { + priority = 0, + usesTaskDependencies = false, + constraints = new + { + maxWallClockTime = "P10675199DT2H48M5.4775807S", + maxTaskRetryCount = 0, + }, + poolInfo = new + { + poolId = "poolId", + }, + }, + }); Response response = await client.UpdateJobScheduleAsync("jobScheduleId", content); Console.WriteLine(response.Status); @@ -2028,7 +3642,21 @@ public void Example_Batch_CreateJobSchedule_CreatesABasicJobSchedule() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "jobScheduleId", + schedule = new + { + recurrenceInterval = "PT5M", + }, + jobSpecification = new + { + poolInfo = new + { + poolId = "poolId", + }, + }, + }); Response response = client.CreateJobSchedule(content); Console.WriteLine(response.Status); @@ -2042,7 +3670,21 @@ public async Task Example_Batch_CreateJobSchedule_CreatesABasicJobSchedule_Async TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "jobScheduleId", + schedule = new + { + recurrenceInterval = "PT5M", + }, + jobSpecification = new + { + poolInfo = new + { + poolId = "poolId", + }, + }, + }); Response response = await client.CreateJobScheduleAsync(content); Console.WriteLine(response.Status); @@ -2056,7 +3698,13 @@ public void Example_Batch_CreateJobSchedule_CreatesABasicJobSchedule_Convenience TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); + BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration + { + RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), + }, new BatchJobSpecification(new BatchPoolInfo + { + PoolId = "poolId", + })); Response response = client.CreateJobSchedule(jobSchedule); } @@ -2068,7 +3716,13 @@ public async Task Example_Batch_CreateJobSchedule_CreatesABasicJobSchedule_Conve TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); + BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration + { + RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), + }, new BatchJobSpecification(new BatchPoolInfo + { + PoolId = "poolId", + })); Response response = await client.CreateJobScheduleAsync(jobSchedule); } @@ -2080,7 +3734,149 @@ public void Example_Batch_CreateJobSchedule_CreatesAComplexJobScheduleAdd() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "jobScheduleId", + schedule = new + { + doNotRunUntil = "2014-09-10T02:30:00.000Z", + doNotRunAfter = "2014-09-10T06:30:00.000Z", + startWindow = "PT1M", + recurrenceInterval = "PT5M", + }, + jobSpecification = new + { + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + jobManagerTask = new + { + id = "mytask1", + commandLine = "myprogram.exe", + resourceFiles = new object[] + { +new +{ +httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", +filePath = "myprogram.exe", +}, +new +{ +httpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", +filePath = "test.txt", +} + }, + environmentSettings = new object[] + { +new +{ +name = "myvariable", +value = "myvalue", +} + }, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = 0, + retentionTime = "PT1H", + }, + requiredSlots = 2, + killJobOnCompletion = true, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, + runExclusive = true, + }, + poolInfo = new + { + autoPoolSpecification = new + { + autoPoolIdPrefix = "mypool", + poolLifetimeOption = "jobschedule", + pool = new + { + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 3, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 2, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + startTask = new + { + commandLine = "myprogram2.exe", + resourceFiles = new object[] + { +new +{ +httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", +filePath = "myprogram2.exe", +} + }, + environmentSettings = new object[] + { +new +{ +name = "myvariable", +value = "myvalue", +} + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + maxTaskRetryCount = 2, + waitForSuccess = true, + }, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + targetNodeCommunicationMode = "default", + }, + }, + }, + }, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + }); Response response = client.CreateJobSchedule(content); Console.WriteLine(response.Status); @@ -2094,7 +3890,149 @@ public async Task Example_Batch_CreateJobSchedule_CreatesAComplexJobScheduleAdd_ TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "jobScheduleId", + schedule = new + { + doNotRunUntil = "2014-09-10T02:30:00.000Z", + doNotRunAfter = "2014-09-10T06:30:00.000Z", + startWindow = "PT1M", + recurrenceInterval = "PT5M", + }, + jobSpecification = new + { + priority = 100, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = -1, + }, + jobManagerTask = new + { + id = "mytask1", + commandLine = "myprogram.exe", + resourceFiles = new object[] + { +new +{ +httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", +filePath = "myprogram.exe", +}, +new +{ +httpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", +filePath = "test.txt", +} + }, + environmentSettings = new object[] + { +new +{ +name = "myvariable", +value = "myvalue", +} + }, + constraints = new + { + maxWallClockTime = "PT1H", + maxTaskRetryCount = 0, + retentionTime = "PT1H", + }, + requiredSlots = 2, + killJobOnCompletion = true, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, + runExclusive = true, + }, + poolInfo = new + { + autoPoolSpecification = new + { + autoPoolIdPrefix = "mypool", + poolLifetimeOption = "jobschedule", + pool = new + { + vmSize = "Standard_D1_v2", + virtualMachineConfiguration = new + { + imageReference = new + { + publisher = "MicrosoftWindowsServer", + offer = "WindowsServer", + sku = "2016-datacenter-smalldisk", + version = "latest", + }, + nodeAgentSKUId = "batch.node.windows amd64", + }, + resizeTimeout = "PT15M", + targetDedicatedNodes = 3, + targetLowPriorityNodes = 0, + taskSlotsPerNode = 2, + taskSchedulingPolicy = new + { + nodeFillType = "spread", + }, + enableAutoScale = false, + enableInterNodeCommunication = true, + startTask = new + { + commandLine = "myprogram2.exe", + resourceFiles = new object[] + { +new +{ +httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", +filePath = "myprogram2.exe", +} + }, + environmentSettings = new object[] + { +new +{ +name = "myvariable", +value = "myvalue", +} + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "admin", + }, + }, + maxTaskRetryCount = 2, + waitForSuccess = true, + }, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + targetNodeCommunicationMode = "default", + }, + }, + }, + }, + metadata = new object[] + { +new +{ +name = "myproperty", +value = "myvalue", +} + }, + }); Response response = await client.CreateJobScheduleAsync(content); Console.WriteLine(response.Status); @@ -2108,7 +4046,104 @@ public void Example_Batch_CreateJobSchedule_CreatesAComplexJobScheduleAdd_Conven TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); + BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration + { + DoNotRunUntil = DateTimeOffset.Parse("2014-09-10T02:30:00.000Z"), + DoNotRunAfter = DateTimeOffset.Parse("2014-09-10T06:30:00.000Z"), + StartWindow = XmlConvert.ToTimeSpan("PT1M"), + RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), + }, new BatchJobSpecification(new BatchPoolInfo + { + AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.JobSchedule) + { + AutoPoolIdPrefix = "mypool", + Pool = new BatchPoolSpecification("Standard_D1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TaskSlotsPerNode = 2, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 3, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + StartTask = new BatchStartTask("myprogram2.exe") + { + ResourceFiles = {new ResourceFile +{ +HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", +FilePath = "myprogram2.exe", +}}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") +{ +Value = "myvalue", +}}, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + MaxTaskRetryCount = 2, + WaitForSuccess = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, + }, + }, + }) + { + Priority = 100, + Constraints = new BatchJobConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = -1, + }, + JobManagerTask = new BatchJobManagerTask("mytask1", "myprogram.exe") + { + ResourceFiles = {new ResourceFile +{ +HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", +FilePath = "myprogram.exe", +}, new ResourceFile +{ +HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", +FilePath = "test.txt", +}}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") +{ +Value = "myvalue", +}}, + Constraints = new BatchTaskConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + RetentionTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = 0, + }, + RequiredSlots = 2, + KillJobOnCompletion = true, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, + RunExclusive = true, + }, + }) + { + Metadata = { new MetadataItem("myproperty", "myvalue") }, + }; Response response = client.CreateJobSchedule(jobSchedule); } @@ -2120,7 +4155,104 @@ public async Task Example_Batch_CreateJobSchedule_CreatesAComplexJobScheduleAdd_ TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); + BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration + { + DoNotRunUntil = DateTimeOffset.Parse("2014-09-10T02:30:00.000Z"), + DoNotRunAfter = DateTimeOffset.Parse("2014-09-10T06:30:00.000Z"), + StartWindow = XmlConvert.ToTimeSpan("PT1M"), + RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), + }, new BatchJobSpecification(new BatchPoolInfo + { + AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.JobSchedule) + { + AutoPoolIdPrefix = "mypool", + Pool = new BatchPoolSpecification("Standard_D1_v2") + { + VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference + { + Publisher = "MicrosoftWindowsServer", + Offer = "WindowsServer", + Sku = "2016-datacenter-smalldisk", + Version = "latest", + }, "batch.node.windows amd64"), + TaskSlotsPerNode = 2, + TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), + ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), + TargetDedicatedNodes = 3, + TargetLowPriorityNodes = 0, + EnableAutoScale = false, + EnableInterNodeCommunication = true, + StartTask = new BatchStartTask("myprogram2.exe") + { + ResourceFiles = {new ResourceFile +{ +HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", +FilePath = "myprogram2.exe", +}}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") +{ +Value = "myvalue", +}}, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.Admin, + }, + }, + MaxTaskRetryCount = 2, + WaitForSuccess = true, + }, + Metadata = { new MetadataItem("myproperty", "myvalue") }, + TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, + }, + }, + }) + { + Priority = 100, + Constraints = new BatchJobConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = -1, + }, + JobManagerTask = new BatchJobManagerTask("mytask1", "myprogram.exe") + { + ResourceFiles = {new ResourceFile +{ +HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", +FilePath = "myprogram.exe", +}, new ResourceFile +{ +HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", +FilePath = "test.txt", +}}, + EnvironmentSettings = {new EnvironmentSetting("myvariable") +{ +Value = "myvalue", +}}, + Constraints = new BatchTaskConstraints + { + MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), + RetentionTime = XmlConvert.ToTimeSpan("PT1H"), + MaxTaskRetryCount = 0, + }, + RequiredSlots = 2, + KillJobOnCompletion = true, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, + RunExclusive = true, + }, + }) + { + Metadata = { new MetadataItem("myproperty", "myvalue") }, + }; Response response = await client.CreateJobScheduleAsync(jobSchedule); } @@ -2132,7 +4264,11 @@ public void Example_Batch_CreateTask_CreatesABasicTask() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "task1", + commandLine = "cmd /c echo task1", + }); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -2146,7 +4282,11 @@ public async Task Example_Batch_CreateTask_CreatesABasicTask_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "task1", + commandLine = "cmd /c echo task1", + }); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -2160,7 +4300,7 @@ public void Example_Batch_CreateTask_CreatesABasicTask_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); + BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1"); Response response = client.CreateTask("jobId", task); } @@ -2172,7 +4312,7 @@ public async Task Example_Batch_CreateTask_CreatesABasicTask_Convenience_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); + BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1"); Response response = await client.CreateTaskAsync("jobId", task); } @@ -2184,7 +4324,24 @@ public void Example_Batch_CreateTask_CreatesATaskWithContainerSettings() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "taskId", + commandLine = "bash -c 'echo hello'", + containerSettings = new + { + imageName = "ubuntu", + containerRunOptions = "--rm", + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, + }); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -2198,7 +4355,24 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithContainerSettings_Asy TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "taskId", + commandLine = "bash -c 'echo hello'", + containerSettings = new + { + imageName = "ubuntu", + containerRunOptions = "--rm", + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, + }); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -2212,7 +4386,21 @@ public void Example_Batch_CreateTask_CreatesATaskWithContainerSettings_Convenien TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); + BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "bash -c 'echo hello'") + { + ContainerSettings = new BatchTaskContainerSettings("ubuntu") + { + ContainerRunOptions = "--rm", + }, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, + }; Response response = client.CreateTask("jobId", task); } @@ -2224,7 +4412,21 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithContainerSettings_Con TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); + BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "bash -c 'echo hello'") + { + ContainerSettings = new BatchTaskContainerSettings("ubuntu") + { + ContainerRunOptions = "--rm", + }, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, + }; Response response = await client.CreateTaskAsync("jobId", task); } @@ -2236,7 +4438,34 @@ public void Example_Batch_CreateTask_CreatesATaskWithExitConditions() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "taskId", + commandLine = "cmd /c exit 3", + exitConditions = new + { + exitCodeRanges = new object[] + { +new +{ +start = 2, +end = 4, +exitOptions = new +{ +jobAction = "terminate", +}, +} + }, + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, + }); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -2250,7 +4479,34 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithExitConditions_Async( TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "taskId", + commandLine = "cmd /c exit 3", + exitConditions = new + { + exitCodeRanges = new object[] + { +new +{ +start = 2, +end = 4, +exitOptions = new +{ +jobAction = "terminate", +}, +} + }, + }, + userIdentity = new + { + autoUser = new + { + scope = "task", + elevationLevel = "nonadmin", + }, + }, + }); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -2264,7 +4520,24 @@ public void Example_Batch_CreateTask_CreatesATaskWithExitConditions_Convenience( TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); + BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "cmd /c exit 3") + { + ExitConditions = new ExitConditions + { + ExitCodeRanges = {new ExitCodeRangeMapping(2, 4, new ExitOptions +{ +JobAction = BatchJobAction.Terminate, +})}, + }, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, + }; Response response = client.CreateTask("jobId", task); } @@ -2276,7 +4549,24 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithExitConditions_Conven TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); + BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "cmd /c exit 3") + { + ExitConditions = new ExitConditions + { + ExitCodeRanges = {new ExitCodeRangeMapping(2, 4, new ExitOptions +{ +JobAction = BatchJobAction.Terminate, +})}, + }, + UserIdentity = new UserIdentity + { + AutoUser = new AutoUserSpecification + { + Scope = AutoUserScope.Task, + ElevationLevel = ElevationLevel.NonAdmin, + }, + }, + }; Response response = await client.CreateTaskAsync("jobId", task); } @@ -2288,7 +4578,12 @@ public void Example_Batch_CreateTask_CreatesATaskWithExtraSlotRequirement() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "task1", + requiredSlots = 2, + commandLine = "cmd /c echo task1", + }); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -2302,7 +4597,12 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithExtraSlotRequirement_ TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + id = "task1", + requiredSlots = 2, + commandLine = "cmd /c echo task1", + }); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -2316,7 +4616,10 @@ public void Example_Batch_CreateTask_CreatesATaskWithExtraSlotRequirement_Conven TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); + BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1") + { + RequiredSlots = 2, + }; Response response = client.CreateTask("jobId", task); } @@ -2328,7 +4631,10 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithExtraSlotRequirement_ TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); + BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1") + { + RequiredSlots = 2, + }; Response response = await client.CreateTaskAsync("jobId", task); } @@ -2340,7 +4646,22 @@ public void Example_Batch_CreateTaskCollection_CreatesABasicCollectionOfTasks() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + value = new object[] + { +new +{ +id = "simple1", +commandLine = "cmd /c dir /s", +}, +new +{ +id = "simple2", +commandLine = "cmd /c dir /s", +} + }, + }); Response response = client.CreateTaskCollection("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -2355,7 +4676,22 @@ public async Task Example_Batch_CreateTaskCollection_CreatesABasicCollectionOfTa TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + value = new object[] + { +new +{ +id = "simple1", +commandLine = "cmd /c dir /s", +}, +new +{ +id = "simple2", +commandLine = "cmd /c dir /s", +} + }, + }); Response response = await client.CreateTaskCollectionAsync("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -2370,7 +4706,11 @@ public void Example_Batch_CreateTaskCollection_CreatesABasicCollectionOfTasks_Co TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskGroup taskCollection = new BatchTaskGroup(null); + BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] + { +new BatchTaskCreateContent("simple1", "cmd /c dir /s"), +new BatchTaskCreateContent("simple2", "cmd /c dir /s") + }); Response response = client.CreateTaskCollection("jobId", taskCollection); } @@ -2382,7 +4722,11 @@ public async Task Example_Batch_CreateTaskCollection_CreatesABasicCollectionOfTa TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskGroup taskCollection = new BatchTaskGroup(null); + BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] + { +new BatchTaskCreateContent("simple1", "cmd /c dir /s"), +new BatchTaskCreateContent("simple2", "cmd /c dir /s") + }); Response response = await client.CreateTaskCollectionAsync("jobId", taskCollection); } @@ -2394,7 +4738,67 @@ public void Example_Batch_CreateTaskCollection_CreatesAComplexCollectionOfTasks( TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + value = new object[] + { +new +{ +id = "complex1", +commandLine = "cmd /c dir /s", +resourceFiles = new object[] +{ +new +{ +autoStorageContainerName = "containerName", +filePath = "data", +} +}, +environmentSettings = new object[] +{ +new +{ +name = "env1", +value = "value1", +}, +new +{ +name = "env2", +value = "value2", +} +}, +affinityInfo = new +{ +affinityId = "affinityId", +}, +constraints = new +{ +maxWallClockTime = "P1D", +retentionTime = "P2D", +maxTaskRetryCount = 5, +}, +requiredSlots = 2, +multiInstanceSettings = new +{ +numberOfInstances = 3, +coordinationCommandLine = "cmd /c echo coordinating", +commonResourceFiles = new object[] +{ +new +{ +httpUrl = "https://common.blob.core.windows.net/", +filePath = "common.exe", +} +}, +}, +}, +new +{ +id = "simple3", +commandLine = "cmd /c dir /s", +} + }, + }); Response response = client.CreateTaskCollection("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -2409,7 +4813,67 @@ public async Task Example_Batch_CreateTaskCollection_CreatesAComplexCollectionOf TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + value = new object[] + { +new +{ +id = "complex1", +commandLine = "cmd /c dir /s", +resourceFiles = new object[] +{ +new +{ +autoStorageContainerName = "containerName", +filePath = "data", +} +}, +environmentSettings = new object[] +{ +new +{ +name = "env1", +value = "value1", +}, +new +{ +name = "env2", +value = "value2", +} +}, +affinityInfo = new +{ +affinityId = "affinityId", +}, +constraints = new +{ +maxWallClockTime = "P1D", +retentionTime = "P2D", +maxTaskRetryCount = 5, +}, +requiredSlots = 2, +multiInstanceSettings = new +{ +numberOfInstances = 3, +coordinationCommandLine = "cmd /c echo coordinating", +commonResourceFiles = new object[] +{ +new +{ +httpUrl = "https://common.blob.core.windows.net/", +filePath = "common.exe", +} +}, +}, +}, +new +{ +id = "simple3", +commandLine = "cmd /c dir /s", +} + }, + }); Response response = await client.CreateTaskCollectionAsync("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -2424,7 +4888,42 @@ public void Example_Batch_CreateTaskCollection_CreatesAComplexCollectionOfTasks_ TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskGroup taskCollection = new BatchTaskGroup(null); + BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] + { +new BatchTaskCreateContent("complex1", "cmd /c dir /s") +{ +ResourceFiles = {new ResourceFile +{ +AutoStorageContainerName = "containerName", +FilePath = "data", +}}, +EnvironmentSettings = {new EnvironmentSetting("env1") +{ +Value = "value1", +}, new EnvironmentSetting("env2") +{ +Value = "value2", +}}, +AffinityInfo = new AffinityInfo("affinityId"), +Constraints = new BatchTaskConstraints +{ +MaxWallClockTime = XmlConvert.ToTimeSpan("P1D"), +RetentionTime = XmlConvert.ToTimeSpan("P2D"), +MaxTaskRetryCount = 5, +}, +RequiredSlots = 2, +MultiInstanceSettings = new MultiInstanceSettings("cmd /c echo coordinating") +{ +NumberOfInstances = 3, +CommonResourceFiles = {new ResourceFile +{ +HttpUrl = "https://common.blob.core.windows.net/", +FilePath = "common.exe", +}}, +}, +}, +new BatchTaskCreateContent("simple3", "cmd /c dir /s") + }); Response response = client.CreateTaskCollection("jobId", taskCollection); } @@ -2436,7 +4935,42 @@ public async Task Example_Batch_CreateTaskCollection_CreatesAComplexCollectionOf TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskGroup taskCollection = new BatchTaskGroup(null); + BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] + { +new BatchTaskCreateContent("complex1", "cmd /c dir /s") +{ +ResourceFiles = {new ResourceFile +{ +AutoStorageContainerName = "containerName", +FilePath = "data", +}}, +EnvironmentSettings = {new EnvironmentSetting("env1") +{ +Value = "value1", +}, new EnvironmentSetting("env2") +{ +Value = "value2", +}}, +AffinityInfo = new AffinityInfo("affinityId"), +Constraints = new BatchTaskConstraints +{ +MaxWallClockTime = XmlConvert.ToTimeSpan("P1D"), +RetentionTime = XmlConvert.ToTimeSpan("P2D"), +MaxTaskRetryCount = 5, +}, +RequiredSlots = 2, +MultiInstanceSettings = new MultiInstanceSettings("cmd /c echo coordinating") +{ +NumberOfInstances = 3, +CommonResourceFiles = {new ResourceFile +{ +HttpUrl = "https://common.blob.core.windows.net/", +FilePath = "common.exe", +}}, +}, +}, +new BatchTaskCreateContent("simple3", "cmd /c dir /s") + }); Response response = await client.CreateTaskCollectionAsync("jobId", taskCollection); } @@ -2736,7 +5270,13 @@ public void Example_Batch_CreateNodeUser_NodeCreateUser() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + name = "userName", + isAdmin = false, + expiryTime = "2017-08-01T00:00:00Z", + password = "Password", + }); Response response = client.CreateNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", content); Console.WriteLine(response.Status); @@ -2750,7 +5290,13 @@ public async Task Example_Batch_CreateNodeUser_NodeCreateUser_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + name = "userName", + isAdmin = false, + expiryTime = "2017-08-01T00:00:00Z", + password = "Password", + }); Response response = await client.CreateNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); Console.WriteLine(response.Status); @@ -2764,7 +5310,12 @@ public void Example_Batch_CreateNodeUser_NodeCreateUser_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeUserCreateContent user = new BatchNodeUserCreateContent(null); + BatchNodeUserCreateContent user = new BatchNodeUserCreateContent("userName") + { + IsAdmin = false, + ExpiryTime = DateTimeOffset.Parse("2017-08-01T00:00:00Z"), + Password = "Password", + }; Response response = client.CreateNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", user); } @@ -2776,7 +5327,12 @@ public async Task Example_Batch_CreateNodeUser_NodeCreateUser_Convenience_Async( TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeUserCreateContent user = new BatchNodeUserCreateContent(null); + BatchNodeUserCreateContent user = new BatchNodeUserCreateContent("userName") + { + IsAdmin = false, + ExpiryTime = DateTimeOffset.Parse("2017-08-01T00:00:00Z"), + Password = "Password", + }; Response response = await client.CreateNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", user); } @@ -2814,7 +5370,11 @@ public void Example_Batch_ReplaceNodeUser_NodeUpdateUser() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + password = "12345", + expiryTime = "2016-11-27T00:45:48.7320857Z", + }); Response response = client.ReplaceNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); Console.WriteLine(response.Status); @@ -2828,7 +5388,11 @@ public async Task Example_Batch_ReplaceNodeUser_NodeUpdateUser_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + password = "12345", + expiryTime = "2016-11-27T00:45:48.7320857Z", + }); Response response = await client.ReplaceNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); Console.WriteLine(response.Status); @@ -2842,7 +5406,11 @@ public void Example_Batch_ReplaceNodeUser_NodeUpdateUser_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent(); + BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent + { + Password = "12345", + ExpiryTime = DateTimeOffset.Parse("2016-11-27T00:45:48.7320857Z"), + }; Response response = client.ReplaceNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); } @@ -2854,7 +5422,11 @@ public async Task Example_Batch_ReplaceNodeUser_NodeUpdateUser_Convenience_Async TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent(); + BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent + { + Password = "12345", + ExpiryTime = DateTimeOffset.Parse("2016-11-27T00:45:48.7320857Z"), + }; Response response = await client.ReplaceNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); } @@ -3094,7 +5666,11 @@ public void Example_Batch_UploadNodeLogs_UploadBatchServiceLogs() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + containerUrl = "https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", + startTime = "2017-11-27T00:00:00Z", + }); Response response = client.UploadNodeLogs("poolId", "tvm-1695681911_1-20161121t182739z", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -3110,7 +5686,11 @@ public async Task Example_Batch_UploadNodeLogs_UploadBatchServiceLogs_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new object()); + using RequestContent content = RequestContent.Create(new + { + containerUrl = "https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", + startTime = "2017-11-27T00:00:00Z", + }); Response response = await client.UploadNodeLogsAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -3126,7 +5706,7 @@ public void Example_Batch_UploadNodeLogs_UploadBatchServiceLogs_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent(null, default); + UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent("https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", DateTimeOffset.Parse("2017-11-27T00:00:00Z")); Response response = client.UploadNodeLogs("poolId", "tvm-1695681911_1-20161121t182739z", content); } @@ -3138,7 +5718,7 @@ public async Task Example_Batch_UploadNodeLogs_UploadBatchServiceLogs_Convenienc TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent(null, default); + UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent("https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", DateTimeOffset.Parse("2017-11-27T00:00:00Z")); Response response = await client.UploadNodeLogsAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); }