diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventBaseProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventBaseProperties.Serialization.cs deleted file mode 100644 index 172820121300..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventBaseProperties.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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatEventBaseProperties : 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(AcsChatEventBaseProperties)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("recipientCommunicationIdentifier"u8); - writer.WriteObjectValue(RecipientCommunicationIdentifier, options); - if (Optional.IsDefined(TransactionId)) - { - writer.WritePropertyName("transactionId"u8); - writer.WriteStringValue(TransactionId); - } - if (Optional.IsDefined(ThreadId)) - { - writer.WritePropertyName("threadId"u8); - writer.WriteStringValue(ThreadId); - } - 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 - } - } - } - - AcsChatEventBaseProperties 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(AcsChatEventBaseProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatEventBaseProperties(document.RootElement, options); - } - - internal static AcsChatEventBaseProperties DeserializeAcsChatEventBaseProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationIdentifierModel recipientCommunicationIdentifier = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("recipientCommunicationIdentifier"u8)) - { - recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatEventBaseProperties(recipientCommunicationIdentifier, transactionId, threadId, 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(AcsChatEventBaseProperties)} does not support writing '{options.Format}' format."); - } - } - - AcsChatEventBaseProperties 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 DeserializeAcsChatEventBaseProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatEventBaseProperties)} 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 AcsChatEventBaseProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatEventBaseProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventBaseProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventBaseProperties.cs deleted file mode 100644 index ab0c02f851ba..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventBaseProperties.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of all chat events. - public partial class AcsChatEventBaseProperties - { - /// - /// 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 communication identifier of the target user. - /// is null. - internal AcsChatEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier) - { - Argument.AssertNotNull(recipientCommunicationIdentifier, nameof(recipientCommunicationIdentifier)); - - RecipientCommunicationIdentifier = recipientCommunicationIdentifier; - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - internal AcsChatEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier, string transactionId, string threadId, IDictionary serializedAdditionalRawData) - { - RecipientCommunicationIdentifier = recipientCommunicationIdentifier; - TransactionId = transactionId; - ThreadId = threadId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatEventBaseProperties() - { - } - - /// The communication identifier of the target user. - public CommunicationIdentifierModel RecipientCommunicationIdentifier { get; } - /// The transaction id will be used as co-relation vector. - public string TransactionId { get; } - /// The chat thread id. - public string ThreadId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventInThreadBaseProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventInThreadBaseProperties.Serialization.cs deleted file mode 100644 index 8c1f443284ad..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventInThreadBaseProperties.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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatEventInThreadBaseProperties : 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(AcsChatEventInThreadBaseProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TransactionId)) - { - writer.WritePropertyName("transactionId"u8); - writer.WriteStringValue(TransactionId); - } - if (Optional.IsDefined(ThreadId)) - { - writer.WritePropertyName("threadId"u8); - writer.WriteStringValue(ThreadId); - } - 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 - } - } - } - - AcsChatEventInThreadBaseProperties 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(AcsChatEventInThreadBaseProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatEventInThreadBaseProperties(document.RootElement, options); - } - - internal static AcsChatEventInThreadBaseProperties DeserializeAcsChatEventInThreadBaseProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatEventInThreadBaseProperties(transactionId, threadId, 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(AcsChatEventInThreadBaseProperties)} does not support writing '{options.Format}' format."); - } - } - - AcsChatEventInThreadBaseProperties 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 DeserializeAcsChatEventInThreadBaseProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatEventInThreadBaseProperties)} 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 AcsChatEventInThreadBaseProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatEventInThreadBaseProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventInThreadBaseProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventInThreadBaseProperties.cs deleted file mode 100644 index a19356f6f111..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatEventInThreadBaseProperties.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of all thread-level chat events. - public partial class AcsChatEventInThreadBaseProperties - { - /// - /// 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 . - internal AcsChatEventInThreadBaseProperties() - { - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - internal AcsChatEventInThreadBaseProperties(string transactionId, string threadId, IDictionary serializedAdditionalRawData) - { - TransactionId = transactionId; - ThreadId = threadId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The transaction id will be used as co-relation vector. - public string TransactionId { get; } - /// The chat thread id. - public string ThreadId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedEventData.Serialization.cs deleted file mode 100644 index a4aae168de79..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedEventData.Serialization.cs +++ /dev/null @@ -1,197 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatMessageDeletedEventData : 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(AcsChatMessageDeletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("deleteTime"u8); - writer.WriteStringValue(DeleteTime, "O"); - } - - AcsChatMessageDeletedEventData 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(AcsChatMessageDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatMessageDeletedEventData(document.RootElement, options); - } - - internal static AcsChatMessageDeletedEventData DeserializeAcsChatMessageDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset deleteTime = default; - string messageId = default; - CommunicationIdentifierModel senderCommunicationIdentifier = default; - string senderDisplayName = default; - DateTimeOffset composeTime = default; - string type = default; - long? version = default; - CommunicationIdentifierModel recipientCommunicationIdentifier = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deleteTime"u8)) - { - deleteTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("senderCommunicationIdentifier"u8)) - { - senderCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("senderDisplayName"u8)) - { - senderDisplayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("composeTime"u8)) - { - composeTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("recipientCommunicationIdentifier"u8)) - { - recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatMessageDeletedEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - deleteTime); - } - - 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(AcsChatMessageDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatMessageDeletedEventData 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 DeserializeAcsChatMessageDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatMessageDeletedEventData)} 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 AcsChatMessageDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatMessageDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedEventData.cs deleted file mode 100644 index 29bd2123a788..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedEventData.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatMessageDeleted event. - public partial class AcsChatMessageDeletedEventData : AcsChatMessageEventBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The communication identifier of the sender. - /// The original compose time of the message. - /// The time at which the message was deleted. - /// or is null. - internal AcsChatMessageDeletedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, CommunicationIdentifierModel senderCommunicationIdentifier, DateTimeOffset composeTime, DateTimeOffset deleteTime) : base(recipientCommunicationIdentifier, senderCommunicationIdentifier, composeTime) - { - Argument.AssertNotNull(recipientCommunicationIdentifier, nameof(recipientCommunicationIdentifier)); - Argument.AssertNotNull(senderCommunicationIdentifier, nameof(senderCommunicationIdentifier)); - - DeleteTime = deleteTime; - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The time at which the message was deleted. - internal AcsChatMessageDeletedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, string transactionId, string threadId, IDictionary serializedAdditionalRawData, string messageId, CommunicationIdentifierModel senderCommunicationIdentifier, string senderDisplayName, DateTimeOffset composeTime, string type, long? version, DateTimeOffset deleteTime) : base(recipientCommunicationIdentifier, transactionId, threadId, serializedAdditionalRawData, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version) - { - DeleteTime = deleteTime; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatMessageDeletedEventData() - { - } - - /// The time at which the message was deleted. - public DateTimeOffset DeleteTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedInThreadEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedInThreadEventData.Serialization.cs deleted file mode 100644 index bceef0c48673..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedInThreadEventData.Serialization.cs +++ /dev/null @@ -1,190 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatMessageDeletedInThreadEventData : 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(AcsChatMessageDeletedInThreadEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("deleteTime"u8); - writer.WriteStringValue(DeleteTime, "O"); - } - - AcsChatMessageDeletedInThreadEventData 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(AcsChatMessageDeletedInThreadEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatMessageDeletedInThreadEventData(document.RootElement, options); - } - - internal static AcsChatMessageDeletedInThreadEventData DeserializeAcsChatMessageDeletedInThreadEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset deleteTime = default; - string messageId = default; - CommunicationIdentifierModel senderCommunicationIdentifier = default; - string senderDisplayName = default; - DateTimeOffset composeTime = default; - string type = default; - long? version = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deleteTime"u8)) - { - deleteTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("senderCommunicationIdentifier"u8)) - { - senderCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("senderDisplayName"u8)) - { - senderDisplayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("composeTime"u8)) - { - composeTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatMessageDeletedInThreadEventData( - transactionId, - threadId, - serializedAdditionalRawData, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - deleteTime); - } - - 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(AcsChatMessageDeletedInThreadEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatMessageDeletedInThreadEventData 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 DeserializeAcsChatMessageDeletedInThreadEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatMessageDeletedInThreadEventData)} 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 AcsChatMessageDeletedInThreadEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatMessageDeletedInThreadEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedInThreadEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedInThreadEventData.cs deleted file mode 100644 index fdf50c683027..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageDeletedInThreadEventData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatMessageDeletedInThread event. - public partial class AcsChatMessageDeletedInThreadEventData : AcsChatMessageEventInThreadBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the sender. - /// The original compose time of the message. - /// The time at which the message was deleted. - /// is null. - internal AcsChatMessageDeletedInThreadEventData(CommunicationIdentifierModel senderCommunicationIdentifier, DateTimeOffset composeTime, DateTimeOffset deleteTime) : base(senderCommunicationIdentifier, composeTime) - { - Argument.AssertNotNull(senderCommunicationIdentifier, nameof(senderCommunicationIdentifier)); - - DeleteTime = deleteTime; - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The time at which the message was deleted. - internal AcsChatMessageDeletedInThreadEventData(string transactionId, string threadId, IDictionary serializedAdditionalRawData, string messageId, CommunicationIdentifierModel senderCommunicationIdentifier, string senderDisplayName, DateTimeOffset composeTime, string type, long? version, DateTimeOffset deleteTime) : base(transactionId, threadId, serializedAdditionalRawData, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version) - { - DeleteTime = deleteTime; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatMessageDeletedInThreadEventData() - { - } - - /// The time at which the message was deleted. - public DateTimeOffset DeleteTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedEventData.Serialization.cs deleted file mode 100644 index 97ee30c1867a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedEventData.Serialization.cs +++ /dev/null @@ -1,229 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatMessageEditedEventData : 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(AcsChatMessageEditedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(MessageBody)) - { - writer.WritePropertyName("messageBody"u8); - writer.WriteStringValue(MessageBody); - } - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("editTime"u8); - writer.WriteStringValue(EditTime, "O"); - } - - AcsChatMessageEditedEventData 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(AcsChatMessageEditedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatMessageEditedEventData(document.RootElement, options); - } - - internal static AcsChatMessageEditedEventData DeserializeAcsChatMessageEditedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string messageBody = default; - IReadOnlyDictionary metadata = default; - DateTimeOffset editTime = default; - string messageId = default; - CommunicationIdentifierModel senderCommunicationIdentifier = default; - string senderDisplayName = default; - DateTimeOffset composeTime = default; - string type = default; - long? version = default; - CommunicationIdentifierModel recipientCommunicationIdentifier = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("messageBody"u8)) - { - messageBody = property.Value.GetString(); - continue; - } - if (property.NameEquals("metadata"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (property.NameEquals("editTime"u8)) - { - editTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("senderCommunicationIdentifier"u8)) - { - senderCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("senderDisplayName"u8)) - { - senderDisplayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("composeTime"u8)) - { - composeTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("recipientCommunicationIdentifier"u8)) - { - recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatMessageEditedEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - messageBody, - metadata, - editTime); - } - - 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(AcsChatMessageEditedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatMessageEditedEventData 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 DeserializeAcsChatMessageEditedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatMessageEditedEventData)} 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 AcsChatMessageEditedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatMessageEditedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedEventData.cs deleted file mode 100644 index 92f3f537ac6c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedEventData.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatMessageEdited event. - public partial class AcsChatMessageEditedEventData : AcsChatMessageEventBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The communication identifier of the sender. - /// The original compose time of the message. - /// The chat message metadata. - /// The time at which the message was edited. - /// , or is null. - internal AcsChatMessageEditedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, CommunicationIdentifierModel senderCommunicationIdentifier, DateTimeOffset composeTime, IReadOnlyDictionary metadata, DateTimeOffset editTime) : base(recipientCommunicationIdentifier, senderCommunicationIdentifier, composeTime) - { - Argument.AssertNotNull(recipientCommunicationIdentifier, nameof(recipientCommunicationIdentifier)); - Argument.AssertNotNull(senderCommunicationIdentifier, nameof(senderCommunicationIdentifier)); - Argument.AssertNotNull(metadata, nameof(metadata)); - - Metadata = metadata; - EditTime = editTime; - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The body of the chat message. - /// The chat message metadata. - /// The time at which the message was edited. - internal AcsChatMessageEditedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, string transactionId, string threadId, IDictionary serializedAdditionalRawData, string messageId, CommunicationIdentifierModel senderCommunicationIdentifier, string senderDisplayName, DateTimeOffset composeTime, string type, long? version, string messageBody, IReadOnlyDictionary metadata, DateTimeOffset editTime) : base(recipientCommunicationIdentifier, transactionId, threadId, serializedAdditionalRawData, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version) - { - MessageBody = messageBody; - Metadata = metadata; - EditTime = editTime; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatMessageEditedEventData() - { - } - - /// The body of the chat message. - public string MessageBody { get; } - /// The chat message metadata. - public IReadOnlyDictionary Metadata { get; } - /// The time at which the message was edited. - public DateTimeOffset EditTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedInThreadEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedInThreadEventData.Serialization.cs deleted file mode 100644 index 7bf5019d2ec1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedInThreadEventData.Serialization.cs +++ /dev/null @@ -1,222 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatMessageEditedInThreadEventData : 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(AcsChatMessageEditedInThreadEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(MessageBody)) - { - writer.WritePropertyName("messageBody"u8); - writer.WriteStringValue(MessageBody); - } - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("editTime"u8); - writer.WriteStringValue(EditTime, "O"); - } - - AcsChatMessageEditedInThreadEventData 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(AcsChatMessageEditedInThreadEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatMessageEditedInThreadEventData(document.RootElement, options); - } - - internal static AcsChatMessageEditedInThreadEventData DeserializeAcsChatMessageEditedInThreadEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string messageBody = default; - IReadOnlyDictionary metadata = default; - DateTimeOffset editTime = default; - string messageId = default; - CommunicationIdentifierModel senderCommunicationIdentifier = default; - string senderDisplayName = default; - DateTimeOffset composeTime = default; - string type = default; - long? version = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("messageBody"u8)) - { - messageBody = property.Value.GetString(); - continue; - } - if (property.NameEquals("metadata"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (property.NameEquals("editTime"u8)) - { - editTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("senderCommunicationIdentifier"u8)) - { - senderCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("senderDisplayName"u8)) - { - senderDisplayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("composeTime"u8)) - { - composeTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatMessageEditedInThreadEventData( - transactionId, - threadId, - serializedAdditionalRawData, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - messageBody, - metadata, - editTime); - } - - 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(AcsChatMessageEditedInThreadEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatMessageEditedInThreadEventData 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 DeserializeAcsChatMessageEditedInThreadEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatMessageEditedInThreadEventData)} 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 AcsChatMessageEditedInThreadEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatMessageEditedInThreadEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedInThreadEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedInThreadEventData.cs deleted file mode 100644 index 99134233639c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEditedInThreadEventData.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatMessageEditedInThread event. - public partial class AcsChatMessageEditedInThreadEventData : AcsChatMessageEventInThreadBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the sender. - /// The original compose time of the message. - /// The chat message metadata. - /// The time at which the message was edited. - /// or is null. - internal AcsChatMessageEditedInThreadEventData(CommunicationIdentifierModel senderCommunicationIdentifier, DateTimeOffset composeTime, IReadOnlyDictionary metadata, DateTimeOffset editTime) : base(senderCommunicationIdentifier, composeTime) - { - Argument.AssertNotNull(senderCommunicationIdentifier, nameof(senderCommunicationIdentifier)); - Argument.AssertNotNull(metadata, nameof(metadata)); - - Metadata = metadata; - EditTime = editTime; - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The body of the chat message. - /// The chat message metadata. - /// The time at which the message was edited. - internal AcsChatMessageEditedInThreadEventData(string transactionId, string threadId, IDictionary serializedAdditionalRawData, string messageId, CommunicationIdentifierModel senderCommunicationIdentifier, string senderDisplayName, DateTimeOffset composeTime, string type, long? version, string messageBody, IReadOnlyDictionary metadata, DateTimeOffset editTime) : base(transactionId, threadId, serializedAdditionalRawData, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version) - { - MessageBody = messageBody; - Metadata = metadata; - EditTime = editTime; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatMessageEditedInThreadEventData() - { - } - - /// The body of the chat message. - public string MessageBody { get; } - /// The chat message metadata. - public IReadOnlyDictionary Metadata { get; } - /// The time at which the message was edited. - public DateTimeOffset EditTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventBaseProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventBaseProperties.Serialization.cs deleted file mode 100644 index 5c8edcacc2cc..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventBaseProperties.Serialization.cs +++ /dev/null @@ -1,212 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatMessageEventBaseProperties : 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(AcsChatMessageEventBaseProperties)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(MessageId)) - { - writer.WritePropertyName("messageId"u8); - writer.WriteStringValue(MessageId); - } - writer.WritePropertyName("senderCommunicationIdentifier"u8); - writer.WriteObjectValue(SenderCommunicationIdentifier, options); - if (Optional.IsDefined(SenderDisplayName)) - { - writer.WritePropertyName("senderDisplayName"u8); - writer.WriteStringValue(SenderDisplayName); - } - writer.WritePropertyName("composeTime"u8); - writer.WriteStringValue(ComposeTime, "O"); - if (Optional.IsDefined(Type)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteNumberValue(Version.Value); - } - } - - AcsChatMessageEventBaseProperties 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(AcsChatMessageEventBaseProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatMessageEventBaseProperties(document.RootElement, options); - } - - internal static AcsChatMessageEventBaseProperties DeserializeAcsChatMessageEventBaseProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string messageId = default; - CommunicationIdentifierModel senderCommunicationIdentifier = default; - string senderDisplayName = default; - DateTimeOffset composeTime = default; - string type = default; - long? version = default; - CommunicationIdentifierModel recipientCommunicationIdentifier = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("senderCommunicationIdentifier"u8)) - { - senderCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("senderDisplayName"u8)) - { - senderDisplayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("composeTime"u8)) - { - composeTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("recipientCommunicationIdentifier"u8)) - { - recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatMessageEventBaseProperties( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version); - } - - 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(AcsChatMessageEventBaseProperties)} does not support writing '{options.Format}' format."); - } - } - - AcsChatMessageEventBaseProperties 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 DeserializeAcsChatMessageEventBaseProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatMessageEventBaseProperties)} 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 AcsChatMessageEventBaseProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatMessageEventBaseProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventBaseProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventBaseProperties.cs deleted file mode 100644 index d0109a86be03..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventBaseProperties.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of all chat message events. - public partial class AcsChatMessageEventBaseProperties : AcsChatEventBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The communication identifier of the sender. - /// The original compose time of the message. - /// or is null. - internal AcsChatMessageEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier, CommunicationIdentifierModel senderCommunicationIdentifier, DateTimeOffset composeTime) : base(recipientCommunicationIdentifier) - { - Argument.AssertNotNull(recipientCommunicationIdentifier, nameof(recipientCommunicationIdentifier)); - Argument.AssertNotNull(senderCommunicationIdentifier, nameof(senderCommunicationIdentifier)); - - SenderCommunicationIdentifier = senderCommunicationIdentifier; - ComposeTime = composeTime; - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - internal AcsChatMessageEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier, string transactionId, string threadId, IDictionary serializedAdditionalRawData, string messageId, CommunicationIdentifierModel senderCommunicationIdentifier, string senderDisplayName, DateTimeOffset composeTime, string type, long? version) : base(recipientCommunicationIdentifier, transactionId, threadId, serializedAdditionalRawData) - { - MessageId = messageId; - SenderCommunicationIdentifier = senderCommunicationIdentifier; - SenderDisplayName = senderDisplayName; - ComposeTime = composeTime; - Type = type; - Version = version; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatMessageEventBaseProperties() - { - } - - /// The chat message id. - public string MessageId { get; } - /// The communication identifier of the sender. - public CommunicationIdentifierModel SenderCommunicationIdentifier { get; } - /// The display name of the sender. - public string SenderDisplayName { get; } - /// The original compose time of the message. - public DateTimeOffset ComposeTime { get; } - /// The type of the message. - public string Type { get; } - /// The version of the message. - public long? Version { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventInThreadBaseProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventInThreadBaseProperties.Serialization.cs deleted file mode 100644 index daf9837f457b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventInThreadBaseProperties.Serialization.cs +++ /dev/null @@ -1,205 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatMessageEventInThreadBaseProperties : 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(AcsChatMessageEventInThreadBaseProperties)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(MessageId)) - { - writer.WritePropertyName("messageId"u8); - writer.WriteStringValue(MessageId); - } - writer.WritePropertyName("senderCommunicationIdentifier"u8); - writer.WriteObjectValue(SenderCommunicationIdentifier, options); - if (Optional.IsDefined(SenderDisplayName)) - { - writer.WritePropertyName("senderDisplayName"u8); - writer.WriteStringValue(SenderDisplayName); - } - writer.WritePropertyName("composeTime"u8); - writer.WriteStringValue(ComposeTime, "O"); - if (Optional.IsDefined(Type)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteNumberValue(Version.Value); - } - } - - AcsChatMessageEventInThreadBaseProperties 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(AcsChatMessageEventInThreadBaseProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatMessageEventInThreadBaseProperties(document.RootElement, options); - } - - internal static AcsChatMessageEventInThreadBaseProperties DeserializeAcsChatMessageEventInThreadBaseProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string messageId = default; - CommunicationIdentifierModel senderCommunicationIdentifier = default; - string senderDisplayName = default; - DateTimeOffset composeTime = default; - string type = default; - long? version = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("senderCommunicationIdentifier"u8)) - { - senderCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("senderDisplayName"u8)) - { - senderDisplayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("composeTime"u8)) - { - composeTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatMessageEventInThreadBaseProperties( - transactionId, - threadId, - serializedAdditionalRawData, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version); - } - - 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(AcsChatMessageEventInThreadBaseProperties)} does not support writing '{options.Format}' format."); - } - } - - AcsChatMessageEventInThreadBaseProperties 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 DeserializeAcsChatMessageEventInThreadBaseProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatMessageEventInThreadBaseProperties)} 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 AcsChatMessageEventInThreadBaseProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatMessageEventInThreadBaseProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventInThreadBaseProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventInThreadBaseProperties.cs deleted file mode 100644 index 72fdab5e25f7..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageEventInThreadBaseProperties.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of all thread-level chat message events. - public partial class AcsChatMessageEventInThreadBaseProperties : AcsChatEventInThreadBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the sender. - /// The original compose time of the message. - /// is null. - internal AcsChatMessageEventInThreadBaseProperties(CommunicationIdentifierModel senderCommunicationIdentifier, DateTimeOffset composeTime) - { - Argument.AssertNotNull(senderCommunicationIdentifier, nameof(senderCommunicationIdentifier)); - - SenderCommunicationIdentifier = senderCommunicationIdentifier; - ComposeTime = composeTime; - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - internal AcsChatMessageEventInThreadBaseProperties(string transactionId, string threadId, IDictionary serializedAdditionalRawData, string messageId, CommunicationIdentifierModel senderCommunicationIdentifier, string senderDisplayName, DateTimeOffset composeTime, string type, long? version) : base(transactionId, threadId, serializedAdditionalRawData) - { - MessageId = messageId; - SenderCommunicationIdentifier = senderCommunicationIdentifier; - SenderDisplayName = senderDisplayName; - ComposeTime = composeTime; - Type = type; - Version = version; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatMessageEventInThreadBaseProperties() - { - } - - /// The chat message id. - public string MessageId { get; } - /// The communication identifier of the sender. - public CommunicationIdentifierModel SenderCommunicationIdentifier { get; } - /// The display name of the sender. - public string SenderDisplayName { get; } - /// The original compose time of the message. - public DateTimeOffset ComposeTime { get; } - /// The type of the message. - public string Type { get; } - /// The version of the message. - public long? Version { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedEventData.Serialization.cs deleted file mode 100644 index 30ba40046cec..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedEventData.Serialization.cs +++ /dev/null @@ -1,220 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatMessageReceivedEventData : 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(AcsChatMessageReceivedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(MessageBody)) - { - writer.WritePropertyName("messageBody"u8); - writer.WriteStringValue(MessageBody); - } - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - AcsChatMessageReceivedEventData 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(AcsChatMessageReceivedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatMessageReceivedEventData(document.RootElement, options); - } - - internal static AcsChatMessageReceivedEventData DeserializeAcsChatMessageReceivedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string messageBody = default; - IReadOnlyDictionary metadata = default; - string messageId = default; - CommunicationIdentifierModel senderCommunicationIdentifier = default; - string senderDisplayName = default; - DateTimeOffset composeTime = default; - string type = default; - long? version = default; - CommunicationIdentifierModel recipientCommunicationIdentifier = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("messageBody"u8)) - { - messageBody = property.Value.GetString(); - continue; - } - if (property.NameEquals("metadata"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("senderCommunicationIdentifier"u8)) - { - senderCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("senderDisplayName"u8)) - { - senderDisplayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("composeTime"u8)) - { - composeTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("recipientCommunicationIdentifier"u8)) - { - recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatMessageReceivedEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - messageBody, - metadata); - } - - 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(AcsChatMessageReceivedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatMessageReceivedEventData 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 DeserializeAcsChatMessageReceivedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatMessageReceivedEventData)} 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 AcsChatMessageReceivedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatMessageReceivedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedEventData.cs deleted file mode 100644 index 2410db3e730b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedEventData.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatMessageReceived event. - public partial class AcsChatMessageReceivedEventData : AcsChatMessageEventBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The communication identifier of the sender. - /// The original compose time of the message. - /// The chat message metadata. - /// , or is null. - internal AcsChatMessageReceivedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, CommunicationIdentifierModel senderCommunicationIdentifier, DateTimeOffset composeTime, IReadOnlyDictionary metadata) : base(recipientCommunicationIdentifier, senderCommunicationIdentifier, composeTime) - { - Argument.AssertNotNull(recipientCommunicationIdentifier, nameof(recipientCommunicationIdentifier)); - Argument.AssertNotNull(senderCommunicationIdentifier, nameof(senderCommunicationIdentifier)); - Argument.AssertNotNull(metadata, nameof(metadata)); - - Metadata = metadata; - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The body of the chat message. - /// The chat message metadata. - internal AcsChatMessageReceivedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, string transactionId, string threadId, IDictionary serializedAdditionalRawData, string messageId, CommunicationIdentifierModel senderCommunicationIdentifier, string senderDisplayName, DateTimeOffset composeTime, string type, long? version, string messageBody, IReadOnlyDictionary metadata) : base(recipientCommunicationIdentifier, transactionId, threadId, serializedAdditionalRawData, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version) - { - MessageBody = messageBody; - Metadata = metadata; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatMessageReceivedEventData() - { - } - - /// The body of the chat message. - public string MessageBody { get; } - /// The chat message metadata. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedInThreadEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedInThreadEventData.Serialization.cs deleted file mode 100644 index 03658d848d09..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedInThreadEventData.Serialization.cs +++ /dev/null @@ -1,213 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatMessageReceivedInThreadEventData : 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(AcsChatMessageReceivedInThreadEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(MessageBody)) - { - writer.WritePropertyName("messageBody"u8); - writer.WriteStringValue(MessageBody); - } - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - AcsChatMessageReceivedInThreadEventData 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(AcsChatMessageReceivedInThreadEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatMessageReceivedInThreadEventData(document.RootElement, options); - } - - internal static AcsChatMessageReceivedInThreadEventData DeserializeAcsChatMessageReceivedInThreadEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string messageBody = default; - IReadOnlyDictionary metadata = default; - string messageId = default; - CommunicationIdentifierModel senderCommunicationIdentifier = default; - string senderDisplayName = default; - DateTimeOffset composeTime = default; - string type = default; - long? version = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("messageBody"u8)) - { - messageBody = property.Value.GetString(); - continue; - } - if (property.NameEquals("metadata"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("senderCommunicationIdentifier"u8)) - { - senderCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("senderDisplayName"u8)) - { - senderDisplayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("composeTime"u8)) - { - composeTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatMessageReceivedInThreadEventData( - transactionId, - threadId, - serializedAdditionalRawData, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - messageBody, - metadata); - } - - 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(AcsChatMessageReceivedInThreadEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatMessageReceivedInThreadEventData 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 DeserializeAcsChatMessageReceivedInThreadEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatMessageReceivedInThreadEventData)} 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 AcsChatMessageReceivedInThreadEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatMessageReceivedInThreadEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedInThreadEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedInThreadEventData.cs deleted file mode 100644 index 8698284721c1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatMessageReceivedInThreadEventData.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatMessageReceivedInThread event. - public partial class AcsChatMessageReceivedInThreadEventData : AcsChatMessageEventInThreadBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the sender. - /// The original compose time of the message. - /// The chat message metadata. - /// or is null. - internal AcsChatMessageReceivedInThreadEventData(CommunicationIdentifierModel senderCommunicationIdentifier, DateTimeOffset composeTime, IReadOnlyDictionary metadata) : base(senderCommunicationIdentifier, composeTime) - { - Argument.AssertNotNull(senderCommunicationIdentifier, nameof(senderCommunicationIdentifier)); - Argument.AssertNotNull(metadata, nameof(metadata)); - - Metadata = metadata; - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The body of the chat message. - /// The chat message metadata. - internal AcsChatMessageReceivedInThreadEventData(string transactionId, string threadId, IDictionary serializedAdditionalRawData, string messageId, CommunicationIdentifierModel senderCommunicationIdentifier, string senderDisplayName, DateTimeOffset composeTime, string type, long? version, string messageBody, IReadOnlyDictionary metadata) : base(transactionId, threadId, serializedAdditionalRawData, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version) - { - MessageBody = messageBody; - Metadata = metadata; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatMessageReceivedInThreadEventData() - { - } - - /// The body of the chat message. - public string MessageBody { get; } - /// The chat message metadata. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadEventData.Serialization.cs deleted file mode 100644 index 4acb68c7bf71..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadEventData.Serialization.cs +++ /dev/null @@ -1,178 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatParticipantAddedToThreadEventData : 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(AcsChatParticipantAddedToThreadEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("time"u8); - writer.WriteStringValue(Time, "O"); - writer.WritePropertyName("addedByCommunicationIdentifier"u8); - writer.WriteObjectValue(AddedByCommunicationIdentifier, options); - writer.WritePropertyName("participantAdded"u8); - writer.WriteObjectValue(ParticipantAdded, options); - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteNumberValue(Version.Value); - } - } - - AcsChatParticipantAddedToThreadEventData 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(AcsChatParticipantAddedToThreadEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatParticipantAddedToThreadEventData(document.RootElement, options); - } - - internal static AcsChatParticipantAddedToThreadEventData DeserializeAcsChatParticipantAddedToThreadEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset time = default; - CommunicationIdentifierModel addedByCommunicationIdentifier = default; - AcsChatThreadParticipantProperties participantAdded = default; - long? version = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("time"u8)) - { - time = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("addedByCommunicationIdentifier"u8)) - { - addedByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("participantAdded"u8)) - { - participantAdded = AcsChatThreadParticipantProperties.DeserializeAcsChatThreadParticipantProperties(property.Value, options); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatParticipantAddedToThreadEventData( - transactionId, - threadId, - serializedAdditionalRawData, - time, - addedByCommunicationIdentifier, - participantAdded, - version); - } - - 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(AcsChatParticipantAddedToThreadEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatParticipantAddedToThreadEventData 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 DeserializeAcsChatParticipantAddedToThreadEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatParticipantAddedToThreadEventData)} 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 AcsChatParticipantAddedToThreadEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatParticipantAddedToThreadEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadEventData.cs deleted file mode 100644 index 0c74e23af594..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadEventData.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatThreadParticipantAdded event. - public partial class AcsChatParticipantAddedToThreadEventData : AcsChatEventInThreadBaseProperties - { - /// Initializes a new instance of . - /// The time at which the user was added to the thread. - /// The communication identifier of the user who added the user. - /// The details of the user who was added. - /// or is null. - internal AcsChatParticipantAddedToThreadEventData(DateTimeOffset time, CommunicationIdentifierModel addedByCommunicationIdentifier, AcsChatThreadParticipantProperties participantAdded) - { - Argument.AssertNotNull(addedByCommunicationIdentifier, nameof(addedByCommunicationIdentifier)); - Argument.AssertNotNull(participantAdded, nameof(participantAdded)); - - Time = time; - AddedByCommunicationIdentifier = addedByCommunicationIdentifier; - ParticipantAdded = participantAdded; - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The time at which the user was added to the thread. - /// The communication identifier of the user who added the user. - /// The details of the user who was added. - /// The version of the thread. - internal AcsChatParticipantAddedToThreadEventData(string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset time, CommunicationIdentifierModel addedByCommunicationIdentifier, AcsChatThreadParticipantProperties participantAdded, long? version) : base(transactionId, threadId, serializedAdditionalRawData) - { - Time = time; - AddedByCommunicationIdentifier = addedByCommunicationIdentifier; - ParticipantAdded = participantAdded; - Version = version; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatParticipantAddedToThreadEventData() - { - } - - /// The time at which the user was added to the thread. - public DateTimeOffset Time { get; } - /// The communication identifier of the user who added the user. - public CommunicationIdentifierModel AddedByCommunicationIdentifier { get; } - /// The details of the user who was added. - public AcsChatThreadParticipantProperties ParticipantAdded { get; } - /// The version of the thread. - public long? Version { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadWithUserEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadWithUserEventData.Serialization.cs deleted file mode 100644 index 656b0ad7865b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadWithUserEventData.Serialization.cs +++ /dev/null @@ -1,187 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatParticipantAddedToThreadWithUserEventData : 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(AcsChatParticipantAddedToThreadWithUserEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("time"u8); - writer.WriteStringValue(Time, "O"); - writer.WritePropertyName("addedByCommunicationIdentifier"u8); - writer.WriteObjectValue(AddedByCommunicationIdentifier, options); - writer.WritePropertyName("participantAdded"u8); - writer.WriteObjectValue(ParticipantAdded, options); - } - - AcsChatParticipantAddedToThreadWithUserEventData 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(AcsChatParticipantAddedToThreadWithUserEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatParticipantAddedToThreadWithUserEventData(document.RootElement, options); - } - - internal static AcsChatParticipantAddedToThreadWithUserEventData DeserializeAcsChatParticipantAddedToThreadWithUserEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset time = default; - CommunicationIdentifierModel addedByCommunicationIdentifier = default; - AcsChatThreadParticipantProperties participantAdded = default; - DateTimeOffset createTime = default; - long? version = default; - CommunicationIdentifierModel recipientCommunicationIdentifier = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("time"u8)) - { - time = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("addedByCommunicationIdentifier"u8)) - { - addedByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("participantAdded"u8)) - { - participantAdded = AcsChatThreadParticipantProperties.DeserializeAcsChatThreadParticipantProperties(property.Value, options); - continue; - } - if (property.NameEquals("createTime"u8)) - { - createTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("recipientCommunicationIdentifier"u8)) - { - recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatParticipantAddedToThreadWithUserEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData, - createTime, - version, - time, - addedByCommunicationIdentifier, - participantAdded); - } - - 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(AcsChatParticipantAddedToThreadWithUserEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatParticipantAddedToThreadWithUserEventData 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 DeserializeAcsChatParticipantAddedToThreadWithUserEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatParticipantAddedToThreadWithUserEventData)} 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 AcsChatParticipantAddedToThreadWithUserEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatParticipantAddedToThreadWithUserEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadWithUserEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadWithUserEventData.cs deleted file mode 100644 index 95e15aab1526..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantAddedToThreadWithUserEventData.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatParticipantAddedToThreadWithUser event. - public partial class AcsChatParticipantAddedToThreadWithUserEventData : AcsChatThreadEventBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The original creation time of the thread. - /// The time at which the user was added to the thread. - /// The communication identifier of the user who added the user. - /// The details of the user who was added. - /// , or is null. - internal AcsChatParticipantAddedToThreadWithUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, DateTimeOffset createTime, DateTimeOffset time, CommunicationIdentifierModel addedByCommunicationIdentifier, AcsChatThreadParticipantProperties participantAdded) : base(recipientCommunicationIdentifier, createTime) - { - Argument.AssertNotNull(recipientCommunicationIdentifier, nameof(recipientCommunicationIdentifier)); - Argument.AssertNotNull(addedByCommunicationIdentifier, nameof(addedByCommunicationIdentifier)); - Argument.AssertNotNull(participantAdded, nameof(participantAdded)); - - Time = time; - AddedByCommunicationIdentifier = addedByCommunicationIdentifier; - ParticipantAdded = participantAdded; - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The original creation time of the thread. - /// The version of the thread. - /// The time at which the user was added to the thread. - /// The communication identifier of the user who added the user. - /// The details of the user who was added. - internal AcsChatParticipantAddedToThreadWithUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset createTime, long? version, DateTimeOffset time, CommunicationIdentifierModel addedByCommunicationIdentifier, AcsChatThreadParticipantProperties participantAdded) : base(recipientCommunicationIdentifier, transactionId, threadId, serializedAdditionalRawData, createTime, version) - { - Time = time; - AddedByCommunicationIdentifier = addedByCommunicationIdentifier; - ParticipantAdded = participantAdded; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatParticipantAddedToThreadWithUserEventData() - { - } - - /// The time at which the user was added to the thread. - public DateTimeOffset Time { get; } - /// The communication identifier of the user who added the user. - public CommunicationIdentifierModel AddedByCommunicationIdentifier { get; } - /// The details of the user who was added. - public AcsChatThreadParticipantProperties ParticipantAdded { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadEventData.Serialization.cs deleted file mode 100644 index 34a1f1d8e6bd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadEventData.Serialization.cs +++ /dev/null @@ -1,178 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatParticipantRemovedFromThreadEventData : 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(AcsChatParticipantRemovedFromThreadEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("time"u8); - writer.WriteStringValue(Time, "O"); - writer.WritePropertyName("removedByCommunicationIdentifier"u8); - writer.WriteObjectValue(RemovedByCommunicationIdentifier, options); - writer.WritePropertyName("participantRemoved"u8); - writer.WriteObjectValue(ParticipantRemoved, options); - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteNumberValue(Version.Value); - } - } - - AcsChatParticipantRemovedFromThreadEventData 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(AcsChatParticipantRemovedFromThreadEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatParticipantRemovedFromThreadEventData(document.RootElement, options); - } - - internal static AcsChatParticipantRemovedFromThreadEventData DeserializeAcsChatParticipantRemovedFromThreadEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset time = default; - CommunicationIdentifierModel removedByCommunicationIdentifier = default; - AcsChatThreadParticipantProperties participantRemoved = default; - long? version = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("time"u8)) - { - time = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("removedByCommunicationIdentifier"u8)) - { - removedByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("participantRemoved"u8)) - { - participantRemoved = AcsChatThreadParticipantProperties.DeserializeAcsChatThreadParticipantProperties(property.Value, options); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatParticipantRemovedFromThreadEventData( - transactionId, - threadId, - serializedAdditionalRawData, - time, - removedByCommunicationIdentifier, - participantRemoved, - version); - } - - 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(AcsChatParticipantRemovedFromThreadEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatParticipantRemovedFromThreadEventData 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 DeserializeAcsChatParticipantRemovedFromThreadEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatParticipantRemovedFromThreadEventData)} 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 AcsChatParticipantRemovedFromThreadEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatParticipantRemovedFromThreadEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadEventData.cs deleted file mode 100644 index 2984453d0a26..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadEventData.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatThreadParticipantRemoved event. - public partial class AcsChatParticipantRemovedFromThreadEventData : AcsChatEventInThreadBaseProperties - { - /// Initializes a new instance of . - /// The time at which the user was removed to the thread. - /// The communication identifier of the user who removed the user. - /// The details of the user who was removed. - /// or is null. - internal AcsChatParticipantRemovedFromThreadEventData(DateTimeOffset time, CommunicationIdentifierModel removedByCommunicationIdentifier, AcsChatThreadParticipantProperties participantRemoved) - { - Argument.AssertNotNull(removedByCommunicationIdentifier, nameof(removedByCommunicationIdentifier)); - Argument.AssertNotNull(participantRemoved, nameof(participantRemoved)); - - Time = time; - RemovedByCommunicationIdentifier = removedByCommunicationIdentifier; - ParticipantRemoved = participantRemoved; - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The time at which the user was removed to the thread. - /// The communication identifier of the user who removed the user. - /// The details of the user who was removed. - /// The version of the thread. - internal AcsChatParticipantRemovedFromThreadEventData(string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset time, CommunicationIdentifierModel removedByCommunicationIdentifier, AcsChatThreadParticipantProperties participantRemoved, long? version) : base(transactionId, threadId, serializedAdditionalRawData) - { - Time = time; - RemovedByCommunicationIdentifier = removedByCommunicationIdentifier; - ParticipantRemoved = participantRemoved; - Version = version; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatParticipantRemovedFromThreadEventData() - { - } - - /// The time at which the user was removed to the thread. - public DateTimeOffset Time { get; } - /// The communication identifier of the user who removed the user. - public CommunicationIdentifierModel RemovedByCommunicationIdentifier { get; } - /// The details of the user who was removed. - public AcsChatThreadParticipantProperties ParticipantRemoved { get; } - /// The version of the thread. - public long? Version { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadWithUserEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadWithUserEventData.Serialization.cs deleted file mode 100644 index f7db6f14d6f8..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadWithUserEventData.Serialization.cs +++ /dev/null @@ -1,187 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatParticipantRemovedFromThreadWithUserEventData : 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(AcsChatParticipantRemovedFromThreadWithUserEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("time"u8); - writer.WriteStringValue(Time, "O"); - writer.WritePropertyName("removedByCommunicationIdentifier"u8); - writer.WriteObjectValue(RemovedByCommunicationIdentifier, options); - writer.WritePropertyName("participantRemoved"u8); - writer.WriteObjectValue(ParticipantRemoved, options); - } - - AcsChatParticipantRemovedFromThreadWithUserEventData 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(AcsChatParticipantRemovedFromThreadWithUserEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatParticipantRemovedFromThreadWithUserEventData(document.RootElement, options); - } - - internal static AcsChatParticipantRemovedFromThreadWithUserEventData DeserializeAcsChatParticipantRemovedFromThreadWithUserEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset time = default; - CommunicationIdentifierModel removedByCommunicationIdentifier = default; - AcsChatThreadParticipantProperties participantRemoved = default; - DateTimeOffset createTime = default; - long? version = default; - CommunicationIdentifierModel recipientCommunicationIdentifier = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("time"u8)) - { - time = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("removedByCommunicationIdentifier"u8)) - { - removedByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("participantRemoved"u8)) - { - participantRemoved = AcsChatThreadParticipantProperties.DeserializeAcsChatThreadParticipantProperties(property.Value, options); - continue; - } - if (property.NameEquals("createTime"u8)) - { - createTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("recipientCommunicationIdentifier"u8)) - { - recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatParticipantRemovedFromThreadWithUserEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData, - createTime, - version, - time, - removedByCommunicationIdentifier, - participantRemoved); - } - - 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(AcsChatParticipantRemovedFromThreadWithUserEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatParticipantRemovedFromThreadWithUserEventData 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 DeserializeAcsChatParticipantRemovedFromThreadWithUserEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatParticipantRemovedFromThreadWithUserEventData)} 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 AcsChatParticipantRemovedFromThreadWithUserEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatParticipantRemovedFromThreadWithUserEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadWithUserEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadWithUserEventData.cs deleted file mode 100644 index 109684ffc523..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatParticipantRemovedFromThreadWithUserEventData.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser event. - public partial class AcsChatParticipantRemovedFromThreadWithUserEventData : AcsChatThreadEventBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The original creation time of the thread. - /// The time at which the user was removed to the thread. - /// The communication identifier of the user who removed the user. - /// The details of the user who was removed. - /// , or is null. - internal AcsChatParticipantRemovedFromThreadWithUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, DateTimeOffset createTime, DateTimeOffset time, CommunicationIdentifierModel removedByCommunicationIdentifier, AcsChatThreadParticipantProperties participantRemoved) : base(recipientCommunicationIdentifier, createTime) - { - Argument.AssertNotNull(recipientCommunicationIdentifier, nameof(recipientCommunicationIdentifier)); - Argument.AssertNotNull(removedByCommunicationIdentifier, nameof(removedByCommunicationIdentifier)); - Argument.AssertNotNull(participantRemoved, nameof(participantRemoved)); - - Time = time; - RemovedByCommunicationIdentifier = removedByCommunicationIdentifier; - ParticipantRemoved = participantRemoved; - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The original creation time of the thread. - /// The version of the thread. - /// The time at which the user was removed to the thread. - /// The communication identifier of the user who removed the user. - /// The details of the user who was removed. - internal AcsChatParticipantRemovedFromThreadWithUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset createTime, long? version, DateTimeOffset time, CommunicationIdentifierModel removedByCommunicationIdentifier, AcsChatThreadParticipantProperties participantRemoved) : base(recipientCommunicationIdentifier, transactionId, threadId, serializedAdditionalRawData, createTime, version) - { - Time = time; - RemovedByCommunicationIdentifier = removedByCommunicationIdentifier; - ParticipantRemoved = participantRemoved; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatParticipantRemovedFromThreadWithUserEventData() - { - } - - /// The time at which the user was removed to the thread. - public DateTimeOffset Time { get; } - /// The communication identifier of the user who removed the user. - public CommunicationIdentifierModel RemovedByCommunicationIdentifier { get; } - /// The details of the user who was removed. - public AcsChatThreadParticipantProperties ParticipantRemoved { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedEventData.Serialization.cs deleted file mode 100644 index 660520158e5d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedEventData.Serialization.cs +++ /dev/null @@ -1,240 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatThreadCreatedEventData : 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(AcsChatThreadCreatedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("createdByCommunicationIdentifier"u8); - writer.WriteObjectValue(CreatedByCommunicationIdentifier, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - foreach (var item in Properties) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("participants"u8); - writer.WriteStartArray(); - foreach (var item in Participants) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - - AcsChatThreadCreatedEventData 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(AcsChatThreadCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatThreadCreatedEventData(document.RootElement, options); - } - - internal static AcsChatThreadCreatedEventData DeserializeAcsChatThreadCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationIdentifierModel createdByCommunicationIdentifier = default; - IReadOnlyDictionary properties = default; - IReadOnlyDictionary metadata = default; - IReadOnlyList participants = default; - DateTimeOffset createTime = default; - long? version = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("createdByCommunicationIdentifier"u8)) - { - createdByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("properties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - properties = dictionary; - continue; - } - if (property.NameEquals("metadata"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (property.NameEquals("participants"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsChatThreadParticipantProperties.DeserializeAcsChatThreadParticipantProperties(item, options)); - } - participants = array; - continue; - } - if (property.NameEquals("createTime"u8)) - { - createTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatThreadCreatedEventData( - transactionId, - threadId, - serializedAdditionalRawData, - createTime, - version, - createdByCommunicationIdentifier, - properties, - metadata, - participants); - } - - 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(AcsChatThreadCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatThreadCreatedEventData 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 DeserializeAcsChatThreadCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatThreadCreatedEventData)} 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 AcsChatThreadCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatThreadCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedEventData.cs deleted file mode 100644 index 30a77e8200e9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedEventData.cs +++ /dev/null @@ -1,98 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatThreadCreated event. - public partial class AcsChatThreadCreatedEventData : AcsChatThreadEventInThreadBaseProperties - { - /// Initializes a new instance of . - /// The original creation time of the thread. - /// The communication identifier of the user who created the thread. - /// The thread properties. - /// The thread metadata. - /// The list of properties of participants who are part of the thread. - /// , , or is null. - internal AcsChatThreadCreatedEventData(DateTimeOffset createTime, CommunicationIdentifierModel createdByCommunicationIdentifier, IReadOnlyDictionary properties, IReadOnlyDictionary metadata, IEnumerable participants) : base(createTime) - { - Argument.AssertNotNull(createdByCommunicationIdentifier, nameof(createdByCommunicationIdentifier)); - Argument.AssertNotNull(properties, nameof(properties)); - Argument.AssertNotNull(metadata, nameof(metadata)); - Argument.AssertNotNull(participants, nameof(participants)); - - CreatedByCommunicationIdentifier = createdByCommunicationIdentifier; - Properties = properties; - Metadata = metadata; - Participants = participants.ToList(); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who created the thread. - /// The thread properties. - /// The thread metadata. - /// The list of properties of participants who are part of the thread. - internal AcsChatThreadCreatedEventData(string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset createTime, long? version, CommunicationIdentifierModel createdByCommunicationIdentifier, IReadOnlyDictionary properties, IReadOnlyDictionary metadata, IReadOnlyList participants) : base(transactionId, threadId, serializedAdditionalRawData, createTime, version) - { - CreatedByCommunicationIdentifier = createdByCommunicationIdentifier; - Properties = properties; - Metadata = metadata; - Participants = participants; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatThreadCreatedEventData() - { - } - - /// The communication identifier of the user who created the thread. - public CommunicationIdentifierModel CreatedByCommunicationIdentifier { get; } - /// - /// The thread properties - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary Properties { get; } - /// The thread metadata. - public IReadOnlyDictionary Metadata { get; } - /// The list of properties of participants who are part of the thread. - public IReadOnlyList Participants { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedWithUserEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedWithUserEventData.Serialization.cs deleted file mode 100644 index 096a08aa546a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedWithUserEventData.Serialization.cs +++ /dev/null @@ -1,247 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatThreadCreatedWithUserEventData : 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(AcsChatThreadCreatedWithUserEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("createdByCommunicationIdentifier"u8); - writer.WriteObjectValue(CreatedByCommunicationIdentifier, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - foreach (var item in Properties) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("participants"u8); - writer.WriteStartArray(); - foreach (var item in Participants) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - - AcsChatThreadCreatedWithUserEventData 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(AcsChatThreadCreatedWithUserEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatThreadCreatedWithUserEventData(document.RootElement, options); - } - - internal static AcsChatThreadCreatedWithUserEventData DeserializeAcsChatThreadCreatedWithUserEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationIdentifierModel createdByCommunicationIdentifier = default; - IReadOnlyDictionary properties = default; - IReadOnlyDictionary metadata = default; - IReadOnlyList participants = default; - DateTimeOffset createTime = default; - long? version = default; - CommunicationIdentifierModel recipientCommunicationIdentifier = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("createdByCommunicationIdentifier"u8)) - { - createdByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("properties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - properties = dictionary; - continue; - } - if (property.NameEquals("metadata"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (property.NameEquals("participants"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsChatThreadParticipantProperties.DeserializeAcsChatThreadParticipantProperties(item, options)); - } - participants = array; - continue; - } - if (property.NameEquals("createTime"u8)) - { - createTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("recipientCommunicationIdentifier"u8)) - { - recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatThreadCreatedWithUserEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData, - createTime, - version, - createdByCommunicationIdentifier, - properties, - metadata, - participants); - } - - 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(AcsChatThreadCreatedWithUserEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatThreadCreatedWithUserEventData 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 DeserializeAcsChatThreadCreatedWithUserEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatThreadCreatedWithUserEventData)} 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 AcsChatThreadCreatedWithUserEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatThreadCreatedWithUserEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedWithUserEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedWithUserEventData.cs deleted file mode 100644 index 1016b59134b6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadCreatedWithUserEventData.cs +++ /dev/null @@ -1,101 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatThreadCreatedWithUser event. - public partial class AcsChatThreadCreatedWithUserEventData : AcsChatThreadEventBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The original creation time of the thread. - /// The communication identifier of the user who created the thread. - /// The thread properties. - /// The thread metadata. - /// The list of properties of participants who are part of the thread. - /// , , , or is null. - internal AcsChatThreadCreatedWithUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, DateTimeOffset createTime, CommunicationIdentifierModel createdByCommunicationIdentifier, IReadOnlyDictionary properties, IReadOnlyDictionary metadata, IEnumerable participants) : base(recipientCommunicationIdentifier, createTime) - { - Argument.AssertNotNull(recipientCommunicationIdentifier, nameof(recipientCommunicationIdentifier)); - Argument.AssertNotNull(createdByCommunicationIdentifier, nameof(createdByCommunicationIdentifier)); - Argument.AssertNotNull(properties, nameof(properties)); - Argument.AssertNotNull(metadata, nameof(metadata)); - Argument.AssertNotNull(participants, nameof(participants)); - - CreatedByCommunicationIdentifier = createdByCommunicationIdentifier; - Properties = properties; - Metadata = metadata; - Participants = participants.ToList(); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who created the thread. - /// The thread properties. - /// The thread metadata. - /// The list of properties of participants who are part of the thread. - internal AcsChatThreadCreatedWithUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset createTime, long? version, CommunicationIdentifierModel createdByCommunicationIdentifier, IReadOnlyDictionary properties, IReadOnlyDictionary metadata, IReadOnlyList participants) : base(recipientCommunicationIdentifier, transactionId, threadId, serializedAdditionalRawData, createTime, version) - { - CreatedByCommunicationIdentifier = createdByCommunicationIdentifier; - Properties = properties; - Metadata = metadata; - Participants = participants; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatThreadCreatedWithUserEventData() - { - } - - /// The communication identifier of the user who created the thread. - public CommunicationIdentifierModel CreatedByCommunicationIdentifier { get; } - /// - /// The thread properties - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary Properties { get; } - /// The thread metadata. - public IReadOnlyDictionary Metadata { get; } - /// The list of properties of participants who are part of the thread. - public IReadOnlyList Participants { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadDeletedEventData.Serialization.cs deleted file mode 100644 index 8b2f2a7db481..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadDeletedEventData.Serialization.cs +++ /dev/null @@ -1,171 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatThreadDeletedEventData : 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(AcsChatThreadDeletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("deletedByCommunicationIdentifier"u8); - writer.WriteObjectValue(DeletedByCommunicationIdentifier, options); - writer.WritePropertyName("deleteTime"u8); - writer.WriteStringValue(DeleteTime, "O"); - } - - AcsChatThreadDeletedEventData 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(AcsChatThreadDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatThreadDeletedEventData(document.RootElement, options); - } - - internal static AcsChatThreadDeletedEventData DeserializeAcsChatThreadDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationIdentifierModel deletedByCommunicationIdentifier = default; - DateTimeOffset deleteTime = default; - DateTimeOffset createTime = default; - long? version = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deletedByCommunicationIdentifier"u8)) - { - deletedByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("deleteTime"u8)) - { - deleteTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("createTime"u8)) - { - createTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatThreadDeletedEventData( - transactionId, - threadId, - serializedAdditionalRawData, - createTime, - version, - deletedByCommunicationIdentifier, - deleteTime); - } - - 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(AcsChatThreadDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatThreadDeletedEventData 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 DeserializeAcsChatThreadDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatThreadDeletedEventData)} 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 AcsChatThreadDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatThreadDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadDeletedEventData.cs deleted file mode 100644 index 68b39610ce9d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatThreadDeleted event. - public partial class AcsChatThreadDeletedEventData : AcsChatThreadEventInThreadBaseProperties - { - /// Initializes a new instance of . - /// The original creation time of the thread. - /// The communication identifier of the user who deleted the thread. - /// The deletion time of the thread. - /// is null. - internal AcsChatThreadDeletedEventData(DateTimeOffset createTime, CommunicationIdentifierModel deletedByCommunicationIdentifier, DateTimeOffset deleteTime) : base(createTime) - { - Argument.AssertNotNull(deletedByCommunicationIdentifier, nameof(deletedByCommunicationIdentifier)); - - DeletedByCommunicationIdentifier = deletedByCommunicationIdentifier; - DeleteTime = deleteTime; - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who deleted the thread. - /// The deletion time of the thread. - internal AcsChatThreadDeletedEventData(string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset createTime, long? version, CommunicationIdentifierModel deletedByCommunicationIdentifier, DateTimeOffset deleteTime) : base(transactionId, threadId, serializedAdditionalRawData, createTime, version) - { - DeletedByCommunicationIdentifier = deletedByCommunicationIdentifier; - DeleteTime = deleteTime; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatThreadDeletedEventData() - { - } - - /// The communication identifier of the user who deleted the thread. - public CommunicationIdentifierModel DeletedByCommunicationIdentifier { get; } - /// The deletion time of the thread. - public DateTimeOffset DeleteTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventBaseProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventBaseProperties.Serialization.cs deleted file mode 100644 index dbc9bad2c0fe..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventBaseProperties.Serialization.cs +++ /dev/null @@ -1,167 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatThreadEventBaseProperties : 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(AcsChatThreadEventBaseProperties)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("createTime"u8); - writer.WriteStringValue(CreateTime, "O"); - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteNumberValue(Version.Value); - } - } - - AcsChatThreadEventBaseProperties 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(AcsChatThreadEventBaseProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatThreadEventBaseProperties(document.RootElement, options); - } - - internal static AcsChatThreadEventBaseProperties DeserializeAcsChatThreadEventBaseProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset createTime = default; - long? version = default; - CommunicationIdentifierModel recipientCommunicationIdentifier = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("createTime"u8)) - { - createTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("recipientCommunicationIdentifier"u8)) - { - recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatThreadEventBaseProperties( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData, - createTime, - version); - } - - 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(AcsChatThreadEventBaseProperties)} does not support writing '{options.Format}' format."); - } - } - - AcsChatThreadEventBaseProperties 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 DeserializeAcsChatThreadEventBaseProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatThreadEventBaseProperties)} 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 AcsChatThreadEventBaseProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatThreadEventBaseProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventBaseProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventBaseProperties.cs deleted file mode 100644 index d2a25d81594d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventBaseProperties.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of all chat thread events. - public partial class AcsChatThreadEventBaseProperties : AcsChatEventBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The original creation time of the thread. - /// is null. - internal AcsChatThreadEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier, DateTimeOffset createTime) : base(recipientCommunicationIdentifier) - { - Argument.AssertNotNull(recipientCommunicationIdentifier, nameof(recipientCommunicationIdentifier)); - - CreateTime = createTime; - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The original creation time of the thread. - /// The version of the thread. - internal AcsChatThreadEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier, string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset createTime, long? version) : base(recipientCommunicationIdentifier, transactionId, threadId, serializedAdditionalRawData) - { - CreateTime = createTime; - Version = version; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatThreadEventBaseProperties() - { - } - - /// The original creation time of the thread. - public DateTimeOffset CreateTime { get; } - /// The version of the thread. - public long? Version { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventInThreadBaseProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventInThreadBaseProperties.Serialization.cs deleted file mode 100644 index c6a84493d388..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventInThreadBaseProperties.Serialization.cs +++ /dev/null @@ -1,155 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatThreadEventInThreadBaseProperties : 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(AcsChatThreadEventInThreadBaseProperties)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("createTime"u8); - writer.WriteStringValue(CreateTime, "O"); - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteNumberValue(Version.Value); - } - } - - AcsChatThreadEventInThreadBaseProperties 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(AcsChatThreadEventInThreadBaseProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatThreadEventInThreadBaseProperties(document.RootElement, options); - } - - internal static AcsChatThreadEventInThreadBaseProperties DeserializeAcsChatThreadEventInThreadBaseProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset createTime = default; - long? version = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("createTime"u8)) - { - createTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatThreadEventInThreadBaseProperties(transactionId, threadId, serializedAdditionalRawData, createTime, version); - } - - 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(AcsChatThreadEventInThreadBaseProperties)} does not support writing '{options.Format}' format."); - } - } - - AcsChatThreadEventInThreadBaseProperties 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 DeserializeAcsChatThreadEventInThreadBaseProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatThreadEventInThreadBaseProperties)} 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 AcsChatThreadEventInThreadBaseProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatThreadEventInThreadBaseProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventInThreadBaseProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventInThreadBaseProperties.cs deleted file mode 100644 index 6f41f0fe85ee..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadEventInThreadBaseProperties.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of all chat thread events. - public partial class AcsChatThreadEventInThreadBaseProperties : AcsChatEventInThreadBaseProperties - { - /// Initializes a new instance of . - /// The original creation time of the thread. - internal AcsChatThreadEventInThreadBaseProperties(DateTimeOffset createTime) - { - CreateTime = createTime; - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The original creation time of the thread. - /// The version of the thread. - internal AcsChatThreadEventInThreadBaseProperties(string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset createTime, long? version) : base(transactionId, threadId, serializedAdditionalRawData) - { - CreateTime = createTime; - Version = version; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatThreadEventInThreadBaseProperties() - { - } - - /// The original creation time of the thread. - public DateTimeOffset CreateTime { get; } - /// The version of the thread. - public long? Version { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadParticipantProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadParticipantProperties.Serialization.cs deleted file mode 100644 index a1c77c4bfd43..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadParticipantProperties.Serialization.cs +++ /dev/null @@ -1,172 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatThreadParticipantProperties : 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(AcsChatThreadParticipantProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - writer.WritePropertyName("participantCommunicationIdentifier"u8); - writer.WriteObjectValue(ParticipantCommunicationIdentifier, options); - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - 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 - } - } - } - - AcsChatThreadParticipantProperties 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(AcsChatThreadParticipantProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatThreadParticipantProperties(document.RootElement, options); - } - - internal static AcsChatThreadParticipantProperties DeserializeAcsChatThreadParticipantProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string displayName = default; - CommunicationIdentifierModel participantCommunicationIdentifier = default; - IReadOnlyDictionary metadata = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("displayName"u8)) - { - displayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("participantCommunicationIdentifier"u8)) - { - participantCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("metadata"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatThreadParticipantProperties(displayName, participantCommunicationIdentifier, metadata, 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(AcsChatThreadParticipantProperties)} does not support writing '{options.Format}' format."); - } - } - - AcsChatThreadParticipantProperties 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 DeserializeAcsChatThreadParticipantProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatThreadParticipantProperties)} 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 AcsChatThreadParticipantProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatThreadParticipantProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadParticipantProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadParticipantProperties.cs deleted file mode 100644 index 5fae54aff8c5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadParticipantProperties.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the chat thread participant. - public partial class AcsChatThreadParticipantProperties - { - /// - /// 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 communication identifier of the user. - /// The metadata of the user. - /// or is null. - internal AcsChatThreadParticipantProperties(CommunicationIdentifierModel participantCommunicationIdentifier, IReadOnlyDictionary metadata) - { - Argument.AssertNotNull(participantCommunicationIdentifier, nameof(participantCommunicationIdentifier)); - Argument.AssertNotNull(metadata, nameof(metadata)); - - ParticipantCommunicationIdentifier = participantCommunicationIdentifier; - Metadata = metadata; - } - - /// Initializes a new instance of . - /// The name of the user. - /// The communication identifier of the user. - /// The metadata of the user. - /// Keeps track of any properties unknown to the library. - internal AcsChatThreadParticipantProperties(string displayName, CommunicationIdentifierModel participantCommunicationIdentifier, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) - { - DisplayName = displayName; - ParticipantCommunicationIdentifier = participantCommunicationIdentifier; - Metadata = metadata; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatThreadParticipantProperties() - { - } - - /// The name of the user. - public string DisplayName { get; } - /// The communication identifier of the user. - public CommunicationIdentifierModel ParticipantCommunicationIdentifier { get; } - /// The metadata of the user. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedEventData.Serialization.cs deleted file mode 100644 index 1b26923f5d7d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedEventData.Serialization.cs +++ /dev/null @@ -1,230 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatThreadPropertiesUpdatedEventData : 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(AcsChatThreadPropertiesUpdatedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("editedByCommunicationIdentifier"u8); - writer.WriteObjectValue(EditedByCommunicationIdentifier, options); - writer.WritePropertyName("editTime"u8); - writer.WriteStringValue(EditTime, "O"); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - foreach (var item in Properties) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - AcsChatThreadPropertiesUpdatedEventData 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(AcsChatThreadPropertiesUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatThreadPropertiesUpdatedEventData(document.RootElement, options); - } - - internal static AcsChatThreadPropertiesUpdatedEventData DeserializeAcsChatThreadPropertiesUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationIdentifierModel editedByCommunicationIdentifier = default; - DateTimeOffset editTime = default; - IReadOnlyDictionary properties = default; - IReadOnlyDictionary metadata = default; - DateTimeOffset createTime = default; - long? version = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("editedByCommunicationIdentifier"u8)) - { - editedByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("editTime"u8)) - { - editTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("properties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - properties = dictionary; - continue; - } - if (property.NameEquals("metadata"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (property.NameEquals("createTime"u8)) - { - createTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatThreadPropertiesUpdatedEventData( - transactionId, - threadId, - serializedAdditionalRawData, - createTime, - version, - editedByCommunicationIdentifier, - editTime, - properties, - metadata); - } - - 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(AcsChatThreadPropertiesUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatThreadPropertiesUpdatedEventData 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 DeserializeAcsChatThreadPropertiesUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatThreadPropertiesUpdatedEventData)} 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 AcsChatThreadPropertiesUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatThreadPropertiesUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedEventData.cs deleted file mode 100644 index 44f774f4f9a4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedEventData.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatThreadPropertiesUpdated event. - public partial class AcsChatThreadPropertiesUpdatedEventData : AcsChatThreadEventInThreadBaseProperties - { - /// Initializes a new instance of . - /// The original creation time of the thread. - /// The communication identifier of the user who updated the thread properties. - /// The time at which the properties of the thread were updated. - /// The updated thread properties. - /// The thread metadata. - /// , or is null. - internal AcsChatThreadPropertiesUpdatedEventData(DateTimeOffset createTime, CommunicationIdentifierModel editedByCommunicationIdentifier, DateTimeOffset editTime, IReadOnlyDictionary properties, IReadOnlyDictionary metadata) : base(createTime) - { - Argument.AssertNotNull(editedByCommunicationIdentifier, nameof(editedByCommunicationIdentifier)); - Argument.AssertNotNull(properties, nameof(properties)); - Argument.AssertNotNull(metadata, nameof(metadata)); - - EditedByCommunicationIdentifier = editedByCommunicationIdentifier; - EditTime = editTime; - Properties = properties; - Metadata = metadata; - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who updated the thread properties. - /// The time at which the properties of the thread were updated. - /// The updated thread properties. - /// The thread metadata. - internal AcsChatThreadPropertiesUpdatedEventData(string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset createTime, long? version, CommunicationIdentifierModel editedByCommunicationIdentifier, DateTimeOffset editTime, IReadOnlyDictionary properties, IReadOnlyDictionary metadata) : base(transactionId, threadId, serializedAdditionalRawData, createTime, version) - { - EditedByCommunicationIdentifier = editedByCommunicationIdentifier; - EditTime = editTime; - Properties = properties; - Metadata = metadata; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatThreadPropertiesUpdatedEventData() - { - } - - /// The communication identifier of the user who updated the thread properties. - public CommunicationIdentifierModel EditedByCommunicationIdentifier { get; } - /// The time at which the properties of the thread were updated. - public DateTimeOffset EditTime { get; } - /// - /// The updated thread properties - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary Properties { get; } - /// The thread metadata. - public IReadOnlyDictionary Metadata { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedPerUserEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedPerUserEventData.Serialization.cs deleted file mode 100644 index 572d294f52df..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedPerUserEventData.Serialization.cs +++ /dev/null @@ -1,237 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatThreadPropertiesUpdatedPerUserEventData : 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(AcsChatThreadPropertiesUpdatedPerUserEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("editedByCommunicationIdentifier"u8); - writer.WriteObjectValue(EditedByCommunicationIdentifier, options); - writer.WritePropertyName("editTime"u8); - writer.WriteStringValue(EditTime, "O"); - writer.WritePropertyName("metadata"u8); - writer.WriteStartObject(); - foreach (var item in Metadata) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - foreach (var item in Properties) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - } - - AcsChatThreadPropertiesUpdatedPerUserEventData 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(AcsChatThreadPropertiesUpdatedPerUserEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatThreadPropertiesUpdatedPerUserEventData(document.RootElement, options); - } - - internal static AcsChatThreadPropertiesUpdatedPerUserEventData DeserializeAcsChatThreadPropertiesUpdatedPerUserEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationIdentifierModel editedByCommunicationIdentifier = default; - DateTimeOffset editTime = default; - IReadOnlyDictionary metadata = default; - IReadOnlyDictionary properties = default; - DateTimeOffset createTime = default; - long? version = default; - CommunicationIdentifierModel recipientCommunicationIdentifier = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("editedByCommunicationIdentifier"u8)) - { - editedByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("editTime"u8)) - { - editTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("metadata"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - metadata = dictionary; - continue; - } - if (property.NameEquals("properties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - properties = dictionary; - continue; - } - if (property.NameEquals("createTime"u8)) - { - createTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("recipientCommunicationIdentifier"u8)) - { - recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatThreadPropertiesUpdatedPerUserEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData, - createTime, - version, - editedByCommunicationIdentifier, - editTime, - metadata, - properties); - } - - 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(AcsChatThreadPropertiesUpdatedPerUserEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatThreadPropertiesUpdatedPerUserEventData 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 DeserializeAcsChatThreadPropertiesUpdatedPerUserEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatThreadPropertiesUpdatedPerUserEventData)} 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 AcsChatThreadPropertiesUpdatedPerUserEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatThreadPropertiesUpdatedPerUserEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedPerUserEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedPerUserEventData.cs deleted file mode 100644 index 571ff029f325..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadPropertiesUpdatedPerUserEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser event. - public partial class AcsChatThreadPropertiesUpdatedPerUserEventData : AcsChatThreadEventBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The original creation time of the thread. - /// The communication identifier of the user who updated the thread properties. - /// The time at which the properties of the thread were updated. - /// The thread metadata. - /// The updated thread properties. - /// , , or is null. - internal AcsChatThreadPropertiesUpdatedPerUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, DateTimeOffset createTime, CommunicationIdentifierModel editedByCommunicationIdentifier, DateTimeOffset editTime, IReadOnlyDictionary metadata, IReadOnlyDictionary properties) : base(recipientCommunicationIdentifier, createTime) - { - Argument.AssertNotNull(recipientCommunicationIdentifier, nameof(recipientCommunicationIdentifier)); - Argument.AssertNotNull(editedByCommunicationIdentifier, nameof(editedByCommunicationIdentifier)); - Argument.AssertNotNull(metadata, nameof(metadata)); - Argument.AssertNotNull(properties, nameof(properties)); - - EditedByCommunicationIdentifier = editedByCommunicationIdentifier; - EditTime = editTime; - Metadata = metadata; - Properties = properties; - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who updated the thread properties. - /// The time at which the properties of the thread were updated. - /// The thread metadata. - /// The updated thread properties. - internal AcsChatThreadPropertiesUpdatedPerUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset createTime, long? version, CommunicationIdentifierModel editedByCommunicationIdentifier, DateTimeOffset editTime, IReadOnlyDictionary metadata, IReadOnlyDictionary properties) : base(recipientCommunicationIdentifier, transactionId, threadId, serializedAdditionalRawData, createTime, version) - { - EditedByCommunicationIdentifier = editedByCommunicationIdentifier; - EditTime = editTime; - Metadata = metadata; - Properties = properties; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatThreadPropertiesUpdatedPerUserEventData() - { - } - - /// The communication identifier of the user who updated the thread properties. - public CommunicationIdentifierModel EditedByCommunicationIdentifier { get; } - /// The time at which the properties of the thread were updated. - public DateTimeOffset EditTime { get; } - /// The thread metadata. - public IReadOnlyDictionary Metadata { get; } - /// - /// The updated thread properties - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary Properties { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadWithUserDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadWithUserDeletedEventData.Serialization.cs deleted file mode 100644 index e3eb7fc57494..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadWithUserDeletedEventData.Serialization.cs +++ /dev/null @@ -1,178 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsChatThreadWithUserDeletedEventData : 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(AcsChatThreadWithUserDeletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("deletedByCommunicationIdentifier"u8); - writer.WriteObjectValue(DeletedByCommunicationIdentifier, options); - writer.WritePropertyName("deleteTime"u8); - writer.WriteStringValue(DeleteTime, "O"); - } - - AcsChatThreadWithUserDeletedEventData 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(AcsChatThreadWithUserDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsChatThreadWithUserDeletedEventData(document.RootElement, options); - } - - internal static AcsChatThreadWithUserDeletedEventData DeserializeAcsChatThreadWithUserDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationIdentifierModel deletedByCommunicationIdentifier = default; - DateTimeOffset deleteTime = default; - DateTimeOffset createTime = default; - long? version = default; - CommunicationIdentifierModel recipientCommunicationIdentifier = default; - string transactionId = default; - string threadId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deletedByCommunicationIdentifier"u8)) - { - deletedByCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("deleteTime"u8)) - { - deleteTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("createTime"u8)) - { - createTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("recipientCommunicationIdentifier"u8)) - { - recipientCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("transactionId"u8)) - { - transactionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("threadId"u8)) - { - threadId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsChatThreadWithUserDeletedEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData, - createTime, - version, - deletedByCommunicationIdentifier, - deleteTime); - } - - 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(AcsChatThreadWithUserDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsChatThreadWithUserDeletedEventData 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 DeserializeAcsChatThreadWithUserDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsChatThreadWithUserDeletedEventData)} 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 AcsChatThreadWithUserDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsChatThreadWithUserDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadWithUserDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadWithUserDeletedEventData.cs deleted file mode 100644 index 2b366137bfd7..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsChatThreadWithUserDeletedEventData.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatThreadWithUserDeleted event. - public partial class AcsChatThreadWithUserDeletedEventData : AcsChatThreadEventBaseProperties - { - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The original creation time of the thread. - /// The communication identifier of the user who deleted the thread. - /// The deletion time of the thread. - /// or is null. - internal AcsChatThreadWithUserDeletedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, DateTimeOffset createTime, CommunicationIdentifierModel deletedByCommunicationIdentifier, DateTimeOffset deleteTime) : base(recipientCommunicationIdentifier, createTime) - { - Argument.AssertNotNull(recipientCommunicationIdentifier, nameof(recipientCommunicationIdentifier)); - Argument.AssertNotNull(deletedByCommunicationIdentifier, nameof(deletedByCommunicationIdentifier)); - - DeletedByCommunicationIdentifier = deletedByCommunicationIdentifier; - DeleteTime = deleteTime; - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// Keeps track of any properties unknown to the library. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who deleted the thread. - /// The deletion time of the thread. - internal AcsChatThreadWithUserDeletedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier, string transactionId, string threadId, IDictionary serializedAdditionalRawData, DateTimeOffset createTime, long? version, CommunicationIdentifierModel deletedByCommunicationIdentifier, DateTimeOffset deleteTime) : base(recipientCommunicationIdentifier, transactionId, threadId, serializedAdditionalRawData, createTime, version) - { - DeletedByCommunicationIdentifier = deletedByCommunicationIdentifier; - DeleteTime = deleteTime; - } - - /// Initializes a new instance of for deserialization. - internal AcsChatThreadWithUserDeletedEventData() - { - } - - /// The communication identifier of the user who deleted the thread. - public CommunicationIdentifierModel DeletedByCommunicationIdentifier { get; } - /// The deletion time of the thread. - public DateTimeOffset DeleteTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportReceivedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportReceivedEventData.Serialization.cs deleted file mode 100644 index e923e3d0b390..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportReceivedEventData.Serialization.cs +++ /dev/null @@ -1,198 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsEmailDeliveryReportReceivedEventData : 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(AcsEmailDeliveryReportReceivedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Sender)) - { - writer.WritePropertyName("sender"u8); - writer.WriteStringValue(Sender); - } - if (Optional.IsDefined(Recipient)) - { - writer.WritePropertyName("recipient"u8); - writer.WriteStringValue(Recipient); - } - if (Optional.IsDefined(MessageId)) - { - writer.WritePropertyName("messageId"u8); - writer.WriteStringValue(MessageId); - } - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WritePropertyName("deliveryStatusDetails"u8); - writer.WriteObjectValue(DeliveryStatusDetails, options); - writer.WritePropertyName("deliveryAttemptTimeStamp"u8); - writer.WriteStringValue(DeliveryAttemptTimestamp, "O"); - 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 - } - } - } - - AcsEmailDeliveryReportReceivedEventData 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(AcsEmailDeliveryReportReceivedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsEmailDeliveryReportReceivedEventData(document.RootElement, options); - } - - internal static AcsEmailDeliveryReportReceivedEventData DeserializeAcsEmailDeliveryReportReceivedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string sender = default; - string recipient = default; - string messageId = default; - AcsEmailDeliveryReportStatus status = default; - AcsEmailDeliveryReportStatusDetails deliveryStatusDetails = default; - DateTimeOffset deliveryAttemptTimeStamp = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sender"u8)) - { - sender = property.Value.GetString(); - continue; - } - if (property.NameEquals("recipient"u8)) - { - recipient = property.Value.GetString(); - continue; - } - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new AcsEmailDeliveryReportStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("deliveryStatusDetails"u8)) - { - deliveryStatusDetails = AcsEmailDeliveryReportStatusDetails.DeserializeAcsEmailDeliveryReportStatusDetails(property.Value, options); - continue; - } - if (property.NameEquals("deliveryAttemptTimeStamp"u8)) - { - deliveryAttemptTimeStamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsEmailDeliveryReportReceivedEventData( - sender, - recipient, - messageId, - status, - deliveryStatusDetails, - deliveryAttemptTimeStamp, - 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(AcsEmailDeliveryReportReceivedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsEmailDeliveryReportReceivedEventData 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 DeserializeAcsEmailDeliveryReportReceivedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsEmailDeliveryReportReceivedEventData)} 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 AcsEmailDeliveryReportReceivedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsEmailDeliveryReportReceivedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportReceivedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportReceivedEventData.cs deleted file mode 100644 index f733218d6093..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportReceivedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.EmailDeliveryReportReceived event. - public partial class AcsEmailDeliveryReportReceivedEventData - { - /// - /// 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 status of the email. Any value other than Delivered is considered failed. - /// Detailed information about the status if any. - /// The time at which the email delivery report received timestamp. - /// is null. - internal AcsEmailDeliveryReportReceivedEventData(AcsEmailDeliveryReportStatus status, AcsEmailDeliveryReportStatusDetails deliveryStatusDetails, DateTimeOffset deliveryAttemptTimestamp) - { - Argument.AssertNotNull(deliveryStatusDetails, nameof(deliveryStatusDetails)); - - Status = status; - DeliveryStatusDetails = deliveryStatusDetails; - DeliveryAttemptTimestamp = deliveryAttemptTimestamp; - } - - /// Initializes a new instance of . - /// The Sender Email Address. - /// The recipient Email Address. - /// The Id of the email been sent. - /// The status of the email. Any value other than Delivered is considered failed. - /// Detailed information about the status if any. - /// The time at which the email delivery report received timestamp. - /// Keeps track of any properties unknown to the library. - internal AcsEmailDeliveryReportReceivedEventData(string sender, string recipient, string messageId, AcsEmailDeliveryReportStatus status, AcsEmailDeliveryReportStatusDetails deliveryStatusDetails, DateTimeOffset deliveryAttemptTimestamp, IDictionary serializedAdditionalRawData) - { - Sender = sender; - Recipient = recipient; - MessageId = messageId; - Status = status; - DeliveryStatusDetails = deliveryStatusDetails; - DeliveryAttemptTimestamp = deliveryAttemptTimestamp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsEmailDeliveryReportReceivedEventData() - { - } - - /// The Sender Email Address. - public string Sender { get; } - /// The recipient Email Address. - public string Recipient { get; } - /// The Id of the email been sent. - public string MessageId { get; } - /// The status of the email. Any value other than Delivered is considered failed. - public AcsEmailDeliveryReportStatus Status { get; } - /// Detailed information about the status if any. - public AcsEmailDeliveryReportStatusDetails DeliveryStatusDetails { get; } - /// The time at which the email delivery report received timestamp. - public DateTimeOffset DeliveryAttemptTimestamp { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportStatus.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportStatus.cs deleted file mode 100644 index 116220d30935..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportStatus.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// The status of the email. Any value other than Delivered is considered failed. - public readonly partial struct AcsEmailDeliveryReportStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AcsEmailDeliveryReportStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string BouncedValue = "Bounced"; - private const string DeliveredValue = "Delivered"; - private const string FailedValue = "Failed"; - private const string FilteredSpamValue = "FilteredSpam"; - private const string QuarantinedValue = "Quarantined"; - private const string SuppressedValue = "Suppressed"; - - /// Hard bounce detected while sending the email. - public static AcsEmailDeliveryReportStatus Bounced { get; } = new AcsEmailDeliveryReportStatus(BouncedValue); - /// The email was delivered. - public static AcsEmailDeliveryReportStatus Delivered { get; } = new AcsEmailDeliveryReportStatus(DeliveredValue); - /// The email failed to be delivered. - public static AcsEmailDeliveryReportStatus Failed { get; } = new AcsEmailDeliveryReportStatus(FailedValue); - /// The message was identified as spam and was rejected or blocked (not quarantined). - public static AcsEmailDeliveryReportStatus FilteredSpam { get; } = new AcsEmailDeliveryReportStatus(FilteredSpamValue); - /// The message was quarantined (as spam, bulk mail, or phishing). For more information, see Quarantined email messages in EOP (EXCHANGE ONLINE PROTECTION). - public static AcsEmailDeliveryReportStatus Quarantined { get; } = new AcsEmailDeliveryReportStatus(QuarantinedValue); - /// The email was suppressed. - public static AcsEmailDeliveryReportStatus Suppressed { get; } = new AcsEmailDeliveryReportStatus(SuppressedValue); - /// Determines if two values are the same. - public static bool operator ==(AcsEmailDeliveryReportStatus left, AcsEmailDeliveryReportStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AcsEmailDeliveryReportStatus left, AcsEmailDeliveryReportStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AcsEmailDeliveryReportStatus(string value) => new AcsEmailDeliveryReportStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AcsEmailDeliveryReportStatus other && Equals(other); - /// - public bool Equals(AcsEmailDeliveryReportStatus 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportStatusDetails.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportStatusDetails.Serialization.cs deleted file mode 100644 index e1627716463b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportStatusDetails.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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsEmailDeliveryReportStatusDetails : 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(AcsEmailDeliveryReportStatusDetails)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(StatusMessage)) - { - writer.WritePropertyName("statusMessage"u8); - writer.WriteStringValue(StatusMessage); - } - 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 - } - } - } - - AcsEmailDeliveryReportStatusDetails 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(AcsEmailDeliveryReportStatusDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsEmailDeliveryReportStatusDetails(document.RootElement, options); - } - - internal static AcsEmailDeliveryReportStatusDetails DeserializeAcsEmailDeliveryReportStatusDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string statusMessage = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("statusMessage"u8)) - { - statusMessage = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsEmailDeliveryReportStatusDetails(statusMessage, 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(AcsEmailDeliveryReportStatusDetails)} does not support writing '{options.Format}' format."); - } - } - - AcsEmailDeliveryReportStatusDetails 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 DeserializeAcsEmailDeliveryReportStatusDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsEmailDeliveryReportStatusDetails)} 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 AcsEmailDeliveryReportStatusDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsEmailDeliveryReportStatusDetails(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportStatusDetails.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportStatusDetails.cs deleted file mode 100644 index 23a571fbcab0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailDeliveryReportStatusDetails.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.Messaging.EventGrid.SystemEvents -{ - /// Detailed information about the status if any. - public partial class AcsEmailDeliveryReportStatusDetails - { - /// - /// 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 AcsEmailDeliveryReportStatusDetails() - { - } - - /// Initializes a new instance of . - /// Detailed status message. - /// Keeps track of any properties unknown to the library. - internal AcsEmailDeliveryReportStatusDetails(string statusMessage, IDictionary serializedAdditionalRawData) - { - StatusMessage = statusMessage; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Detailed status message. - public string StatusMessage { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailEngagementTrackingReportReceivedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailEngagementTrackingReportReceivedEventData.Serialization.cs deleted file mode 100644 index de59f4582b5e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailEngagementTrackingReportReceivedEventData.Serialization.cs +++ /dev/null @@ -1,213 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsEmailEngagementTrackingReportReceivedEventData : 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(AcsEmailEngagementTrackingReportReceivedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Sender)) - { - writer.WritePropertyName("sender"u8); - writer.WriteStringValue(Sender); - } - if (Optional.IsDefined(Recipient)) - { - writer.WritePropertyName("recipient"u8); - writer.WriteStringValue(Recipient); - } - if (Optional.IsDefined(MessageId)) - { - writer.WritePropertyName("messageId"u8); - writer.WriteStringValue(MessageId); - } - writer.WritePropertyName("userActionTimeStamp"u8); - writer.WriteStringValue(UserActionTimestamp, "O"); - if (Optional.IsDefined(EngagementContext)) - { - writer.WritePropertyName("engagementContext"u8); - writer.WriteStringValue(EngagementContext); - } - if (Optional.IsDefined(UserAgent)) - { - writer.WritePropertyName("userAgent"u8); - writer.WriteStringValue(UserAgent); - } - writer.WritePropertyName("engagementType"u8); - writer.WriteStringValue(Engagement.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AcsEmailEngagementTrackingReportReceivedEventData 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(AcsEmailEngagementTrackingReportReceivedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsEmailEngagementTrackingReportReceivedEventData(document.RootElement, options); - } - - internal static AcsEmailEngagementTrackingReportReceivedEventData DeserializeAcsEmailEngagementTrackingReportReceivedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string sender = default; - string recipient = default; - string messageId = default; - DateTimeOffset userActionTimeStamp = default; - string engagementContext = default; - string userAgent = default; - AcsUserEngagement engagementType = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sender"u8)) - { - sender = property.Value.GetString(); - continue; - } - if (property.NameEquals("recipient"u8)) - { - recipient = property.Value.GetString(); - continue; - } - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("userActionTimeStamp"u8)) - { - userActionTimeStamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("engagementContext"u8)) - { - engagementContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("userAgent"u8)) - { - userAgent = property.Value.GetString(); - continue; - } - if (property.NameEquals("engagementType"u8)) - { - engagementType = new AcsUserEngagement(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsEmailEngagementTrackingReportReceivedEventData( - sender, - recipient, - messageId, - userActionTimeStamp, - engagementContext, - userAgent, - engagementType, - 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(AcsEmailEngagementTrackingReportReceivedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsEmailEngagementTrackingReportReceivedEventData 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 DeserializeAcsEmailEngagementTrackingReportReceivedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsEmailEngagementTrackingReportReceivedEventData)} 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 AcsEmailEngagementTrackingReportReceivedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsEmailEngagementTrackingReportReceivedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailEngagementTrackingReportReceivedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailEngagementTrackingReportReceivedEventData.cs deleted file mode 100644 index 9de2267639d7..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsEmailEngagementTrackingReportReceivedEventData.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.EmailEngagementTrackingReportReceived event. - public partial class AcsEmailEngagementTrackingReportReceivedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time at which the user interacted with the email. - /// The type of engagement user have with email. - internal AcsEmailEngagementTrackingReportReceivedEventData(DateTimeOffset userActionTimestamp, AcsUserEngagement engagement) - { - UserActionTimestamp = userActionTimestamp; - Engagement = engagement; - } - - /// Initializes a new instance of . - /// The Sender Email Address. - /// The Recipient Email Address. - /// The Id of the email that has been sent. - /// The time at which the user interacted with the email. - /// The context of the type of engagement user had with email. - /// The user agent interacting with the email. - /// The type of engagement user have with email. - /// Keeps track of any properties unknown to the library. - internal AcsEmailEngagementTrackingReportReceivedEventData(string sender, string recipient, string messageId, DateTimeOffset userActionTimestamp, string engagementContext, string userAgent, AcsUserEngagement engagement, IDictionary serializedAdditionalRawData) - { - Sender = sender; - Recipient = recipient; - MessageId = messageId; - UserActionTimestamp = userActionTimestamp; - EngagementContext = engagementContext; - UserAgent = userAgent; - Engagement = engagement; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsEmailEngagementTrackingReportReceivedEventData() - { - } - - /// The Sender Email Address. - public string Sender { get; } - /// The Recipient Email Address. - public string Recipient { get; } - /// The Id of the email that has been sent. - public string MessageId { get; } - /// The time at which the user interacted with the email. - public DateTimeOffset UserActionTimestamp { get; } - /// The context of the type of engagement user had with email. - public string EngagementContext { get; } - /// The user agent interacting with the email. - public string UserAgent { get; } - /// The type of engagement user have with email. - public AcsUserEngagement Engagement { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallCustomContext.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallCustomContext.Serialization.cs deleted file mode 100644 index 469e084d67b5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallCustomContext.Serialization.cs +++ /dev/null @@ -1,172 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsIncomingCallCustomContext : 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(AcsIncomingCallCustomContext)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("sipHeaders"u8); - writer.WriteStartObject(); - foreach (var item in SipHeaders) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("voipHeaders"u8); - writer.WriteStartObject(); - foreach (var item in VoipHeaders) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - 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 - } - } - } - - AcsIncomingCallCustomContext 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(AcsIncomingCallCustomContext)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsIncomingCallCustomContext(document.RootElement, options); - } - - internal static AcsIncomingCallCustomContext DeserializeAcsIncomingCallCustomContext(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary sipHeaders = default; - IReadOnlyDictionary voipHeaders = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sipHeaders"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - sipHeaders = dictionary; - continue; - } - if (property.NameEquals("voipHeaders"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - voipHeaders = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsIncomingCallCustomContext(sipHeaders, voipHeaders, 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(AcsIncomingCallCustomContext)} does not support writing '{options.Format}' format."); - } - } - - AcsIncomingCallCustomContext 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 DeserializeAcsIncomingCallCustomContext(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsIncomingCallCustomContext)} 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 AcsIncomingCallCustomContext FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsIncomingCallCustomContext(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallCustomContext.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallCustomContext.cs deleted file mode 100644 index 56afdcd867fb..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallCustomContext.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.Messaging.EventGrid.SystemEvents -{ - /// Custom Context of Incoming Call. - public partial class AcsIncomingCallCustomContext - { - /// - /// 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 . - /// Sip Headers for incoming call. - /// Voip Headers for incoming call. - /// or is null. - internal AcsIncomingCallCustomContext(IReadOnlyDictionary sipHeaders, IReadOnlyDictionary voipHeaders) - { - Argument.AssertNotNull(sipHeaders, nameof(sipHeaders)); - Argument.AssertNotNull(voipHeaders, nameof(voipHeaders)); - - SipHeaders = sipHeaders; - VoipHeaders = voipHeaders; - } - - /// Initializes a new instance of . - /// Sip Headers for incoming call. - /// Voip Headers for incoming call. - /// Keeps track of any properties unknown to the library. - internal AcsIncomingCallCustomContext(IReadOnlyDictionary sipHeaders, IReadOnlyDictionary voipHeaders, IDictionary serializedAdditionalRawData) - { - SipHeaders = sipHeaders; - VoipHeaders = voipHeaders; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsIncomingCallCustomContext() - { - } - - /// Sip Headers for incoming call. - public IReadOnlyDictionary SipHeaders { get; } - /// Voip Headers for incoming call. - public IReadOnlyDictionary VoipHeaders { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallEventData.Serialization.cs deleted file mode 100644 index 30e667ddb263..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallEventData.Serialization.cs +++ /dev/null @@ -1,210 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsIncomingCallEventData : 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(AcsIncomingCallEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("to"u8); - writer.WriteObjectValue(ToCommunicationIdentifier, options); - writer.WritePropertyName("from"u8); - writer.WriteObjectValue(FromCommunicationIdentifier, options); - if (Optional.IsDefined(ServerCallId)) - { - writer.WritePropertyName("serverCallId"u8); - writer.WriteStringValue(ServerCallId); - } - if (Optional.IsDefined(CallerDisplayName)) - { - writer.WritePropertyName("callerDisplayName"u8); - writer.WriteStringValue(CallerDisplayName); - } - writer.WritePropertyName("customContext"u8); - writer.WriteObjectValue(CustomContext, options); - if (Optional.IsDefined(IncomingCallContext)) - { - writer.WritePropertyName("incomingCallContext"u8); - writer.WriteStringValue(IncomingCallContext); - } - if (Optional.IsDefined(CorrelationId)) - { - writer.WritePropertyName("correlationId"u8); - writer.WriteStringValue(CorrelationId); - } - 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 - } - } - } - - AcsIncomingCallEventData 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(AcsIncomingCallEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsIncomingCallEventData(document.RootElement, options); - } - - internal static AcsIncomingCallEventData DeserializeAcsIncomingCallEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationIdentifierModel to = default; - CommunicationIdentifierModel @from = default; - string serverCallId = default; - string callerDisplayName = default; - AcsIncomingCallCustomContext customContext = default; - string incomingCallContext = default; - string correlationId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("to"u8)) - { - to = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("from"u8)) - { - @from = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("callerDisplayName"u8)) - { - callerDisplayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("customContext"u8)) - { - customContext = AcsIncomingCallCustomContext.DeserializeAcsIncomingCallCustomContext(property.Value, options); - continue; - } - if (property.NameEquals("incomingCallContext"u8)) - { - incomingCallContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsIncomingCallEventData( - to, - @from, - serverCallId, - callerDisplayName, - customContext, - incomingCallContext, - correlationId, - 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(AcsIncomingCallEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsIncomingCallEventData 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 DeserializeAcsIncomingCallEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsIncomingCallEventData)} 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 AcsIncomingCallEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsIncomingCallEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallEventData.cs deleted file mode 100644 index a5ce2d8a623d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsIncomingCallEventData.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for an Microsoft.Communication.IncomingCall event. - public partial class AcsIncomingCallEventData - { - /// - /// 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 communication identifier of the target user. - /// The communication identifier of the user who initiated the call. - /// Custom Context of Incoming Call. - /// , or is null. - internal AcsIncomingCallEventData(CommunicationIdentifierModel toCommunicationIdentifier, CommunicationIdentifierModel fromCommunicationIdentifier, AcsIncomingCallCustomContext customContext) - { - Argument.AssertNotNull(toCommunicationIdentifier, nameof(toCommunicationIdentifier)); - Argument.AssertNotNull(fromCommunicationIdentifier, nameof(fromCommunicationIdentifier)); - Argument.AssertNotNull(customContext, nameof(customContext)); - - ToCommunicationIdentifier = toCommunicationIdentifier; - FromCommunicationIdentifier = fromCommunicationIdentifier; - CustomContext = customContext; - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The communication identifier of the user who initiated the call. - /// The Id of the server call. - /// Display name of caller. - /// Custom Context of Incoming Call. - /// Signed incoming call context. - /// CorrelationId (CallId). - /// Keeps track of any properties unknown to the library. - internal AcsIncomingCallEventData(CommunicationIdentifierModel toCommunicationIdentifier, CommunicationIdentifierModel fromCommunicationIdentifier, string serverCallId, string callerDisplayName, AcsIncomingCallCustomContext customContext, string incomingCallContext, string correlationId, IDictionary serializedAdditionalRawData) - { - ToCommunicationIdentifier = toCommunicationIdentifier; - FromCommunicationIdentifier = fromCommunicationIdentifier; - ServerCallId = serverCallId; - CallerDisplayName = callerDisplayName; - CustomContext = customContext; - IncomingCallContext = incomingCallContext; - CorrelationId = correlationId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsIncomingCallEventData() - { - } - - /// The communication identifier of the target user. - public CommunicationIdentifierModel ToCommunicationIdentifier { get; } - /// The communication identifier of the user who initiated the call. - public CommunicationIdentifierModel FromCommunicationIdentifier { get; } - /// The Id of the server call. - public string ServerCallId { get; } - /// Display name of caller. - public string CallerDisplayName { get; } - /// Custom Context of Incoming Call. - public AcsIncomingCallCustomContext CustomContext { get; } - /// Signed incoming call context. - public string IncomingCallContext { get; } - /// CorrelationId (CallId). - public string CorrelationId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsInteractiveReplyKind.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsInteractiveReplyKind.cs deleted file mode 100644 index 0ab05d173ed6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsInteractiveReplyKind.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Interactive reply kind. - public readonly partial struct AcsInteractiveReplyKind : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AcsInteractiveReplyKind(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ButtonReplyValue = "buttonReply"; - private const string ListReplyValue = "listReply"; - private const string UnknownValue = "unknown"; - - /// Messaged interactive reply type is ButtonReply. - public static AcsInteractiveReplyKind ButtonReply { get; } = new AcsInteractiveReplyKind(ButtonReplyValue); - /// Messaged interactive reply type is ListReply. - public static AcsInteractiveReplyKind ListReply { get; } = new AcsInteractiveReplyKind(ListReplyValue); - /// Messaged interactive reply type is Unknown. - public static AcsInteractiveReplyKind Unknown { get; } = new AcsInteractiveReplyKind(UnknownValue); - /// Determines if two values are the same. - public static bool operator ==(AcsInteractiveReplyKind left, AcsInteractiveReplyKind right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AcsInteractiveReplyKind left, AcsInteractiveReplyKind right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AcsInteractiveReplyKind(string value) => new AcsInteractiveReplyKind(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AcsInteractiveReplyKind other && Equals(other); - /// - public bool Equals(AcsInteractiveReplyKind 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageButtonContent.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageButtonContent.Serialization.cs deleted file mode 100644 index e275f42cae70..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageButtonContent.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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsMessageButtonContent : 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(AcsMessageButtonContent)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Text)) - { - writer.WritePropertyName("text"u8); - writer.WriteStringValue(Text); - } - if (Optional.IsDefined(Payload)) - { - writer.WritePropertyName("payload"u8); - writer.WriteStringValue(Payload); - } - 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 - } - } - } - - AcsMessageButtonContent 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(AcsMessageButtonContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsMessageButtonContent(document.RootElement, options); - } - - internal static AcsMessageButtonContent DeserializeAcsMessageButtonContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string text = default; - string payload = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("text"u8)) - { - text = property.Value.GetString(); - continue; - } - if (property.NameEquals("payload"u8)) - { - payload = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsMessageButtonContent(text, payload, 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(AcsMessageButtonContent)} does not support writing '{options.Format}' format."); - } - } - - AcsMessageButtonContent 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 DeserializeAcsMessageButtonContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsMessageButtonContent)} 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 AcsMessageButtonContent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsMessageButtonContent(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageButtonContent.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageButtonContent.cs deleted file mode 100644 index 45a1fd73025a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageButtonContent.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.Messaging.EventGrid.SystemEvents -{ - /// Message Button Content. - public partial class AcsMessageButtonContent - { - /// - /// 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 AcsMessageButtonContent() - { - } - - /// Initializes a new instance of . - /// The Text of the button. - /// The Payload of the button which was clicked by the user, setup by the business. - /// Keeps track of any properties unknown to the library. - internal AcsMessageButtonContent(string text, string payload, IDictionary serializedAdditionalRawData) - { - Text = text; - Payload = payload; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The Text of the button. - public string Text { get; } - /// The Payload of the button which was clicked by the user, setup by the business. - public string Payload { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageChannelEventError.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageChannelEventError.Serialization.cs deleted file mode 100644 index bcfd6c23a26a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageChannelEventError.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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsMessageChannelEventError : 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(AcsMessageChannelEventError)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ChannelCode)) - { - writer.WritePropertyName("channelCode"u8); - writer.WriteStringValue(ChannelCode); - } - if (Optional.IsDefined(ChannelMessage)) - { - writer.WritePropertyName("channelMessage"u8); - writer.WriteStringValue(ChannelMessage); - } - 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 - } - } - } - - AcsMessageChannelEventError 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(AcsMessageChannelEventError)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsMessageChannelEventError(document.RootElement, options); - } - - internal static AcsMessageChannelEventError DeserializeAcsMessageChannelEventError(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string channelCode = default; - string channelMessage = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("channelCode"u8)) - { - channelCode = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelMessage"u8)) - { - channelMessage = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsMessageChannelEventError(channelCode, channelMessage, 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(AcsMessageChannelEventError)} does not support writing '{options.Format}' format."); - } - } - - AcsMessageChannelEventError 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 DeserializeAcsMessageChannelEventError(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsMessageChannelEventError)} 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 AcsMessageChannelEventError FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsMessageChannelEventError(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageChannelEventError.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageChannelEventError.cs deleted file mode 100644 index d8cc61fcb0a2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageChannelEventError.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.Messaging.EventGrid.SystemEvents -{ - /// Message Channel Event Error. - public partial class AcsMessageChannelEventError - { - /// - /// 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 AcsMessageChannelEventError() - { - } - - /// Initializes a new instance of . - /// The channel error code. - /// The channel error message. - /// Keeps track of any properties unknown to the library. - internal AcsMessageChannelEventError(string channelCode, string channelMessage, IDictionary serializedAdditionalRawData) - { - ChannelCode = channelCode; - ChannelMessage = channelMessage; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The channel error code. - public string ChannelCode { get; } - /// The channel error message. - public string ChannelMessage { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageChannelKind.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageChannelKind.cs deleted file mode 100644 index 6fb22ab63ec1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageChannelKind.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.Messaging.EventGrid.SystemEvents -{ - /// Message channel kind. - public readonly partial struct AcsMessageChannelKind : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AcsMessageChannelKind(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string WhatsappValue = "whatsapp"; - - /// Updated message channel type is WhatsApp. - public static AcsMessageChannelKind Whatsapp { get; } = new AcsMessageChannelKind(WhatsappValue); - /// Determines if two values are the same. - public static bool operator ==(AcsMessageChannelKind left, AcsMessageChannelKind right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AcsMessageChannelKind left, AcsMessageChannelKind right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AcsMessageChannelKind(string value) => new AcsMessageChannelKind(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AcsMessageChannelKind other && Equals(other); - /// - public bool Equals(AcsMessageChannelKind 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageContext.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageContext.Serialization.cs deleted file mode 100644 index 9ffc096f009a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageContext.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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsMessageContext : 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(AcsMessageContext)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(From)) - { - writer.WritePropertyName("from"u8); - writer.WriteStringValue(From); - } - if (Optional.IsDefined(MessageId)) - { - writer.WritePropertyName("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 - } - } - } - - AcsMessageContext 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(AcsMessageContext)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsMessageContext(document.RootElement, options); - } - - internal static AcsMessageContext DeserializeAcsMessageContext(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string @from = default; - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("from"u8)) - { - @from = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsMessageContext(@from, id, 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(AcsMessageContext)} does not support writing '{options.Format}' format."); - } - } - - AcsMessageContext 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 DeserializeAcsMessageContext(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsMessageContext)} 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 AcsMessageContext FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsMessageContext(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageContext.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageContext.cs deleted file mode 100644 index d347701b6a6c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageContext.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.Messaging.EventGrid.SystemEvents -{ - /// Message Context. - public partial class AcsMessageContext - { - /// - /// 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 AcsMessageContext() - { - } - - /// Initializes a new instance of . - /// The WhatsApp ID for the customer who replied to an inbound message. - /// The message ID for the sent message for an inbound reply. - /// Keeps track of any properties unknown to the library. - internal AcsMessageContext(string @from, string messageId, IDictionary serializedAdditionalRawData) - { - From = @from; - MessageId = messageId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The WhatsApp ID for the customer who replied to an inbound message. - public string From { get; } - /// The message ID for the sent message for an inbound reply. - public string MessageId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageDeliveryStatus.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageDeliveryStatus.cs deleted file mode 100644 index afb1a13707cd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageDeliveryStatus.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Message delivery status. - public readonly partial struct AcsMessageDeliveryStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AcsMessageDeliveryStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ReadValue = "read"; - private const string DeliveredValue = "delivered"; - private const string FailedValue = "failed"; - private const string SentValue = "sent"; - private const string WarningValue = "warning"; - private const string UnknownValue = "unknown"; - - /// Read. - public static AcsMessageDeliveryStatus Read { get; } = new AcsMessageDeliveryStatus(ReadValue); - /// Delivered. - public static AcsMessageDeliveryStatus Delivered { get; } = new AcsMessageDeliveryStatus(DeliveredValue); - /// Failed. - public static AcsMessageDeliveryStatus Failed { get; } = new AcsMessageDeliveryStatus(FailedValue); - /// Sent. - public static AcsMessageDeliveryStatus Sent { get; } = new AcsMessageDeliveryStatus(SentValue); - /// Warning. - public static AcsMessageDeliveryStatus Warning { get; } = new AcsMessageDeliveryStatus(WarningValue); - /// Unknown. - public static AcsMessageDeliveryStatus Unknown { get; } = new AcsMessageDeliveryStatus(UnknownValue); - /// Determines if two values are the same. - public static bool operator ==(AcsMessageDeliveryStatus left, AcsMessageDeliveryStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AcsMessageDeliveryStatus left, AcsMessageDeliveryStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AcsMessageDeliveryStatus(string value) => new AcsMessageDeliveryStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AcsMessageDeliveryStatus other && Equals(other); - /// - public bool Equals(AcsMessageDeliveryStatus 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageDeliveryStatusUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageDeliveryStatusUpdatedEventData.Serialization.cs deleted file mode 100644 index 72b0f5b834ec..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageDeliveryStatusUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsMessageDeliveryStatusUpdatedEventData : 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(AcsMessageDeliveryStatusUpdatedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(MessageId)) - { - writer.WritePropertyName("messageId"u8); - writer.WriteStringValue(MessageId); - } - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WritePropertyName("channelType"u8); - writer.WriteStringValue(ChannelKind.ToString()); - } - - AcsMessageDeliveryStatusUpdatedEventData 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(AcsMessageDeliveryStatusUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsMessageDeliveryStatusUpdatedEventData(document.RootElement, options); - } - - internal static AcsMessageDeliveryStatusUpdatedEventData DeserializeAcsMessageDeliveryStatusUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string messageId = default; - AcsMessageDeliveryStatus status = default; - AcsMessageChannelKind channelType = default; - string @from = default; - string to = default; - DateTimeOffset receivedTimeStamp = default; - AcsMessageChannelEventError error = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new AcsMessageDeliveryStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("channelType"u8)) - { - channelType = new AcsMessageChannelKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("from"u8)) - { - @from = property.Value.GetString(); - continue; - } - if (property.NameEquals("to"u8)) - { - to = property.Value.GetString(); - continue; - } - if (property.NameEquals("receivedTimeStamp"u8)) - { - receivedTimeStamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("error"u8)) - { - error = AcsMessageChannelEventError.DeserializeAcsMessageChannelEventError(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsMessageDeliveryStatusUpdatedEventData( - @from, - to, - receivedTimeStamp, - error, - serializedAdditionalRawData, - messageId, - status, - channelType); - } - - 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(AcsMessageDeliveryStatusUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsMessageDeliveryStatusUpdatedEventData 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 DeserializeAcsMessageDeliveryStatusUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsMessageDeliveryStatusUpdatedEventData)} 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 AcsMessageDeliveryStatusUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsMessageDeliveryStatusUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageDeliveryStatusUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageDeliveryStatusUpdatedEventData.cs deleted file mode 100644 index 08ee6836ec0e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageDeliveryStatusUpdatedEventData.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.AdvancedMessageDeliveryStatusUpdated event. - public partial class AcsMessageDeliveryStatusUpdatedEventData : AcsMessageEventData - { - /// Initializes a new instance of . - /// The time message was received. - /// The channel event error. - /// The updated message status. - /// The updated message channel type. - /// is null. - internal AcsMessageDeliveryStatusUpdatedEventData(DateTimeOffset receivedTimestamp, AcsMessageChannelEventError error, AcsMessageDeliveryStatus status, AcsMessageChannelKind channelKind) : base(receivedTimestamp, error) - { - Argument.AssertNotNull(error, nameof(error)); - - Status = status; - ChannelKind = channelKind; - } - - /// Initializes a new instance of . - /// The message sender. - /// The message recipient. - /// The time message was received. - /// The channel event error. - /// Keeps track of any properties unknown to the library. - /// The message id. - /// The updated message status. - /// The updated message channel type. - internal AcsMessageDeliveryStatusUpdatedEventData(string @from, string to, DateTimeOffset receivedTimestamp, AcsMessageChannelEventError error, IDictionary serializedAdditionalRawData, string messageId, AcsMessageDeliveryStatus status, AcsMessageChannelKind channelKind) : base(@from, to, receivedTimestamp, error, serializedAdditionalRawData) - { - MessageId = messageId; - Status = status; - ChannelKind = channelKind; - } - - /// Initializes a new instance of for deserialization. - internal AcsMessageDeliveryStatusUpdatedEventData() - { - } - - /// The message id. - public string MessageId { get; } - /// The updated message status. - public AcsMessageDeliveryStatus Status { get; } - /// The updated message channel type. - public AcsMessageChannelKind ChannelKind { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageEventData.Serialization.cs deleted file mode 100644 index a2d1c63653e7..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageEventData.Serialization.cs +++ /dev/null @@ -1,172 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsMessageEventData : 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(AcsMessageEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(From)) - { - writer.WritePropertyName("from"u8); - writer.WriteStringValue(From); - } - if (Optional.IsDefined(To)) - { - writer.WritePropertyName("to"u8); - writer.WriteStringValue(To); - } - writer.WritePropertyName("receivedTimeStamp"u8); - writer.WriteStringValue(ReceivedTimestamp, "O"); - writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AcsMessageEventData 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(AcsMessageEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsMessageEventData(document.RootElement, options); - } - - internal static AcsMessageEventData DeserializeAcsMessageEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string @from = default; - string to = default; - DateTimeOffset receivedTimeStamp = default; - AcsMessageChannelEventError error = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("from"u8)) - { - @from = property.Value.GetString(); - continue; - } - if (property.NameEquals("to"u8)) - { - to = property.Value.GetString(); - continue; - } - if (property.NameEquals("receivedTimeStamp"u8)) - { - receivedTimeStamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("error"u8)) - { - error = AcsMessageChannelEventError.DeserializeAcsMessageChannelEventError(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsMessageEventData(@from, to, receivedTimeStamp, error, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(AcsMessageEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsMessageEventData 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 DeserializeAcsMessageEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsMessageEventData)} 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 AcsMessageEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsMessageEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageEventData.cs deleted file mode 100644 index cedcc1dc0758..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of all chat thread events. - public partial class AcsMessageEventData - { - /// - /// 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 time message was received. - /// The channel event error. - /// is null. - internal AcsMessageEventData(DateTimeOffset receivedTimestamp, AcsMessageChannelEventError error) - { - Argument.AssertNotNull(error, nameof(error)); - - ReceivedTimestamp = receivedTimestamp; - Error = error; - } - - /// Initializes a new instance of . - /// The message sender. - /// The message recipient. - /// The time message was received. - /// The channel event error. - /// Keeps track of any properties unknown to the library. - internal AcsMessageEventData(string @from, string to, DateTimeOffset receivedTimestamp, AcsMessageChannelEventError error, IDictionary serializedAdditionalRawData) - { - From = @from; - To = to; - ReceivedTimestamp = receivedTimestamp; - Error = error; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsMessageEventData() - { - } - - /// The message sender. - public string From { get; } - /// The message recipient. - public string To { get; } - /// The time message was received. - public DateTimeOffset ReceivedTimestamp { get; } - /// The channel event error. - public AcsMessageChannelEventError Error { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveButtonReplyContent.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveButtonReplyContent.Serialization.cs deleted file mode 100644 index 2216403a633d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveButtonReplyContent.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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsMessageInteractiveButtonReplyContent : 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(AcsMessageInteractiveButtonReplyContent)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ButtonId)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(ButtonId); - } - if (Optional.IsDefined(Title)) - { - writer.WritePropertyName("title"u8); - writer.WriteStringValue(Title); - } - 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 - } - } - } - - AcsMessageInteractiveButtonReplyContent 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(AcsMessageInteractiveButtonReplyContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsMessageInteractiveButtonReplyContent(document.RootElement, options); - } - - internal static AcsMessageInteractiveButtonReplyContent DeserializeAcsMessageInteractiveButtonReplyContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string title = 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("title"u8)) - { - title = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsMessageInteractiveButtonReplyContent(id, title, 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(AcsMessageInteractiveButtonReplyContent)} does not support writing '{options.Format}' format."); - } - } - - AcsMessageInteractiveButtonReplyContent 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 DeserializeAcsMessageInteractiveButtonReplyContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsMessageInteractiveButtonReplyContent)} 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 AcsMessageInteractiveButtonReplyContent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsMessageInteractiveButtonReplyContent(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveButtonReplyContent.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveButtonReplyContent.cs deleted file mode 100644 index 1fe95c67946d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveButtonReplyContent.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.Messaging.EventGrid.SystemEvents -{ - /// Message Interactive button reply content for a user to business message. - public partial class AcsMessageInteractiveButtonReplyContent - { - /// - /// 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 AcsMessageInteractiveButtonReplyContent() - { - } - - /// Initializes a new instance of . - /// The ID of the button. - /// The title of the button. - /// Keeps track of any properties unknown to the library. - internal AcsMessageInteractiveButtonReplyContent(string buttonId, string title, IDictionary serializedAdditionalRawData) - { - ButtonId = buttonId; - Title = title; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The ID of the button. - public string ButtonId { get; } - /// The title of the button. - public string Title { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveContent.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveContent.Serialization.cs deleted file mode 100644 index 6ff87f62f04f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveContent.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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsMessageInteractiveContent : 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(AcsMessageInteractiveContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ReplyKind.ToString()); - writer.WritePropertyName("buttonReply"u8); - writer.WriteObjectValue(ButtonReply, options); - writer.WritePropertyName("listReply"u8); - writer.WriteObjectValue(ListReply, 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 - } - } - } - - AcsMessageInteractiveContent 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(AcsMessageInteractiveContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsMessageInteractiveContent(document.RootElement, options); - } - - internal static AcsMessageInteractiveContent DeserializeAcsMessageInteractiveContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AcsInteractiveReplyKind type = default; - AcsMessageInteractiveButtonReplyContent buttonReply = default; - AcsMessageInteractiveListReplyContent listReply = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = new AcsInteractiveReplyKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("buttonReply"u8)) - { - buttonReply = AcsMessageInteractiveButtonReplyContent.DeserializeAcsMessageInteractiveButtonReplyContent(property.Value, options); - continue; - } - if (property.NameEquals("listReply"u8)) - { - listReply = AcsMessageInteractiveListReplyContent.DeserializeAcsMessageInteractiveListReplyContent(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsMessageInteractiveContent(type, buttonReply, listReply, 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(AcsMessageInteractiveContent)} does not support writing '{options.Format}' format."); - } - } - - AcsMessageInteractiveContent 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 DeserializeAcsMessageInteractiveContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsMessageInteractiveContent)} 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 AcsMessageInteractiveContent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsMessageInteractiveContent(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveContent.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveContent.cs deleted file mode 100644 index 0d59cf31c2ff..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveContent.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Message Interactive Content. - public partial class AcsMessageInteractiveContent - { - /// - /// 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 Message interactive reply type. - /// The Message Sent when a customer clicks a button. - /// The Message Sent when a customer selects an item from a list. - /// or is null. - internal AcsMessageInteractiveContent(AcsInteractiveReplyKind replyKind, AcsMessageInteractiveButtonReplyContent buttonReply, AcsMessageInteractiveListReplyContent listReply) - { - Argument.AssertNotNull(buttonReply, nameof(buttonReply)); - Argument.AssertNotNull(listReply, nameof(listReply)); - - ReplyKind = replyKind; - ButtonReply = buttonReply; - ListReply = listReply; - } - - /// Initializes a new instance of . - /// The Message interactive reply type. - /// The Message Sent when a customer clicks a button. - /// The Message Sent when a customer selects an item from a list. - /// Keeps track of any properties unknown to the library. - internal AcsMessageInteractiveContent(AcsInteractiveReplyKind replyKind, AcsMessageInteractiveButtonReplyContent buttonReply, AcsMessageInteractiveListReplyContent listReply, IDictionary serializedAdditionalRawData) - { - ReplyKind = replyKind; - ButtonReply = buttonReply; - ListReply = listReply; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsMessageInteractiveContent() - { - } - - /// The Message interactive reply type. - public AcsInteractiveReplyKind ReplyKind { get; } - /// The Message Sent when a customer clicks a button. - public AcsMessageInteractiveButtonReplyContent ButtonReply { get; } - /// The Message Sent when a customer selects an item from a list. - public AcsMessageInteractiveListReplyContent ListReply { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveListReplyContent.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveListReplyContent.Serialization.cs deleted file mode 100644 index 12bbb0dc4500..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveListReplyContent.Serialization.cs +++ /dev/null @@ -1,167 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsMessageInteractiveListReplyContent : 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(AcsMessageInteractiveListReplyContent)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ListItemId)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(ListItemId); - } - if (Optional.IsDefined(Title)) - { - writer.WritePropertyName("title"u8); - writer.WriteStringValue(Title); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - 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 - } - } - } - - AcsMessageInteractiveListReplyContent 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(AcsMessageInteractiveListReplyContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsMessageInteractiveListReplyContent(document.RootElement, options); - } - - internal static AcsMessageInteractiveListReplyContent DeserializeAcsMessageInteractiveListReplyContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string title = default; - string description = 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("title"u8)) - { - title = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsMessageInteractiveListReplyContent(id, title, description, 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(AcsMessageInteractiveListReplyContent)} does not support writing '{options.Format}' format."); - } - } - - AcsMessageInteractiveListReplyContent 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 DeserializeAcsMessageInteractiveListReplyContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsMessageInteractiveListReplyContent)} 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 AcsMessageInteractiveListReplyContent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsMessageInteractiveListReplyContent(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveListReplyContent.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveListReplyContent.cs deleted file mode 100644 index fff70f8e670e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageInteractiveListReplyContent.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.Messaging.EventGrid.SystemEvents -{ - /// Message Interactive list reply content for a user to business message. - public partial class AcsMessageInteractiveListReplyContent - { - /// - /// 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 AcsMessageInteractiveListReplyContent() - { - } - - /// Initializes a new instance of . - /// The ID of the selected list item. - /// The title of the selected list item. - /// The description of the selected row. - /// Keeps track of any properties unknown to the library. - internal AcsMessageInteractiveListReplyContent(string listItemId, string title, string description, IDictionary serializedAdditionalRawData) - { - ListItemId = listItemId; - Title = title; - Description = description; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The ID of the selected list item. - public string ListItemId { get; } - /// The title of the selected list item. - public string Title { get; } - /// The description of the selected row. - public string Description { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageMediaContent.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageMediaContent.Serialization.cs deleted file mode 100644 index c1b6362d3b52..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageMediaContent.Serialization.cs +++ /dev/null @@ -1,178 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsMessageMediaContent : 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(AcsMessageMediaContent)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(MimeType)) - { - writer.WritePropertyName("mimeType"u8); - writer.WriteStringValue(MimeType); - } - if (Optional.IsDefined(MediaId)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(MediaId); - } - if (Optional.IsDefined(FileName)) - { - writer.WritePropertyName("fileName"u8); - writer.WriteStringValue(FileName); - } - if (Optional.IsDefined(Caption)) - { - writer.WritePropertyName("caption"u8); - writer.WriteStringValue(Caption); - } - 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 - } - } - } - - AcsMessageMediaContent 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(AcsMessageMediaContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsMessageMediaContent(document.RootElement, options); - } - - internal static AcsMessageMediaContent DeserializeAcsMessageMediaContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string mimeType = default; - string id = default; - string fileName = default; - string caption = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("mimeType"u8)) - { - mimeType = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("fileName"u8)) - { - fileName = property.Value.GetString(); - continue; - } - if (property.NameEquals("caption"u8)) - { - caption = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsMessageMediaContent(mimeType, id, fileName, caption, 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(AcsMessageMediaContent)} does not support writing '{options.Format}' format."); - } - } - - AcsMessageMediaContent 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 DeserializeAcsMessageMediaContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsMessageMediaContent)} 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 AcsMessageMediaContent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsMessageMediaContent(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageMediaContent.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageMediaContent.cs deleted file mode 100644 index a217e0538938..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageMediaContent.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Message Media Content. - public partial class AcsMessageMediaContent - { - /// - /// 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 AcsMessageMediaContent() - { - } - - /// Initializes a new instance of . - /// The MIME type of the file this media represents. - /// The media identifier. - /// The filename of the underlying media file as specified when uploaded. - /// The caption for the media object, if supported and provided. - /// Keeps track of any properties unknown to the library. - internal AcsMessageMediaContent(string mimeType, string mediaId, string fileName, string caption, IDictionary serializedAdditionalRawData) - { - MimeType = mimeType; - MediaId = mediaId; - FileName = fileName; - Caption = caption; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The MIME type of the file this media represents. - public string MimeType { get; } - /// The media identifier. - public string MediaId { get; } - /// The filename of the underlying media file as specified when uploaded. - public string FileName { get; } - /// The caption for the media object, if supported and provided. - public string Caption { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageReceivedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageReceivedEventData.Serialization.cs deleted file mode 100644 index 29d76082dfa2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageReceivedEventData.Serialization.cs +++ /dev/null @@ -1,206 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsMessageReceivedEventData : 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(AcsMessageReceivedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Content)) - { - writer.WritePropertyName("content"u8); - writer.WriteStringValue(Content); - } - writer.WritePropertyName("channelType"u8); - writer.WriteStringValue(ChannelKind.ToString()); - writer.WritePropertyName("media"u8); - writer.WriteObjectValue(MediaContent, options); - writer.WritePropertyName("context"u8); - writer.WriteObjectValue(Context, options); - writer.WritePropertyName("button"u8); - writer.WriteObjectValue(Button, options); - writer.WritePropertyName("interactive"u8); - writer.WriteObjectValue(InteractiveContent, options); - } - - AcsMessageReceivedEventData 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(AcsMessageReceivedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsMessageReceivedEventData(document.RootElement, options); - } - - internal static AcsMessageReceivedEventData DeserializeAcsMessageReceivedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string content = default; - AcsMessageChannelKind channelType = default; - AcsMessageMediaContent media = default; - AcsMessageContext context = default; - AcsMessageButtonContent button = default; - AcsMessageInteractiveContent interactive = default; - string @from = default; - string to = default; - DateTimeOffset receivedTimeStamp = default; - AcsMessageChannelEventError error = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("content"u8)) - { - content = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelType"u8)) - { - channelType = new AcsMessageChannelKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("media"u8)) - { - media = AcsMessageMediaContent.DeserializeAcsMessageMediaContent(property.Value, options); - continue; - } - if (property.NameEquals("context"u8)) - { - context = AcsMessageContext.DeserializeAcsMessageContext(property.Value, options); - continue; - } - if (property.NameEquals("button"u8)) - { - button = AcsMessageButtonContent.DeserializeAcsMessageButtonContent(property.Value, options); - continue; - } - if (property.NameEquals("interactive"u8)) - { - interactive = AcsMessageInteractiveContent.DeserializeAcsMessageInteractiveContent(property.Value, options); - continue; - } - if (property.NameEquals("from"u8)) - { - @from = property.Value.GetString(); - continue; - } - if (property.NameEquals("to"u8)) - { - to = property.Value.GetString(); - continue; - } - if (property.NameEquals("receivedTimeStamp"u8)) - { - receivedTimeStamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("error"u8)) - { - error = AcsMessageChannelEventError.DeserializeAcsMessageChannelEventError(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsMessageReceivedEventData( - @from, - to, - receivedTimeStamp, - error, - serializedAdditionalRawData, - content, - channelType, - media, - context, - button, - interactive); - } - - 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(AcsMessageReceivedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsMessageReceivedEventData 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 DeserializeAcsMessageReceivedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsMessageReceivedEventData)} 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 AcsMessageReceivedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsMessageReceivedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageReceivedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageReceivedEventData.cs deleted file mode 100644 index b7435b051bdf..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsMessageReceivedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.AdvancedMessageReceived event. - public partial class AcsMessageReceivedEventData : AcsMessageEventData - { - /// Initializes a new instance of . - /// The time message was received. - /// The channel event error. - /// The message channel type. - /// The received message media content. - /// The received message context. - /// The received message button content. - /// The received message interactive content. - /// , , , or is null. - internal AcsMessageReceivedEventData(DateTimeOffset receivedTimestamp, AcsMessageChannelEventError error, AcsMessageChannelKind channelKind, AcsMessageMediaContent mediaContent, AcsMessageContext context, AcsMessageButtonContent button, AcsMessageInteractiveContent interactiveContent) : base(receivedTimestamp, error) - { - Argument.AssertNotNull(error, nameof(error)); - Argument.AssertNotNull(mediaContent, nameof(mediaContent)); - Argument.AssertNotNull(context, nameof(context)); - Argument.AssertNotNull(button, nameof(button)); - Argument.AssertNotNull(interactiveContent, nameof(interactiveContent)); - - ChannelKind = channelKind; - MediaContent = mediaContent; - Context = context; - Button = button; - InteractiveContent = interactiveContent; - } - - /// Initializes a new instance of . - /// The message sender. - /// The message recipient. - /// The time message was received. - /// The channel event error. - /// Keeps track of any properties unknown to the library. - /// The message content. - /// The message channel type. - /// The received message media content. - /// The received message context. - /// The received message button content. - /// The received message interactive content. - internal AcsMessageReceivedEventData(string @from, string to, DateTimeOffset receivedTimestamp, AcsMessageChannelEventError error, IDictionary serializedAdditionalRawData, string content, AcsMessageChannelKind channelKind, AcsMessageMediaContent mediaContent, AcsMessageContext context, AcsMessageButtonContent button, AcsMessageInteractiveContent interactiveContent) : base(@from, to, receivedTimestamp, error, serializedAdditionalRawData) - { - Content = content; - ChannelKind = channelKind; - MediaContent = mediaContent; - Context = context; - Button = button; - InteractiveContent = interactiveContent; - } - - /// Initializes a new instance of for deserialization. - internal AcsMessageReceivedEventData() - { - } - - /// The message content. - public string Content { get; } - /// The message channel type. - public AcsMessageChannelKind ChannelKind { get; } - /// The received message media content. - public AcsMessageMediaContent MediaContent { get; } - /// The received message context. - public AcsMessageContext Context { get; } - /// The received message button content. - public AcsMessageButtonContent Button { get; } - /// The received message interactive content. - public AcsMessageInteractiveContent InteractiveContent { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingChunkInfoProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingChunkInfoProperties.Serialization.cs deleted file mode 100644 index a8f2e2d3be36..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingChunkInfoProperties.Serialization.cs +++ /dev/null @@ -1,211 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRecordingChunkInfoProperties : 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(AcsRecordingChunkInfoProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(DocumentId)) - { - writer.WritePropertyName("documentId"u8); - writer.WriteStringValue(DocumentId); - } - if (Optional.IsDefined(Index)) - { - writer.WritePropertyName("index"u8); - writer.WriteNumberValue(Index.Value); - } - if (Optional.IsDefined(EndReason)) - { - writer.WritePropertyName("endReason"u8); - writer.WriteStringValue(EndReason); - } - if (Optional.IsDefined(MetadataLocation)) - { - writer.WritePropertyName("metadataLocation"u8); - writer.WriteStringValue(MetadataLocation); - } - if (Optional.IsDefined(ContentLocation)) - { - writer.WritePropertyName("contentLocation"u8); - writer.WriteStringValue(ContentLocation); - } - if (Optional.IsDefined(DeleteLocation)) - { - writer.WritePropertyName("deleteLocation"u8); - writer.WriteStringValue(DeleteLocation); - } - 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 - } - } - } - - AcsRecordingChunkInfoProperties 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(AcsRecordingChunkInfoProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRecordingChunkInfoProperties(document.RootElement, options); - } - - internal static AcsRecordingChunkInfoProperties DeserializeAcsRecordingChunkInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string documentId = default; - long? index = default; - string endReason = default; - string metadataLocation = default; - string contentLocation = default; - string deleteLocation = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("documentId"u8)) - { - documentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("index"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - index = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("endReason"u8)) - { - endReason = property.Value.GetString(); - continue; - } - if (property.NameEquals("metadataLocation"u8)) - { - metadataLocation = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentLocation"u8)) - { - contentLocation = property.Value.GetString(); - continue; - } - if (property.NameEquals("deleteLocation"u8)) - { - deleteLocation = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRecordingChunkInfoProperties( - documentId, - index, - endReason, - metadataLocation, - contentLocation, - deleteLocation, - 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(AcsRecordingChunkInfoProperties)} does not support writing '{options.Format}' format."); - } - } - - AcsRecordingChunkInfoProperties 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 DeserializeAcsRecordingChunkInfoProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRecordingChunkInfoProperties)} 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 AcsRecordingChunkInfoProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRecordingChunkInfoProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingChunkInfoProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingChunkInfoProperties.cs deleted file mode 100644 index e27b518ff320..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingChunkInfoProperties.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema for all properties of Recording Chunk Information. - public partial class AcsRecordingChunkInfoProperties - { - /// - /// 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 AcsRecordingChunkInfoProperties() - { - } - - /// Initializes a new instance of . - /// The documentId of the recording chunk. - /// The index of the recording chunk. - /// The reason for ending the recording chunk. - /// The location of the metadata for this chunk. - /// The location of the content for this chunk. - /// The location to delete all chunk storage. - /// Keeps track of any properties unknown to the library. - internal AcsRecordingChunkInfoProperties(string documentId, long? index, string endReason, string metadataLocation, string contentLocation, string deleteLocation, IDictionary serializedAdditionalRawData) - { - DocumentId = documentId; - Index = index; - EndReason = endReason; - MetadataLocation = metadataLocation; - ContentLocation = contentLocation; - DeleteLocation = deleteLocation; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The documentId of the recording chunk. - public string DocumentId { get; } - /// The index of the recording chunk. - public long? Index { get; } - /// The reason for ending the recording chunk. - public string EndReason { get; } - /// The location of the metadata for this chunk. - public string MetadataLocation { get; } - /// The location of the content for this chunk. - public string ContentLocation { get; } - /// The location to delete all chunk storage. - public string DeleteLocation { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingFileStatusUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingFileStatusUpdatedEventData.Serialization.cs deleted file mode 100644 index 395739dfd570..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingFileStatusUpdatedEventData.Serialization.cs +++ /dev/null @@ -1,208 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRecordingFileStatusUpdatedEventData : 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(AcsRecordingFileStatusUpdatedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("recordingStorageInfo"u8); - writer.WriteObjectValue(RecordingStorageInfo, options); - writer.WritePropertyName("recordingStartTime"u8); - writer.WriteStringValue(RecordingStartTime, "O"); - if (Optional.IsDefined(RecordingDurationMs)) - { - writer.WritePropertyName("recordingDurationMs"u8); - writer.WriteNumberValue(RecordingDurationMs.Value); - } - writer.WritePropertyName("recordingContentType"u8); - writer.WriteStringValue(RecordingContentType.ToString()); - writer.WritePropertyName("recordingChannelType"u8); - writer.WriteStringValue(RecordingChannelKind.ToString()); - writer.WritePropertyName("recordingFormatType"u8); - writer.WriteStringValue(RecordingFormatType.ToString()); - if (Optional.IsDefined(SessionEndReason)) - { - writer.WritePropertyName("sessionEndReason"u8); - writer.WriteStringValue(SessionEndReason); - } - 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 - } - } - } - - AcsRecordingFileStatusUpdatedEventData 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(AcsRecordingFileStatusUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRecordingFileStatusUpdatedEventData(document.RootElement, options); - } - - internal static AcsRecordingFileStatusUpdatedEventData DeserializeAcsRecordingFileStatusUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AcsRecordingStorageInfoProperties recordingStorageInfo = default; - DateTimeOffset recordingStartTime = default; - long? recordingDurationMs = default; - RecordingContentType recordingContentType = default; - RecordingChannelType recordingChannelType = default; - RecordingFormatType recordingFormatType = default; - string sessionEndReason = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("recordingStorageInfo"u8)) - { - recordingStorageInfo = AcsRecordingStorageInfoProperties.DeserializeAcsRecordingStorageInfoProperties(property.Value, options); - continue; - } - if (property.NameEquals("recordingStartTime"u8)) - { - recordingStartTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("recordingDurationMs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - recordingDurationMs = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("recordingContentType"u8)) - { - recordingContentType = new RecordingContentType(property.Value.GetString()); - continue; - } - if (property.NameEquals("recordingChannelType"u8)) - { - recordingChannelType = new RecordingChannelType(property.Value.GetString()); - continue; - } - if (property.NameEquals("recordingFormatType"u8)) - { - recordingFormatType = new RecordingFormatType(property.Value.GetString()); - continue; - } - if (property.NameEquals("sessionEndReason"u8)) - { - sessionEndReason = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRecordingFileStatusUpdatedEventData( - recordingStorageInfo, - recordingStartTime, - recordingDurationMs, - recordingContentType, - recordingChannelType, - recordingFormatType, - sessionEndReason, - 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(AcsRecordingFileStatusUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRecordingFileStatusUpdatedEventData 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 DeserializeAcsRecordingFileStatusUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRecordingFileStatusUpdatedEventData)} 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 AcsRecordingFileStatusUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRecordingFileStatusUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingFileStatusUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingFileStatusUpdatedEventData.cs deleted file mode 100644 index a5e50aee2cc8..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingFileStatusUpdatedEventData.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RecordingFileStatusUpdated event. - public partial class AcsRecordingFileStatusUpdatedEventData - { - /// - /// 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 details of recording storage information. - /// The time at which the recording started. - /// The recording content type- AudioVideo, or Audio. - /// The recording channel type - Mixed, Unmixed. - /// The recording format type - Mp4, Mp3, Wav. - /// is null. - internal AcsRecordingFileStatusUpdatedEventData(AcsRecordingStorageInfoProperties recordingStorageInfo, DateTimeOffset recordingStartTime, RecordingContentType recordingContentType, RecordingChannelType recordingChannelKind, RecordingFormatType recordingFormatType) - { - Argument.AssertNotNull(recordingStorageInfo, nameof(recordingStorageInfo)); - - RecordingStorageInfo = recordingStorageInfo; - RecordingStartTime = recordingStartTime; - RecordingContentType = recordingContentType; - RecordingChannelKind = recordingChannelKind; - RecordingFormatType = recordingFormatType; - } - - /// Initializes a new instance of . - /// The details of recording storage information. - /// The time at which the recording started. - /// The recording duration in milliseconds. - /// The recording content type- AudioVideo, or Audio. - /// The recording channel type - Mixed, Unmixed. - /// The recording format type - Mp4, Mp3, Wav. - /// The reason for ending recording session. - /// Keeps track of any properties unknown to the library. - internal AcsRecordingFileStatusUpdatedEventData(AcsRecordingStorageInfoProperties recordingStorageInfo, DateTimeOffset recordingStartTime, long? recordingDurationMs, RecordingContentType recordingContentType, RecordingChannelType recordingChannelKind, RecordingFormatType recordingFormatType, string sessionEndReason, IDictionary serializedAdditionalRawData) - { - RecordingStorageInfo = recordingStorageInfo; - RecordingStartTime = recordingStartTime; - RecordingDurationMs = recordingDurationMs; - RecordingContentType = recordingContentType; - RecordingChannelKind = recordingChannelKind; - RecordingFormatType = recordingFormatType; - SessionEndReason = sessionEndReason; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsRecordingFileStatusUpdatedEventData() - { - } - - /// The details of recording storage information. - public AcsRecordingStorageInfoProperties RecordingStorageInfo { get; } - /// The time at which the recording started. - public DateTimeOffset RecordingStartTime { get; } - /// The recording duration in milliseconds. - public long? RecordingDurationMs { get; } - /// The recording content type- AudioVideo, or Audio. - public RecordingContentType RecordingContentType { get; } - /// The recording channel type - Mixed, Unmixed. - public RecordingChannelType RecordingChannelKind { get; } - /// The recording format type - Mp4, Mp3, Wav. - public RecordingFormatType RecordingFormatType { get; } - /// The reason for ending recording session. - public string SessionEndReason { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingStorageInfoProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingStorageInfoProperties.Serialization.cs deleted file mode 100644 index b982628a55e1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingStorageInfoProperties.Serialization.cs +++ /dev/null @@ -1,152 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRecordingStorageInfoProperties : 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(AcsRecordingStorageInfoProperties)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("recordingChunks"u8); - writer.WriteStartArray(); - foreach (var item in RecordingChunks) - { - 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 - } - } - } - - AcsRecordingStorageInfoProperties 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(AcsRecordingStorageInfoProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRecordingStorageInfoProperties(document.RootElement, options); - } - - internal static AcsRecordingStorageInfoProperties DeserializeAcsRecordingStorageInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList recordingChunks = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("recordingChunks"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRecordingChunkInfoProperties.DeserializeAcsRecordingChunkInfoProperties(item, options)); - } - recordingChunks = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRecordingStorageInfoProperties(recordingChunks, 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(AcsRecordingStorageInfoProperties)} does not support writing '{options.Format}' format."); - } - } - - AcsRecordingStorageInfoProperties 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 DeserializeAcsRecordingStorageInfoProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRecordingStorageInfoProperties)} 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 AcsRecordingStorageInfoProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRecordingStorageInfoProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingStorageInfoProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingStorageInfoProperties.cs deleted file mode 100644 index bc7b2ef0b31b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRecordingStorageInfoProperties.cs +++ /dev/null @@ -1,76 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema for all properties of Recording Storage Information. - public partial class AcsRecordingStorageInfoProperties - { - /// - /// 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 . - /// List of details of recording chunks information. - /// is null. - internal AcsRecordingStorageInfoProperties(IEnumerable recordingChunks) - { - Argument.AssertNotNull(recordingChunks, nameof(recordingChunks)); - - RecordingChunks = recordingChunks.ToList(); - } - - /// Initializes a new instance of . - /// List of details of recording chunks information. - /// Keeps track of any properties unknown to the library. - internal AcsRecordingStorageInfoProperties(IReadOnlyList recordingChunks, IDictionary serializedAdditionalRawData) - { - RecordingChunks = recordingChunks; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsRecordingStorageInfoProperties() - { - } - - /// List of details of recording chunks information. - public IReadOnlyList RecordingChunks { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterChannelConfiguration.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterChannelConfiguration.Serialization.cs deleted file mode 100644 index 135e0f74c1e6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterChannelConfiguration.Serialization.cs +++ /dev/null @@ -1,175 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterChannelConfiguration : 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(AcsRouterChannelConfiguration)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ChannelId)) - { - writer.WritePropertyName("channelId"u8); - writer.WriteStringValue(ChannelId); - } - if (Optional.IsDefined(CapacityCostPerJob)) - { - writer.WritePropertyName("capacityCostPerJob"u8); - writer.WriteNumberValue(CapacityCostPerJob.Value); - } - if (Optional.IsDefined(MaxNumberOfJobs)) - { - writer.WritePropertyName("maxNumberOfJobs"u8); - writer.WriteNumberValue(MaxNumberOfJobs.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AcsRouterChannelConfiguration 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(AcsRouterChannelConfiguration)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterChannelConfiguration(document.RootElement, options); - } - - internal static AcsRouterChannelConfiguration DeserializeAcsRouterChannelConfiguration(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string channelId = default; - int? capacityCostPerJob = default; - int? maxNumberOfJobs = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (property.NameEquals("capacityCostPerJob"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - capacityCostPerJob = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("maxNumberOfJobs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maxNumberOfJobs = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterChannelConfiguration(channelId, capacityCostPerJob, maxNumberOfJobs, 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(AcsRouterChannelConfiguration)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterChannelConfiguration 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 DeserializeAcsRouterChannelConfiguration(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterChannelConfiguration)} 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 AcsRouterChannelConfiguration FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterChannelConfiguration(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterChannelConfiguration.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterChannelConfiguration.cs deleted file mode 100644 index 9b3d3e8de17f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterChannelConfiguration.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.Messaging.EventGrid.SystemEvents -{ - /// Router Channel Configuration. - public partial class AcsRouterChannelConfiguration - { - /// - /// 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 AcsRouterChannelConfiguration() - { - } - - /// Initializes a new instance of . - /// Channel ID for Router Job. - /// Capacity Cost Per Job for Router Job. - /// Max Number of Jobs for Router Job. - /// Keeps track of any properties unknown to the library. - internal AcsRouterChannelConfiguration(string channelId, int? capacityCostPerJob, int? maxNumberOfJobs, IDictionary serializedAdditionalRawData) - { - ChannelId = channelId; - CapacityCostPerJob = capacityCostPerJob; - MaxNumberOfJobs = maxNumberOfJobs; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Channel ID for Router Job. - public string ChannelId { get; } - /// Capacity Cost Per Job for Router Job. - public int? CapacityCostPerJob { get; } - /// Max Number of Jobs for Router Job. - public int? MaxNumberOfJobs { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterCommunicationError.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterCommunicationError.Serialization.cs deleted file mode 100644 index ac35ce20f6dd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterCommunicationError.Serialization.cs +++ /dev/null @@ -1,199 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterCommunicationError : 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(AcsRouterCommunicationError)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Code)) - { - writer.WritePropertyName("code"u8); - writer.WriteStringValue(Code); - } - if (Optional.IsDefined(Message)) - { - writer.WritePropertyName("message"u8); - writer.WriteStringValue(Message); - } - if (Optional.IsDefined(Target)) - { - writer.WritePropertyName("target"u8); - writer.WriteStringValue(Target); - } - writer.WritePropertyName("innererror"u8); - writer.WriteObjectValue(Innererror, options); - writer.WritePropertyName("details"u8); - writer.WriteStartArray(); - foreach (var item in Details) - { - 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 - } - } - } - - AcsRouterCommunicationError 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(AcsRouterCommunicationError)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterCommunicationError(document.RootElement, options); - } - - internal static AcsRouterCommunicationError DeserializeAcsRouterCommunicationError(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string code = default; - string message = default; - string target = default; - AcsRouterCommunicationError innererror = default; - IReadOnlyList details = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code"u8)) - { - code = property.Value.GetString(); - continue; - } - if (property.NameEquals("message"u8)) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("target"u8)) - { - target = property.Value.GetString(); - continue; - } - if (property.NameEquals("innererror"u8)) - { - innererror = DeserializeAcsRouterCommunicationError(property.Value, options); - continue; - } - if (property.NameEquals("details"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DeserializeAcsRouterCommunicationError(item, options)); - } - details = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterCommunicationError( - code, - message, - target, - innererror, - details, - 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(AcsRouterCommunicationError)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterCommunicationError 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 DeserializeAcsRouterCommunicationError(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterCommunicationError)} 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 AcsRouterCommunicationError FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterCommunicationError(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterCommunicationError.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterCommunicationError.cs deleted file mode 100644 index 35ae98ef1222..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterCommunicationError.cs +++ /dev/null @@ -1,95 +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.Messaging.EventGrid.SystemEvents -{ - /// Router Communication Error. - public partial class AcsRouterCommunicationError - { - /// - /// 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 . - /// Router Communication Inner Error. - /// List of Router Communication Errors. - /// or is null. - internal AcsRouterCommunicationError(AcsRouterCommunicationError innererror, IEnumerable details) - { - Argument.AssertNotNull(innererror, nameof(innererror)); - Argument.AssertNotNull(details, nameof(details)); - - Innererror = innererror; - Details = details.ToList(); - } - - /// Initializes a new instance of . - /// Router Communication Error Code. - /// Router Communication Error Message. - /// Router Communication Error Target. - /// Router Communication Inner Error. - /// List of Router Communication Errors. - /// Keeps track of any properties unknown to the library. - internal AcsRouterCommunicationError(string code, string message, string target, AcsRouterCommunicationError innererror, IReadOnlyList details, IDictionary serializedAdditionalRawData) - { - Code = code; - Message = message; - Target = target; - Innererror = innererror; - Details = details; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterCommunicationError() - { - } - - /// Router Communication Error Code. - public string Code { get; } - /// Router Communication Error Message. - public string Message { get; } - /// Router Communication Error Target. - public string Target { get; } - /// Router Communication Inner Error. - public AcsRouterCommunicationError Innererror { get; } - /// List of Router Communication Errors. - public IReadOnlyList Details { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterEventData.Serialization.cs deleted file mode 100644 index 5b32185ff864..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterEventData.Serialization.cs +++ /dev/null @@ -1,167 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterEventData : 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(AcsRouterEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(JobId)) - { - writer.WritePropertyName("jobId"u8); - writer.WriteStringValue(JobId); - } - if (Optional.IsDefined(ChannelReference)) - { - writer.WritePropertyName("channelReference"u8); - writer.WriteStringValue(ChannelReference); - } - if (Optional.IsDefined(ChannelId)) - { - writer.WritePropertyName("channelId"u8); - writer.WriteStringValue(ChannelId); - } - 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 - } - } - } - - AcsRouterEventData 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(AcsRouterEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterEventData(document.RootElement, options); - } - - internal static AcsRouterEventData DeserializeAcsRouterEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterEventData(jobId, channelReference, channelId, 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(AcsRouterEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterEventData 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 DeserializeAcsRouterEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterEventData)} 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 AcsRouterEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterEventData.cs deleted file mode 100644 index ef5256da1f16..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of all Router events. - public partial class AcsRouterEventData - { - /// - /// 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 . - internal AcsRouterEventData() - { - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - internal AcsRouterEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData) - { - JobId = jobId; - ChannelReference = channelReference; - ChannelId = channelId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Router Event Job ID. - public string JobId { get; } - /// Router Event Channel Reference. - public string ChannelReference { get; } - /// Router Event Channel ID. - public string ChannelId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCancelledEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCancelledEventData.Serialization.cs deleted file mode 100644 index e15c613a25c7..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCancelledEventData.Serialization.cs +++ /dev/null @@ -1,197 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobCancelledEventData : 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(AcsRouterJobCancelledEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Note)) - { - writer.WritePropertyName("note"u8); - writer.WriteStringValue(Note); - } - if (Optional.IsDefined(DispositionCode)) - { - writer.WritePropertyName("dispositionCode"u8); - writer.WriteStringValue(DispositionCode); - } - } - - AcsRouterJobCancelledEventData 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(AcsRouterJobCancelledEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobCancelledEventData(document.RootElement, options); - } - - internal static AcsRouterJobCancelledEventData DeserializeAcsRouterJobCancelledEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string note = default; - string dispositionCode = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("note"u8)) - { - note = property.Value.GetString(); - continue; - } - if (property.NameEquals("dispositionCode"u8)) - { - dispositionCode = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobCancelledEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - note, - dispositionCode); - } - - 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(AcsRouterJobCancelledEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobCancelledEventData 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 DeserializeAcsRouterJobCancelledEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobCancelledEventData)} 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 AcsRouterJobCancelledEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobCancelledEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCancelledEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCancelledEventData.cs deleted file mode 100644 index ec856a4acd43..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCancelledEventData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobCancelled event. - public partial class AcsRouterJobCancelledEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// or is null. - internal AcsRouterJobCancelledEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Note. - /// Router Job Disposition Code. - internal AcsRouterJobCancelledEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, string note, string dispositionCode) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - Note = note; - DispositionCode = dispositionCode; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobCancelledEventData() - { - } - - /// Router Job Note. - public string Note { get; } - /// Router Job Disposition Code. - public string DispositionCode { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassificationFailedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassificationFailedEventData.Serialization.cs deleted file mode 100644 index 090664429c16..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassificationFailedEventData.Serialization.cs +++ /dev/null @@ -1,204 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobClassificationFailedEventData : 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(AcsRouterJobClassificationFailedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(ClassificationPolicyId)) - { - writer.WritePropertyName("classificationPolicyId"u8); - writer.WriteStringValue(ClassificationPolicyId); - } - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - - AcsRouterJobClassificationFailedEventData 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(AcsRouterJobClassificationFailedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobClassificationFailedEventData(document.RootElement, options); - } - - internal static AcsRouterJobClassificationFailedEventData DeserializeAcsRouterJobClassificationFailedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string classificationPolicyId = default; - IReadOnlyList errors = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("classificationPolicyId"u8)) - { - classificationPolicyId = property.Value.GetString(); - continue; - } - if (property.NameEquals("errors"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterCommunicationError.DeserializeAcsRouterCommunicationError(item, options)); - } - errors = array; - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobClassificationFailedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - classificationPolicyId, - errors); - } - - 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(AcsRouterJobClassificationFailedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobClassificationFailedEventData 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 DeserializeAcsRouterJobClassificationFailedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobClassificationFailedEventData)} 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 AcsRouterJobClassificationFailedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobClassificationFailedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassificationFailedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassificationFailedEventData.cs deleted file mode 100644 index 0dde294286a4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassificationFailedEventData.cs +++ /dev/null @@ -1,57 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobClassificationFailed event. - public partial class AcsRouterJobClassificationFailedEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Classification Failed Errors. - /// , or is null. - internal AcsRouterJobClassificationFailedEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags, IEnumerable errors) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - Argument.AssertNotNull(errors, nameof(errors)); - - Errors = errors.ToList(); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Classification Policy Id. - /// Router Job Classification Failed Errors. - internal AcsRouterJobClassificationFailedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, string classificationPolicyId, IReadOnlyList errors) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - ClassificationPolicyId = classificationPolicyId; - Errors = errors; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobClassificationFailedEventData() - { - } - - /// Router Job Classification Policy Id. - public string ClassificationPolicyId { get; } - /// Router Job Classification Failed Errors. - public IReadOnlyList Errors { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassifiedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassifiedEventData.Serialization.cs deleted file mode 100644 index 0b0a9bd354ec..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassifiedEventData.Serialization.cs +++ /dev/null @@ -1,229 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobClassifiedEventData : 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(AcsRouterJobClassifiedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("queueDetails"u8); - writer.WriteObjectValue(QueueDetails, options); - if (Optional.IsDefined(ClassificationPolicyId)) - { - writer.WritePropertyName("classificationPolicyId"u8); - writer.WriteStringValue(ClassificationPolicyId); - } - if (Optional.IsDefined(Priority)) - { - writer.WritePropertyName("priority"u8); - writer.WriteNumberValue(Priority.Value); - } - writer.WritePropertyName("attachedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in AttachedWorkerSelectors) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - - AcsRouterJobClassifiedEventData 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(AcsRouterJobClassifiedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobClassifiedEventData(document.RootElement, options); - } - - internal static AcsRouterJobClassifiedEventData DeserializeAcsRouterJobClassifiedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AcsRouterQueueDetails queueDetails = default; - string classificationPolicyId = default; - int? priority = default; - IReadOnlyList attachedWorkerSelectors = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queueDetails"u8)) - { - queueDetails = AcsRouterQueueDetails.DeserializeAcsRouterQueueDetails(property.Value, options); - continue; - } - if (property.NameEquals("classificationPolicyId"u8)) - { - classificationPolicyId = property.Value.GetString(); - continue; - } - if (property.NameEquals("priority"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - priority = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("attachedWorkerSelectors"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterWorkerSelector.DeserializeAcsRouterWorkerSelector(item, options)); - } - attachedWorkerSelectors = array; - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobClassifiedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - queueDetails, - classificationPolicyId, - priority, - attachedWorkerSelectors); - } - - 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(AcsRouterJobClassifiedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobClassifiedEventData 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 DeserializeAcsRouterJobClassifiedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobClassifiedEventData)} 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 AcsRouterJobClassifiedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobClassifiedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassifiedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassifiedEventData.cs deleted file mode 100644 index db2dbdd50165..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClassifiedEventData.cs +++ /dev/null @@ -1,68 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobClassified event. - public partial class AcsRouterJobClassifiedEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Queue Info. - /// Router Job Attached Worker Selector. - /// , , or is null. - internal AcsRouterJobClassifiedEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags, AcsRouterQueueDetails queueDetails, IEnumerable attachedWorkerSelectors) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - Argument.AssertNotNull(queueDetails, nameof(queueDetails)); - Argument.AssertNotNull(attachedWorkerSelectors, nameof(attachedWorkerSelectors)); - - QueueDetails = queueDetails; - AttachedWorkerSelectors = attachedWorkerSelectors.ToList(); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Queue Info. - /// Router Job Classification Policy Id. - /// Router Job Priority. - /// Router Job Attached Worker Selector. - internal AcsRouterJobClassifiedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, AcsRouterQueueDetails queueDetails, string classificationPolicyId, int? priority, IReadOnlyList attachedWorkerSelectors) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - QueueDetails = queueDetails; - ClassificationPolicyId = classificationPolicyId; - Priority = priority; - AttachedWorkerSelectors = attachedWorkerSelectors; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobClassifiedEventData() - { - } - - /// Router Job Queue Info. - public AcsRouterQueueDetails QueueDetails { get; } - /// Router Job Classification Policy Id. - public string ClassificationPolicyId { get; } - /// Router Job Priority. - public int? Priority { get; } - /// Router Job Attached Worker Selector. - public IReadOnlyList AttachedWorkerSelectors { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClosedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClosedEventData.Serialization.cs deleted file mode 100644 index b9c7d767ce73..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClosedEventData.Serialization.cs +++ /dev/null @@ -1,209 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobClosedEventData : 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(AcsRouterJobClosedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(AssignmentId)) - { - writer.WritePropertyName("assignmentId"u8); - writer.WriteStringValue(AssignmentId); - } - if (Optional.IsDefined(WorkerId)) - { - writer.WritePropertyName("workerId"u8); - writer.WriteStringValue(WorkerId); - } - if (Optional.IsDefined(DispositionCode)) - { - writer.WritePropertyName("dispositionCode"u8); - writer.WriteStringValue(DispositionCode); - } - } - - AcsRouterJobClosedEventData 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(AcsRouterJobClosedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobClosedEventData(document.RootElement, options); - } - - internal static AcsRouterJobClosedEventData DeserializeAcsRouterJobClosedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string assignmentId = default; - string workerId = default; - string dispositionCode = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("assignmentId"u8)) - { - assignmentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("dispositionCode"u8)) - { - dispositionCode = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobClosedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - assignmentId, - workerId, - dispositionCode); - } - - 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(AcsRouterJobClosedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobClosedEventData 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 DeserializeAcsRouterJobClosedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobClosedEventData)} 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 AcsRouterJobClosedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobClosedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClosedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClosedEventData.cs deleted file mode 100644 index 6fc530792e27..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobClosedEventData.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobClosed event. - public partial class AcsRouterJobClosedEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// or is null. - internal AcsRouterJobClosedEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Closed Assignment Id. - /// Router Job Closed Worker Id. - /// Router Job Closed Disposition Code. - internal AcsRouterJobClosedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, string assignmentId, string workerId, string dispositionCode) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - AssignmentId = assignmentId; - WorkerId = workerId; - DispositionCode = dispositionCode; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobClosedEventData() - { - } - - /// Router Job Closed Assignment Id. - public string AssignmentId { get; } - /// Router Job Closed Worker Id. - public string WorkerId { get; } - /// Router Job Closed Disposition Code. - public string DispositionCode { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCompletedEventData.Serialization.cs deleted file mode 100644 index ad9d4e2b7562..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCompletedEventData.Serialization.cs +++ /dev/null @@ -1,197 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobCompletedEventData : 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(AcsRouterJobCompletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(AssignmentId)) - { - writer.WritePropertyName("assignmentId"u8); - writer.WriteStringValue(AssignmentId); - } - if (Optional.IsDefined(WorkerId)) - { - writer.WritePropertyName("workerId"u8); - writer.WriteStringValue(WorkerId); - } - } - - AcsRouterJobCompletedEventData 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(AcsRouterJobCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobCompletedEventData(document.RootElement, options); - } - - internal static AcsRouterJobCompletedEventData DeserializeAcsRouterJobCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string assignmentId = default; - string workerId = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("assignmentId"u8)) - { - assignmentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobCompletedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - assignmentId, - workerId); - } - - 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(AcsRouterJobCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobCompletedEventData 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 DeserializeAcsRouterJobCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobCompletedEventData)} 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 AcsRouterJobCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCompletedEventData.cs deleted file mode 100644 index bcb67b8d7a6c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobCompletedEventData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobCompleted event. - public partial class AcsRouterJobCompletedEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// or is null. - internal AcsRouterJobCompletedEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Completed Assignment Id. - /// Router Job Completed Worker Id. - internal AcsRouterJobCompletedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, string assignmentId, string workerId) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - AssignmentId = assignmentId; - WorkerId = workerId; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobCompletedEventData() - { - } - - /// Router Job Completed Assignment Id. - public string AssignmentId { get; } - /// Router Job Completed Worker Id. - public string WorkerId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobDeletedEventData.Serialization.cs deleted file mode 100644 index bbaef5ff3234..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobDeletedEventData.Serialization.cs +++ /dev/null @@ -1,173 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobDeletedEventData : 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(AcsRouterJobDeletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AcsRouterJobDeletedEventData 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(AcsRouterJobDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobDeletedEventData(document.RootElement, options); - } - - internal static AcsRouterJobDeletedEventData DeserializeAcsRouterJobDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobDeletedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags); - } - - 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(AcsRouterJobDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobDeletedEventData 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 DeserializeAcsRouterJobDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobDeletedEventData)} 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 AcsRouterJobDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobDeletedEventData.cs deleted file mode 100644 index 126b1aea8474..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobDeleted event. - public partial class AcsRouterJobDeletedEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// or is null. - internal AcsRouterJobDeletedEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - internal AcsRouterJobDeletedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobDeletedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobEventData.Serialization.cs deleted file mode 100644 index 87daa91a2b05..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobEventData.Serialization.cs +++ /dev/null @@ -1,194 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobEventData : 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(AcsRouterJobEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(QueueId)) - { - writer.WritePropertyName("queueId"u8); - writer.WriteStringValue(QueueId); - } - writer.WritePropertyName("labels"u8); - writer.WriteStartObject(); - foreach (var item in Labels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - AcsRouterJobEventData 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(AcsRouterJobEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobEventData(document.RootElement, options); - } - - internal static AcsRouterJobEventData DeserializeAcsRouterJobEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags); - } - - 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(AcsRouterJobEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobEventData 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 DeserializeAcsRouterJobEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobEventData)} 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 AcsRouterJobEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobEventData.cs deleted file mode 100644 index 0d4b12a31a8b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobEventData.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of all Router Job events. - public partial class AcsRouterJobEventData : AcsRouterEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// or is null. - internal AcsRouterJobEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - - Labels = labels; - Tags = tags; - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - internal AcsRouterJobEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags) : base(jobId, channelReference, channelId, serializedAdditionalRawData) - { - QueueId = queueId; - Labels = labels; - Tags = tags; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobEventData() - { - } - - /// Router Job events Queue Id. - public string QueueId { get; } - /// Router Job events Labels. - public IReadOnlyDictionary Labels { get; } - /// Router Jobs events Tags. - public IReadOnlyDictionary Tags { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobExceptionTriggeredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobExceptionTriggeredEventData.Serialization.cs deleted file mode 100644 index d905440c958c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobExceptionTriggeredEventData.Serialization.cs +++ /dev/null @@ -1,197 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobExceptionTriggeredEventData : 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(AcsRouterJobExceptionTriggeredEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(RuleKey)) - { - writer.WritePropertyName("ruleKey"u8); - writer.WriteStringValue(RuleKey); - } - if (Optional.IsDefined(ExceptionRuleId)) - { - writer.WritePropertyName("exceptionRuleId"u8); - writer.WriteStringValue(ExceptionRuleId); - } - } - - AcsRouterJobExceptionTriggeredEventData 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(AcsRouterJobExceptionTriggeredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobExceptionTriggeredEventData(document.RootElement, options); - } - - internal static AcsRouterJobExceptionTriggeredEventData DeserializeAcsRouterJobExceptionTriggeredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string ruleKey = default; - string exceptionRuleId = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ruleKey"u8)) - { - ruleKey = property.Value.GetString(); - continue; - } - if (property.NameEquals("exceptionRuleId"u8)) - { - exceptionRuleId = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobExceptionTriggeredEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - ruleKey, - exceptionRuleId); - } - - 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(AcsRouterJobExceptionTriggeredEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobExceptionTriggeredEventData 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 DeserializeAcsRouterJobExceptionTriggeredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobExceptionTriggeredEventData)} 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 AcsRouterJobExceptionTriggeredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobExceptionTriggeredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobExceptionTriggeredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobExceptionTriggeredEventData.cs deleted file mode 100644 index 9f4aa2bed164..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobExceptionTriggeredEventData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobExceptionTriggered event. - public partial class AcsRouterJobExceptionTriggeredEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// or is null. - internal AcsRouterJobExceptionTriggeredEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Exception Triggered Rule Key. - /// Router Job Exception Triggered Rule Id. - internal AcsRouterJobExceptionTriggeredEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, string ruleKey, string exceptionRuleId) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - RuleKey = ruleKey; - ExceptionRuleId = exceptionRuleId; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobExceptionTriggeredEventData() - { - } - - /// Router Job Exception Triggered Rule Key. - public string RuleKey { get; } - /// Router Job Exception Triggered Rule Id. - public string ExceptionRuleId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobQueuedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobQueuedEventData.Serialization.cs deleted file mode 100644 index 75226e90cba1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobQueuedEventData.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobQueuedEventData : 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(AcsRouterJobQueuedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Priority)) - { - writer.WritePropertyName("priority"u8); - writer.WriteNumberValue(Priority.Value); - } - writer.WritePropertyName("attachedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in AttachedWorkerSelectors) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WritePropertyName("requestedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in RequestedWorkerSelectors) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - - AcsRouterJobQueuedEventData 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(AcsRouterJobQueuedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobQueuedEventData(document.RootElement, options); - } - - internal static AcsRouterJobQueuedEventData DeserializeAcsRouterJobQueuedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? priority = default; - IReadOnlyList attachedWorkerSelectors = default; - IReadOnlyList requestedWorkerSelectors = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("priority"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - priority = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("attachedWorkerSelectors"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterWorkerSelector.DeserializeAcsRouterWorkerSelector(item, options)); - } - attachedWorkerSelectors = array; - continue; - } - if (property.NameEquals("requestedWorkerSelectors"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterWorkerSelector.DeserializeAcsRouterWorkerSelector(item, options)); - } - requestedWorkerSelectors = array; - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobQueuedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - priority, - attachedWorkerSelectors, - requestedWorkerSelectors); - } - - 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(AcsRouterJobQueuedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobQueuedEventData 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 DeserializeAcsRouterJobQueuedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobQueuedEventData)} 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 AcsRouterJobQueuedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobQueuedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobQueuedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobQueuedEventData.cs deleted file mode 100644 index ac701da4ca38..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobQueuedEventData.cs +++ /dev/null @@ -1,64 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobQueued event. - public partial class AcsRouterJobQueuedEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Queued Attached Worker Selector. - /// Router Job Queued Requested Worker Selector. - /// , , or is null. - internal AcsRouterJobQueuedEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags, IEnumerable attachedWorkerSelectors, IEnumerable requestedWorkerSelectors) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - Argument.AssertNotNull(attachedWorkerSelectors, nameof(attachedWorkerSelectors)); - Argument.AssertNotNull(requestedWorkerSelectors, nameof(requestedWorkerSelectors)); - - AttachedWorkerSelectors = attachedWorkerSelectors.ToList(); - RequestedWorkerSelectors = requestedWorkerSelectors.ToList(); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Priority. - /// Router Job Queued Attached Worker Selector. - /// Router Job Queued Requested Worker Selector. - internal AcsRouterJobQueuedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, int? priority, IReadOnlyList attachedWorkerSelectors, IReadOnlyList requestedWorkerSelectors) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - Priority = priority; - AttachedWorkerSelectors = attachedWorkerSelectors; - RequestedWorkerSelectors = requestedWorkerSelectors; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobQueuedEventData() - { - } - - /// Router Job Priority. - public int? Priority { get; } - /// Router Job Queued Attached Worker Selector. - public IReadOnlyList AttachedWorkerSelectors { get; } - /// Router Job Queued Requested Worker Selector. - public IReadOnlyList RequestedWorkerSelectors { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobReceivedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobReceivedEventData.Serialization.cs deleted file mode 100644 index 0e2b60e8c2da..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobReceivedEventData.Serialization.cs +++ /dev/null @@ -1,247 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobReceivedEventData : 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(AcsRouterJobReceivedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("jobStatus"u8); - writer.WriteStringValue(JobStatus.ToString()); - if (Optional.IsDefined(ClassificationPolicyId)) - { - writer.WritePropertyName("classificationPolicyId"u8); - writer.WriteStringValue(ClassificationPolicyId); - } - if (Optional.IsDefined(Priority)) - { - writer.WritePropertyName("priority"u8); - writer.WriteNumberValue(Priority.Value); - } - writer.WritePropertyName("requestedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in RequestedWorkerSelectors) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WritePropertyName("scheduledOn"u8); - writer.WriteStringValue(ScheduledOn, "O"); - writer.WritePropertyName("unavailableForMatching"u8); - writer.WriteBooleanValue(UnavailableForMatching); - } - - AcsRouterJobReceivedEventData 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(AcsRouterJobReceivedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobReceivedEventData(document.RootElement, options); - } - - internal static AcsRouterJobReceivedEventData DeserializeAcsRouterJobReceivedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AcsRouterJobStatus jobStatus = default; - string classificationPolicyId = default; - int? priority = default; - IReadOnlyList requestedWorkerSelectors = default; - DateTimeOffset scheduledOn = default; - bool unavailableForMatching = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("jobStatus"u8)) - { - jobStatus = new AcsRouterJobStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("classificationPolicyId"u8)) - { - classificationPolicyId = property.Value.GetString(); - continue; - } - if (property.NameEquals("priority"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - priority = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("requestedWorkerSelectors"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterWorkerSelector.DeserializeAcsRouterWorkerSelector(item, options)); - } - requestedWorkerSelectors = array; - continue; - } - if (property.NameEquals("scheduledOn"u8)) - { - scheduledOn = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("unavailableForMatching"u8)) - { - unavailableForMatching = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobReceivedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - jobStatus, - classificationPolicyId, - priority, - requestedWorkerSelectors, - scheduledOn, - unavailableForMatching); - } - - 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(AcsRouterJobReceivedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobReceivedEventData 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 DeserializeAcsRouterJobReceivedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobReceivedEventData)} 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 AcsRouterJobReceivedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobReceivedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobReceivedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobReceivedEventData.cs deleted file mode 100644 index 3a5d5a136ea7..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobReceivedEventData.cs +++ /dev/null @@ -1,79 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobReceived event. - public partial class AcsRouterJobReceivedEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Received Job Status. - /// Router Job Received Requested Worker Selectors. - /// Router Job Received Scheduled Time in UTC. - /// Unavailable For Matching for Router Job Received. - /// , or is null. - internal AcsRouterJobReceivedEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags, AcsRouterJobStatus jobStatus, IEnumerable requestedWorkerSelectors, DateTimeOffset scheduledOn, bool unavailableForMatching) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - Argument.AssertNotNull(requestedWorkerSelectors, nameof(requestedWorkerSelectors)); - - JobStatus = jobStatus; - RequestedWorkerSelectors = requestedWorkerSelectors.ToList(); - ScheduledOn = scheduledOn; - UnavailableForMatching = unavailableForMatching; - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Received Job Status. - /// Router Job Classification Policy Id. - /// Router Job Priority. - /// Router Job Received Requested Worker Selectors. - /// Router Job Received Scheduled Time in UTC. - /// Unavailable For Matching for Router Job Received. - internal AcsRouterJobReceivedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, AcsRouterJobStatus jobStatus, string classificationPolicyId, int? priority, IReadOnlyList requestedWorkerSelectors, DateTimeOffset scheduledOn, bool unavailableForMatching) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - JobStatus = jobStatus; - ClassificationPolicyId = classificationPolicyId; - Priority = priority; - RequestedWorkerSelectors = requestedWorkerSelectors; - ScheduledOn = scheduledOn; - UnavailableForMatching = unavailableForMatching; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobReceivedEventData() - { - } - - /// Router Job Received Job Status. - public AcsRouterJobStatus JobStatus { get; } - /// Router Job Classification Policy Id. - public string ClassificationPolicyId { get; } - /// Router Job Priority. - public int? Priority { get; } - /// Router Job Received Requested Worker Selectors. - public IReadOnlyList RequestedWorkerSelectors { get; } - /// Router Job Received Scheduled Time in UTC. - public DateTimeOffset ScheduledOn { get; } - /// Unavailable For Matching for Router Job Received. - public bool UnavailableForMatching { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobSchedulingFailedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobSchedulingFailedEventData.Serialization.cs deleted file mode 100644 index 69d6854197d6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobSchedulingFailedEventData.Serialization.cs +++ /dev/null @@ -1,248 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobSchedulingFailedEventData : 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(AcsRouterJobSchedulingFailedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Priority)) - { - writer.WritePropertyName("priority"u8); - writer.WriteNumberValue(Priority.Value); - } - writer.WritePropertyName("expiredAttachedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in ExpiredAttachedWorkerSelectors) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WritePropertyName("expiredRequestedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in ExpiredRequestedWorkerSelectors) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WritePropertyName("scheduledOn"u8); - writer.WriteStringValue(ScheduledOn, "O"); - if (Optional.IsDefined(FailureReason)) - { - writer.WritePropertyName("failureReason"u8); - writer.WriteStringValue(FailureReason); - } - } - - AcsRouterJobSchedulingFailedEventData 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(AcsRouterJobSchedulingFailedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobSchedulingFailedEventData(document.RootElement, options); - } - - internal static AcsRouterJobSchedulingFailedEventData DeserializeAcsRouterJobSchedulingFailedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? priority = default; - IReadOnlyList expiredAttachedWorkerSelectors = default; - IReadOnlyList expiredRequestedWorkerSelectors = default; - DateTimeOffset scheduledOn = default; - string failureReason = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("priority"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - priority = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("expiredAttachedWorkerSelectors"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterWorkerSelector.DeserializeAcsRouterWorkerSelector(item, options)); - } - expiredAttachedWorkerSelectors = array; - continue; - } - if (property.NameEquals("expiredRequestedWorkerSelectors"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterWorkerSelector.DeserializeAcsRouterWorkerSelector(item, options)); - } - expiredRequestedWorkerSelectors = array; - continue; - } - if (property.NameEquals("scheduledOn"u8)) - { - scheduledOn = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("failureReason"u8)) - { - failureReason = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobSchedulingFailedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - priority, - expiredAttachedWorkerSelectors, - expiredRequestedWorkerSelectors, - scheduledOn, - failureReason); - } - - 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(AcsRouterJobSchedulingFailedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobSchedulingFailedEventData 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 DeserializeAcsRouterJobSchedulingFailedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobSchedulingFailedEventData)} 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 AcsRouterJobSchedulingFailedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobSchedulingFailedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobSchedulingFailedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobSchedulingFailedEventData.cs deleted file mode 100644 index 6d55b80f185a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobSchedulingFailedEventData.cs +++ /dev/null @@ -1,74 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobSchedulingFailed event. - public partial class AcsRouterJobSchedulingFailedEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Scheduling Failed Attached Worker Selector Expired. - /// Router Job Scheduling Failed Requested Worker Selector Expired. - /// Router Job Scheduling Failed Scheduled Time in UTC. - /// , , or is null. - internal AcsRouterJobSchedulingFailedEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags, IEnumerable expiredAttachedWorkerSelectors, IEnumerable expiredRequestedWorkerSelectors, DateTimeOffset scheduledOn) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - Argument.AssertNotNull(expiredAttachedWorkerSelectors, nameof(expiredAttachedWorkerSelectors)); - Argument.AssertNotNull(expiredRequestedWorkerSelectors, nameof(expiredRequestedWorkerSelectors)); - - ExpiredAttachedWorkerSelectors = expiredAttachedWorkerSelectors.ToList(); - ExpiredRequestedWorkerSelectors = expiredRequestedWorkerSelectors.ToList(); - ScheduledOn = scheduledOn; - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Priority. - /// Router Job Scheduling Failed Attached Worker Selector Expired. - /// Router Job Scheduling Failed Requested Worker Selector Expired. - /// Router Job Scheduling Failed Scheduled Time in UTC. - /// Router Job Scheduling Failed Reason. - internal AcsRouterJobSchedulingFailedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, int? priority, IReadOnlyList expiredAttachedWorkerSelectors, IReadOnlyList expiredRequestedWorkerSelectors, DateTimeOffset scheduledOn, string failureReason) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - Priority = priority; - ExpiredAttachedWorkerSelectors = expiredAttachedWorkerSelectors; - ExpiredRequestedWorkerSelectors = expiredRequestedWorkerSelectors; - ScheduledOn = scheduledOn; - FailureReason = failureReason; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobSchedulingFailedEventData() - { - } - - /// Router Job Priority. - public int? Priority { get; } - /// Router Job Scheduling Failed Attached Worker Selector Expired. - public IReadOnlyList ExpiredAttachedWorkerSelectors { get; } - /// Router Job Scheduling Failed Requested Worker Selector Expired. - public IReadOnlyList ExpiredRequestedWorkerSelectors { get; } - /// Router Job Scheduling Failed Scheduled Time in UTC. - public DateTimeOffset ScheduledOn { get; } - /// Router Job Scheduling Failed Reason. - public string FailureReason { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobStatus.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobStatus.cs deleted file mode 100644 index f678137c38b7..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobStatus.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Acs Router Job Status. - public readonly partial struct AcsRouterJobStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AcsRouterJobStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PendingClassificationValue = "PendingClassification"; - private const string QueuedValue = "Queued"; - private const string AssignedValue = "Assigned"; - private const string CompletedValue = "Completed"; - private const string ClosedValue = "Closed"; - private const string CancelledValue = "Cancelled"; - private const string ClassificationFailedValue = "ClassificationFailed"; - private const string CreatedValue = "Created"; - private const string PendingScheduleValue = "PendingSchedule"; - private const string ScheduledValue = "Scheduled"; - private const string ScheduleFailedValue = "ScheduleFailed"; - private const string WaitingForActivationValue = "WaitingForActivation"; - - /// Router Job Status Pending Classification. - public static AcsRouterJobStatus PendingClassification { get; } = new AcsRouterJobStatus(PendingClassificationValue); - /// Router Job Status Queued. - public static AcsRouterJobStatus Queued { get; } = new AcsRouterJobStatus(QueuedValue); - /// Router Job Status Assigned. - public static AcsRouterJobStatus Assigned { get; } = new AcsRouterJobStatus(AssignedValue); - /// Router Job Status Completed. - public static AcsRouterJobStatus Completed { get; } = new AcsRouterJobStatus(CompletedValue); - /// Router Job Status Closed. - public static AcsRouterJobStatus Closed { get; } = new AcsRouterJobStatus(ClosedValue); - /// Router Job Status Cancelled. - public static AcsRouterJobStatus Cancelled { get; } = new AcsRouterJobStatus(CancelledValue); - /// Router Job Status Classification Failed. - public static AcsRouterJobStatus ClassificationFailed { get; } = new AcsRouterJobStatus(ClassificationFailedValue); - /// Router Job Status Created. - public static AcsRouterJobStatus Created { get; } = new AcsRouterJobStatus(CreatedValue); - /// Router Job Status Pending Schedule. - public static AcsRouterJobStatus PendingSchedule { get; } = new AcsRouterJobStatus(PendingScheduleValue); - /// Router Job Status Scheduled. - public static AcsRouterJobStatus Scheduled { get; } = new AcsRouterJobStatus(ScheduledValue); - /// Router Job Status Schedule Failed. - public static AcsRouterJobStatus ScheduleFailed { get; } = new AcsRouterJobStatus(ScheduleFailedValue); - /// Router Job Status Waiting For Activation. - public static AcsRouterJobStatus WaitingForActivation { get; } = new AcsRouterJobStatus(WaitingForActivationValue); - /// Determines if two values are the same. - public static bool operator ==(AcsRouterJobStatus left, AcsRouterJobStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AcsRouterJobStatus left, AcsRouterJobStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AcsRouterJobStatus(string value) => new AcsRouterJobStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AcsRouterJobStatus other && Equals(other); - /// - public bool Equals(AcsRouterJobStatus 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobUnassignedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobUnassignedEventData.Serialization.cs deleted file mode 100644 index 9441b48fa3fb..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobUnassignedEventData.Serialization.cs +++ /dev/null @@ -1,197 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobUnassignedEventData : 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(AcsRouterJobUnassignedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(AssignmentId)) - { - writer.WritePropertyName("assignmentId"u8); - writer.WriteStringValue(AssignmentId); - } - if (Optional.IsDefined(WorkerId)) - { - writer.WritePropertyName("workerId"u8); - writer.WriteStringValue(WorkerId); - } - } - - AcsRouterJobUnassignedEventData 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(AcsRouterJobUnassignedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobUnassignedEventData(document.RootElement, options); - } - - internal static AcsRouterJobUnassignedEventData DeserializeAcsRouterJobUnassignedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string assignmentId = default; - string workerId = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("assignmentId"u8)) - { - assignmentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobUnassignedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - assignmentId, - workerId); - } - - 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(AcsRouterJobUnassignedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobUnassignedEventData 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 DeserializeAcsRouterJobUnassignedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobUnassignedEventData)} 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 AcsRouterJobUnassignedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobUnassignedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobUnassignedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobUnassignedEventData.cs deleted file mode 100644 index 21e9655d2741..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobUnassignedEventData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobUnassigned event. - public partial class AcsRouterJobUnassignedEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// or is null. - internal AcsRouterJobUnassignedEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Unassigned Assignment Id. - /// Router Job Unassigned Worker Id. - internal AcsRouterJobUnassignedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, string assignmentId, string workerId) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - AssignmentId = assignmentId; - WorkerId = workerId; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobUnassignedEventData() - { - } - - /// Router Job Unassigned Assignment Id. - public string AssignmentId { get; } - /// Router Job Unassigned Worker Id. - public string WorkerId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWaitingForActivationEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWaitingForActivationEventData.Serialization.cs deleted file mode 100644 index fc5948af2cc9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWaitingForActivationEventData.Serialization.cs +++ /dev/null @@ -1,245 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobWaitingForActivationEventData : 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(AcsRouterJobWaitingForActivationEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Priority)) - { - writer.WritePropertyName("priority"u8); - writer.WriteNumberValue(Priority.Value); - } - writer.WritePropertyName("expiredAttachedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in ExpiredAttachedWorkerSelectors) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WritePropertyName("expiredRequestedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in ExpiredRequestedWorkerSelectors) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WritePropertyName("scheduledOn"u8); - writer.WriteStringValue(ScheduledOn, "O"); - writer.WritePropertyName("unavailableForMatching"u8); - writer.WriteBooleanValue(UnavailableForMatching); - } - - AcsRouterJobWaitingForActivationEventData 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(AcsRouterJobWaitingForActivationEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobWaitingForActivationEventData(document.RootElement, options); - } - - internal static AcsRouterJobWaitingForActivationEventData DeserializeAcsRouterJobWaitingForActivationEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? priority = default; - IReadOnlyList expiredAttachedWorkerSelectors = default; - IReadOnlyList expiredRequestedWorkerSelectors = default; - DateTimeOffset scheduledOn = default; - bool unavailableForMatching = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("priority"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - priority = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("expiredAttachedWorkerSelectors"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterWorkerSelector.DeserializeAcsRouterWorkerSelector(item, options)); - } - expiredAttachedWorkerSelectors = array; - continue; - } - if (property.NameEquals("expiredRequestedWorkerSelectors"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterWorkerSelector.DeserializeAcsRouterWorkerSelector(item, options)); - } - expiredRequestedWorkerSelectors = array; - continue; - } - if (property.NameEquals("scheduledOn"u8)) - { - scheduledOn = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("unavailableForMatching"u8)) - { - unavailableForMatching = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobWaitingForActivationEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - priority, - expiredAttachedWorkerSelectors, - expiredRequestedWorkerSelectors, - scheduledOn, - unavailableForMatching); - } - - 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(AcsRouterJobWaitingForActivationEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobWaitingForActivationEventData 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 DeserializeAcsRouterJobWaitingForActivationEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobWaitingForActivationEventData)} 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 AcsRouterJobWaitingForActivationEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobWaitingForActivationEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWaitingForActivationEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWaitingForActivationEventData.cs deleted file mode 100644 index 445da526d6c0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWaitingForActivationEventData.cs +++ /dev/null @@ -1,76 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobWaitingForActivation event. - public partial class AcsRouterJobWaitingForActivationEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Waiting For Activation Worker Selector Expired. - /// Router Job Waiting For Activation Requested Worker Selector Expired. - /// Router Job Waiting For Activation Scheduled Time in UTC. - /// Router Job Waiting For Activation Unavailable For Matching. - /// , , or is null. - internal AcsRouterJobWaitingForActivationEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags, IEnumerable expiredAttachedWorkerSelectors, IEnumerable expiredRequestedWorkerSelectors, DateTimeOffset scheduledOn, bool unavailableForMatching) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - Argument.AssertNotNull(expiredAttachedWorkerSelectors, nameof(expiredAttachedWorkerSelectors)); - Argument.AssertNotNull(expiredRequestedWorkerSelectors, nameof(expiredRequestedWorkerSelectors)); - - ExpiredAttachedWorkerSelectors = expiredAttachedWorkerSelectors.ToList(); - ExpiredRequestedWorkerSelectors = expiredRequestedWorkerSelectors.ToList(); - ScheduledOn = scheduledOn; - UnavailableForMatching = unavailableForMatching; - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Waiting For Activation Priority. - /// Router Job Waiting For Activation Worker Selector Expired. - /// Router Job Waiting For Activation Requested Worker Selector Expired. - /// Router Job Waiting For Activation Scheduled Time in UTC. - /// Router Job Waiting For Activation Unavailable For Matching. - internal AcsRouterJobWaitingForActivationEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, int? priority, IReadOnlyList expiredAttachedWorkerSelectors, IReadOnlyList expiredRequestedWorkerSelectors, DateTimeOffset scheduledOn, bool unavailableForMatching) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - Priority = priority; - ExpiredAttachedWorkerSelectors = expiredAttachedWorkerSelectors; - ExpiredRequestedWorkerSelectors = expiredRequestedWorkerSelectors; - ScheduledOn = scheduledOn; - UnavailableForMatching = unavailableForMatching; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobWaitingForActivationEventData() - { - } - - /// Router Job Waiting For Activation Priority. - public int? Priority { get; } - /// Router Job Waiting For Activation Worker Selector Expired. - public IReadOnlyList ExpiredAttachedWorkerSelectors { get; } - /// Router Job Waiting For Activation Requested Worker Selector Expired. - public IReadOnlyList ExpiredRequestedWorkerSelectors { get; } - /// Router Job Waiting For Activation Scheduled Time in UTC. - public DateTimeOffset ScheduledOn { get; } - /// Router Job Waiting For Activation Unavailable For Matching. - public bool UnavailableForMatching { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWorkerSelectorsExpiredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWorkerSelectorsExpiredEventData.Serialization.cs deleted file mode 100644 index c413c842d5f3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWorkerSelectorsExpiredEventData.Serialization.cs +++ /dev/null @@ -1,211 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterJobWorkerSelectorsExpiredEventData : 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(AcsRouterJobWorkerSelectorsExpiredEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("expiredRequestedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in ExpiredRequestedWorkerSelectors) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WritePropertyName("expiredAttachedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in ExpiredAttachedWorkerSelectors) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - - AcsRouterJobWorkerSelectorsExpiredEventData 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(AcsRouterJobWorkerSelectorsExpiredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterJobWorkerSelectorsExpiredEventData(document.RootElement, options); - } - - internal static AcsRouterJobWorkerSelectorsExpiredEventData DeserializeAcsRouterJobWorkerSelectorsExpiredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList expiredRequestedWorkerSelectors = default; - IReadOnlyList expiredAttachedWorkerSelectors = default; - string queueId = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("expiredRequestedWorkerSelectors"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterWorkerSelector.DeserializeAcsRouterWorkerSelector(item, options)); - } - expiredRequestedWorkerSelectors = array; - continue; - } - if (property.NameEquals("expiredAttachedWorkerSelectors"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterWorkerSelector.DeserializeAcsRouterWorkerSelector(item, options)); - } - expiredAttachedWorkerSelectors = array; - continue; - } - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterJobWorkerSelectorsExpiredEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - queueId, - labels, - tags, - expiredRequestedWorkerSelectors, - expiredAttachedWorkerSelectors); - } - - 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(AcsRouterJobWorkerSelectorsExpiredEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterJobWorkerSelectorsExpiredEventData 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 DeserializeAcsRouterJobWorkerSelectorsExpiredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterJobWorkerSelectorsExpiredEventData)} 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 AcsRouterJobWorkerSelectorsExpiredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterJobWorkerSelectorsExpiredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWorkerSelectorsExpiredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWorkerSelectorsExpiredEventData.cs deleted file mode 100644 index 28655f6d0119..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterJobWorkerSelectorsExpiredEventData.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.Collections.Generic; -using System.Linq; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobWorkerSelectorsExpired event. - public partial class AcsRouterJobWorkerSelectorsExpiredEventData : AcsRouterJobEventData - { - /// Initializes a new instance of . - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Worker Selectors Expired Requested Worker Selectors. - /// Router Job Worker Selectors Expired Attached Worker Selectors. - /// , , or is null. - internal AcsRouterJobWorkerSelectorsExpiredEventData(IReadOnlyDictionary labels, IReadOnlyDictionary tags, IEnumerable expiredRequestedWorkerSelectors, IEnumerable expiredAttachedWorkerSelectors) : base(labels, tags) - { - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - Argument.AssertNotNull(expiredRequestedWorkerSelectors, nameof(expiredRequestedWorkerSelectors)); - Argument.AssertNotNull(expiredAttachedWorkerSelectors, nameof(expiredAttachedWorkerSelectors)); - - ExpiredRequestedWorkerSelectors = expiredRequestedWorkerSelectors.ToList(); - ExpiredAttachedWorkerSelectors = expiredAttachedWorkerSelectors.ToList(); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Worker Selectors Expired Requested Worker Selectors. - /// Router Job Worker Selectors Expired Attached Worker Selectors. - internal AcsRouterJobWorkerSelectorsExpiredEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string queueId, IReadOnlyDictionary labels, IReadOnlyDictionary tags, IReadOnlyList expiredRequestedWorkerSelectors, IReadOnlyList expiredAttachedWorkerSelectors) : base(jobId, channelReference, channelId, serializedAdditionalRawData, queueId, labels, tags) - { - ExpiredRequestedWorkerSelectors = expiredRequestedWorkerSelectors; - ExpiredAttachedWorkerSelectors = expiredAttachedWorkerSelectors; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterJobWorkerSelectorsExpiredEventData() - { - } - - /// Router Job Worker Selectors Expired Requested Worker Selectors. - public IReadOnlyList ExpiredRequestedWorkerSelectors { get; } - /// Router Job Worker Selectors Expired Attached Worker Selectors. - public IReadOnlyList ExpiredAttachedWorkerSelectors { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterLabelOperator.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterLabelOperator.cs deleted file mode 100644 index 6a90053bf7f6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterLabelOperator.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Router Job Worker Selector Label Operator. - public readonly partial struct AcsRouterLabelOperator : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AcsRouterLabelOperator(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EqualValue = "Equal"; - private const string NotEqualValue = "NotEqual"; - private const string GreaterValue = "Greater"; - private const string LessValue = "Less"; - private const string GreaterThanOrEqualValue = "GreaterThanOrEqual"; - private const string LessThanOrEqualValue = "LessThanOrEqual"; - - /// Router Label Operator Equal. - public static AcsRouterLabelOperator Equal { get; } = new AcsRouterLabelOperator(EqualValue); - /// Router Label Operator Not Equal. - public static AcsRouterLabelOperator NotEqual { get; } = new AcsRouterLabelOperator(NotEqualValue); - /// Router Label Operator Greater. - public static AcsRouterLabelOperator Greater { get; } = new AcsRouterLabelOperator(GreaterValue); - /// Router Label Operator Less. - public static AcsRouterLabelOperator Less { get; } = new AcsRouterLabelOperator(LessValue); - /// Router Label Operator Greater than or equal. - public static AcsRouterLabelOperator GreaterThanOrEqual { get; } = new AcsRouterLabelOperator(GreaterThanOrEqualValue); - /// Router Label Operator Less than or equal. - public static AcsRouterLabelOperator LessThanOrEqual { get; } = new AcsRouterLabelOperator(LessThanOrEqualValue); - /// Determines if two values are the same. - public static bool operator ==(AcsRouterLabelOperator left, AcsRouterLabelOperator right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AcsRouterLabelOperator left, AcsRouterLabelOperator right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AcsRouterLabelOperator(string value) => new AcsRouterLabelOperator(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AcsRouterLabelOperator other && Equals(other); - /// - public bool Equals(AcsRouterLabelOperator 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterQueueDetails.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterQueueDetails.Serialization.cs deleted file mode 100644 index c25adb1efb16..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterQueueDetails.Serialization.cs +++ /dev/null @@ -1,175 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterQueueDetails : 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(AcsRouterQueueDetails)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - writer.WritePropertyName("labels"u8); - writer.WriteStartObject(); - foreach (var item in Labels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - 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 - } - } - } - - AcsRouterQueueDetails 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(AcsRouterQueueDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterQueueDetails(document.RootElement, options); - } - - internal static AcsRouterQueueDetails DeserializeAcsRouterQueueDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string name = default; - IReadOnlyDictionary labels = 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("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterQueueDetails(id, name, labels, 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(AcsRouterQueueDetails)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterQueueDetails 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 DeserializeAcsRouterQueueDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterQueueDetails)} 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 AcsRouterQueueDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterQueueDetails(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterQueueDetails.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterQueueDetails.cs deleted file mode 100644 index c1c9142e9c3c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterQueueDetails.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Router Queue Details. - public partial class AcsRouterQueueDetails - { - /// - /// 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 . - /// Router Queue Labels. - /// is null. - internal AcsRouterQueueDetails(IReadOnlyDictionary labels) - { - Argument.AssertNotNull(labels, nameof(labels)); - - Labels = labels; - } - - /// Initializes a new instance of . - /// Router Queue Id. - /// Router Queue Name. - /// Router Queue Labels. - /// Keeps track of any properties unknown to the library. - internal AcsRouterQueueDetails(string id, string name, IReadOnlyDictionary labels, IDictionary serializedAdditionalRawData) - { - Id = id; - Name = name; - Labels = labels; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterQueueDetails() - { - } - - /// Router Queue Id. - public string Id { get; } - /// Router Queue Name. - public string Name { get; } - /// Router Queue Labels. - public IReadOnlyDictionary Labels { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterUpdatedWorkerProperty.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterUpdatedWorkerProperty.cs deleted file mode 100644 index 670a1c711318..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterUpdatedWorkerProperty.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Worker properties that can be updated. - public readonly partial struct AcsRouterUpdatedWorkerProperty : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AcsRouterUpdatedWorkerProperty(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AvailableForOffersValue = "AvailableForOffers"; - private const string TotalCapacityValue = "TotalCapacity"; - private const string QueueAssignmentsValue = "QueueAssignments"; - private const string LabelsValue = "Labels"; - private const string TagsValue = "Tags"; - private const string ChannelConfigurationsValue = "ChannelConfigurations"; - - /// AvailableForOffers. - public static AcsRouterUpdatedWorkerProperty AvailableForOffers { get; } = new AcsRouterUpdatedWorkerProperty(AvailableForOffersValue); - /// TotalCapacity. - public static AcsRouterUpdatedWorkerProperty TotalCapacity { get; } = new AcsRouterUpdatedWorkerProperty(TotalCapacityValue); - /// QueueAssignments. - public static AcsRouterUpdatedWorkerProperty QueueAssignments { get; } = new AcsRouterUpdatedWorkerProperty(QueueAssignmentsValue); - /// Labels. - public static AcsRouterUpdatedWorkerProperty Labels { get; } = new AcsRouterUpdatedWorkerProperty(LabelsValue); - /// Tags. - public static AcsRouterUpdatedWorkerProperty Tags { get; } = new AcsRouterUpdatedWorkerProperty(TagsValue); - /// ChannelConfigurations. - public static AcsRouterUpdatedWorkerProperty ChannelConfigurations { get; } = new AcsRouterUpdatedWorkerProperty(ChannelConfigurationsValue); - /// Determines if two values are the same. - public static bool operator ==(AcsRouterUpdatedWorkerProperty left, AcsRouterUpdatedWorkerProperty right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AcsRouterUpdatedWorkerProperty left, AcsRouterUpdatedWorkerProperty right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AcsRouterUpdatedWorkerProperty(string value) => new AcsRouterUpdatedWorkerProperty(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AcsRouterUpdatedWorkerProperty other && Equals(other); - /// - public bool Equals(AcsRouterUpdatedWorkerProperty 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeletedEventData.Serialization.cs deleted file mode 100644 index 7c89f2dfa373..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeletedEventData.Serialization.cs +++ /dev/null @@ -1,144 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterWorkerDeletedEventData : 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(AcsRouterWorkerDeletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AcsRouterWorkerDeletedEventData 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(AcsRouterWorkerDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterWorkerDeletedEventData(document.RootElement, options); - } - - internal static AcsRouterWorkerDeletedEventData DeserializeAcsRouterWorkerDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string workerId = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterWorkerDeletedEventData(jobId, channelReference, channelId, serializedAdditionalRawData, workerId); - } - - 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(AcsRouterWorkerDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterWorkerDeletedEventData 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 DeserializeAcsRouterWorkerDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterWorkerDeletedEventData)} 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 AcsRouterWorkerDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterWorkerDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeletedEventData.cs deleted file mode 100644 index 038c0af0fb7d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeletedEventData.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerDeleted event. - public partial class AcsRouterWorkerDeletedEventData : AcsRouterWorkerEventData - { - /// Initializes a new instance of . - internal AcsRouterWorkerDeletedEventData() - { - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Worker events Worker Id. - internal AcsRouterWorkerDeletedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string workerId) : base(jobId, channelReference, channelId, serializedAdditionalRawData, workerId) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeregisteredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeregisteredEventData.Serialization.cs deleted file mode 100644 index b248ed2ec1e4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeregisteredEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterWorkerDeregisteredEventData : 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(AcsRouterWorkerDeregisteredEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(WorkerId)) - { - writer.WritePropertyName("workerId"u8); - writer.WriteStringValue(WorkerId); - } - 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 - } - } - } - - AcsRouterWorkerDeregisteredEventData 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(AcsRouterWorkerDeregisteredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterWorkerDeregisteredEventData(document.RootElement, options); - } - - internal static AcsRouterWorkerDeregisteredEventData DeserializeAcsRouterWorkerDeregisteredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string workerId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterWorkerDeregisteredEventData(workerId, 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(AcsRouterWorkerDeregisteredEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterWorkerDeregisteredEventData 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 DeserializeAcsRouterWorkerDeregisteredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterWorkerDeregisteredEventData)} 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 AcsRouterWorkerDeregisteredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterWorkerDeregisteredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeregisteredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeregisteredEventData.cs deleted file mode 100644 index bc11a21496ed..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerDeregisteredEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerDeregistered event. - public partial class AcsRouterWorkerDeregisteredEventData - { - /// - /// 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 AcsRouterWorkerDeregisteredEventData() - { - } - - /// Initializes a new instance of . - /// Router Worker Deregistered Worker Id. - /// Keeps track of any properties unknown to the library. - internal AcsRouterWorkerDeregisteredEventData(string workerId, IDictionary serializedAdditionalRawData) - { - WorkerId = workerId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Router Worker Deregistered Worker Id. - public string WorkerId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerEventData.Serialization.cs deleted file mode 100644 index 7c0739ea3ed8..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterWorkerEventData : 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(AcsRouterWorkerEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(WorkerId)) - { - writer.WritePropertyName("workerId"u8); - writer.WriteStringValue(WorkerId); - } - } - - AcsRouterWorkerEventData 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(AcsRouterWorkerEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterWorkerEventData(document.RootElement, options); - } - - internal static AcsRouterWorkerEventData DeserializeAcsRouterWorkerEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string workerId = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterWorkerEventData(jobId, channelReference, channelId, serializedAdditionalRawData, workerId); - } - - 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(AcsRouterWorkerEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterWorkerEventData 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 DeserializeAcsRouterWorkerEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterWorkerEventData)} 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 AcsRouterWorkerEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterWorkerEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerEventData.cs deleted file mode 100644 index 3a11277c3050..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerEventData.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of all Router Worker events. - public partial class AcsRouterWorkerEventData : AcsRouterEventData - { - /// Initializes a new instance of . - internal AcsRouterWorkerEventData() - { - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Worker events Worker Id. - internal AcsRouterWorkerEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string workerId) : base(jobId, channelReference, channelId, serializedAdditionalRawData) - { - WorkerId = workerId; - } - - /// Router Worker events Worker Id. - public string WorkerId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferAcceptedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferAcceptedEventData.Serialization.cs deleted file mode 100644 index 3c17625dd6a3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferAcceptedEventData.Serialization.cs +++ /dev/null @@ -1,281 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterWorkerOfferAcceptedEventData : 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(AcsRouterWorkerOfferAcceptedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(QueueId)) - { - writer.WritePropertyName("queueId"u8); - writer.WriteStringValue(QueueId); - } - if (Optional.IsDefined(OfferId)) - { - writer.WritePropertyName("offerId"u8); - writer.WriteStringValue(OfferId); - } - if (Optional.IsDefined(AssignmentId)) - { - writer.WritePropertyName("assignmentId"u8); - writer.WriteStringValue(AssignmentId); - } - if (Optional.IsDefined(JobPriority)) - { - writer.WritePropertyName("jobPriority"u8); - writer.WriteNumberValue(JobPriority.Value); - } - writer.WritePropertyName("workerLabels"u8); - writer.WriteStartObject(); - foreach (var item in WorkerLabels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("workerTags"u8); - writer.WriteStartObject(); - foreach (var item in WorkerTags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("jobLabels"u8); - writer.WriteStartObject(); - foreach (var item in JobLabels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("jobTags"u8); - writer.WriteStartObject(); - foreach (var item in JobTags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - AcsRouterWorkerOfferAcceptedEventData 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(AcsRouterWorkerOfferAcceptedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterWorkerOfferAcceptedEventData(document.RootElement, options); - } - - internal static AcsRouterWorkerOfferAcceptedEventData DeserializeAcsRouterWorkerOfferAcceptedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string queueId = default; - string offerId = default; - string assignmentId = default; - int? jobPriority = default; - IReadOnlyDictionary workerLabels = default; - IReadOnlyDictionary workerTags = default; - IReadOnlyDictionary jobLabels = default; - IReadOnlyDictionary jobTags = default; - string workerId = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("offerId"u8)) - { - offerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("assignmentId"u8)) - { - assignmentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("jobPriority"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - jobPriority = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("workerLabels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - workerLabels = dictionary; - continue; - } - if (property.NameEquals("workerTags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - workerTags = dictionary; - continue; - } - if (property.NameEquals("jobLabels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobLabels = dictionary; - continue; - } - if (property.NameEquals("jobTags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobTags = dictionary; - continue; - } - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterWorkerOfferAcceptedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - workerId, - queueId, - offerId, - assignmentId, - jobPriority, - workerLabels, - workerTags, - jobLabels, - jobTags); - } - - 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(AcsRouterWorkerOfferAcceptedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterWorkerOfferAcceptedEventData 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 DeserializeAcsRouterWorkerOfferAcceptedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterWorkerOfferAcceptedEventData)} 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 AcsRouterWorkerOfferAcceptedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterWorkerOfferAcceptedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferAcceptedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferAcceptedEventData.cs deleted file mode 100644 index 8308b2379894..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferAcceptedEventData.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerOfferAccepted event. - public partial class AcsRouterWorkerOfferAcceptedEventData : AcsRouterWorkerEventData - { - /// Initializes a new instance of . - /// Router Worker Offer Accepted Worker Labels. - /// Router Worker Offer Accepted Worker Tags. - /// Router Worker Offer Accepted Job Labels. - /// Router Worker Offer Accepted Job Tags. - /// , , or is null. - internal AcsRouterWorkerOfferAcceptedEventData(IReadOnlyDictionary workerLabels, IReadOnlyDictionary workerTags, IReadOnlyDictionary jobLabels, IReadOnlyDictionary jobTags) - { - Argument.AssertNotNull(workerLabels, nameof(workerLabels)); - Argument.AssertNotNull(workerTags, nameof(workerTags)); - Argument.AssertNotNull(jobLabels, nameof(jobLabels)); - Argument.AssertNotNull(jobTags, nameof(jobTags)); - - WorkerLabels = workerLabels; - WorkerTags = workerTags; - JobLabels = jobLabels; - JobTags = jobTags; - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Worker events Worker Id. - /// Router Worker Offer Accepted Queue Id. - /// Router Worker Offer Accepted Offer Id. - /// Router Worker Offer Accepted Assignment Id. - /// Router Worker Offer Accepted Job Priority. - /// Router Worker Offer Accepted Worker Labels. - /// Router Worker Offer Accepted Worker Tags. - /// Router Worker Offer Accepted Job Labels. - /// Router Worker Offer Accepted Job Tags. - internal AcsRouterWorkerOfferAcceptedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string workerId, string queueId, string offerId, string assignmentId, int? jobPriority, IReadOnlyDictionary workerLabels, IReadOnlyDictionary workerTags, IReadOnlyDictionary jobLabels, IReadOnlyDictionary jobTags) : base(jobId, channelReference, channelId, serializedAdditionalRawData, workerId) - { - QueueId = queueId; - OfferId = offerId; - AssignmentId = assignmentId; - JobPriority = jobPriority; - WorkerLabels = workerLabels; - WorkerTags = workerTags; - JobLabels = jobLabels; - JobTags = jobTags; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterWorkerOfferAcceptedEventData() - { - } - - /// Router Worker Offer Accepted Queue Id. - public string QueueId { get; } - /// Router Worker Offer Accepted Offer Id. - public string OfferId { get; } - /// Router Worker Offer Accepted Assignment Id. - public string AssignmentId { get; } - /// Router Worker Offer Accepted Job Priority. - public int? JobPriority { get; } - /// Router Worker Offer Accepted Worker Labels. - public IReadOnlyDictionary WorkerLabels { get; } - /// Router Worker Offer Accepted Worker Tags. - public IReadOnlyDictionary WorkerTags { get; } - /// Router Worker Offer Accepted Job Labels. - public IReadOnlyDictionary JobLabels { get; } - /// Router Worker Offer Accepted Job Tags. - public IReadOnlyDictionary JobTags { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferDeclinedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferDeclinedEventData.Serialization.cs deleted file mode 100644 index 03ac1ee19352..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferDeclinedEventData.Serialization.cs +++ /dev/null @@ -1,173 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterWorkerOfferDeclinedEventData : 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(AcsRouterWorkerOfferDeclinedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(QueueId)) - { - writer.WritePropertyName("queueId"u8); - writer.WriteStringValue(QueueId); - } - if (Optional.IsDefined(OfferId)) - { - writer.WritePropertyName("offerId"u8); - writer.WriteStringValue(OfferId); - } - } - - AcsRouterWorkerOfferDeclinedEventData 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(AcsRouterWorkerOfferDeclinedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterWorkerOfferDeclinedEventData(document.RootElement, options); - } - - internal static AcsRouterWorkerOfferDeclinedEventData DeserializeAcsRouterWorkerOfferDeclinedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string queueId = default; - string offerId = default; - string workerId = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("offerId"u8)) - { - offerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterWorkerOfferDeclinedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - workerId, - queueId, - offerId); - } - - 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(AcsRouterWorkerOfferDeclinedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterWorkerOfferDeclinedEventData 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 DeserializeAcsRouterWorkerOfferDeclinedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterWorkerOfferDeclinedEventData)} 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 AcsRouterWorkerOfferDeclinedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterWorkerOfferDeclinedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferDeclinedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferDeclinedEventData.cs deleted file mode 100644 index 1197ec2176a3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferDeclinedEventData.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerOfferDeclined event. - public partial class AcsRouterWorkerOfferDeclinedEventData : AcsRouterWorkerEventData - { - /// Initializes a new instance of . - internal AcsRouterWorkerOfferDeclinedEventData() - { - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Worker events Worker Id. - /// Router Worker Offer Declined Queue Id. - /// Router Worker Offer Declined Offer Id. - internal AcsRouterWorkerOfferDeclinedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string workerId, string queueId, string offerId) : base(jobId, channelReference, channelId, serializedAdditionalRawData, workerId) - { - QueueId = queueId; - OfferId = offerId; - } - - /// Router Worker Offer Declined Queue Id. - public string QueueId { get; } - /// Router Worker Offer Declined Offer Id. - public string OfferId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferExpiredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferExpiredEventData.Serialization.cs deleted file mode 100644 index 9dc8153fd970..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferExpiredEventData.Serialization.cs +++ /dev/null @@ -1,173 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterWorkerOfferExpiredEventData : 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(AcsRouterWorkerOfferExpiredEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(QueueId)) - { - writer.WritePropertyName("queueId"u8); - writer.WriteStringValue(QueueId); - } - if (Optional.IsDefined(OfferId)) - { - writer.WritePropertyName("offerId"u8); - writer.WriteStringValue(OfferId); - } - } - - AcsRouterWorkerOfferExpiredEventData 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(AcsRouterWorkerOfferExpiredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterWorkerOfferExpiredEventData(document.RootElement, options); - } - - internal static AcsRouterWorkerOfferExpiredEventData DeserializeAcsRouterWorkerOfferExpiredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string queueId = default; - string offerId = default; - string workerId = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("offerId"u8)) - { - offerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterWorkerOfferExpiredEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - workerId, - queueId, - offerId); - } - - 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(AcsRouterWorkerOfferExpiredEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterWorkerOfferExpiredEventData 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 DeserializeAcsRouterWorkerOfferExpiredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterWorkerOfferExpiredEventData)} 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 AcsRouterWorkerOfferExpiredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterWorkerOfferExpiredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferExpiredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferExpiredEventData.cs deleted file mode 100644 index 2b67e73ec019..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferExpiredEventData.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerOfferExpired event. - public partial class AcsRouterWorkerOfferExpiredEventData : AcsRouterWorkerEventData - { - /// Initializes a new instance of . - internal AcsRouterWorkerOfferExpiredEventData() - { - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Worker events Worker Id. - /// Router Worker Offer Expired Queue Id. - /// Router Worker Offer Expired Offer Id. - internal AcsRouterWorkerOfferExpiredEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string workerId, string queueId, string offerId) : base(jobId, channelReference, channelId, serializedAdditionalRawData, workerId) - { - QueueId = queueId; - OfferId = offerId; - } - - /// Router Worker Offer Expired Queue Id. - public string QueueId { get; } - /// Router Worker Offer Expired Offer Id. - public string OfferId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferIssuedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferIssuedEventData.Serialization.cs deleted file mode 100644 index 817a8da1b0fd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferIssuedEventData.Serialization.cs +++ /dev/null @@ -1,287 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterWorkerOfferIssuedEventData : 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(AcsRouterWorkerOfferIssuedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(QueueId)) - { - writer.WritePropertyName("queueId"u8); - writer.WriteStringValue(QueueId); - } - if (Optional.IsDefined(OfferId)) - { - writer.WritePropertyName("offerId"u8); - writer.WriteStringValue(OfferId); - } - if (Optional.IsDefined(JobPriority)) - { - writer.WritePropertyName("jobPriority"u8); - writer.WriteNumberValue(JobPriority.Value); - } - writer.WritePropertyName("workerLabels"u8); - writer.WriteStartObject(); - foreach (var item in WorkerLabels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("offeredOn"u8); - writer.WriteStringValue(OfferedOn, "O"); - writer.WritePropertyName("expiresOn"u8); - writer.WriteStringValue(ExpiresOn, "O"); - writer.WritePropertyName("workerTags"u8); - writer.WriteStartObject(); - foreach (var item in WorkerTags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("jobLabels"u8); - writer.WriteStartObject(); - foreach (var item in JobLabels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("jobTags"u8); - writer.WriteStartObject(); - foreach (var item in JobTags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - AcsRouterWorkerOfferIssuedEventData 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(AcsRouterWorkerOfferIssuedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterWorkerOfferIssuedEventData(document.RootElement, options); - } - - internal static AcsRouterWorkerOfferIssuedEventData DeserializeAcsRouterWorkerOfferIssuedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string queueId = default; - string offerId = default; - int? jobPriority = default; - IReadOnlyDictionary workerLabels = default; - DateTimeOffset offeredOn = default; - DateTimeOffset expiresOn = default; - IReadOnlyDictionary workerTags = default; - IReadOnlyDictionary jobLabels = default; - IReadOnlyDictionary jobTags = default; - string workerId = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("offerId"u8)) - { - offerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("jobPriority"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - jobPriority = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("workerLabels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - workerLabels = dictionary; - continue; - } - if (property.NameEquals("offeredOn"u8)) - { - offeredOn = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("expiresOn"u8)) - { - expiresOn = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("workerTags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - workerTags = dictionary; - continue; - } - if (property.NameEquals("jobLabels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobLabels = dictionary; - continue; - } - if (property.NameEquals("jobTags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobTags = dictionary; - continue; - } - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterWorkerOfferIssuedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - workerId, - queueId, - offerId, - jobPriority, - workerLabels, - offeredOn, - expiresOn, - workerTags, - jobLabels, - jobTags); - } - - 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(AcsRouterWorkerOfferIssuedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterWorkerOfferIssuedEventData 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 DeserializeAcsRouterWorkerOfferIssuedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterWorkerOfferIssuedEventData)} 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 AcsRouterWorkerOfferIssuedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterWorkerOfferIssuedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferIssuedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferIssuedEventData.cs deleted file mode 100644 index f964beba9d50..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferIssuedEventData.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerOfferIssued event. - public partial class AcsRouterWorkerOfferIssuedEventData : AcsRouterWorkerEventData - { - /// Initializes a new instance of . - /// Router Worker Offer Issued Worker Labels. - /// Router Worker Offer Issued Time in UTC. - /// Router Worker Offer Issued Expiration Time in UTC. - /// Router Worker Offer Issued Worker Tags. - /// Router Worker Offer Issued Job Labels. - /// Router Worker Offer Issued Job Tags. - /// , , or is null. - internal AcsRouterWorkerOfferIssuedEventData(IReadOnlyDictionary workerLabels, DateTimeOffset offeredOn, DateTimeOffset expiresOn, IReadOnlyDictionary workerTags, IReadOnlyDictionary jobLabels, IReadOnlyDictionary jobTags) - { - Argument.AssertNotNull(workerLabels, nameof(workerLabels)); - Argument.AssertNotNull(workerTags, nameof(workerTags)); - Argument.AssertNotNull(jobLabels, nameof(jobLabels)); - Argument.AssertNotNull(jobTags, nameof(jobTags)); - - WorkerLabels = workerLabels; - OfferedOn = offeredOn; - ExpiresOn = expiresOn; - WorkerTags = workerTags; - JobLabels = jobLabels; - JobTags = jobTags; - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Worker events Worker Id. - /// Router Worker Offer Issued Queue Id. - /// Router Worker Offer Issued Offer Id. - /// Router Worker Offer Issued Job Priority. - /// Router Worker Offer Issued Worker Labels. - /// Router Worker Offer Issued Time in UTC. - /// Router Worker Offer Issued Expiration Time in UTC. - /// Router Worker Offer Issued Worker Tags. - /// Router Worker Offer Issued Job Labels. - /// Router Worker Offer Issued Job Tags. - internal AcsRouterWorkerOfferIssuedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string workerId, string queueId, string offerId, int? jobPriority, IReadOnlyDictionary workerLabels, DateTimeOffset offeredOn, DateTimeOffset expiresOn, IReadOnlyDictionary workerTags, IReadOnlyDictionary jobLabels, IReadOnlyDictionary jobTags) : base(jobId, channelReference, channelId, serializedAdditionalRawData, workerId) - { - QueueId = queueId; - OfferId = offerId; - JobPriority = jobPriority; - WorkerLabels = workerLabels; - OfferedOn = offeredOn; - ExpiresOn = expiresOn; - WorkerTags = workerTags; - JobLabels = jobLabels; - JobTags = jobTags; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterWorkerOfferIssuedEventData() - { - } - - /// Router Worker Offer Issued Queue Id. - public string QueueId { get; } - /// Router Worker Offer Issued Offer Id. - public string OfferId { get; } - /// Router Worker Offer Issued Job Priority. - public int? JobPriority { get; } - /// Router Worker Offer Issued Worker Labels. - public IReadOnlyDictionary WorkerLabels { get; } - /// Router Worker Offer Issued Time in UTC. - public DateTimeOffset OfferedOn { get; } - /// Router Worker Offer Issued Expiration Time in UTC. - public DateTimeOffset ExpiresOn { get; } - /// Router Worker Offer Issued Worker Tags. - public IReadOnlyDictionary WorkerTags { get; } - /// Router Worker Offer Issued Job Labels. - public IReadOnlyDictionary JobLabels { get; } - /// Router Worker Offer Issued Job Tags. - public IReadOnlyDictionary JobTags { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferRevokedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferRevokedEventData.Serialization.cs deleted file mode 100644 index 30122510eb90..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferRevokedEventData.Serialization.cs +++ /dev/null @@ -1,173 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterWorkerOfferRevokedEventData : 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(AcsRouterWorkerOfferRevokedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(QueueId)) - { - writer.WritePropertyName("queueId"u8); - writer.WriteStringValue(QueueId); - } - if (Optional.IsDefined(OfferId)) - { - writer.WritePropertyName("offerId"u8); - writer.WriteStringValue(OfferId); - } - } - - AcsRouterWorkerOfferRevokedEventData 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(AcsRouterWorkerOfferRevokedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterWorkerOfferRevokedEventData(document.RootElement, options); - } - - internal static AcsRouterWorkerOfferRevokedEventData DeserializeAcsRouterWorkerOfferRevokedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string queueId = default; - string offerId = default; - string workerId = default; - string jobId = default; - string channelReference = default; - string channelId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queueId"u8)) - { - queueId = property.Value.GetString(); - continue; - } - if (property.NameEquals("offerId"u8)) - { - offerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("jobId"u8)) - { - jobId = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelReference"u8)) - { - channelReference = property.Value.GetString(); - continue; - } - if (property.NameEquals("channelId"u8)) - { - channelId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterWorkerOfferRevokedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData, - workerId, - queueId, - offerId); - } - - 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(AcsRouterWorkerOfferRevokedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterWorkerOfferRevokedEventData 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 DeserializeAcsRouterWorkerOfferRevokedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterWorkerOfferRevokedEventData)} 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 AcsRouterWorkerOfferRevokedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterWorkerOfferRevokedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferRevokedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferRevokedEventData.cs deleted file mode 100644 index 79f37f345b28..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerOfferRevokedEventData.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerOfferRevoked event. - public partial class AcsRouterWorkerOfferRevokedEventData : AcsRouterWorkerEventData - { - /// Initializes a new instance of . - internal AcsRouterWorkerOfferRevokedEventData() - { - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Keeps track of any properties unknown to the library. - /// Router Worker events Worker Id. - /// Router Worker Offer Revoked Queue Id. - /// Router Worker Offer Revoked Offer Id. - internal AcsRouterWorkerOfferRevokedEventData(string jobId, string channelReference, string channelId, IDictionary serializedAdditionalRawData, string workerId, string queueId, string offerId) : base(jobId, channelReference, channelId, serializedAdditionalRawData, workerId) - { - QueueId = queueId; - OfferId = offerId; - } - - /// Router Worker Offer Revoked Queue Id. - public string QueueId { get; } - /// Router Worker Offer Revoked Offer Id. - public string OfferId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerRegisteredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerRegisteredEventData.Serialization.cs deleted file mode 100644 index 22dbe3708dc4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerRegisteredEventData.Serialization.cs +++ /dev/null @@ -1,241 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterWorkerRegisteredEventData : 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(AcsRouterWorkerRegisteredEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(WorkerId)) - { - writer.WritePropertyName("workerId"u8); - writer.WriteStringValue(WorkerId); - } - writer.WritePropertyName("queueAssignments"u8); - writer.WriteStartArray(); - foreach (var item in QueueAssignments) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WritePropertyName("channelConfigurations"u8); - writer.WriteStartArray(); - foreach (var item in ChannelConfigurations) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (Optional.IsDefined(TotalCapacity)) - { - writer.WritePropertyName("totalCapacity"u8); - writer.WriteNumberValue(TotalCapacity.Value); - } - writer.WritePropertyName("labels"u8); - writer.WriteStartObject(); - foreach (var item in Labels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - 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 - } - } - } - - AcsRouterWorkerRegisteredEventData 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(AcsRouterWorkerRegisteredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterWorkerRegisteredEventData(document.RootElement, options); - } - - internal static AcsRouterWorkerRegisteredEventData DeserializeAcsRouterWorkerRegisteredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string workerId = default; - IReadOnlyList queueAssignments = default; - IReadOnlyList channelConfigurations = default; - int? totalCapacity = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueAssignments"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterQueueDetails.DeserializeAcsRouterQueueDetails(item, options)); - } - queueAssignments = array; - continue; - } - if (property.NameEquals("channelConfigurations"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterChannelConfiguration.DeserializeAcsRouterChannelConfiguration(item, options)); - } - channelConfigurations = array; - continue; - } - if (property.NameEquals("totalCapacity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - totalCapacity = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterWorkerRegisteredEventData( - workerId, - queueAssignments, - channelConfigurations, - totalCapacity, - labels, - tags, - 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(AcsRouterWorkerRegisteredEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterWorkerRegisteredEventData 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 DeserializeAcsRouterWorkerRegisteredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterWorkerRegisteredEventData)} 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 AcsRouterWorkerRegisteredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterWorkerRegisteredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerRegisteredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerRegisteredEventData.cs deleted file mode 100644 index e5b8ab2dc682..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerRegisteredEventData.cs +++ /dev/null @@ -1,105 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerRegistered event. - public partial class AcsRouterWorkerRegisteredEventData - { - /// - /// 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 . - /// Router Worker Registered Queue Info. - /// Router Worker Registered Channel Configuration. - /// Router Worker Registered Labels. - /// Router Worker Registered Tags. - /// , , or is null. - internal AcsRouterWorkerRegisteredEventData(IEnumerable queueAssignments, IEnumerable channelConfigurations, IReadOnlyDictionary labels, IReadOnlyDictionary tags) - { - Argument.AssertNotNull(queueAssignments, nameof(queueAssignments)); - Argument.AssertNotNull(channelConfigurations, nameof(channelConfigurations)); - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - - QueueAssignments = queueAssignments.ToList(); - ChannelConfigurations = channelConfigurations.ToList(); - Labels = labels; - Tags = tags; - } - - /// Initializes a new instance of . - /// Router Worker Registered Worker Id. - /// Router Worker Registered Queue Info. - /// Router Worker Registered Channel Configuration. - /// Router Worker Register Total Capacity. - /// Router Worker Registered Labels. - /// Router Worker Registered Tags. - /// Keeps track of any properties unknown to the library. - internal AcsRouterWorkerRegisteredEventData(string workerId, IReadOnlyList queueAssignments, IReadOnlyList channelConfigurations, int? totalCapacity, IReadOnlyDictionary labels, IReadOnlyDictionary tags, IDictionary serializedAdditionalRawData) - { - WorkerId = workerId; - QueueAssignments = queueAssignments; - ChannelConfigurations = channelConfigurations; - TotalCapacity = totalCapacity; - Labels = labels; - Tags = tags; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterWorkerRegisteredEventData() - { - } - - /// Router Worker Registered Worker Id. - public string WorkerId { get; } - /// Router Worker Registered Queue Info. - public IReadOnlyList QueueAssignments { get; } - /// Router Worker Registered Channel Configuration. - public IReadOnlyList ChannelConfigurations { get; } - /// Router Worker Register Total Capacity. - public int? TotalCapacity { get; } - /// Router Worker Registered Labels. - public IReadOnlyDictionary Labels { get; } - /// Router Worker Registered Tags. - public IReadOnlyDictionary Tags { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerSelector.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerSelector.Serialization.cs deleted file mode 100644 index 36871c0eb165..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerSelector.Serialization.cs +++ /dev/null @@ -1,199 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterWorkerSelector : 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(AcsRouterWorkerSelector)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Key)) - { - writer.WritePropertyName("key"u8); - writer.WriteStringValue(Key); - } - writer.WritePropertyName("labelOperator"u8); - writer.WriteStringValue(LabelOperator.ToString()); - writer.WritePropertyName("value"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(LabelValue); -#else - using (JsonDocument document = JsonDocument.Parse(LabelValue)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - writer.WritePropertyName("ttlSeconds"u8); - writer.WriteNumberValue(TimeToLive); - writer.WritePropertyName("state"u8); - writer.WriteStringValue(SelectorState.ToString()); - writer.WritePropertyName("expirationTime"u8); - writer.WriteStringValue(ExpirationTime, "O"); - 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 - } - } - } - - AcsRouterWorkerSelector 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(AcsRouterWorkerSelector)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterWorkerSelector(document.RootElement, options); - } - - internal static AcsRouterWorkerSelector DeserializeAcsRouterWorkerSelector(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string key = default; - AcsRouterLabelOperator labelOperator = default; - BinaryData value = default; - double ttlSeconds = default; - AcsRouterWorkerSelectorState state = default; - DateTimeOffset expirationTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("key"u8)) - { - key = property.Value.GetString(); - continue; - } - if (property.NameEquals("labelOperator"u8)) - { - labelOperator = new AcsRouterLabelOperator(property.Value.GetString()); - continue; - } - if (property.NameEquals("value"u8)) - { - value = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("ttlSeconds"u8)) - { - ttlSeconds = property.Value.GetDouble(); - continue; - } - if (property.NameEquals("state"u8)) - { - state = new AcsRouterWorkerSelectorState(property.Value.GetString()); - continue; - } - if (property.NameEquals("expirationTime"u8)) - { - expirationTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterWorkerSelector( - key, - labelOperator, - value, - ttlSeconds, - state, - expirationTime, - 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(AcsRouterWorkerSelector)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterWorkerSelector 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 DeserializeAcsRouterWorkerSelector(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterWorkerSelector)} 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 AcsRouterWorkerSelector FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterWorkerSelector(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerSelector.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerSelector.cs deleted file mode 100644 index 0de728036de4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerSelector.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Router Job Worker Selector. - public partial class AcsRouterWorkerSelector - { - /// - /// 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 . - /// Router Job Worker Selector Label Operator. - /// Router Job Worker Selector Value. - /// Router Job Worker Selector Time to Live in Seconds. - /// Router Job Worker Selector State. - /// Router Job Worker Selector Expiration Time. - /// is null. - internal AcsRouterWorkerSelector(AcsRouterLabelOperator labelOperator, BinaryData labelValue, double timeToLive, AcsRouterWorkerSelectorState selectorState, DateTimeOffset expirationTime) - { - Argument.AssertNotNull(labelValue, nameof(labelValue)); - - LabelOperator = labelOperator; - LabelValue = labelValue; - TimeToLive = timeToLive; - SelectorState = selectorState; - ExpirationTime = expirationTime; - } - - /// Initializes a new instance of . - /// Router Job Worker Selector Key. - /// Router Job Worker Selector Label Operator. - /// Router Job Worker Selector Value. - /// Router Job Worker Selector Time to Live in Seconds. - /// Router Job Worker Selector State. - /// Router Job Worker Selector Expiration Time. - /// Keeps track of any properties unknown to the library. - internal AcsRouterWorkerSelector(string key, AcsRouterLabelOperator labelOperator, BinaryData labelValue, double timeToLive, AcsRouterWorkerSelectorState selectorState, DateTimeOffset expirationTime, IDictionary serializedAdditionalRawData) - { - Key = key; - LabelOperator = labelOperator; - LabelValue = labelValue; - TimeToLive = timeToLive; - SelectorState = selectorState; - ExpirationTime = expirationTime; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterWorkerSelector() - { - } - - /// Router Job Worker Selector Key. - public string Key { get; } - /// Router Job Worker Selector Label Operator. - public AcsRouterLabelOperator LabelOperator { get; } - /// - /// Router Job Worker Selector Value - /// - /// To assign an object to 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" }. - /// - /// - /// - /// - public BinaryData LabelValue { get; } - /// Router Job Worker Selector Time to Live in Seconds. - public double TimeToLive { get; } - /// Router Job Worker Selector State. - public AcsRouterWorkerSelectorState SelectorState { get; } - /// Router Job Worker Selector Expiration Time. - public DateTimeOffset ExpirationTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerSelectorState.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerSelectorState.cs deleted file mode 100644 index 9a07ed1b9780..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerSelectorState.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Router Worker Selector State. - public readonly partial struct AcsRouterWorkerSelectorState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AcsRouterWorkerSelectorState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ActiveValue = "active"; - private const string ExpiredValue = "expired"; - - /// Router Worker Selector State Active. - public static AcsRouterWorkerSelectorState Active { get; } = new AcsRouterWorkerSelectorState(ActiveValue); - /// Router Worker Selector State Expired. - public static AcsRouterWorkerSelectorState Expired { get; } = new AcsRouterWorkerSelectorState(ExpiredValue); - /// Determines if two values are the same. - public static bool operator ==(AcsRouterWorkerSelectorState left, AcsRouterWorkerSelectorState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AcsRouterWorkerSelectorState left, AcsRouterWorkerSelectorState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AcsRouterWorkerSelectorState(string value) => new AcsRouterWorkerSelectorState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AcsRouterWorkerSelectorState other && Equals(other); - /// - public bool Equals(AcsRouterWorkerSelectorState 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerUpdatedEventData.Serialization.cs deleted file mode 100644 index bb7ac8581576..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerUpdatedEventData.Serialization.cs +++ /dev/null @@ -1,260 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsRouterWorkerUpdatedEventData : 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(AcsRouterWorkerUpdatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(WorkerId)) - { - writer.WritePropertyName("workerId"u8); - writer.WriteStringValue(WorkerId); - } - writer.WritePropertyName("queueAssignments"u8); - writer.WriteStartArray(); - foreach (var item in QueueAssignments) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WritePropertyName("channelConfigurations"u8); - writer.WriteStartArray(); - foreach (var item in ChannelConfigurations) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (Optional.IsDefined(TotalCapacity)) - { - writer.WritePropertyName("totalCapacity"u8); - writer.WriteNumberValue(TotalCapacity.Value); - } - writer.WritePropertyName("labels"u8); - writer.WriteStartObject(); - foreach (var item in Labels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("updatedWorkerProperties"u8); - writer.WriteStartArray(); - foreach (var item in UpdatedWorkerProperties) - { - writer.WriteStringValue(item.ToString()); - } - writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AcsRouterWorkerUpdatedEventData 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(AcsRouterWorkerUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsRouterWorkerUpdatedEventData(document.RootElement, options); - } - - internal static AcsRouterWorkerUpdatedEventData DeserializeAcsRouterWorkerUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string workerId = default; - IReadOnlyList queueAssignments = default; - IReadOnlyList channelConfigurations = default; - int? totalCapacity = default; - IReadOnlyDictionary labels = default; - IReadOnlyDictionary tags = default; - IReadOnlyList updatedWorkerProperties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("workerId"u8)) - { - workerId = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueAssignments"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterQueueDetails.DeserializeAcsRouterQueueDetails(item, options)); - } - queueAssignments = array; - continue; - } - if (property.NameEquals("channelConfigurations"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsRouterChannelConfiguration.DeserializeAcsRouterChannelConfiguration(item, options)); - } - channelConfigurations = array; - continue; - } - if (property.NameEquals("totalCapacity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - totalCapacity = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("labels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - labels = dictionary; - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("updatedWorkerProperties"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(new AcsRouterUpdatedWorkerProperty(item.GetString())); - } - updatedWorkerProperties = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsRouterWorkerUpdatedEventData( - workerId, - queueAssignments, - channelConfigurations, - totalCapacity, - labels, - tags, - updatedWorkerProperties, - 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(AcsRouterWorkerUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsRouterWorkerUpdatedEventData 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 DeserializeAcsRouterWorkerUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsRouterWorkerUpdatedEventData)} 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 AcsRouterWorkerUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsRouterWorkerUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerUpdatedEventData.cs deleted file mode 100644 index 3d1b2b1ca992..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsRouterWorkerUpdatedEventData.cs +++ /dev/null @@ -1,112 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerUpdated event. - public partial class AcsRouterWorkerUpdatedEventData - { - /// - /// 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 . - /// Router Worker Updated Queue Info. - /// Router Worker Updated Channel Configuration. - /// Router Worker Updated Labels. - /// Router Worker Updated Tags. - /// Router Worker Properties Updated. - /// , , , or is null. - internal AcsRouterWorkerUpdatedEventData(IEnumerable queueAssignments, IEnumerable channelConfigurations, IReadOnlyDictionary labels, IReadOnlyDictionary tags, IEnumerable updatedWorkerProperties) - { - Argument.AssertNotNull(queueAssignments, nameof(queueAssignments)); - Argument.AssertNotNull(channelConfigurations, nameof(channelConfigurations)); - Argument.AssertNotNull(labels, nameof(labels)); - Argument.AssertNotNull(tags, nameof(tags)); - Argument.AssertNotNull(updatedWorkerProperties, nameof(updatedWorkerProperties)); - - QueueAssignments = queueAssignments.ToList(); - ChannelConfigurations = channelConfigurations.ToList(); - Labels = labels; - Tags = tags; - UpdatedWorkerProperties = updatedWorkerProperties.ToList(); - } - - /// Initializes a new instance of . - /// Router Worker Updated Worker Id. - /// Router Worker Updated Queue Info. - /// Router Worker Updated Channel Configuration. - /// Router Worker Updated Total Capacity. - /// Router Worker Updated Labels. - /// Router Worker Updated Tags. - /// Router Worker Properties Updated. - /// Keeps track of any properties unknown to the library. - internal AcsRouterWorkerUpdatedEventData(string workerId, IReadOnlyList queueAssignments, IReadOnlyList channelConfigurations, int? totalCapacity, IReadOnlyDictionary labels, IReadOnlyDictionary tags, IReadOnlyList updatedWorkerProperties, IDictionary serializedAdditionalRawData) - { - WorkerId = workerId; - QueueAssignments = queueAssignments; - ChannelConfigurations = channelConfigurations; - TotalCapacity = totalCapacity; - Labels = labels; - Tags = tags; - UpdatedWorkerProperties = updatedWorkerProperties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsRouterWorkerUpdatedEventData() - { - } - - /// Router Worker Updated Worker Id. - public string WorkerId { get; } - /// Router Worker Updated Queue Info. - public IReadOnlyList QueueAssignments { get; } - /// Router Worker Updated Channel Configuration. - public IReadOnlyList ChannelConfigurations { get; } - /// Router Worker Updated Total Capacity. - public int? TotalCapacity { get; } - /// Router Worker Updated Labels. - public IReadOnlyDictionary Labels { get; } - /// Router Worker Updated Tags. - public IReadOnlyDictionary Tags { get; } - /// Router Worker Properties Updated. - public IReadOnlyList UpdatedWorkerProperties { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryAttemptProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryAttemptProperties.Serialization.cs deleted file mode 100644 index b717e628d80f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryAttemptProperties.Serialization.cs +++ /dev/null @@ -1,172 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsSmsDeliveryAttemptProperties : 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(AcsSmsDeliveryAttemptProperties)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(SegmentsSucceeded)) - { - writer.WritePropertyName("segmentsSucceeded"u8); - writer.WriteNumberValue(SegmentsSucceeded.Value); - } - if (Optional.IsDefined(SegmentsFailed)) - { - writer.WritePropertyName("segmentsFailed"u8); - writer.WriteNumberValue(SegmentsFailed.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AcsSmsDeliveryAttemptProperties 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(AcsSmsDeliveryAttemptProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsSmsDeliveryAttemptProperties(document.RootElement, options); - } - - internal static AcsSmsDeliveryAttemptProperties DeserializeAcsSmsDeliveryAttemptProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset timestamp = default; - int? segmentsSucceeded = default; - int? segmentsFailed = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("segmentsSucceeded"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - segmentsSucceeded = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("segmentsFailed"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - segmentsFailed = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsSmsDeliveryAttemptProperties(timestamp, segmentsSucceeded, segmentsFailed, 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(AcsSmsDeliveryAttemptProperties)} does not support writing '{options.Format}' format."); - } - } - - AcsSmsDeliveryAttemptProperties 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 DeserializeAcsSmsDeliveryAttemptProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsSmsDeliveryAttemptProperties)} 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 AcsSmsDeliveryAttemptProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsSmsDeliveryAttemptProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryAttemptProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryAttemptProperties.cs deleted file mode 100644 index 79cc8014347e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryAttemptProperties.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.Messaging.EventGrid.SystemEvents -{ - /// Schema for details of a delivery attempt. - public partial class AcsSmsDeliveryAttemptProperties - { - /// - /// 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 . - /// TimeStamp when delivery was attempted. - internal AcsSmsDeliveryAttemptProperties(DateTimeOffset timestamp) - { - Timestamp = timestamp; - } - - /// Initializes a new instance of . - /// TimeStamp when delivery was attempted. - /// Number of segments that were successfully delivered. - /// Number of segments whose delivery failed. - /// Keeps track of any properties unknown to the library. - internal AcsSmsDeliveryAttemptProperties(DateTimeOffset timestamp, int? segmentsSucceeded, int? segmentsFailed, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - SegmentsSucceeded = segmentsSucceeded; - SegmentsFailed = segmentsFailed; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsSmsDeliveryAttemptProperties() - { - } - - /// TimeStamp when delivery was attempted. - public DateTimeOffset Timestamp { get; } - /// Number of segments that were successfully delivered. - public int? SegmentsSucceeded { get; } - /// Number of segments whose delivery failed. - public int? SegmentsFailed { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryReportReceivedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryReportReceivedEventData.Serialization.cs deleted file mode 100644 index 3daf4e3535c6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryReportReceivedEventData.Serialization.cs +++ /dev/null @@ -1,206 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsSmsDeliveryReportReceivedEventData : 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(AcsSmsDeliveryReportReceivedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(DeliveryStatus)) - { - writer.WritePropertyName("deliveryStatus"u8); - writer.WriteStringValue(DeliveryStatus); - } - if (Optional.IsDefined(DeliveryStatusDetails)) - { - writer.WritePropertyName("deliveryStatusDetails"u8); - writer.WriteStringValue(DeliveryStatusDetails); - } - writer.WritePropertyName("deliveryAttempts"u8); - writer.WriteStartArray(); - foreach (var item in DeliveryAttempts) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WritePropertyName("receivedTimestamp"u8); - writer.WriteStringValue(ReceivedTimestamp, "O"); - if (Optional.IsDefined(Tag)) - { - writer.WritePropertyName("tag"u8); - writer.WriteStringValue(Tag); - } - } - - AcsSmsDeliveryReportReceivedEventData 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(AcsSmsDeliveryReportReceivedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsSmsDeliveryReportReceivedEventData(document.RootElement, options); - } - - internal static AcsSmsDeliveryReportReceivedEventData DeserializeAcsSmsDeliveryReportReceivedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string deliveryStatus = default; - string deliveryStatusDetails = default; - IReadOnlyList deliveryAttempts = default; - DateTimeOffset receivedTimestamp = default; - string tag = default; - string messageId = default; - string @from = default; - string to = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deliveryStatus"u8)) - { - deliveryStatus = property.Value.GetString(); - continue; - } - if (property.NameEquals("deliveryStatusDetails"u8)) - { - deliveryStatusDetails = property.Value.GetString(); - continue; - } - if (property.NameEquals("deliveryAttempts"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AcsSmsDeliveryAttemptProperties.DeserializeAcsSmsDeliveryAttemptProperties(item, options)); - } - deliveryAttempts = array; - continue; - } - if (property.NameEquals("receivedTimestamp"u8)) - { - receivedTimestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("tag"u8)) - { - tag = property.Value.GetString(); - continue; - } - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("from"u8)) - { - @from = property.Value.GetString(); - continue; - } - if (property.NameEquals("to"u8)) - { - to = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsSmsDeliveryReportReceivedEventData( - messageId, - @from, - to, - serializedAdditionalRawData, - deliveryStatus, - deliveryStatusDetails, - deliveryAttempts, - receivedTimestamp, - tag); - } - - 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(AcsSmsDeliveryReportReceivedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsSmsDeliveryReportReceivedEventData 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 DeserializeAcsSmsDeliveryReportReceivedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsSmsDeliveryReportReceivedEventData)} 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 AcsSmsDeliveryReportReceivedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsSmsDeliveryReportReceivedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryReportReceivedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryReportReceivedEventData.cs deleted file mode 100644 index 3f14eeca621a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsDeliveryReportReceivedEventData.cs +++ /dev/null @@ -1,64 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.SMSDeliveryReportReceived event. - public partial class AcsSmsDeliveryReportReceivedEventData : AcsSmsEventBaseProperties - { - /// Initializes a new instance of . - /// List of details of delivery attempts made. - /// The time at which the SMS delivery report was received. - /// is null. - internal AcsSmsDeliveryReportReceivedEventData(IEnumerable deliveryAttempts, DateTimeOffset receivedTimestamp) - { - Argument.AssertNotNull(deliveryAttempts, nameof(deliveryAttempts)); - - DeliveryAttempts = deliveryAttempts.ToList(); - ReceivedTimestamp = receivedTimestamp; - } - - /// Initializes a new instance of . - /// The identity of the SMS message. - /// The identity of SMS message sender. - /// The identity of SMS message receiver. - /// Keeps track of any properties unknown to the library. - /// Status of Delivery. - /// Details about Delivery Status. - /// List of details of delivery attempts made. - /// The time at which the SMS delivery report was received. - /// Customer Content. - internal AcsSmsDeliveryReportReceivedEventData(string messageId, string @from, string to, IDictionary serializedAdditionalRawData, string deliveryStatus, string deliveryStatusDetails, IReadOnlyList deliveryAttempts, DateTimeOffset receivedTimestamp, string tag) : base(messageId, @from, to, serializedAdditionalRawData) - { - DeliveryStatus = deliveryStatus; - DeliveryStatusDetails = deliveryStatusDetails; - DeliveryAttempts = deliveryAttempts; - ReceivedTimestamp = receivedTimestamp; - Tag = tag; - } - - /// Initializes a new instance of for deserialization. - internal AcsSmsDeliveryReportReceivedEventData() - { - } - - /// Status of Delivery. - public string DeliveryStatus { get; } - /// Details about Delivery Status. - public string DeliveryStatusDetails { get; } - /// List of details of delivery attempts made. - public IReadOnlyList DeliveryAttempts { get; } - /// The time at which the SMS delivery report was received. - public DateTimeOffset ReceivedTimestamp { get; } - /// Customer Content. - public string Tag { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsEventBaseProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsEventBaseProperties.Serialization.cs deleted file mode 100644 index 65ba807bd87f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsEventBaseProperties.Serialization.cs +++ /dev/null @@ -1,167 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsSmsEventBaseProperties : 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(AcsSmsEventBaseProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(MessageId)) - { - writer.WritePropertyName("messageId"u8); - writer.WriteStringValue(MessageId); - } - if (Optional.IsDefined(From)) - { - writer.WritePropertyName("from"u8); - writer.WriteStringValue(From); - } - if (Optional.IsDefined(To)) - { - writer.WritePropertyName("to"u8); - writer.WriteStringValue(To); - } - 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 - } - } - } - - AcsSmsEventBaseProperties 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(AcsSmsEventBaseProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsSmsEventBaseProperties(document.RootElement, options); - } - - internal static AcsSmsEventBaseProperties DeserializeAcsSmsEventBaseProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string messageId = default; - string @from = default; - string to = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("from"u8)) - { - @from = property.Value.GetString(); - continue; - } - if (property.NameEquals("to"u8)) - { - to = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsSmsEventBaseProperties(messageId, @from, to, 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(AcsSmsEventBaseProperties)} does not support writing '{options.Format}' format."); - } - } - - AcsSmsEventBaseProperties 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 DeserializeAcsSmsEventBaseProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsSmsEventBaseProperties)} 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 AcsSmsEventBaseProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsSmsEventBaseProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsEventBaseProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsEventBaseProperties.cs deleted file mode 100644 index 4374d09b5603..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsEventBaseProperties.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of all SMS events. - public partial class AcsSmsEventBaseProperties - { - /// - /// 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 . - internal AcsSmsEventBaseProperties() - { - } - - /// Initializes a new instance of . - /// The identity of the SMS message. - /// The identity of SMS message sender. - /// The identity of SMS message receiver. - /// Keeps track of any properties unknown to the library. - internal AcsSmsEventBaseProperties(string messageId, string @from, string to, IDictionary serializedAdditionalRawData) - { - MessageId = messageId; - From = @from; - To = to; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The identity of the SMS message. - public string MessageId { get; } - /// The identity of SMS message sender. - public string From { get; } - /// The identity of SMS message receiver. - public string To { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsReceivedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsReceivedEventData.Serialization.cs deleted file mode 100644 index 0f08b2151d59..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsReceivedEventData.Serialization.cs +++ /dev/null @@ -1,163 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsSmsReceivedEventData : 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(AcsSmsReceivedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Message)) - { - writer.WritePropertyName("message"u8); - writer.WriteStringValue(Message); - } - writer.WritePropertyName("receivedTimestamp"u8); - writer.WriteStringValue(ReceivedTimestamp, "O"); - } - - AcsSmsReceivedEventData 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(AcsSmsReceivedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsSmsReceivedEventData(document.RootElement, options); - } - - internal static AcsSmsReceivedEventData DeserializeAcsSmsReceivedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string message = default; - DateTimeOffset receivedTimestamp = default; - string messageId = default; - string @from = default; - string to = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("message"u8)) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("receivedTimestamp"u8)) - { - receivedTimestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("messageId"u8)) - { - messageId = property.Value.GetString(); - continue; - } - if (property.NameEquals("from"u8)) - { - @from = property.Value.GetString(); - continue; - } - if (property.NameEquals("to"u8)) - { - to = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsSmsReceivedEventData( - messageId, - @from, - to, - serializedAdditionalRawData, - message, - receivedTimestamp); - } - - 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(AcsSmsReceivedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsSmsReceivedEventData 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 DeserializeAcsSmsReceivedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsSmsReceivedEventData)} 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 AcsSmsReceivedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsSmsReceivedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsReceivedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsReceivedEventData.cs deleted file mode 100644 index 75b7cdc072c2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsSmsReceivedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.SMSReceived event. - public partial class AcsSmsReceivedEventData : AcsSmsEventBaseProperties - { - /// Initializes a new instance of . - /// The time at which the SMS was received. - internal AcsSmsReceivedEventData(DateTimeOffset receivedTimestamp) - { - ReceivedTimestamp = receivedTimestamp; - } - - /// Initializes a new instance of . - /// The identity of the SMS message. - /// The identity of SMS message sender. - /// The identity of SMS message receiver. - /// Keeps track of any properties unknown to the library. - /// The SMS content. - /// The time at which the SMS was received. - internal AcsSmsReceivedEventData(string messageId, string @from, string to, IDictionary serializedAdditionalRawData, string message, DateTimeOffset receivedTimestamp) : base(messageId, @from, to, serializedAdditionalRawData) - { - Message = message; - ReceivedTimestamp = receivedTimestamp; - } - - /// Initializes a new instance of for deserialization. - internal AcsSmsReceivedEventData() - { - } - - /// The SMS content. - public string Message { get; } - /// The time at which the SMS was received. - public DateTimeOffset ReceivedTimestamp { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsUserDisconnectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsUserDisconnectedEventData.Serialization.cs deleted file mode 100644 index 611bd185e924..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsUserDisconnectedEventData.Serialization.cs +++ /dev/null @@ -1,142 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AcsUserDisconnectedEventData : 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(AcsUserDisconnectedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("userCommunicationIdentifier"u8); - writer.WriteObjectValue(UserCommunicationIdentifier, 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 - } - } - } - - AcsUserDisconnectedEventData 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(AcsUserDisconnectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAcsUserDisconnectedEventData(document.RootElement, options); - } - - internal static AcsUserDisconnectedEventData DeserializeAcsUserDisconnectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationIdentifierModel userCommunicationIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("userCommunicationIdentifier"u8)) - { - userCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AcsUserDisconnectedEventData(userCommunicationIdentifier, 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(AcsUserDisconnectedEventData)} does not support writing '{options.Format}' format."); - } - } - - AcsUserDisconnectedEventData 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 DeserializeAcsUserDisconnectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AcsUserDisconnectedEventData)} 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 AcsUserDisconnectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAcsUserDisconnectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsUserDisconnectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsUserDisconnectedEventData.cs deleted file mode 100644 index 5dcfa4a59766..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsUserDisconnectedEventData.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for an Microsoft.Communication.UserDisconnected event. - public partial class AcsUserDisconnectedEventData - { - /// - /// 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 communication identifier of the user who was disconnected. - /// is null. - internal AcsUserDisconnectedEventData(CommunicationIdentifierModel userCommunicationIdentifier) - { - Argument.AssertNotNull(userCommunicationIdentifier, nameof(userCommunicationIdentifier)); - - UserCommunicationIdentifier = userCommunicationIdentifier; - } - - /// Initializes a new instance of . - /// The communication identifier of the user who was disconnected. - /// Keeps track of any properties unknown to the library. - internal AcsUserDisconnectedEventData(CommunicationIdentifierModel userCommunicationIdentifier, IDictionary serializedAdditionalRawData) - { - UserCommunicationIdentifier = userCommunicationIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AcsUserDisconnectedEventData() - { - } - - /// The communication identifier of the user who was disconnected. - public CommunicationIdentifierModel UserCommunicationIdentifier { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsUserEngagement.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsUserEngagement.cs deleted file mode 100644 index 81dfd6b3ee1b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AcsUserEngagement.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// The type of engagement user have with email. - public readonly partial struct AcsUserEngagement : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AcsUserEngagement(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ViewValue = "view"; - private const string ClickValue = "click"; - - /// View. - public static AcsUserEngagement View { get; } = new AcsUserEngagement(ViewValue); - /// Click. - public static AcsUserEngagement Click { get; } = new AcsUserEngagement(ClickValue); - /// Determines if two values are the same. - public static bool operator ==(AcsUserEngagement left, AcsUserEngagement right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AcsUserEngagement left, AcsUserEngagement right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AcsUserEngagement(string value) => new AcsUserEngagement(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AcsUserEngagement other && Equals(other); - /// - public bool Equals(AcsUserEngagement 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionAddedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionAddedEventData.Serialization.cs deleted file mode 100644 index 800e8325ee3a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionAddedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiCenterApiDefinitionAddedEventData : 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(ApiCenterApiDefinitionAddedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Title)) - { - writer.WritePropertyName("title"u8); - writer.WriteStringValue(Title); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - writer.WritePropertyName("specification"u8); - writer.WriteObjectValue(Specification, 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 - } - } - } - - ApiCenterApiDefinitionAddedEventData 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(ApiCenterApiDefinitionAddedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiCenterApiDefinitionAddedEventData(document.RootElement, options); - } - - internal static ApiCenterApiDefinitionAddedEventData DeserializeApiCenterApiDefinitionAddedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string title = default; - string description = default; - ApiCenterApiSpecification specification = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("title"u8)) - { - title = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("specification"u8)) - { - specification = ApiCenterApiSpecification.DeserializeApiCenterApiSpecification(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiCenterApiDefinitionAddedEventData(title, description, specification, 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(ApiCenterApiDefinitionAddedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiCenterApiDefinitionAddedEventData 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 DeserializeApiCenterApiDefinitionAddedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiCenterApiDefinitionAddedEventData)} 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 ApiCenterApiDefinitionAddedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiCenterApiDefinitionAddedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionAddedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionAddedEventData.cs deleted file mode 100644 index 57570dd11c36..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionAddedEventData.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the data property of an EventGridEvent for a Microsoft.ApiCenter.ApiDefinitionAdded event. - public partial class ApiCenterApiDefinitionAddedEventData - { - /// - /// 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 . - /// API definition specification. - /// is null. - internal ApiCenterApiDefinitionAddedEventData(ApiCenterApiSpecification specification) - { - Argument.AssertNotNull(specification, nameof(specification)); - - Specification = specification; - } - - /// Initializes a new instance of . - /// API definition title. - /// API definition description. - /// API definition specification. - /// Keeps track of any properties unknown to the library. - internal ApiCenterApiDefinitionAddedEventData(string title, string description, ApiCenterApiSpecification specification, IDictionary serializedAdditionalRawData) - { - Title = title; - Description = description; - Specification = specification; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ApiCenterApiDefinitionAddedEventData() - { - } - - /// API definition title. - public string Title { get; } - /// API definition description. - public string Description { get; } - /// API definition specification. - public ApiCenterApiSpecification Specification { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionUpdatedEventData.Serialization.cs deleted file mode 100644 index 67da914fdaef..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiCenterApiDefinitionUpdatedEventData : 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(ApiCenterApiDefinitionUpdatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Title)) - { - writer.WritePropertyName("title"u8); - writer.WriteStringValue(Title); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - writer.WritePropertyName("specification"u8); - writer.WriteObjectValue(Specification, 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 - } - } - } - - ApiCenterApiDefinitionUpdatedEventData 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(ApiCenterApiDefinitionUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiCenterApiDefinitionUpdatedEventData(document.RootElement, options); - } - - internal static ApiCenterApiDefinitionUpdatedEventData DeserializeApiCenterApiDefinitionUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string title = default; - string description = default; - ApiCenterApiSpecification specification = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("title"u8)) - { - title = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("specification"u8)) - { - specification = ApiCenterApiSpecification.DeserializeApiCenterApiSpecification(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiCenterApiDefinitionUpdatedEventData(title, description, specification, 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(ApiCenterApiDefinitionUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiCenterApiDefinitionUpdatedEventData 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 DeserializeApiCenterApiDefinitionUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiCenterApiDefinitionUpdatedEventData)} 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 ApiCenterApiDefinitionUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiCenterApiDefinitionUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionUpdatedEventData.cs deleted file mode 100644 index cc06633b915f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiDefinitionUpdatedEventData.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the data property of an EventGridEvent for a Microsoft.ApiCenter.ApiDefinitionUpdated event. - public partial class ApiCenterApiDefinitionUpdatedEventData - { - /// - /// 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 . - /// API definition specification. - /// is null. - internal ApiCenterApiDefinitionUpdatedEventData(ApiCenterApiSpecification specification) - { - Argument.AssertNotNull(specification, nameof(specification)); - - Specification = specification; - } - - /// Initializes a new instance of . - /// API definition title. - /// API definition description. - /// API definition specification. - /// Keeps track of any properties unknown to the library. - internal ApiCenterApiDefinitionUpdatedEventData(string title, string description, ApiCenterApiSpecification specification, IDictionary serializedAdditionalRawData) - { - Title = title; - Description = description; - Specification = specification; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ApiCenterApiDefinitionUpdatedEventData() - { - } - - /// API definition title. - public string Title { get; } - /// API definition description. - public string Description { get; } - /// API definition specification. - public ApiCenterApiSpecification Specification { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiSpecification.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiSpecification.Serialization.cs deleted file mode 100644 index 795c1c8642f9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiSpecification.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiCenterApiSpecification : 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(ApiCenterApiSpecification)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteStringValue(Version); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ApiCenterApiSpecification 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(ApiCenterApiSpecification)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiCenterApiSpecification(document.RootElement, options); - } - - internal static ApiCenterApiSpecification DeserializeApiCenterApiSpecification(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - string version = 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("version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiCenterApiSpecification(name, version, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(ApiCenterApiSpecification)} does not support writing '{options.Format}' format."); - } - } - - ApiCenterApiSpecification 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 DeserializeApiCenterApiSpecification(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiCenterApiSpecification)} 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 ApiCenterApiSpecification FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiCenterApiSpecification(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiSpecification.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiSpecification.cs deleted file mode 100644 index 9e0f43020490..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiCenterApiSpecification.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.Messaging.EventGrid.SystemEvents -{ - /// API specification details. - public partial class ApiCenterApiSpecification - { - /// - /// 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 ApiCenterApiSpecification() - { - } - - /// Initializes a new instance of . - /// Specification name. - /// Specification version. - /// Keeps track of any properties unknown to the library. - internal ApiCenterApiSpecification(string name, string version, IDictionary serializedAdditionalRawData) - { - Name = name; - Version = version; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Specification name. - public string Name { get; } - /// Specification version. - public string Version { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiCreatedEventData.Serialization.cs deleted file mode 100644 index 37ecb8627dd2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementApiCreatedEventData : 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(ApiManagementApiCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementApiCreatedEventData 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(ApiManagementApiCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementApiCreatedEventData(document.RootElement, options); - } - - internal static ApiManagementApiCreatedEventData DeserializeApiManagementApiCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementApiCreatedEventData(resourceUri, 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(ApiManagementApiCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementApiCreatedEventData 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 DeserializeApiManagementApiCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementApiCreatedEventData)} 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 ApiManagementApiCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementApiCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiCreatedEventData.cs deleted file mode 100644 index 749dcc764d1e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.APICreated event. - public partial class ApiManagementApiCreatedEventData - { - /// - /// 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 ApiManagementApiCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementApiCreatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiDeletedEventData.Serialization.cs deleted file mode 100644 index 25351792dc41..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementApiDeletedEventData : 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(ApiManagementApiDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementApiDeletedEventData 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(ApiManagementApiDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementApiDeletedEventData(document.RootElement, options); - } - - internal static ApiManagementApiDeletedEventData DeserializeApiManagementApiDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementApiDeletedEventData(resourceUri, 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(ApiManagementApiDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementApiDeletedEventData 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 DeserializeApiManagementApiDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementApiDeletedEventData)} 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 ApiManagementApiDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementApiDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiDeletedEventData.cs deleted file mode 100644 index ee98592a9300..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.APIDeleted event. - public partial class ApiManagementApiDeletedEventData - { - /// - /// 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 ApiManagementApiDeletedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementApiDeletedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseCreatedEventData.Serialization.cs deleted file mode 100644 index bb621ed76bf8..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementApiReleaseCreatedEventData : 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(ApiManagementApiReleaseCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementApiReleaseCreatedEventData 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(ApiManagementApiReleaseCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementApiReleaseCreatedEventData(document.RootElement, options); - } - - internal static ApiManagementApiReleaseCreatedEventData DeserializeApiManagementApiReleaseCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementApiReleaseCreatedEventData(resourceUri, 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(ApiManagementApiReleaseCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementApiReleaseCreatedEventData 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 DeserializeApiManagementApiReleaseCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementApiReleaseCreatedEventData)} 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 ApiManagementApiReleaseCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementApiReleaseCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseCreatedEventData.cs deleted file mode 100644 index a1fd2b32ca6a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.APIReleaseCreated event. - public partial class ApiManagementApiReleaseCreatedEventData - { - /// - /// 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 ApiManagementApiReleaseCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementApiReleaseCreatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseDeletedEventData.Serialization.cs deleted file mode 100644 index c9a0c71fb8c5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementApiReleaseDeletedEventData : 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(ApiManagementApiReleaseDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementApiReleaseDeletedEventData 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(ApiManagementApiReleaseDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementApiReleaseDeletedEventData(document.RootElement, options); - } - - internal static ApiManagementApiReleaseDeletedEventData DeserializeApiManagementApiReleaseDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementApiReleaseDeletedEventData(resourceUri, 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(ApiManagementApiReleaseDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementApiReleaseDeletedEventData 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 DeserializeApiManagementApiReleaseDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementApiReleaseDeletedEventData)} 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 ApiManagementApiReleaseDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementApiReleaseDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseDeletedEventData.cs deleted file mode 100644 index d6a29916552f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.APIReleaseDeleted event. - public partial class ApiManagementApiReleaseDeletedEventData - { - /// - /// 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 ApiManagementApiReleaseDeletedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementApiReleaseDeletedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseUpdatedEventData.Serialization.cs deleted file mode 100644 index c2a8785791c3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementApiReleaseUpdatedEventData : 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(ApiManagementApiReleaseUpdatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementApiReleaseUpdatedEventData 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(ApiManagementApiReleaseUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementApiReleaseUpdatedEventData(document.RootElement, options); - } - - internal static ApiManagementApiReleaseUpdatedEventData DeserializeApiManagementApiReleaseUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementApiReleaseUpdatedEventData(resourceUri, 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(ApiManagementApiReleaseUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementApiReleaseUpdatedEventData 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 DeserializeApiManagementApiReleaseUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementApiReleaseUpdatedEventData)} 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 ApiManagementApiReleaseUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementApiReleaseUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseUpdatedEventData.cs deleted file mode 100644 index 21ecd54e9cf9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiReleaseUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.APIReleaseUpdated event. - public partial class ApiManagementApiReleaseUpdatedEventData - { - /// - /// 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 ApiManagementApiReleaseUpdatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementApiReleaseUpdatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiUpdatedEventData.Serialization.cs deleted file mode 100644 index d5f1490488f7..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementApiUpdatedEventData : 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(ApiManagementApiUpdatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementApiUpdatedEventData 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(ApiManagementApiUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementApiUpdatedEventData(document.RootElement, options); - } - - internal static ApiManagementApiUpdatedEventData DeserializeApiManagementApiUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementApiUpdatedEventData(resourceUri, 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(ApiManagementApiUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementApiUpdatedEventData 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 DeserializeApiManagementApiUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementApiUpdatedEventData)} 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 ApiManagementApiUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementApiUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiUpdatedEventData.cs deleted file mode 100644 index 6f7d3444dd2a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementApiUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.APIUpdated event. - public partial class ApiManagementApiUpdatedEventData - { - /// - /// 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 ApiManagementApiUpdatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementApiUpdatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiAddedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiAddedEventData.Serialization.cs deleted file mode 100644 index 475b185487ad..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiAddedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementGatewayApiAddedEventData : 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(ApiManagementGatewayApiAddedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementGatewayApiAddedEventData 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(ApiManagementGatewayApiAddedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementGatewayApiAddedEventData(document.RootElement, options); - } - - internal static ApiManagementGatewayApiAddedEventData DeserializeApiManagementGatewayApiAddedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementGatewayApiAddedEventData(resourceUri, 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(ApiManagementGatewayApiAddedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementGatewayApiAddedEventData 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 DeserializeApiManagementGatewayApiAddedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementGatewayApiAddedEventData)} 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 ApiManagementGatewayApiAddedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementGatewayApiAddedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiAddedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiAddedEventData.cs deleted file mode 100644 index a044af7e7b8a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiAddedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayAPIAdded event. - public partial class ApiManagementGatewayApiAddedEventData - { - /// - /// 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 ApiManagementGatewayApiAddedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/apis/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementGatewayApiAddedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/apis/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiRemovedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiRemovedEventData.Serialization.cs deleted file mode 100644 index 35dc0c246114..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiRemovedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementGatewayApiRemovedEventData : 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(ApiManagementGatewayApiRemovedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementGatewayApiRemovedEventData 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(ApiManagementGatewayApiRemovedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementGatewayApiRemovedEventData(document.RootElement, options); - } - - internal static ApiManagementGatewayApiRemovedEventData DeserializeApiManagementGatewayApiRemovedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementGatewayApiRemovedEventData(resourceUri, 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(ApiManagementGatewayApiRemovedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementGatewayApiRemovedEventData 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 DeserializeApiManagementGatewayApiRemovedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementGatewayApiRemovedEventData)} 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 ApiManagementGatewayApiRemovedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementGatewayApiRemovedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiRemovedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiRemovedEventData.cs deleted file mode 100644 index 672face4a74c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayApiRemovedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayAPIRemoved event. - public partial class ApiManagementGatewayApiRemovedEventData - { - /// - /// 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 ApiManagementGatewayApiRemovedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/apis/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementGatewayApiRemovedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/apis/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityCreatedEventData.Serialization.cs deleted file mode 100644 index f9429debc593..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementGatewayCertificateAuthorityCreatedEventData : 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(ApiManagementGatewayCertificateAuthorityCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementGatewayCertificateAuthorityCreatedEventData 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(ApiManagementGatewayCertificateAuthorityCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementGatewayCertificateAuthorityCreatedEventData(document.RootElement, options); - } - - internal static ApiManagementGatewayCertificateAuthorityCreatedEventData DeserializeApiManagementGatewayCertificateAuthorityCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementGatewayCertificateAuthorityCreatedEventData(resourceUri, 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(ApiManagementGatewayCertificateAuthorityCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementGatewayCertificateAuthorityCreatedEventData 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 DeserializeApiManagementGatewayCertificateAuthorityCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementGatewayCertificateAuthorityCreatedEventData)} 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 ApiManagementGatewayCertificateAuthorityCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementGatewayCertificateAuthorityCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityCreatedEventData.cs deleted file mode 100644 index 32b7e53f6027..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayCertificateAuthorityCreated event. - public partial class ApiManagementGatewayCertificateAuthorityCreatedEventData - { - /// - /// 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 ApiManagementGatewayCertificateAuthorityCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/certificateAuthorities/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementGatewayCertificateAuthorityCreatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/certificateAuthorities/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityDeletedEventData.Serialization.cs deleted file mode 100644 index 7209c9da9043..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementGatewayCertificateAuthorityDeletedEventData : 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(ApiManagementGatewayCertificateAuthorityDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementGatewayCertificateAuthorityDeletedEventData 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(ApiManagementGatewayCertificateAuthorityDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementGatewayCertificateAuthorityDeletedEventData(document.RootElement, options); - } - - internal static ApiManagementGatewayCertificateAuthorityDeletedEventData DeserializeApiManagementGatewayCertificateAuthorityDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementGatewayCertificateAuthorityDeletedEventData(resourceUri, 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(ApiManagementGatewayCertificateAuthorityDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementGatewayCertificateAuthorityDeletedEventData 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 DeserializeApiManagementGatewayCertificateAuthorityDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementGatewayCertificateAuthorityDeletedEventData)} 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 ApiManagementGatewayCertificateAuthorityDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementGatewayCertificateAuthorityDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityDeletedEventData.cs deleted file mode 100644 index dab4e404a22c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayCertificateAuthorityDeleted event. - public partial class ApiManagementGatewayCertificateAuthorityDeletedEventData - { - /// - /// 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 ApiManagementGatewayCertificateAuthorityDeletedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/certificateAuthorities/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementGatewayCertificateAuthorityDeletedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/certificateAuthorities/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityUpdatedEventData.Serialization.cs deleted file mode 100644 index f0d7e939da8c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementGatewayCertificateAuthorityUpdatedEventData : 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(ApiManagementGatewayCertificateAuthorityUpdatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementGatewayCertificateAuthorityUpdatedEventData 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(ApiManagementGatewayCertificateAuthorityUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementGatewayCertificateAuthorityUpdatedEventData(document.RootElement, options); - } - - internal static ApiManagementGatewayCertificateAuthorityUpdatedEventData DeserializeApiManagementGatewayCertificateAuthorityUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementGatewayCertificateAuthorityUpdatedEventData(resourceUri, 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(ApiManagementGatewayCertificateAuthorityUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementGatewayCertificateAuthorityUpdatedEventData 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 DeserializeApiManagementGatewayCertificateAuthorityUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementGatewayCertificateAuthorityUpdatedEventData)} 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 ApiManagementGatewayCertificateAuthorityUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementGatewayCertificateAuthorityUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityUpdatedEventData.cs deleted file mode 100644 index b302731c4cd0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCertificateAuthorityUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayCertificateAuthorityUpdated event. - public partial class ApiManagementGatewayCertificateAuthorityUpdatedEventData - { - /// - /// 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 ApiManagementGatewayCertificateAuthorityUpdatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/certificateAuthorities/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementGatewayCertificateAuthorityUpdatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/certificateAuthorities/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCreatedEventData.Serialization.cs deleted file mode 100644 index bf6bf9bf82e8..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementGatewayCreatedEventData : 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(ApiManagementGatewayCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementGatewayCreatedEventData 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(ApiManagementGatewayCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementGatewayCreatedEventData(document.RootElement, options); - } - - internal static ApiManagementGatewayCreatedEventData DeserializeApiManagementGatewayCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementGatewayCreatedEventData(resourceUri, 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(ApiManagementGatewayCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementGatewayCreatedEventData 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 DeserializeApiManagementGatewayCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementGatewayCreatedEventData)} 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 ApiManagementGatewayCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementGatewayCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCreatedEventData.cs deleted file mode 100644 index b28dcba9ca70..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayCreated event. - public partial class ApiManagementGatewayCreatedEventData - { - /// - /// 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 ApiManagementGatewayCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementGatewayCreatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayDeletedEventData.Serialization.cs deleted file mode 100644 index 1c4c03f55956..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementGatewayDeletedEventData : 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(ApiManagementGatewayDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementGatewayDeletedEventData 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(ApiManagementGatewayDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementGatewayDeletedEventData(document.RootElement, options); - } - - internal static ApiManagementGatewayDeletedEventData DeserializeApiManagementGatewayDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementGatewayDeletedEventData(resourceUri, 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(ApiManagementGatewayDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementGatewayDeletedEventData 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 DeserializeApiManagementGatewayDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementGatewayDeletedEventData)} 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 ApiManagementGatewayDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementGatewayDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayDeletedEventData.cs deleted file mode 100644 index 5918a4eec077..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayDeleted event. - public partial class ApiManagementGatewayDeletedEventData - { - /// - /// 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 ApiManagementGatewayDeletedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementGatewayDeletedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationCreatedEventData.Serialization.cs deleted file mode 100644 index 8f5e8fae4a35..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementGatewayHostnameConfigurationCreatedEventData : 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(ApiManagementGatewayHostnameConfigurationCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementGatewayHostnameConfigurationCreatedEventData 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(ApiManagementGatewayHostnameConfigurationCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementGatewayHostnameConfigurationCreatedEventData(document.RootElement, options); - } - - internal static ApiManagementGatewayHostnameConfigurationCreatedEventData DeserializeApiManagementGatewayHostnameConfigurationCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementGatewayHostnameConfigurationCreatedEventData(resourceUri, 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(ApiManagementGatewayHostnameConfigurationCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementGatewayHostnameConfigurationCreatedEventData 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 DeserializeApiManagementGatewayHostnameConfigurationCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementGatewayHostnameConfigurationCreatedEventData)} 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 ApiManagementGatewayHostnameConfigurationCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementGatewayHostnameConfigurationCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationCreatedEventData.cs deleted file mode 100644 index dd89003f1941..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayHostnameConfigurationCreated event. - public partial class ApiManagementGatewayHostnameConfigurationCreatedEventData - { - /// - /// 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 ApiManagementGatewayHostnameConfigurationCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/hostnameConfigurations/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementGatewayHostnameConfigurationCreatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/hostnameConfigurations/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationDeletedEventData.Serialization.cs deleted file mode 100644 index 2a65de8c566b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementGatewayHostnameConfigurationDeletedEventData : 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(ApiManagementGatewayHostnameConfigurationDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementGatewayHostnameConfigurationDeletedEventData 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(ApiManagementGatewayHostnameConfigurationDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementGatewayHostnameConfigurationDeletedEventData(document.RootElement, options); - } - - internal static ApiManagementGatewayHostnameConfigurationDeletedEventData DeserializeApiManagementGatewayHostnameConfigurationDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementGatewayHostnameConfigurationDeletedEventData(resourceUri, 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(ApiManagementGatewayHostnameConfigurationDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementGatewayHostnameConfigurationDeletedEventData 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 DeserializeApiManagementGatewayHostnameConfigurationDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementGatewayHostnameConfigurationDeletedEventData)} 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 ApiManagementGatewayHostnameConfigurationDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementGatewayHostnameConfigurationDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationDeletedEventData.cs deleted file mode 100644 index fe117060adce..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayHostnameConfigurationDeleted event. - public partial class ApiManagementGatewayHostnameConfigurationDeletedEventData - { - /// - /// 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 ApiManagementGatewayHostnameConfigurationDeletedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/hostnameConfigurations/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementGatewayHostnameConfigurationDeletedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/hostnameConfigurations/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationUpdatedEventData.Serialization.cs deleted file mode 100644 index b97060c07e9f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementGatewayHostnameConfigurationUpdatedEventData : 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(ApiManagementGatewayHostnameConfigurationUpdatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementGatewayHostnameConfigurationUpdatedEventData 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(ApiManagementGatewayHostnameConfigurationUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementGatewayHostnameConfigurationUpdatedEventData(document.RootElement, options); - } - - internal static ApiManagementGatewayHostnameConfigurationUpdatedEventData DeserializeApiManagementGatewayHostnameConfigurationUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementGatewayHostnameConfigurationUpdatedEventData(resourceUri, 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(ApiManagementGatewayHostnameConfigurationUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementGatewayHostnameConfigurationUpdatedEventData 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 DeserializeApiManagementGatewayHostnameConfigurationUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementGatewayHostnameConfigurationUpdatedEventData)} 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 ApiManagementGatewayHostnameConfigurationUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementGatewayHostnameConfigurationUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationUpdatedEventData.cs deleted file mode 100644 index 0dcea1771fde..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayHostnameConfigurationUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayHostnameConfigurationUpdated event. - public partial class ApiManagementGatewayHostnameConfigurationUpdatedEventData - { - /// - /// 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 ApiManagementGatewayHostnameConfigurationUpdatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/hostnameConfigurations/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementGatewayHostnameConfigurationUpdatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/hostnameConfigurations/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayUpdatedEventData.Serialization.cs deleted file mode 100644 index 12106bcdb3a5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementGatewayUpdatedEventData : 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(ApiManagementGatewayUpdatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementGatewayUpdatedEventData 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(ApiManagementGatewayUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementGatewayUpdatedEventData(document.RootElement, options); - } - - internal static ApiManagementGatewayUpdatedEventData DeserializeApiManagementGatewayUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementGatewayUpdatedEventData(resourceUri, 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(ApiManagementGatewayUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementGatewayUpdatedEventData 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 DeserializeApiManagementGatewayUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementGatewayUpdatedEventData)} 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 ApiManagementGatewayUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementGatewayUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayUpdatedEventData.cs deleted file mode 100644 index dc3cc4137431..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementGatewayUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayUpdated event. - public partial class ApiManagementGatewayUpdatedEventData - { - /// - /// 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 ApiManagementGatewayUpdatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementGatewayUpdatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductCreatedEventData.Serialization.cs deleted file mode 100644 index 8370b13bfdc9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementProductCreatedEventData : 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(ApiManagementProductCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementProductCreatedEventData 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(ApiManagementProductCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementProductCreatedEventData(document.RootElement, options); - } - - internal static ApiManagementProductCreatedEventData DeserializeApiManagementProductCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementProductCreatedEventData(resourceUri, 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(ApiManagementProductCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementProductCreatedEventData 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 DeserializeApiManagementProductCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementProductCreatedEventData)} 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 ApiManagementProductCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementProductCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductCreatedEventData.cs deleted file mode 100644 index d395c9b88db7..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.ProductCreated event. - public partial class ApiManagementProductCreatedEventData - { - /// - /// 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 ApiManagementProductCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementProductCreatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductDeletedEventData.Serialization.cs deleted file mode 100644 index 7da867ded040..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementProductDeletedEventData : 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(ApiManagementProductDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementProductDeletedEventData 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(ApiManagementProductDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementProductDeletedEventData(document.RootElement, options); - } - - internal static ApiManagementProductDeletedEventData DeserializeApiManagementProductDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementProductDeletedEventData(resourceUri, 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(ApiManagementProductDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementProductDeletedEventData 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 DeserializeApiManagementProductDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementProductDeletedEventData)} 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 ApiManagementProductDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementProductDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductDeletedEventData.cs deleted file mode 100644 index 54b5e5c02e30..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.ProductDeleted event. - public partial class ApiManagementProductDeletedEventData - { - /// - /// 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 ApiManagementProductDeletedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementProductDeletedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductUpdatedEventData.Serialization.cs deleted file mode 100644 index 11ac30448ea3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementProductUpdatedEventData : 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(ApiManagementProductUpdatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementProductUpdatedEventData 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(ApiManagementProductUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementProductUpdatedEventData(document.RootElement, options); - } - - internal static ApiManagementProductUpdatedEventData DeserializeApiManagementProductUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementProductUpdatedEventData(resourceUri, 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(ApiManagementProductUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementProductUpdatedEventData 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 DeserializeApiManagementProductUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementProductUpdatedEventData)} 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 ApiManagementProductUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementProductUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductUpdatedEventData.cs deleted file mode 100644 index 336ba37353c3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementProductUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.ProductUpdated event. - public partial class ApiManagementProductUpdatedEventData - { - /// - /// 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 ApiManagementProductUpdatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementProductUpdatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionCreatedEventData.Serialization.cs deleted file mode 100644 index d1e89813c46a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementSubscriptionCreatedEventData : 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(ApiManagementSubscriptionCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementSubscriptionCreatedEventData 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(ApiManagementSubscriptionCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementSubscriptionCreatedEventData(document.RootElement, options); - } - - internal static ApiManagementSubscriptionCreatedEventData DeserializeApiManagementSubscriptionCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementSubscriptionCreatedEventData(resourceUri, 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(ApiManagementSubscriptionCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementSubscriptionCreatedEventData 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 DeserializeApiManagementSubscriptionCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementSubscriptionCreatedEventData)} 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 ApiManagementSubscriptionCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementSubscriptionCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionCreatedEventData.cs deleted file mode 100644 index e7bc42c2ff74..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.SubscriptionCreated event. - public partial class ApiManagementSubscriptionCreatedEventData - { - /// - /// 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 ApiManagementSubscriptionCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementSubscriptionCreatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionDeletedEventData.Serialization.cs deleted file mode 100644 index aa09d39871b2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementSubscriptionDeletedEventData : 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(ApiManagementSubscriptionDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementSubscriptionDeletedEventData 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(ApiManagementSubscriptionDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementSubscriptionDeletedEventData(document.RootElement, options); - } - - internal static ApiManagementSubscriptionDeletedEventData DeserializeApiManagementSubscriptionDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementSubscriptionDeletedEventData(resourceUri, 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(ApiManagementSubscriptionDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementSubscriptionDeletedEventData 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 DeserializeApiManagementSubscriptionDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementSubscriptionDeletedEventData)} 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 ApiManagementSubscriptionDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementSubscriptionDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionDeletedEventData.cs deleted file mode 100644 index 3cfae7be4246..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.SubscriptionDeleted event. - public partial class ApiManagementSubscriptionDeletedEventData - { - /// - /// 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 ApiManagementSubscriptionDeletedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementSubscriptionDeletedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionUpdatedEventData.Serialization.cs deleted file mode 100644 index 290798ec0562..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementSubscriptionUpdatedEventData : 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(ApiManagementSubscriptionUpdatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementSubscriptionUpdatedEventData 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(ApiManagementSubscriptionUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementSubscriptionUpdatedEventData(document.RootElement, options); - } - - internal static ApiManagementSubscriptionUpdatedEventData DeserializeApiManagementSubscriptionUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementSubscriptionUpdatedEventData(resourceUri, 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(ApiManagementSubscriptionUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementSubscriptionUpdatedEventData 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 DeserializeApiManagementSubscriptionUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementSubscriptionUpdatedEventData)} 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 ApiManagementSubscriptionUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementSubscriptionUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionUpdatedEventData.cs deleted file mode 100644 index 564941c53a12..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementSubscriptionUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.SubscriptionUpdated event. - public partial class ApiManagementSubscriptionUpdatedEventData - { - /// - /// 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 ApiManagementSubscriptionUpdatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementSubscriptionUpdatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserCreatedEventData.Serialization.cs deleted file mode 100644 index 7700a92dd618..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementUserCreatedEventData : 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(ApiManagementUserCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementUserCreatedEventData 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(ApiManagementUserCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementUserCreatedEventData(document.RootElement, options); - } - - internal static ApiManagementUserCreatedEventData DeserializeApiManagementUserCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementUserCreatedEventData(resourceUri, 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(ApiManagementUserCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementUserCreatedEventData 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 DeserializeApiManagementUserCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementUserCreatedEventData)} 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 ApiManagementUserCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementUserCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserCreatedEventData.cs deleted file mode 100644 index 5d7803964784..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.UserCreated event. - public partial class ApiManagementUserCreatedEventData - { - /// - /// 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 ApiManagementUserCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementUserCreatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserDeletedEventData.Serialization.cs deleted file mode 100644 index 997b13aa9d49..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementUserDeletedEventData : 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(ApiManagementUserDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementUserDeletedEventData 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(ApiManagementUserDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementUserDeletedEventData(document.RootElement, options); - } - - internal static ApiManagementUserDeletedEventData DeserializeApiManagementUserDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementUserDeletedEventData(resourceUri, 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(ApiManagementUserDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementUserDeletedEventData 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 DeserializeApiManagementUserDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementUserDeletedEventData)} 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 ApiManagementUserDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementUserDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserDeletedEventData.cs deleted file mode 100644 index 46e4e68a77fa..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.UserDeleted event. - public partial class ApiManagementUserDeletedEventData - { - /// - /// 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 ApiManagementUserDeletedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementUserDeletedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserUpdatedEventData.Serialization.cs deleted file mode 100644 index aefcba2c8c70..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ApiManagementUserUpdatedEventData : 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(ApiManagementUserUpdatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - 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 - } - } - } - - ApiManagementUserUpdatedEventData 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(ApiManagementUserUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeApiManagementUserUpdatedEventData(document.RootElement, options); - } - - internal static ApiManagementUserUpdatedEventData DeserializeApiManagementUserUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string resourceUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ApiManagementUserUpdatedEventData(resourceUri, 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(ApiManagementUserUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ApiManagementUserUpdatedEventData 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 DeserializeApiManagementUserUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ApiManagementUserUpdatedEventData)} 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 ApiManagementUserUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeApiManagementUserUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserUpdatedEventData.cs deleted file mode 100644 index 07bdfb4686e3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ApiManagementUserUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.UserUpdated event. - public partial class ApiManagementUserUpdatedEventData - { - /// - /// 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 ApiManagementUserUpdatedEventData() - { - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// Keeps track of any properties unknown to the library. - internal ApiManagementUserUpdatedEventData(string resourceUri, IDictionary serializedAdditionalRawData) - { - ResourceUri = resourceUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - public string ResourceUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppAction.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppAction.cs deleted file mode 100644 index e360f1f1c2eb..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppAction.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Type of action of the operation. - public readonly partial struct AppAction : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AppAction(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string RestartedValue = "Restarted"; - private const string StoppedValue = "Stopped"; - private const string ChangedAppSettingsValue = "ChangedAppSettings"; - private const string StartedValue = "Started"; - private const string CompletedValue = "Completed"; - private const string FailedValue = "Failed"; - - /// Web app was restarted. - public static AppAction Restarted { get; } = new AppAction(RestartedValue); - /// Web app was stopped. - public static AppAction Stopped { get; } = new AppAction(StoppedValue); - /// There was an operation to change app setting on the web app. - public static AppAction ChangedAppSettings { get; } = new AppAction(ChangedAppSettingsValue); - /// The job has started. - public static AppAction Started { get; } = new AppAction(StartedValue); - /// The job has completed. - public static AppAction Completed { get; } = new AppAction(CompletedValue); - /// The job has failed to complete. - public static AppAction Failed { get; } = new AppAction(FailedValue); - /// Determines if two values are the same. - public static bool operator ==(AppAction left, AppAction right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AppAction left, AppAction right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AppAction(string value) => new AppAction(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AppAction other && Equals(other); - /// - public bool Equals(AppAction 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueDeletedEventData.Serialization.cs deleted file mode 100644 index d02ce8908a3f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueDeletedEventData.Serialization.cs +++ /dev/null @@ -1,178 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AppConfigurationKeyValueDeletedEventData : 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(AppConfigurationKeyValueDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Key)) - { - writer.WritePropertyName("key"u8); - writer.WriteStringValue(Key); - } - if (Optional.IsDefined(Label)) - { - writer.WritePropertyName("label"u8); - writer.WriteStringValue(Label); - } - if (Optional.IsDefined(Etag)) - { - writer.WritePropertyName("etag"u8); - writer.WriteStringValue(Etag); - } - if (Optional.IsDefined(SyncToken)) - { - writer.WritePropertyName("syncToken"u8); - writer.WriteStringValue(SyncToken); - } - 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 - } - } - } - - AppConfigurationKeyValueDeletedEventData 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(AppConfigurationKeyValueDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAppConfigurationKeyValueDeletedEventData(document.RootElement, options); - } - - internal static AppConfigurationKeyValueDeletedEventData DeserializeAppConfigurationKeyValueDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string key = default; - string label = default; - string etag = default; - string syncToken = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("key"u8)) - { - key = property.Value.GetString(); - continue; - } - if (property.NameEquals("label"u8)) - { - label = property.Value.GetString(); - continue; - } - if (property.NameEquals("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - if (property.NameEquals("syncToken"u8)) - { - syncToken = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AppConfigurationKeyValueDeletedEventData(key, label, etag, syncToken, 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(AppConfigurationKeyValueDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - AppConfigurationKeyValueDeletedEventData 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 DeserializeAppConfigurationKeyValueDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AppConfigurationKeyValueDeletedEventData)} 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 AppConfigurationKeyValueDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAppConfigurationKeyValueDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueDeletedEventData.cs deleted file mode 100644 index b920a0b33dd2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueDeletedEventData.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AppConfiguration.KeyValueDeleted event. - public partial class AppConfigurationKeyValueDeletedEventData - { - /// - /// 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 AppConfigurationKeyValueDeletedEventData() - { - } - - /// Initializes a new instance of . - /// The key used to identify the key-value that was deleted. - /// The label, if any, used to identify the key-value that was deleted. - /// The etag representing the key-value that was deleted. - /// The sync token representing the server state after the event. - /// Keeps track of any properties unknown to the library. - internal AppConfigurationKeyValueDeletedEventData(string key, string label, string etag, string syncToken, IDictionary serializedAdditionalRawData) - { - Key = key; - Label = label; - Etag = etag; - SyncToken = syncToken; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The key used to identify the key-value that was deleted. - public string Key { get; } - /// The label, if any, used to identify the key-value that was deleted. - public string Label { get; } - /// The etag representing the key-value that was deleted. - public string Etag { get; } - /// The sync token representing the server state after the event. - public string SyncToken { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueModifiedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueModifiedEventData.Serialization.cs deleted file mode 100644 index 73f91a283b8c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueModifiedEventData.Serialization.cs +++ /dev/null @@ -1,178 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AppConfigurationKeyValueModifiedEventData : 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(AppConfigurationKeyValueModifiedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Key)) - { - writer.WritePropertyName("key"u8); - writer.WriteStringValue(Key); - } - if (Optional.IsDefined(Label)) - { - writer.WritePropertyName("label"u8); - writer.WriteStringValue(Label); - } - if (Optional.IsDefined(Etag)) - { - writer.WritePropertyName("etag"u8); - writer.WriteStringValue(Etag); - } - if (Optional.IsDefined(SyncToken)) - { - writer.WritePropertyName("syncToken"u8); - writer.WriteStringValue(SyncToken); - } - 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 - } - } - } - - AppConfigurationKeyValueModifiedEventData 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(AppConfigurationKeyValueModifiedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAppConfigurationKeyValueModifiedEventData(document.RootElement, options); - } - - internal static AppConfigurationKeyValueModifiedEventData DeserializeAppConfigurationKeyValueModifiedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string key = default; - string label = default; - string etag = default; - string syncToken = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("key"u8)) - { - key = property.Value.GetString(); - continue; - } - if (property.NameEquals("label"u8)) - { - label = property.Value.GetString(); - continue; - } - if (property.NameEquals("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - if (property.NameEquals("syncToken"u8)) - { - syncToken = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AppConfigurationKeyValueModifiedEventData(key, label, etag, syncToken, 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(AppConfigurationKeyValueModifiedEventData)} does not support writing '{options.Format}' format."); - } - } - - AppConfigurationKeyValueModifiedEventData 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 DeserializeAppConfigurationKeyValueModifiedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AppConfigurationKeyValueModifiedEventData)} 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 AppConfigurationKeyValueModifiedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAppConfigurationKeyValueModifiedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueModifiedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueModifiedEventData.cs deleted file mode 100644 index e03cb8ded63b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationKeyValueModifiedEventData.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AppConfiguration.KeyValueModified event. - public partial class AppConfigurationKeyValueModifiedEventData - { - /// - /// 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 AppConfigurationKeyValueModifiedEventData() - { - } - - /// Initializes a new instance of . - /// The key used to identify the key-value that was modified. - /// The label, if any, used to identify the key-value that was modified. - /// The etag representing the new state of the key-value. - /// The sync token representing the server state after the event. - /// Keeps track of any properties unknown to the library. - internal AppConfigurationKeyValueModifiedEventData(string key, string label, string etag, string syncToken, IDictionary serializedAdditionalRawData) - { - Key = key; - Label = label; - Etag = etag; - SyncToken = syncToken; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The key used to identify the key-value that was modified. - public string Key { get; } - /// The label, if any, used to identify the key-value that was modified. - public string Label { get; } - /// The etag representing the new state of the key-value. - public string Etag { get; } - /// The sync token representing the server state after the event. - public string SyncToken { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotCreatedEventData.Serialization.cs deleted file mode 100644 index f5af7a38bbc8..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class AppConfigurationSnapshotCreatedEventData : 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(AppConfigurationSnapshotCreatedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AppConfigurationSnapshotCreatedEventData 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(AppConfigurationSnapshotCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAppConfigurationSnapshotCreatedEventData(document.RootElement, options); - } - - internal static AppConfigurationSnapshotCreatedEventData DeserializeAppConfigurationSnapshotCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - string etag = default; - string syncToken = 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("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - if (property.NameEquals("syncToken"u8)) - { - syncToken = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AppConfigurationSnapshotCreatedEventData(name, etag, syncToken, 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(AppConfigurationSnapshotCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - AppConfigurationSnapshotCreatedEventData 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 DeserializeAppConfigurationSnapshotCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AppConfigurationSnapshotCreatedEventData)} 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 AppConfigurationSnapshotCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAppConfigurationSnapshotCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotCreatedEventData.cs deleted file mode 100644 index 319beef466ce..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AppConfiguration.SnapshotCreated event. - public partial class AppConfigurationSnapshotCreatedEventData : AppConfigurationSnapshotEventData - { - /// Initializes a new instance of . - internal AppConfigurationSnapshotCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The name of the snapshot. - /// The etag representing the new state of the snapshot. - /// The sync token representing the server state after the event. - /// Keeps track of any properties unknown to the library. - internal AppConfigurationSnapshotCreatedEventData(string name, string etag, string syncToken, IDictionary serializedAdditionalRawData) : base(name, etag, syncToken, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotEventData.Serialization.cs deleted file mode 100644 index 540ed46bcbaf..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotEventData.Serialization.cs +++ /dev/null @@ -1,167 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AppConfigurationSnapshotEventData : 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(AppConfigurationSnapshotEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Etag)) - { - writer.WritePropertyName("etag"u8); - writer.WriteStringValue(Etag); - } - if (Optional.IsDefined(SyncToken)) - { - writer.WritePropertyName("syncToken"u8); - writer.WriteStringValue(SyncToken); - } - 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 - } - } - } - - AppConfigurationSnapshotEventData 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(AppConfigurationSnapshotEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAppConfigurationSnapshotEventData(document.RootElement, options); - } - - internal static AppConfigurationSnapshotEventData DeserializeAppConfigurationSnapshotEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - string etag = default; - string syncToken = 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("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - if (property.NameEquals("syncToken"u8)) - { - syncToken = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AppConfigurationSnapshotEventData(name, etag, syncToken, 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(AppConfigurationSnapshotEventData)} does not support writing '{options.Format}' format."); - } - } - - AppConfigurationSnapshotEventData 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 DeserializeAppConfigurationSnapshotEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AppConfigurationSnapshotEventData)} 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 AppConfigurationSnapshotEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAppConfigurationSnapshotEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotEventData.cs deleted file mode 100644 index a64d0e66a4fc..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of snapshot events. - public partial class AppConfigurationSnapshotEventData - { - /// - /// 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 . - internal AppConfigurationSnapshotEventData() - { - } - - /// Initializes a new instance of . - /// The name of the snapshot. - /// The etag representing the new state of the snapshot. - /// The sync token representing the server state after the event. - /// Keeps track of any properties unknown to the library. - internal AppConfigurationSnapshotEventData(string name, string etag, string syncToken, IDictionary serializedAdditionalRawData) - { - Name = name; - Etag = etag; - SyncToken = syncToken; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The name of the snapshot. - public string Name { get; } - /// The etag representing the new state of the snapshot. - public string Etag { get; } - /// The sync token representing the server state after the event. - public string SyncToken { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotModifiedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotModifiedEventData.Serialization.cs deleted file mode 100644 index c787e6e2197c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotModifiedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class AppConfigurationSnapshotModifiedEventData : 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(AppConfigurationSnapshotModifiedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AppConfigurationSnapshotModifiedEventData 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(AppConfigurationSnapshotModifiedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAppConfigurationSnapshotModifiedEventData(document.RootElement, options); - } - - internal static AppConfigurationSnapshotModifiedEventData DeserializeAppConfigurationSnapshotModifiedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - string etag = default; - string syncToken = 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("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - if (property.NameEquals("syncToken"u8)) - { - syncToken = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AppConfigurationSnapshotModifiedEventData(name, etag, syncToken, 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(AppConfigurationSnapshotModifiedEventData)} does not support writing '{options.Format}' format."); - } - } - - AppConfigurationSnapshotModifiedEventData 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 DeserializeAppConfigurationSnapshotModifiedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AppConfigurationSnapshotModifiedEventData)} 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 AppConfigurationSnapshotModifiedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAppConfigurationSnapshotModifiedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotModifiedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotModifiedEventData.cs deleted file mode 100644 index cd89dfdb11d1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppConfigurationSnapshotModifiedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AppConfiguration.SnapshotModified event. - public partial class AppConfigurationSnapshotModifiedEventData : AppConfigurationSnapshotEventData - { - /// Initializes a new instance of . - internal AppConfigurationSnapshotModifiedEventData() - { - } - - /// Initializes a new instance of . - /// The name of the snapshot. - /// The etag representing the new state of the snapshot. - /// The sync token representing the server state after the event. - /// Keeps track of any properties unknown to the library. - internal AppConfigurationSnapshotModifiedEventData(string name, string etag, string syncToken, IDictionary serializedAdditionalRawData) : base(name, etag, syncToken, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppEventTypeDetail.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppEventTypeDetail.Serialization.cs deleted file mode 100644 index fb9093c7757e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppEventTypeDetail.Serialization.cs +++ /dev/null @@ -1,142 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AppEventTypeDetail : 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(AppEventTypeDetail)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("action"u8); - writer.WriteStringValue(Action.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AppEventTypeDetail 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(AppEventTypeDetail)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAppEventTypeDetail(document.RootElement, options); - } - - internal static AppEventTypeDetail DeserializeAppEventTypeDetail(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppAction action = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("action"u8)) - { - action = new AppAction(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AppEventTypeDetail(action, 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(AppEventTypeDetail)} does not support writing '{options.Format}' format."); - } - } - - AppEventTypeDetail 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 DeserializeAppEventTypeDetail(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AppEventTypeDetail)} 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 AppEventTypeDetail FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAppEventTypeDetail(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppEventTypeDetail.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppEventTypeDetail.cs deleted file mode 100644 index 43550772de8f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppEventTypeDetail.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Detail of action on the app. - public partial class AppEventTypeDetail - { - /// - /// 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 . - /// Type of action of the operation. - internal AppEventTypeDetail(AppAction action) - { - Action = action; - } - - /// Initializes a new instance of . - /// Type of action of the operation. - /// Keeps track of any properties unknown to the library. - internal AppEventTypeDetail(AppAction action, IDictionary serializedAdditionalRawData) - { - Action = action; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AppEventTypeDetail() - { - } - - /// Type of action of the operation. - public AppAction Action { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppServicePlanAction.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppServicePlanAction.cs deleted file mode 100644 index 50794cff196b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppServicePlanAction.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.Messaging.EventGrid.SystemEvents -{ - /// Type of action on the app service plan. - public readonly partial struct AppServicePlanAction : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AppServicePlanAction(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string UpdatedValue = "Updated"; - - /// App Service plan is being updated. - public static AppServicePlanAction Updated { get; } = new AppServicePlanAction(UpdatedValue); - /// Determines if two values are the same. - public static bool operator ==(AppServicePlanAction left, AppServicePlanAction right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AppServicePlanAction left, AppServicePlanAction right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AppServicePlanAction(string value) => new AppServicePlanAction(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AppServicePlanAction other && Equals(other); - /// - public bool Equals(AppServicePlanAction 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppServicePlanEventTypeDetail.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppServicePlanEventTypeDetail.Serialization.cs deleted file mode 100644 index af722568a779..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppServicePlanEventTypeDetail.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.Messaging.EventGrid.SystemEvents -{ - public partial class AppServicePlanEventTypeDetail : 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(AppServicePlanEventTypeDetail)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("stampKind"u8); - writer.WriteStringValue(StampKind.ToString()); - writer.WritePropertyName("action"u8); - writer.WriteStringValue(Action.ToString()); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AppServicePlanEventTypeDetail 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(AppServicePlanEventTypeDetail)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAppServicePlanEventTypeDetail(document.RootElement, options); - } - - internal static AppServicePlanEventTypeDetail DeserializeAppServicePlanEventTypeDetail(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - StampKind stampKind = default; - AppServicePlanAction action = default; - AsyncStatus status = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("stampKind"u8)) - { - stampKind = new StampKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("action"u8)) - { - action = new AppServicePlanAction(property.Value.GetString()); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new AsyncStatus(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AppServicePlanEventTypeDetail(stampKind, action, status, 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(AppServicePlanEventTypeDetail)} does not support writing '{options.Format}' format."); - } - } - - AppServicePlanEventTypeDetail 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 DeserializeAppServicePlanEventTypeDetail(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AppServicePlanEventTypeDetail)} 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 AppServicePlanEventTypeDetail FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAppServicePlanEventTypeDetail(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppServicePlanEventTypeDetail.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppServicePlanEventTypeDetail.cs deleted file mode 100644 index f4c61633045b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AppServicePlanEventTypeDetail.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Detail of action on the app service plan. - public partial class AppServicePlanEventTypeDetail - { - /// - /// 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 . - /// Kind of environment where app service plan is. - /// Type of action on the app service plan. - /// Asynchronous operation status of the operation on the app service plan. - internal AppServicePlanEventTypeDetail(StampKind stampKind, AppServicePlanAction action, AsyncStatus status) - { - StampKind = stampKind; - Action = action; - Status = status; - } - - /// Initializes a new instance of . - /// Kind of environment where app service plan is. - /// Type of action on the app service plan. - /// Asynchronous operation status of the operation on the app service plan. - /// Keeps track of any properties unknown to the library. - internal AppServicePlanEventTypeDetail(StampKind stampKind, AppServicePlanAction action, AsyncStatus status, IDictionary serializedAdditionalRawData) - { - StampKind = stampKind; - Action = action; - Status = status; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AppServicePlanEventTypeDetail() - { - } - - /// Kind of environment where app service plan is. - public StampKind StampKind { get; } - /// Type of action on the app service plan. - public AppServicePlanAction Action { get; } - /// Asynchronous operation status of the operation on the app service plan. - public AsyncStatus Status { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AsyncStatus.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AsyncStatus.cs deleted file mode 100644 index bde75225c10a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AsyncStatus.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Asynchronous operation status of the operation on the app service plan. - public readonly partial struct AsyncStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AsyncStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string StartedValue = "Started"; - private const string CompletedValue = "Completed"; - private const string FailedValue = "Failed"; - - /// Async operation has started. - public static AsyncStatus Started { get; } = new AsyncStatus(StartedValue); - /// Async operation has completed. - public static AsyncStatus Completed { get; } = new AsyncStatus(CompletedValue); - /// Async operation failed to complete. - public static AsyncStatus Failed { get; } = new AsyncStatus(FailedValue); - /// Determines if two values are the same. - public static bool operator ==(AsyncStatus left, AsyncStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AsyncStatus left, AsyncStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AsyncStatus(string value) => new AsyncStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AsyncStatus other && Equals(other); - /// - public bool Equals(AsyncStatus 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterCreatedEventData.Serialization.cs deleted file mode 100644 index 55b8f25b0e9e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterCreatedEventData.Serialization.cs +++ /dev/null @@ -1,171 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsClusterCreatedEventData : 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(AvsClusterCreatedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AvsClusterCreatedEventData 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(AvsClusterCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsClusterCreatedEventData(document.RootElement, options); - } - - internal static AvsClusterCreatedEventData DeserializeAvsClusterCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - IReadOnlyList addedHostNames = default; - IReadOnlyList removedHostNames = default; - IReadOnlyList inMaintenanceHostNames = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("addedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - addedHostNames = array; - continue; - } - if (property.NameEquals("removedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - removedHostNames = array; - continue; - } - if (property.NameEquals("inMaintenanceHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - inMaintenanceHostNames = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsClusterCreatedEventData(operationId, addedHostNames ?? new ChangeTrackingList(), removedHostNames ?? new ChangeTrackingList(), inMaintenanceHostNames ?? 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(AvsClusterCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsClusterCreatedEventData 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 DeserializeAvsClusterCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsClusterCreatedEventData)} 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 AvsClusterCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsClusterCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterCreatedEventData.cs deleted file mode 100644 index 46bc8cc4d87a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterCreatedEventData.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterCreated event. - public partial class AvsClusterCreatedEventData : AvsClusterEventData - { - /// Initializes a new instance of . - internal AvsClusterCreatedEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// Keeps track of any properties unknown to the library. - internal AvsClusterCreatedEventData(string operationId, IReadOnlyList addedHostNames, IReadOnlyList removedHostNames, IReadOnlyList inMaintenanceHostNames, IDictionary serializedAdditionalRawData) : base(operationId, addedHostNames, removedHostNames, inMaintenanceHostNames, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterDeletedEventData.Serialization.cs deleted file mode 100644 index 125230ad0867..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterDeletedEventData.Serialization.cs +++ /dev/null @@ -1,171 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsClusterDeletedEventData : 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(AvsClusterDeletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AvsClusterDeletedEventData 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(AvsClusterDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsClusterDeletedEventData(document.RootElement, options); - } - - internal static AvsClusterDeletedEventData DeserializeAvsClusterDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - IReadOnlyList addedHostNames = default; - IReadOnlyList removedHostNames = default; - IReadOnlyList inMaintenanceHostNames = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("addedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - addedHostNames = array; - continue; - } - if (property.NameEquals("removedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - removedHostNames = array; - continue; - } - if (property.NameEquals("inMaintenanceHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - inMaintenanceHostNames = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsClusterDeletedEventData(operationId, addedHostNames ?? new ChangeTrackingList(), removedHostNames ?? new ChangeTrackingList(), inMaintenanceHostNames ?? 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(AvsClusterDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsClusterDeletedEventData 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 DeserializeAvsClusterDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsClusterDeletedEventData)} 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 AvsClusterDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsClusterDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterDeletedEventData.cs deleted file mode 100644 index 9dc7f3790647..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterDeletedEventData.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterDeleted event. - public partial class AvsClusterDeletedEventData : AvsClusterEventData - { - /// Initializes a new instance of . - internal AvsClusterDeletedEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// Keeps track of any properties unknown to the library. - internal AvsClusterDeletedEventData(string operationId, IReadOnlyList addedHostNames, IReadOnlyList removedHostNames, IReadOnlyList inMaintenanceHostNames, IDictionary serializedAdditionalRawData) : base(operationId, addedHostNames, removedHostNames, inMaintenanceHostNames, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterEventData.Serialization.cs deleted file mode 100644 index 3b0b93de6011..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterEventData.Serialization.cs +++ /dev/null @@ -1,220 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsClusterEventData : 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(AvsClusterEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(OperationId)) - { - writer.WritePropertyName("operationId"u8); - writer.WriteStringValue(OperationId); - } - if (Optional.IsCollectionDefined(AddedHostNames)) - { - writer.WritePropertyName("addedHostNames"u8); - writer.WriteStartArray(); - foreach (var item in AddedHostNames) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(RemovedHostNames)) - { - writer.WritePropertyName("removedHostNames"u8); - writer.WriteStartArray(); - foreach (var item in RemovedHostNames) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(InMaintenanceHostNames)) - { - writer.WritePropertyName("inMaintenanceHostNames"u8); - writer.WriteStartArray(); - foreach (var item in InMaintenanceHostNames) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AvsClusterEventData 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(AvsClusterEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsClusterEventData(document.RootElement, options); - } - - internal static AvsClusterEventData DeserializeAvsClusterEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - IReadOnlyList addedHostNames = default; - IReadOnlyList removedHostNames = default; - IReadOnlyList inMaintenanceHostNames = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("addedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - addedHostNames = array; - continue; - } - if (property.NameEquals("removedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - removedHostNames = array; - continue; - } - if (property.NameEquals("inMaintenanceHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - inMaintenanceHostNames = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsClusterEventData(operationId, addedHostNames ?? new ChangeTrackingList(), removedHostNames ?? new ChangeTrackingList(), inMaintenanceHostNames ?? 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(AvsClusterEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsClusterEventData 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 DeserializeAvsClusterEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsClusterEventData)} 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 AvsClusterEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsClusterEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterEventData.cs deleted file mode 100644 index 4eef16191dbf..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for Microsoft.AVS/clusters events. - public partial class AvsClusterEventData - { - /// - /// 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 . - internal AvsClusterEventData() - { - AddedHostNames = new ChangeTrackingList(); - RemovedHostNames = new ChangeTrackingList(); - InMaintenanceHostNames = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// Keeps track of any properties unknown to the library. - internal AvsClusterEventData(string operationId, IReadOnlyList addedHostNames, IReadOnlyList removedHostNames, IReadOnlyList inMaintenanceHostNames, IDictionary serializedAdditionalRawData) - { - OperationId = operationId; - AddedHostNames = addedHostNames; - RemovedHostNames = removedHostNames; - InMaintenanceHostNames = inMaintenanceHostNames; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Id of the operation that caused this event. - public string OperationId { get; } - /// Hosts added to the cluster in this event, if any. - public IReadOnlyList AddedHostNames { get; } - /// Hosts removed from the cluster in this event, if any. - public IReadOnlyList RemovedHostNames { get; } - /// Hosts in Maintenance mode in the cluster, if any. - public IReadOnlyList InMaintenanceHostNames { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterFailedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterFailedEventData.Serialization.cs deleted file mode 100644 index 9baf71ab8d87..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterFailedEventData.Serialization.cs +++ /dev/null @@ -1,188 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsClusterFailedEventData : 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(AvsClusterFailedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(FailureMessage)) - { - writer.WritePropertyName("failureMessage"u8); - writer.WriteStringValue(FailureMessage); - } - } - - AvsClusterFailedEventData 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(AvsClusterFailedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsClusterFailedEventData(document.RootElement, options); - } - - internal static AvsClusterFailedEventData DeserializeAvsClusterFailedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string failureMessage = default; - string operationId = default; - IReadOnlyList addedHostNames = default; - IReadOnlyList removedHostNames = default; - IReadOnlyList inMaintenanceHostNames = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("failureMessage"u8)) - { - failureMessage = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("addedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - addedHostNames = array; - continue; - } - if (property.NameEquals("removedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - removedHostNames = array; - continue; - } - if (property.NameEquals("inMaintenanceHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - inMaintenanceHostNames = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsClusterFailedEventData( - operationId, - addedHostNames ?? new ChangeTrackingList(), - removedHostNames ?? new ChangeTrackingList(), - inMaintenanceHostNames ?? new ChangeTrackingList(), - serializedAdditionalRawData, - failureMessage); - } - - 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(AvsClusterFailedEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsClusterFailedEventData 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 DeserializeAvsClusterFailedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsClusterFailedEventData)} 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 AvsClusterFailedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsClusterFailedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterFailedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterFailedEventData.cs deleted file mode 100644 index 35f0e1353db6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterFailedEventData.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterFailed event. - public partial class AvsClusterFailedEventData : AvsClusterEventData - { - /// Initializes a new instance of . - internal AvsClusterFailedEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// Keeps track of any properties unknown to the library. - /// Failure reason of an event. - internal AvsClusterFailedEventData(string operationId, IReadOnlyList addedHostNames, IReadOnlyList removedHostNames, IReadOnlyList inMaintenanceHostNames, IDictionary serializedAdditionalRawData, string failureMessage) : base(operationId, addedHostNames, removedHostNames, inMaintenanceHostNames, serializedAdditionalRawData) - { - FailureMessage = failureMessage; - } - - /// Failure reason of an event. - public string FailureMessage { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatedEventData.Serialization.cs deleted file mode 100644 index 5d6c2758eaab..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatedEventData.Serialization.cs +++ /dev/null @@ -1,171 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsClusterUpdatedEventData : 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(AvsClusterUpdatedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AvsClusterUpdatedEventData 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(AvsClusterUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsClusterUpdatedEventData(document.RootElement, options); - } - - internal static AvsClusterUpdatedEventData DeserializeAvsClusterUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - IReadOnlyList addedHostNames = default; - IReadOnlyList removedHostNames = default; - IReadOnlyList inMaintenanceHostNames = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("addedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - addedHostNames = array; - continue; - } - if (property.NameEquals("removedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - removedHostNames = array; - continue; - } - if (property.NameEquals("inMaintenanceHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - inMaintenanceHostNames = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsClusterUpdatedEventData(operationId, addedHostNames ?? new ChangeTrackingList(), removedHostNames ?? new ChangeTrackingList(), inMaintenanceHostNames ?? 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(AvsClusterUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsClusterUpdatedEventData 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 DeserializeAvsClusterUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsClusterUpdatedEventData)} 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 AvsClusterUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsClusterUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatedEventData.cs deleted file mode 100644 index 7ec6e28e0484..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatedEventData.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterUpdated event. - public partial class AvsClusterUpdatedEventData : AvsClusterEventData - { - /// Initializes a new instance of . - internal AvsClusterUpdatedEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// Keeps track of any properties unknown to the library. - internal AvsClusterUpdatedEventData(string operationId, IReadOnlyList addedHostNames, IReadOnlyList removedHostNames, IReadOnlyList inMaintenanceHostNames, IDictionary serializedAdditionalRawData) : base(operationId, addedHostNames, removedHostNames, inMaintenanceHostNames, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatingEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatingEventData.Serialization.cs deleted file mode 100644 index abe83f07c523..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatingEventData.Serialization.cs +++ /dev/null @@ -1,171 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsClusterUpdatingEventData : 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(AvsClusterUpdatingEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AvsClusterUpdatingEventData 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(AvsClusterUpdatingEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsClusterUpdatingEventData(document.RootElement, options); - } - - internal static AvsClusterUpdatingEventData DeserializeAvsClusterUpdatingEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - IReadOnlyList addedHostNames = default; - IReadOnlyList removedHostNames = default; - IReadOnlyList inMaintenanceHostNames = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("addedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - addedHostNames = array; - continue; - } - if (property.NameEquals("removedHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - removedHostNames = array; - continue; - } - if (property.NameEquals("inMaintenanceHostNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - inMaintenanceHostNames = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsClusterUpdatingEventData(operationId, addedHostNames ?? new ChangeTrackingList(), removedHostNames ?? new ChangeTrackingList(), inMaintenanceHostNames ?? 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(AvsClusterUpdatingEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsClusterUpdatingEventData 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 DeserializeAvsClusterUpdatingEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsClusterUpdatingEventData)} 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 AvsClusterUpdatingEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsClusterUpdatingEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatingEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatingEventData.cs deleted file mode 100644 index 92b2529146e6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsClusterUpdatingEventData.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterUpdating event. - public partial class AvsClusterUpdatingEventData : AvsClusterEventData - { - /// Initializes a new instance of . - internal AvsClusterUpdatingEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// Keeps track of any properties unknown to the library. - internal AvsClusterUpdatingEventData(string operationId, IReadOnlyList addedHostNames, IReadOnlyList removedHostNames, IReadOnlyList inMaintenanceHostNames, IDictionary serializedAdditionalRawData) : base(operationId, addedHostNames, removedHostNames, inMaintenanceHostNames, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudEventData.Serialization.cs deleted file mode 100644 index 2e7a26a87921..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsPrivateCloudEventData : 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(AvsPrivateCloudEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(OperationId)) - { - writer.WritePropertyName("operationId"u8); - writer.WriteStringValue(OperationId); - } - 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 - } - } - } - - AvsPrivateCloudEventData 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(AvsPrivateCloudEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudEventData(document.RootElement, options); - } - - internal static AvsPrivateCloudEventData DeserializeAvsPrivateCloudEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudEventData(operationId, 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(AvsPrivateCloudEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsPrivateCloudEventData 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 DeserializeAvsPrivateCloudEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudEventData)} 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 AvsPrivateCloudEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsPrivateCloudEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudEventData.cs deleted file mode 100644 index 391917dfb4a6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for Microsoft.AVS/privateClouds events. - public partial class AvsPrivateCloudEventData - { - /// - /// 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 . - internal AvsPrivateCloudEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudEventData(string operationId, IDictionary serializedAdditionalRawData) - { - OperationId = operationId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Id of the operation that caused this event. - public string OperationId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudFailedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudFailedEventData.Serialization.cs deleted file mode 100644 index a958fc84ad61..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudFailedEventData.Serialization.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.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - public partial class AvsPrivateCloudFailedEventData : 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(AvsPrivateCloudFailedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(FailureMessage)) - { - writer.WritePropertyName("failureMessage"u8); - writer.WriteStringValue(FailureMessage); - } - } - - AvsPrivateCloudFailedEventData 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(AvsPrivateCloudFailedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudFailedEventData(document.RootElement, options); - } - - internal static AvsPrivateCloudFailedEventData DeserializeAvsPrivateCloudFailedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string failureMessage = default; - string operationId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("failureMessage"u8)) - { - failureMessage = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudFailedEventData(operationId, serializedAdditionalRawData, failureMessage); - } - - 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(AvsPrivateCloudFailedEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsPrivateCloudFailedEventData 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 DeserializeAvsPrivateCloudFailedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudFailedEventData)} 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 AvsPrivateCloudFailedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsPrivateCloudFailedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudFailedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudFailedEventData.cs deleted file mode 100644 index 58e2c3216b39..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudFailedEventData.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.PrivateCloudFailed event. - public partial class AvsPrivateCloudFailedEventData : AvsPrivateCloudEventData - { - /// Initializes a new instance of . - internal AvsPrivateCloudFailedEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Keeps track of any properties unknown to the library. - /// Failure reason of an event. - internal AvsPrivateCloudFailedEventData(string operationId, IDictionary serializedAdditionalRawData, string failureMessage) : base(operationId, serializedAdditionalRawData) - { - FailureMessage = failureMessage; - } - - /// Failure reason of an event. - public string FailureMessage { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatedEventData.Serialization.cs deleted file mode 100644 index aaee57b3c3ab..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsPrivateCloudUpdatedEventData : 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(AvsPrivateCloudUpdatedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AvsPrivateCloudUpdatedEventData 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(AvsPrivateCloudUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudUpdatedEventData(document.RootElement, options); - } - - internal static AvsPrivateCloudUpdatedEventData DeserializeAvsPrivateCloudUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudUpdatedEventData(operationId, 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(AvsPrivateCloudUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsPrivateCloudUpdatedEventData 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 DeserializeAvsPrivateCloudUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudUpdatedEventData)} 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 AvsPrivateCloudUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsPrivateCloudUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatedEventData.cs deleted file mode 100644 index 523ad0039dad..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.PrivateCloudUpdated event. - public partial class AvsPrivateCloudUpdatedEventData : AvsPrivateCloudEventData - { - /// Initializes a new instance of . - internal AvsPrivateCloudUpdatedEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudUpdatedEventData(string operationId, IDictionary serializedAdditionalRawData) : base(operationId, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatingEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatingEventData.Serialization.cs deleted file mode 100644 index e1f205446223..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatingEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsPrivateCloudUpdatingEventData : 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(AvsPrivateCloudUpdatingEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AvsPrivateCloudUpdatingEventData 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(AvsPrivateCloudUpdatingEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudUpdatingEventData(document.RootElement, options); - } - - internal static AvsPrivateCloudUpdatingEventData DeserializeAvsPrivateCloudUpdatingEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudUpdatingEventData(operationId, 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(AvsPrivateCloudUpdatingEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsPrivateCloudUpdatingEventData 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 DeserializeAvsPrivateCloudUpdatingEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudUpdatingEventData)} 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 AvsPrivateCloudUpdatingEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsPrivateCloudUpdatingEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatingEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatingEventData.cs deleted file mode 100644 index d3bd82ababd3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsPrivateCloudUpdatingEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.PrivateCloudUpdating event. - public partial class AvsPrivateCloudUpdatingEventData : AvsPrivateCloudEventData - { - /// Initializes a new instance of . - internal AvsPrivateCloudUpdatingEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudUpdatingEventData(string operationId, IDictionary serializedAdditionalRawData) : base(operationId, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionCancelledEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionCancelledEventData.Serialization.cs deleted file mode 100644 index ad1156bb8117..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionCancelledEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsScriptExecutionCancelledEventData : 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(AvsScriptExecutionCancelledEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AvsScriptExecutionCancelledEventData 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(AvsScriptExecutionCancelledEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsScriptExecutionCancelledEventData(document.RootElement, options); - } - - internal static AvsScriptExecutionCancelledEventData DeserializeAvsScriptExecutionCancelledEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - string cmdletId = default; - IReadOnlyList output = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("cmdletId"u8)) - { - cmdletId = property.Value.GetString(); - continue; - } - if (property.NameEquals("output"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - output = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsScriptExecutionCancelledEventData(operationId, cmdletId, output ?? 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(AvsScriptExecutionCancelledEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsScriptExecutionCancelledEventData 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 DeserializeAvsScriptExecutionCancelledEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsScriptExecutionCancelledEventData)} 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 AvsScriptExecutionCancelledEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsScriptExecutionCancelledEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionCancelledEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionCancelledEventData.cs deleted file mode 100644 index 0116ef430dee..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionCancelledEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ScriptExecutionCancelled event. - public partial class AvsScriptExecutionCancelledEventData : AvsScriptExecutionEventData - { - /// Initializes a new instance of . - internal AvsScriptExecutionCancelledEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Cmdlet referenced in the execution that caused this event. - /// Stdout outputs from the execution, if any. - /// Keeps track of any properties unknown to the library. - internal AvsScriptExecutionCancelledEventData(string operationId, string cmdletId, IReadOnlyList output, IDictionary serializedAdditionalRawData) : base(operationId, cmdletId, output, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionEventData.Serialization.cs deleted file mode 100644 index c22765b20104..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionEventData.Serialization.cs +++ /dev/null @@ -1,181 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsScriptExecutionEventData : 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(AvsScriptExecutionEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(OperationId)) - { - writer.WritePropertyName("operationId"u8); - writer.WriteStringValue(OperationId); - } - if (Optional.IsDefined(CmdletId)) - { - writer.WritePropertyName("cmdletId"u8); - writer.WriteStringValue(CmdletId); - } - if (Optional.IsCollectionDefined(Output)) - { - writer.WritePropertyName("output"u8); - writer.WriteStartArray(); - foreach (var item in Output) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AvsScriptExecutionEventData 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(AvsScriptExecutionEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsScriptExecutionEventData(document.RootElement, options); - } - - internal static AvsScriptExecutionEventData DeserializeAvsScriptExecutionEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - string cmdletId = default; - IReadOnlyList output = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("cmdletId"u8)) - { - cmdletId = property.Value.GetString(); - continue; - } - if (property.NameEquals("output"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - output = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsScriptExecutionEventData(operationId, cmdletId, output ?? 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(AvsScriptExecutionEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsScriptExecutionEventData 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 DeserializeAvsScriptExecutionEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsScriptExecutionEventData)} 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 AvsScriptExecutionEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsScriptExecutionEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionEventData.cs deleted file mode 100644 index d21ddf7920bf..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionEventData.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for Microsoft.AVS/scriptExecutions events. - public partial class AvsScriptExecutionEventData - { - /// - /// 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 . - internal AvsScriptExecutionEventData() - { - Output = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Cmdlet referenced in the execution that caused this event. - /// Stdout outputs from the execution, if any. - /// Keeps track of any properties unknown to the library. - internal AvsScriptExecutionEventData(string operationId, string cmdletId, IReadOnlyList output, IDictionary serializedAdditionalRawData) - { - OperationId = operationId; - CmdletId = cmdletId; - Output = output; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Id of the operation that caused this event. - public string OperationId { get; } - /// Cmdlet referenced in the execution that caused this event. - public string CmdletId { get; } - /// Stdout outputs from the execution, if any. - public IReadOnlyList Output { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFailedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFailedEventData.Serialization.cs deleted file mode 100644 index 69310ee24c2b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFailedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsScriptExecutionFailedEventData : 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(AvsScriptExecutionFailedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(FailureMessage)) - { - writer.WritePropertyName("failureMessage"u8); - writer.WriteStringValue(FailureMessage); - } - } - - AvsScriptExecutionFailedEventData 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(AvsScriptExecutionFailedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsScriptExecutionFailedEventData(document.RootElement, options); - } - - internal static AvsScriptExecutionFailedEventData DeserializeAvsScriptExecutionFailedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string failureMessage = default; - string operationId = default; - string cmdletId = default; - IReadOnlyList output = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("failureMessage"u8)) - { - failureMessage = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("cmdletId"u8)) - { - cmdletId = property.Value.GetString(); - continue; - } - if (property.NameEquals("output"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - output = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsScriptExecutionFailedEventData(operationId, cmdletId, output ?? new ChangeTrackingList(), serializedAdditionalRawData, failureMessage); - } - - 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(AvsScriptExecutionFailedEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsScriptExecutionFailedEventData 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 DeserializeAvsScriptExecutionFailedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsScriptExecutionFailedEventData)} 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 AvsScriptExecutionFailedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsScriptExecutionFailedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFailedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFailedEventData.cs deleted file mode 100644 index e5a135482869..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFailedEventData.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ScriptExecutionFailed event. - public partial class AvsScriptExecutionFailedEventData : AvsScriptExecutionEventData - { - /// Initializes a new instance of . - internal AvsScriptExecutionFailedEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Cmdlet referenced in the execution that caused this event. - /// Stdout outputs from the execution, if any. - /// Keeps track of any properties unknown to the library. - /// Failure reason of an event. - internal AvsScriptExecutionFailedEventData(string operationId, string cmdletId, IReadOnlyList output, IDictionary serializedAdditionalRawData, string failureMessage) : base(operationId, cmdletId, output, serializedAdditionalRawData) - { - FailureMessage = failureMessage; - } - - /// Failure reason of an event. - public string FailureMessage { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFinishedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFinishedEventData.Serialization.cs deleted file mode 100644 index 6556b3dd64fb..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFinishedEventData.Serialization.cs +++ /dev/null @@ -1,166 +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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsScriptExecutionFinishedEventData : 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(AvsScriptExecutionFinishedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("namedOutputs"u8); - writer.WriteStartObject(); - foreach (var item in NamedOutputs) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - AvsScriptExecutionFinishedEventData 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(AvsScriptExecutionFinishedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsScriptExecutionFinishedEventData(document.RootElement, options); - } - - internal static AvsScriptExecutionFinishedEventData DeserializeAvsScriptExecutionFinishedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary namedOutputs = default; - string operationId = default; - string cmdletId = default; - IReadOnlyList output = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("namedOutputs"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - namedOutputs = dictionary; - continue; - } - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("cmdletId"u8)) - { - cmdletId = property.Value.GetString(); - continue; - } - if (property.NameEquals("output"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - output = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsScriptExecutionFinishedEventData(operationId, cmdletId, output ?? new ChangeTrackingList(), serializedAdditionalRawData, namedOutputs); - } - - 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(AvsScriptExecutionFinishedEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsScriptExecutionFinishedEventData 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 DeserializeAvsScriptExecutionFinishedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsScriptExecutionFinishedEventData)} 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 AvsScriptExecutionFinishedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsScriptExecutionFinishedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFinishedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFinishedEventData.cs deleted file mode 100644 index 84f2fd9fd36a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionFinishedEventData.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ScriptExecutionFinished event. - public partial class AvsScriptExecutionFinishedEventData : AvsScriptExecutionEventData - { - /// Initializes a new instance of . - /// Named outputs of completed execution, if any. - /// is null. - internal AvsScriptExecutionFinishedEventData(IReadOnlyDictionary namedOutputs) - { - Argument.AssertNotNull(namedOutputs, nameof(namedOutputs)); - - NamedOutputs = namedOutputs; - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Cmdlet referenced in the execution that caused this event. - /// Stdout outputs from the execution, if any. - /// Keeps track of any properties unknown to the library. - /// Named outputs of completed execution, if any. - internal AvsScriptExecutionFinishedEventData(string operationId, string cmdletId, IReadOnlyList output, IDictionary serializedAdditionalRawData, IReadOnlyDictionary namedOutputs) : base(operationId, cmdletId, output, serializedAdditionalRawData) - { - NamedOutputs = namedOutputs; - } - - /// Initializes a new instance of for deserialization. - internal AvsScriptExecutionFinishedEventData() - { - } - - /// Named outputs of completed execution, if any. - public IReadOnlyDictionary NamedOutputs { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionStartedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionStartedEventData.Serialization.cs deleted file mode 100644 index 314ff99da136..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionStartedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class AvsScriptExecutionStartedEventData : 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(AvsScriptExecutionStartedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - AvsScriptExecutionStartedEventData 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(AvsScriptExecutionStartedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsScriptExecutionStartedEventData(document.RootElement, options); - } - - internal static AvsScriptExecutionStartedEventData DeserializeAvsScriptExecutionStartedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - string cmdletId = default; - IReadOnlyList output = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("cmdletId"u8)) - { - cmdletId = property.Value.GetString(); - continue; - } - if (property.NameEquals("output"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - output = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsScriptExecutionStartedEventData(operationId, cmdletId, output ?? 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(AvsScriptExecutionStartedEventData)} does not support writing '{options.Format}' format."); - } - } - - AvsScriptExecutionStartedEventData 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 DeserializeAvsScriptExecutionStartedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsScriptExecutionStartedEventData)} 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 AvsScriptExecutionStartedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAvsScriptExecutionStartedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionStartedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionStartedEventData.cs deleted file mode 100644 index 08424798e522..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/AvsScriptExecutionStartedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ScriptExecutionStarted event. - public partial class AvsScriptExecutionStartedEventData : AvsScriptExecutionEventData - { - /// Initializes a new instance of . - internal AvsScriptExecutionStartedEventData() - { - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Cmdlet referenced in the execution that caused this event. - /// Stdout outputs from the execution, if any. - /// Keeps track of any properties unknown to the library. - internal AvsScriptExecutionStartedEventData(string operationId, string cmdletId, IReadOnlyList output, IDictionary serializedAdditionalRawData) : base(operationId, cmdletId, output, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationCloudEnvironmentModel.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationCloudEnvironmentModel.cs deleted file mode 100644 index 5bbdda0f5e33..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationCloudEnvironmentModel.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Communication cloud environment model. - public readonly partial struct CommunicationCloudEnvironmentModel : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public CommunicationCloudEnvironmentModel(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PublicValue = "public"; - private const string DodValue = "dod"; - private const string GcchValue = "gcch"; - - /// Public. - public static CommunicationCloudEnvironmentModel Public { get; } = new CommunicationCloudEnvironmentModel(PublicValue); - /// Dod. - public static CommunicationCloudEnvironmentModel Dod { get; } = new CommunicationCloudEnvironmentModel(DodValue); - /// Gcch. - public static CommunicationCloudEnvironmentModel Gcch { get; } = new CommunicationCloudEnvironmentModel(GcchValue); - /// Determines if two values are the same. - public static bool operator ==(CommunicationCloudEnvironmentModel left, CommunicationCloudEnvironmentModel right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(CommunicationCloudEnvironmentModel left, CommunicationCloudEnvironmentModel right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator CommunicationCloudEnvironmentModel(string value) => new CommunicationCloudEnvironmentModel(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is CommunicationCloudEnvironmentModel other && Equals(other); - /// - public bool Equals(CommunicationCloudEnvironmentModel 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationIdentifierModel.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationIdentifierModel.Serialization.cs deleted file mode 100644 index cc557dfeed21..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationIdentifierModel.Serialization.cs +++ /dev/null @@ -1,192 +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.Messaging.EventGrid.SystemEvents -{ - public partial class CommunicationIdentifierModel : 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(CommunicationIdentifierModel)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(RawId)) - { - writer.WritePropertyName("rawId"u8); - writer.WriteStringValue(RawId); - } - writer.WritePropertyName("communicationUser"u8); - writer.WriteObjectValue(CommunicationUser, options); - writer.WritePropertyName("phoneNumber"u8); - writer.WriteObjectValue(PhoneNumber, options); - writer.WritePropertyName("microsoftTeamsUser"u8); - writer.WriteObjectValue(MicrosoftTeamsUser, options); - writer.WritePropertyName("microsoftTeamsApp"u8); - writer.WriteObjectValue(MicrosoftTeamsApp, 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 - } - } - } - - CommunicationIdentifierModel 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(CommunicationIdentifierModel)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCommunicationIdentifierModel(document.RootElement, options); - } - - internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierModel(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationIdentifierModelKind kind = default; - string rawId = default; - CommunicationUserIdentifierModel communicationUser = default; - PhoneNumberIdentifierModel phoneNumber = default; - MicrosoftTeamsUserIdentifierModel microsoftTeamsUser = default; - MicrosoftTeamsAppIdentifierModel microsoftTeamsApp = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kind"u8)) - { - kind = new CommunicationIdentifierModelKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("rawId"u8)) - { - rawId = property.Value.GetString(); - continue; - } - if (property.NameEquals("communicationUser"u8)) - { - communicationUser = CommunicationUserIdentifierModel.DeserializeCommunicationUserIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("phoneNumber"u8)) - { - phoneNumber = PhoneNumberIdentifierModel.DeserializePhoneNumberIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("microsoftTeamsUser"u8)) - { - microsoftTeamsUser = MicrosoftTeamsUserIdentifierModel.DeserializeMicrosoftTeamsUserIdentifierModel(property.Value, options); - continue; - } - if (property.NameEquals("microsoftTeamsApp"u8)) - { - microsoftTeamsApp = MicrosoftTeamsAppIdentifierModel.DeserializeMicrosoftTeamsAppIdentifierModel(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CommunicationIdentifierModel( - kind, - rawId, - communicationUser, - phoneNumber, - microsoftTeamsUser, - microsoftTeamsApp, - 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(CommunicationIdentifierModel)} does not support writing '{options.Format}' format."); - } - } - - CommunicationIdentifierModel 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 DeserializeCommunicationIdentifierModel(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CommunicationIdentifierModel)} 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 CommunicationIdentifierModel FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCommunicationIdentifierModel(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationIdentifierModel.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationIdentifierModel.cs deleted file mode 100644 index 391730bf3a99..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationIdentifierModel.cs +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. - public partial class CommunicationIdentifierModel - { - /// - /// 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 kind. Only required in responses. - /// The communication user. - /// The phone number. - /// The Microsoft Teams user. - /// The Microsoft Teams application. - /// , , or is null. - internal CommunicationIdentifierModel(CommunicationIdentifierModelKind kind, CommunicationUserIdentifierModel communicationUser, PhoneNumberIdentifierModel phoneNumber, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser, MicrosoftTeamsAppIdentifierModel microsoftTeamsApp) - { - Argument.AssertNotNull(communicationUser, nameof(communicationUser)); - Argument.AssertNotNull(phoneNumber, nameof(phoneNumber)); - Argument.AssertNotNull(microsoftTeamsUser, nameof(microsoftTeamsUser)); - Argument.AssertNotNull(microsoftTeamsApp, nameof(microsoftTeamsApp)); - - Kind = kind; - CommunicationUser = communicationUser; - PhoneNumber = phoneNumber; - MicrosoftTeamsUser = microsoftTeamsUser; - MicrosoftTeamsApp = microsoftTeamsApp; - } - - /// Initializes a new instance of . - /// The identifier kind. Only required in responses. - /// Raw Id of the identifier. Optional in requests, required in responses. - /// The communication user. - /// The phone number. - /// The Microsoft Teams user. - /// The Microsoft Teams application. - /// Keeps track of any properties unknown to the library. - internal CommunicationIdentifierModel(CommunicationIdentifierModelKind kind, string rawId, CommunicationUserIdentifierModel communicationUser, PhoneNumberIdentifierModel phoneNumber, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser, MicrosoftTeamsAppIdentifierModel microsoftTeamsApp, IDictionary serializedAdditionalRawData) - { - Kind = kind; - RawId = rawId; - CommunicationUser = communicationUser; - PhoneNumber = phoneNumber; - MicrosoftTeamsUser = microsoftTeamsUser; - MicrosoftTeamsApp = microsoftTeamsApp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CommunicationIdentifierModel() - { - } - - /// The identifier kind. Only required in responses. - public CommunicationIdentifierModelKind Kind { get; } - /// Raw Id of the identifier. Optional in requests, required in responses. - public string RawId { get; } - /// The communication user. - public CommunicationUserIdentifierModel CommunicationUser { get; } - /// The phone number. - public PhoneNumberIdentifierModel PhoneNumber { get; } - /// The Microsoft Teams user. - public MicrosoftTeamsUserIdentifierModel MicrosoftTeamsUser { get; } - /// The Microsoft Teams application. - public MicrosoftTeamsAppIdentifierModel MicrosoftTeamsApp { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationIdentifierModelKind.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationIdentifierModelKind.cs deleted file mode 100644 index be2f34395213..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationIdentifierModelKind.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Communication model identifier kind. - public readonly partial struct CommunicationIdentifierModelKind : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public CommunicationIdentifierModelKind(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string UnknownValue = "unknown"; - private const string CommunicationUserValue = "communicationUser"; - private const string PhoneNumberValue = "phoneNumber"; - private const string MicrosoftTeamsUserValue = "microsoftTeamsUser"; - - /// Unknown. - public static CommunicationIdentifierModelKind Unknown { get; } = new CommunicationIdentifierModelKind(UnknownValue); - /// Communication User. - public static CommunicationIdentifierModelKind CommunicationUser { get; } = new CommunicationIdentifierModelKind(CommunicationUserValue); - /// Phone Number. - public static CommunicationIdentifierModelKind PhoneNumber { get; } = new CommunicationIdentifierModelKind(PhoneNumberValue); - /// Microsoft Teams User. - public static CommunicationIdentifierModelKind MicrosoftTeamsUser { get; } = new CommunicationIdentifierModelKind(MicrosoftTeamsUserValue); - /// Determines if two values are the same. - public static bool operator ==(CommunicationIdentifierModelKind left, CommunicationIdentifierModelKind right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(CommunicationIdentifierModelKind left, CommunicationIdentifierModelKind right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator CommunicationIdentifierModelKind(string value) => new CommunicationIdentifierModelKind(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is CommunicationIdentifierModelKind other && Equals(other); - /// - public bool Equals(CommunicationIdentifierModelKind 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationUserIdentifierModel.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationUserIdentifierModel.Serialization.cs deleted file mode 100644 index 782d8c253d17..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationUserIdentifierModel.Serialization.cs +++ /dev/null @@ -1,142 +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.Messaging.EventGrid.SystemEvents -{ - public partial class CommunicationUserIdentifierModel : 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(CommunicationUserIdentifierModel)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - 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 - } - } - } - - CommunicationUserIdentifierModel 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(CommunicationUserIdentifierModel)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCommunicationUserIdentifierModel(document.RootElement, options); - } - - internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIdentifierModel(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = 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 (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CommunicationUserIdentifierModel(id, 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(CommunicationUserIdentifierModel)} does not support writing '{options.Format}' format."); - } - } - - CommunicationUserIdentifierModel 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 DeserializeCommunicationUserIdentifierModel(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CommunicationUserIdentifierModel)} 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 CommunicationUserIdentifierModel FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCommunicationUserIdentifierModel(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationUserIdentifierModel.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationUserIdentifierModel.cs deleted file mode 100644 index 784344c1c5e2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/CommunicationUserIdentifierModel.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// A user that got created with an Azure Communication Services resource. - public partial class CommunicationUserIdentifierModel - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The Id of the communication user. - /// is null. - internal CommunicationUserIdentifierModel(string id) - { - Argument.AssertNotNull(id, nameof(id)); - - Id = id; - } - - /// Initializes a new instance of . - /// The Id of the communication user. - /// Keeps track of any properties unknown to the library. - internal CommunicationUserIdentifierModel(string id, IDictionary serializedAdditionalRawData) - { - Id = id; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CommunicationUserIdentifierModel() - { - } - - /// The Id of the communication user. - public string Id { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventData.Serialization.cs deleted file mode 100644 index 9c0c10f7ce8b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventData.Serialization.cs +++ /dev/null @@ -1,198 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryArtifactEventData : 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(ContainerRegistryArtifactEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(Action)) - { - writer.WritePropertyName("action"u8); - writer.WriteStringValue(Action); - } - if (Optional.IsDefined(Location)) - { - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - } - writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target, options); - writer.WritePropertyName("connectedRegistry"u8); - writer.WriteObjectValue(ConnectedRegistry, 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 - } - } - } - - ContainerRegistryArtifactEventData 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(ContainerRegistryArtifactEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryArtifactEventData(document.RootElement, options); - } - - internal static ContainerRegistryArtifactEventData DeserializeContainerRegistryArtifactEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - DateTimeOffset timestamp = default; - string action = default; - string location = default; - ContainerRegistryArtifactEventTarget target = default; - ContainerRegistryEventConnectedRegistry connectedRegistry = 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("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("action"u8)) - { - action = property.Value.GetString(); - continue; - } - if (property.NameEquals("location"u8)) - { - location = property.Value.GetString(); - continue; - } - if (property.NameEquals("target"u8)) - { - target = ContainerRegistryArtifactEventTarget.DeserializeContainerRegistryArtifactEventTarget(property.Value, options); - continue; - } - if (property.NameEquals("connectedRegistry"u8)) - { - connectedRegistry = ContainerRegistryEventConnectedRegistry.DeserializeContainerRegistryEventConnectedRegistry(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryArtifactEventData( - id, - timestamp, - action, - location, - target, - connectedRegistry, - 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(ContainerRegistryArtifactEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryArtifactEventData 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 DeserializeContainerRegistryArtifactEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryArtifactEventData)} 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 ContainerRegistryArtifactEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryArtifactEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventData.cs deleted file mode 100644 index 9fb1972e3d56..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventData.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// The content of the event request message. - public partial class ContainerRegistryArtifactEventData - { - /// - /// 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 time at which the event occurred. - /// The target of the event. - /// The connected registry information if the event is generated by a connected registry. - /// or is null. - internal ContainerRegistryArtifactEventData(DateTimeOffset timestamp, ContainerRegistryArtifactEventTarget target, ContainerRegistryEventConnectedRegistry connectedRegistry) - { - Argument.AssertNotNull(target, nameof(target)); - Argument.AssertNotNull(connectedRegistry, nameof(connectedRegistry)); - - Timestamp = timestamp; - Target = target; - ConnectedRegistry = connectedRegistry; - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The connected registry information if the event is generated by a connected registry. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryArtifactEventData(string id, DateTimeOffset timestamp, string action, string location, ContainerRegistryArtifactEventTarget target, ContainerRegistryEventConnectedRegistry connectedRegistry, IDictionary serializedAdditionalRawData) - { - Id = id; - Timestamp = timestamp; - Action = action; - Location = location; - Target = target; - ConnectedRegistry = connectedRegistry; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ContainerRegistryArtifactEventData() - { - } - - /// The event ID. - public string Id { get; } - /// The time at which the event occurred. - public DateTimeOffset Timestamp { get; } - /// The action that encompasses the provided event. - public string Action { get; } - /// The location of the event. - public string Location { get; } - /// The target of the event. - public ContainerRegistryArtifactEventTarget Target { get; } - /// The connected registry information if the event is generated by a connected registry. - public ContainerRegistryEventConnectedRegistry ConnectedRegistry { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventTarget.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventTarget.Serialization.cs deleted file mode 100644 index a34f0291630d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventTarget.Serialization.cs +++ /dev/null @@ -1,223 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryArtifactEventTarget : 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(ContainerRegistryArtifactEventTarget)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(MediaType)) - { - writer.WritePropertyName("mediaType"u8); - writer.WriteStringValue(MediaType); - } - if (Optional.IsDefined(Size)) - { - writer.WritePropertyName("size"u8); - writer.WriteNumberValue(Size.Value); - } - if (Optional.IsDefined(Digest)) - { - writer.WritePropertyName("digest"u8); - writer.WriteStringValue(Digest); - } - if (Optional.IsDefined(Repository)) - { - writer.WritePropertyName("repository"u8); - writer.WriteStringValue(Repository); - } - if (Optional.IsDefined(Tag)) - { - writer.WritePropertyName("tag"u8); - writer.WriteStringValue(Tag); - } - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteStringValue(Version); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerRegistryArtifactEventTarget 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(ContainerRegistryArtifactEventTarget)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryArtifactEventTarget(document.RootElement, options); - } - - internal static ContainerRegistryArtifactEventTarget DeserializeContainerRegistryArtifactEventTarget(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string mediaType = default; - long? size = default; - string digest = default; - string repository = default; - string tag = default; - string name = default; - string version = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("mediaType"u8)) - { - mediaType = property.Value.GetString(); - continue; - } - if (property.NameEquals("size"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - size = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("digest"u8)) - { - digest = property.Value.GetString(); - continue; - } - if (property.NameEquals("repository"u8)) - { - repository = property.Value.GetString(); - continue; - } - if (property.NameEquals("tag"u8)) - { - tag = property.Value.GetString(); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryArtifactEventTarget( - mediaType, - size, - digest, - repository, - tag, - name, - version, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(ContainerRegistryArtifactEventTarget)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryArtifactEventTarget 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 DeserializeContainerRegistryArtifactEventTarget(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryArtifactEventTarget)} 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 ContainerRegistryArtifactEventTarget FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryArtifactEventTarget(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventTarget.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventTarget.cs deleted file mode 100644 index a0b3692c64ba..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryArtifactEventTarget.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.Messaging.EventGrid.SystemEvents -{ - /// The target of the event. - public partial class ContainerRegistryArtifactEventTarget - { - /// - /// 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 ContainerRegistryArtifactEventTarget() - { - } - - /// Initializes a new instance of . - /// The MIME type of the artifact. - /// The size in bytes of the artifact. - /// The digest of the artifact. - /// The repository name of the artifact. - /// The tag of the artifact. - /// The name of the artifact. - /// The version of the artifact. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryArtifactEventTarget(string mediaType, long? size, string digest, string repository, string tag, string name, string version, IDictionary serializedAdditionalRawData) - { - MediaType = mediaType; - Size = size; - Digest = digest; - Repository = repository; - Tag = tag; - Name = name; - Version = version; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The MIME type of the artifact. - public string MediaType { get; } - /// The size in bytes of the artifact. - public long? Size { get; } - /// The digest of the artifact. - public string Digest { get; } - /// The repository name of the artifact. - public string Repository { get; } - /// The tag of the artifact. - public string Tag { get; } - /// The name of the artifact. - public string Name { get; } - /// The version of the artifact. - public string Version { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartDeletedEventData.Serialization.cs deleted file mode 100644 index e10e1f4b30e6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartDeletedEventData.Serialization.cs +++ /dev/null @@ -1,163 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryChartDeletedEventData : 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(ContainerRegistryChartDeletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ContainerRegistryChartDeletedEventData 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(ContainerRegistryChartDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryChartDeletedEventData(document.RootElement, options); - } - - internal static ContainerRegistryChartDeletedEventData DeserializeContainerRegistryChartDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - DateTimeOffset timestamp = default; - string action = default; - string location = default; - ContainerRegistryArtifactEventTarget target = default; - ContainerRegistryEventConnectedRegistry connectedRegistry = 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("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("action"u8)) - { - action = property.Value.GetString(); - continue; - } - if (property.NameEquals("location"u8)) - { - location = property.Value.GetString(); - continue; - } - if (property.NameEquals("target"u8)) - { - target = ContainerRegistryArtifactEventTarget.DeserializeContainerRegistryArtifactEventTarget(property.Value, options); - continue; - } - if (property.NameEquals("connectedRegistry"u8)) - { - connectedRegistry = ContainerRegistryEventConnectedRegistry.DeserializeContainerRegistryEventConnectedRegistry(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryChartDeletedEventData( - id, - timestamp, - action, - location, - target, - connectedRegistry, - 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(ContainerRegistryChartDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryChartDeletedEventData 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 DeserializeContainerRegistryChartDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryChartDeletedEventData)} 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 ContainerRegistryChartDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryChartDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartDeletedEventData.cs deleted file mode 100644 index c51cacba09e9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartDeletedEventData.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ChartDeleted event. - public partial class ContainerRegistryChartDeletedEventData : ContainerRegistryArtifactEventData - { - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The target of the event. - /// The connected registry information if the event is generated by a connected registry. - /// or is null. - internal ContainerRegistryChartDeletedEventData(DateTimeOffset timestamp, ContainerRegistryArtifactEventTarget target, ContainerRegistryEventConnectedRegistry connectedRegistry) : base(timestamp, target, connectedRegistry) - { - Argument.AssertNotNull(target, nameof(target)); - Argument.AssertNotNull(connectedRegistry, nameof(connectedRegistry)); - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The connected registry information if the event is generated by a connected registry. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryChartDeletedEventData(string id, DateTimeOffset timestamp, string action, string location, ContainerRegistryArtifactEventTarget target, ContainerRegistryEventConnectedRegistry connectedRegistry, IDictionary serializedAdditionalRawData) : base(id, timestamp, action, location, target, connectedRegistry, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal ContainerRegistryChartDeletedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartPushedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartPushedEventData.Serialization.cs deleted file mode 100644 index 6e292e2bd1fd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartPushedEventData.Serialization.cs +++ /dev/null @@ -1,163 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryChartPushedEventData : 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(ContainerRegistryChartPushedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ContainerRegistryChartPushedEventData 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(ContainerRegistryChartPushedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryChartPushedEventData(document.RootElement, options); - } - - internal static ContainerRegistryChartPushedEventData DeserializeContainerRegistryChartPushedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - DateTimeOffset timestamp = default; - string action = default; - string location = default; - ContainerRegistryArtifactEventTarget target = default; - ContainerRegistryEventConnectedRegistry connectedRegistry = 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("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("action"u8)) - { - action = property.Value.GetString(); - continue; - } - if (property.NameEquals("location"u8)) - { - location = property.Value.GetString(); - continue; - } - if (property.NameEquals("target"u8)) - { - target = ContainerRegistryArtifactEventTarget.DeserializeContainerRegistryArtifactEventTarget(property.Value, options); - continue; - } - if (property.NameEquals("connectedRegistry"u8)) - { - connectedRegistry = ContainerRegistryEventConnectedRegistry.DeserializeContainerRegistryEventConnectedRegistry(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryChartPushedEventData( - id, - timestamp, - action, - location, - target, - connectedRegistry, - 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(ContainerRegistryChartPushedEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryChartPushedEventData 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 DeserializeContainerRegistryChartPushedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryChartPushedEventData)} 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 ContainerRegistryChartPushedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryChartPushedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartPushedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartPushedEventData.cs deleted file mode 100644 index 1e05ff576eac..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryChartPushedEventData.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ChartPushed event. - public partial class ContainerRegistryChartPushedEventData : ContainerRegistryArtifactEventData - { - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The target of the event. - /// The connected registry information if the event is generated by a connected registry. - /// or is null. - internal ContainerRegistryChartPushedEventData(DateTimeOffset timestamp, ContainerRegistryArtifactEventTarget target, ContainerRegistryEventConnectedRegistry connectedRegistry) : base(timestamp, target, connectedRegistry) - { - Argument.AssertNotNull(target, nameof(target)); - Argument.AssertNotNull(connectedRegistry, nameof(connectedRegistry)); - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The connected registry information if the event is generated by a connected registry. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryChartPushedEventData(string id, DateTimeOffset timestamp, string action, string location, ContainerRegistryArtifactEventTarget target, ContainerRegistryEventConnectedRegistry connectedRegistry, IDictionary serializedAdditionalRawData) : base(id, timestamp, action, location, target, connectedRegistry, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal ContainerRegistryChartPushedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventActor.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventActor.Serialization.cs deleted file mode 100644 index bff224370e7f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventActor.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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryEventActor : 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(ContainerRegistryEventActor)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - 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 - } - } - } - - ContainerRegistryEventActor 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(ContainerRegistryEventActor)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryEventActor(document.RootElement, options); - } - - internal static ContainerRegistryEventActor DeserializeContainerRegistryEventActor(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = 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 (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryEventActor(name, 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(ContainerRegistryEventActor)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryEventActor 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 DeserializeContainerRegistryEventActor(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryEventActor)} 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 ContainerRegistryEventActor FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryEventActor(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventActor.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventActor.cs deleted file mode 100644 index feb212ebef28..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventActor.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.Messaging.EventGrid.SystemEvents -{ - /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. - public partial class ContainerRegistryEventActor - { - /// - /// 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 ContainerRegistryEventActor() - { - } - - /// Initializes a new instance of . - /// The subject or username associated with the request context that generated the event. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryEventActor(string name, IDictionary serializedAdditionalRawData) - { - Name = name; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The subject or username associated with the request context that generated the event. - public string Name { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventConnectedRegistry.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventConnectedRegistry.Serialization.cs deleted file mode 100644 index b28bb98afa41..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventConnectedRegistry.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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryEventConnectedRegistry : 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(ContainerRegistryEventConnectedRegistry)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - 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 - } - } - } - - ContainerRegistryEventConnectedRegistry 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(ContainerRegistryEventConnectedRegistry)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryEventConnectedRegistry(document.RootElement, options); - } - - internal static ContainerRegistryEventConnectedRegistry DeserializeContainerRegistryEventConnectedRegistry(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = 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 (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryEventConnectedRegistry(name, 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(ContainerRegistryEventConnectedRegistry)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryEventConnectedRegistry 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 DeserializeContainerRegistryEventConnectedRegistry(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryEventConnectedRegistry)} 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 ContainerRegistryEventConnectedRegistry FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryEventConnectedRegistry(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventConnectedRegistry.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventConnectedRegistry.cs deleted file mode 100644 index 60e9c7295966..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventConnectedRegistry.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.Messaging.EventGrid.SystemEvents -{ - /// The connected registry information if the event is generated by a connected registry. - public partial class ContainerRegistryEventConnectedRegistry - { - /// - /// 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 ContainerRegistryEventConnectedRegistry() - { - } - - /// Initializes a new instance of . - /// The name of the connected registry that generated this event. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryEventConnectedRegistry(string name, IDictionary serializedAdditionalRawData) - { - Name = name; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The name of the connected registry that generated this event. - public string Name { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventData.Serialization.cs deleted file mode 100644 index e9f801089099..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventData.Serialization.cs +++ /dev/null @@ -1,225 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryEventData : 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(ContainerRegistryEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(Action)) - { - writer.WritePropertyName("action"u8); - writer.WriteStringValue(Action); - } - if (Optional.IsDefined(Location)) - { - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - } - writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target, options); - writer.WritePropertyName("request"u8); - writer.WriteObjectValue(Request, options); - writer.WritePropertyName("actor"u8); - writer.WriteObjectValue(Actor, options); - writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source, options); - writer.WritePropertyName("connectedRegistry"u8); - writer.WriteObjectValue(ConnectedRegistry, 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 - } - } - } - - ContainerRegistryEventData 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(ContainerRegistryEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryEventData(document.RootElement, options); - } - - internal static ContainerRegistryEventData DeserializeContainerRegistryEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - DateTimeOffset timestamp = default; - string action = default; - string location = default; - ContainerRegistryEventTarget target = default; - ContainerRegistryEventRequest request = default; - ContainerRegistryEventActor actor = default; - ContainerRegistryEventSource source = default; - ContainerRegistryEventConnectedRegistry connectedRegistry = 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("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("action"u8)) - { - action = property.Value.GetString(); - continue; - } - if (property.NameEquals("location"u8)) - { - location = property.Value.GetString(); - continue; - } - if (property.NameEquals("target"u8)) - { - target = ContainerRegistryEventTarget.DeserializeContainerRegistryEventTarget(property.Value, options); - continue; - } - if (property.NameEquals("request"u8)) - { - request = ContainerRegistryEventRequest.DeserializeContainerRegistryEventRequest(property.Value, options); - continue; - } - if (property.NameEquals("actor"u8)) - { - actor = ContainerRegistryEventActor.DeserializeContainerRegistryEventActor(property.Value, options); - continue; - } - if (property.NameEquals("source"u8)) - { - source = ContainerRegistryEventSource.DeserializeContainerRegistryEventSource(property.Value, options); - continue; - } - if (property.NameEquals("connectedRegistry"u8)) - { - connectedRegistry = ContainerRegistryEventConnectedRegistry.DeserializeContainerRegistryEventConnectedRegistry(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryEventData( - id, - timestamp, - action, - location, - target, - request, - actor, - source, - connectedRegistry, - 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(ContainerRegistryEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryEventData 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 DeserializeContainerRegistryEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryEventData)} 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 ContainerRegistryEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventData.cs deleted file mode 100644 index 6f9e05701bed..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventData.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// The content of the event request message. - public partial class ContainerRegistryEventData - { - /// - /// 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 time at which the event occurred. - /// The target of the event. - /// The request that generated the event. - /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. - /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - /// The connected registry information if the event is generated by a connected registry. - /// , , , or is null. - internal ContainerRegistryEventData(DateTimeOffset timestamp, ContainerRegistryEventTarget target, ContainerRegistryEventRequest request, ContainerRegistryEventActor actor, ContainerRegistryEventSource source, ContainerRegistryEventConnectedRegistry connectedRegistry) - { - Argument.AssertNotNull(target, nameof(target)); - Argument.AssertNotNull(request, nameof(request)); - Argument.AssertNotNull(actor, nameof(actor)); - Argument.AssertNotNull(source, nameof(source)); - Argument.AssertNotNull(connectedRegistry, nameof(connectedRegistry)); - - Timestamp = timestamp; - Target = target; - Request = request; - Actor = actor; - Source = source; - ConnectedRegistry = connectedRegistry; - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The request that generated the event. - /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. - /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - /// The connected registry information if the event is generated by a connected registry. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryEventData(string id, DateTimeOffset timestamp, string action, string location, ContainerRegistryEventTarget target, ContainerRegistryEventRequest request, ContainerRegistryEventActor actor, ContainerRegistryEventSource source, ContainerRegistryEventConnectedRegistry connectedRegistry, IDictionary serializedAdditionalRawData) - { - Id = id; - Timestamp = timestamp; - Action = action; - Location = location; - Target = target; - Request = request; - Actor = actor; - Source = source; - ConnectedRegistry = connectedRegistry; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ContainerRegistryEventData() - { - } - - /// The event ID. - public string Id { get; } - /// The time at which the event occurred. - public DateTimeOffset Timestamp { get; } - /// The action that encompasses the provided event. - public string Action { get; } - /// The location of the event. - public string Location { get; } - /// The target of the event. - public ContainerRegistryEventTarget Target { get; } - /// The request that generated the event. - public ContainerRegistryEventRequest Request { get; } - /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. - public ContainerRegistryEventActor Actor { get; } - /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - public ContainerRegistryEventSource Source { get; } - /// The connected registry information if the event is generated by a connected registry. - public ContainerRegistryEventConnectedRegistry ConnectedRegistry { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventRequest.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventRequest.Serialization.cs deleted file mode 100644 index f1d8f38ecf9f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventRequest.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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryEventRequest : 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(ContainerRegistryEventRequest)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(Addr)) - { - writer.WritePropertyName("addr"u8); - writer.WriteStringValue(Addr); - } - if (Optional.IsDefined(Host)) - { - writer.WritePropertyName("host"u8); - writer.WriteStringValue(Host); - } - if (Optional.IsDefined(Method)) - { - writer.WritePropertyName("method"u8); - writer.WriteStringValue(Method); - } - if (Optional.IsDefined(Useragent)) - { - writer.WritePropertyName("useragent"u8); - writer.WriteStringValue(Useragent); - } - 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 - } - } - } - - ContainerRegistryEventRequest 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(ContainerRegistryEventRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryEventRequest(document.RootElement, options); - } - - internal static ContainerRegistryEventRequest DeserializeContainerRegistryEventRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string addr = default; - string host = default; - string method = default; - string useragent = 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("addr"u8)) - { - addr = property.Value.GetString(); - continue; - } - if (property.NameEquals("host"u8)) - { - host = property.Value.GetString(); - continue; - } - if (property.NameEquals("method"u8)) - { - method = property.Value.GetString(); - continue; - } - if (property.NameEquals("useragent"u8)) - { - useragent = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryEventRequest( - id, - addr, - host, - method, - useragent, - 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(ContainerRegistryEventRequest)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryEventRequest 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 DeserializeContainerRegistryEventRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryEventRequest)} 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 ContainerRegistryEventRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryEventRequest(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventRequest.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventRequest.cs deleted file mode 100644 index c53cd2d48a7c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventRequest.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// The request that generated the event. - public partial class ContainerRegistryEventRequest - { - /// - /// 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 ContainerRegistryEventRequest() - { - } - - /// Initializes a new instance of . - /// The ID of the request that initiated the event. - /// The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - /// The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - /// The request method that generated the event. - /// The user agent header of the request. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryEventRequest(string id, string addr, string host, string method, string useragent, IDictionary serializedAdditionalRawData) - { - Id = id; - Addr = addr; - Host = host; - Method = method; - Useragent = useragent; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The ID of the request that initiated the event. - public string Id { get; } - /// The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - public string Addr { get; } - /// The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - public string Host { get; } - /// The request method that generated the event. - public string Method { get; } - /// The user agent header of the request. - public string Useragent { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventSource.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventSource.Serialization.cs deleted file mode 100644 index 5594050a3df3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventSource.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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryEventSource : 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(ContainerRegistryEventSource)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Addr)) - { - writer.WritePropertyName("addr"u8); - writer.WriteStringValue(Addr); - } - if (Optional.IsDefined(InstanceID)) - { - writer.WritePropertyName("instanceID"u8); - writer.WriteStringValue(InstanceID); - } - 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 - } - } - } - - ContainerRegistryEventSource 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(ContainerRegistryEventSource)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryEventSource(document.RootElement, options); - } - - internal static ContainerRegistryEventSource DeserializeContainerRegistryEventSource(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string addr = default; - string instanceID = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("addr"u8)) - { - addr = property.Value.GetString(); - continue; - } - if (property.NameEquals("instanceID"u8)) - { - instanceID = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryEventSource(addr, instanceID, 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(ContainerRegistryEventSource)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryEventSource 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 DeserializeContainerRegistryEventSource(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryEventSource)} 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 ContainerRegistryEventSource FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryEventSource(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventSource.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventSource.cs deleted file mode 100644 index 7164efbf89ab..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventSource.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.Messaging.EventGrid.SystemEvents -{ - /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - public partial class ContainerRegistryEventSource - { - /// - /// 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 ContainerRegistryEventSource() - { - } - - /// Initializes a new instance of . - /// The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - /// The running instance of an application. Changes after each restart. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryEventSource(string addr, string instanceID, IDictionary serializedAdditionalRawData) - { - Addr = addr; - InstanceID = instanceID; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - public string Addr { get; } - /// The running instance of an application. Changes after each restart. - public string InstanceID { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventTarget.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventTarget.Serialization.cs deleted file mode 100644 index b04cd91daf5b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventTarget.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryEventTarget : 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(ContainerRegistryEventTarget)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(MediaType)) - { - writer.WritePropertyName("mediaType"u8); - writer.WriteStringValue(MediaType); - } - if (Optional.IsDefined(Size)) - { - writer.WritePropertyName("size"u8); - writer.WriteNumberValue(Size.Value); - } - if (Optional.IsDefined(Digest)) - { - writer.WritePropertyName("digest"u8); - writer.WriteStringValue(Digest); - } - if (Optional.IsDefined(Length)) - { - writer.WritePropertyName("length"u8); - writer.WriteNumberValue(Length.Value); - } - if (Optional.IsDefined(Repository)) - { - writer.WritePropertyName("repository"u8); - writer.WriteStringValue(Repository); - } - if (Optional.IsDefined(Url)) - { - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - } - if (Optional.IsDefined(Tag)) - { - writer.WritePropertyName("tag"u8); - writer.WriteStringValue(Tag); - } - 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 - } - } - } - - ContainerRegistryEventTarget 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(ContainerRegistryEventTarget)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryEventTarget(document.RootElement, options); - } - - internal static ContainerRegistryEventTarget DeserializeContainerRegistryEventTarget(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string mediaType = default; - long? size = default; - string digest = default; - long? length = default; - string repository = default; - string url = default; - string tag = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("mediaType"u8)) - { - mediaType = property.Value.GetString(); - continue; - } - if (property.NameEquals("size"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - size = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("digest"u8)) - { - digest = property.Value.GetString(); - continue; - } - if (property.NameEquals("length"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - length = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("repository"u8)) - { - repository = property.Value.GetString(); - continue; - } - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("tag"u8)) - { - tag = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryEventTarget( - mediaType, - size, - digest, - length, - repository, - url, - tag, - 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(ContainerRegistryEventTarget)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryEventTarget 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 DeserializeContainerRegistryEventTarget(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryEventTarget)} 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 ContainerRegistryEventTarget FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryEventTarget(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventTarget.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventTarget.cs deleted file mode 100644 index 1494dff1e4ff..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryEventTarget.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.Messaging.EventGrid.SystemEvents -{ - /// The target of the event. - public partial class ContainerRegistryEventTarget - { - /// - /// 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 ContainerRegistryEventTarget() - { - } - - /// Initializes a new instance of . - /// The MIME type of the referenced object. - /// The number of bytes of the content. Same as Length field. - /// The digest of the content, as defined by the Registry V2 HTTP API Specification. - /// The number of bytes of the content. Same as Size field. - /// The repository name. - /// The direct URL to the content. - /// The tag name. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryEventTarget(string mediaType, long? size, string digest, long? length, string repository, string url, string tag, IDictionary serializedAdditionalRawData) - { - MediaType = mediaType; - Size = size; - Digest = digest; - Length = length; - Repository = repository; - Url = url; - Tag = tag; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The MIME type of the referenced object. - public string MediaType { get; } - /// The number of bytes of the content. Same as Length field. - public long? Size { get; } - /// The digest of the content, as defined by the Registry V2 HTTP API Specification. - public string Digest { get; } - /// The number of bytes of the content. Same as Size field. - public long? Length { get; } - /// The repository name. - public string Repository { get; } - /// The direct URL to the content. - public string Url { get; } - /// The tag name. - public string Tag { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImageDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImageDeletedEventData.Serialization.cs deleted file mode 100644 index 2317c3678deb..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImageDeletedEventData.Serialization.cs +++ /dev/null @@ -1,184 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryImageDeletedEventData : 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(ContainerRegistryImageDeletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ContainerRegistryImageDeletedEventData 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(ContainerRegistryImageDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryImageDeletedEventData(document.RootElement, options); - } - - internal static ContainerRegistryImageDeletedEventData DeserializeContainerRegistryImageDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - DateTimeOffset timestamp = default; - string action = default; - string location = default; - ContainerRegistryEventTarget target = default; - ContainerRegistryEventRequest request = default; - ContainerRegistryEventActor actor = default; - ContainerRegistryEventSource source = default; - ContainerRegistryEventConnectedRegistry connectedRegistry = 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("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("action"u8)) - { - action = property.Value.GetString(); - continue; - } - if (property.NameEquals("location"u8)) - { - location = property.Value.GetString(); - continue; - } - if (property.NameEquals("target"u8)) - { - target = ContainerRegistryEventTarget.DeserializeContainerRegistryEventTarget(property.Value, options); - continue; - } - if (property.NameEquals("request"u8)) - { - request = ContainerRegistryEventRequest.DeserializeContainerRegistryEventRequest(property.Value, options); - continue; - } - if (property.NameEquals("actor"u8)) - { - actor = ContainerRegistryEventActor.DeserializeContainerRegistryEventActor(property.Value, options); - continue; - } - if (property.NameEquals("source"u8)) - { - source = ContainerRegistryEventSource.DeserializeContainerRegistryEventSource(property.Value, options); - continue; - } - if (property.NameEquals("connectedRegistry"u8)) - { - connectedRegistry = ContainerRegistryEventConnectedRegistry.DeserializeContainerRegistryEventConnectedRegistry(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryImageDeletedEventData( - id, - timestamp, - action, - location, - target, - request, - actor, - source, - connectedRegistry, - 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(ContainerRegistryImageDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryImageDeletedEventData 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 DeserializeContainerRegistryImageDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryImageDeletedEventData)} 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 ContainerRegistryImageDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryImageDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImageDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImageDeletedEventData.cs deleted file mode 100644 index c839e9590b91..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImageDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ImageDeleted event. - public partial class ContainerRegistryImageDeletedEventData : ContainerRegistryEventData - { - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The target of the event. - /// The request that generated the event. - /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. - /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - /// The connected registry information if the event is generated by a connected registry. - /// , , , or is null. - internal ContainerRegistryImageDeletedEventData(DateTimeOffset timestamp, ContainerRegistryEventTarget target, ContainerRegistryEventRequest request, ContainerRegistryEventActor actor, ContainerRegistryEventSource source, ContainerRegistryEventConnectedRegistry connectedRegistry) : base(timestamp, target, request, actor, source, connectedRegistry) - { - Argument.AssertNotNull(target, nameof(target)); - Argument.AssertNotNull(request, nameof(request)); - Argument.AssertNotNull(actor, nameof(actor)); - Argument.AssertNotNull(source, nameof(source)); - Argument.AssertNotNull(connectedRegistry, nameof(connectedRegistry)); - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The request that generated the event. - /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. - /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - /// The connected registry information if the event is generated by a connected registry. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryImageDeletedEventData(string id, DateTimeOffset timestamp, string action, string location, ContainerRegistryEventTarget target, ContainerRegistryEventRequest request, ContainerRegistryEventActor actor, ContainerRegistryEventSource source, ContainerRegistryEventConnectedRegistry connectedRegistry, IDictionary serializedAdditionalRawData) : base(id, timestamp, action, location, target, request, actor, source, connectedRegistry, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal ContainerRegistryImageDeletedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImagePushedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImagePushedEventData.Serialization.cs deleted file mode 100644 index 99f3256056db..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImagePushedEventData.Serialization.cs +++ /dev/null @@ -1,184 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerRegistryImagePushedEventData : 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(ContainerRegistryImagePushedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ContainerRegistryImagePushedEventData 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(ContainerRegistryImagePushedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerRegistryImagePushedEventData(document.RootElement, options); - } - - internal static ContainerRegistryImagePushedEventData DeserializeContainerRegistryImagePushedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - DateTimeOffset timestamp = default; - string action = default; - string location = default; - ContainerRegistryEventTarget target = default; - ContainerRegistryEventRequest request = default; - ContainerRegistryEventActor actor = default; - ContainerRegistryEventSource source = default; - ContainerRegistryEventConnectedRegistry connectedRegistry = 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("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("action"u8)) - { - action = property.Value.GetString(); - continue; - } - if (property.NameEquals("location"u8)) - { - location = property.Value.GetString(); - continue; - } - if (property.NameEquals("target"u8)) - { - target = ContainerRegistryEventTarget.DeserializeContainerRegistryEventTarget(property.Value, options); - continue; - } - if (property.NameEquals("request"u8)) - { - request = ContainerRegistryEventRequest.DeserializeContainerRegistryEventRequest(property.Value, options); - continue; - } - if (property.NameEquals("actor"u8)) - { - actor = ContainerRegistryEventActor.DeserializeContainerRegistryEventActor(property.Value, options); - continue; - } - if (property.NameEquals("source"u8)) - { - source = ContainerRegistryEventSource.DeserializeContainerRegistryEventSource(property.Value, options); - continue; - } - if (property.NameEquals("connectedRegistry"u8)) - { - connectedRegistry = ContainerRegistryEventConnectedRegistry.DeserializeContainerRegistryEventConnectedRegistry(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerRegistryImagePushedEventData( - id, - timestamp, - action, - location, - target, - request, - actor, - source, - connectedRegistry, - 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(ContainerRegistryImagePushedEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerRegistryImagePushedEventData 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 DeserializeContainerRegistryImagePushedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerRegistryImagePushedEventData)} 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 ContainerRegistryImagePushedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerRegistryImagePushedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImagePushedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImagePushedEventData.cs deleted file mode 100644 index 32fbf481e6df..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerRegistryImagePushedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ImagePushed event. - public partial class ContainerRegistryImagePushedEventData : ContainerRegistryEventData - { - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The target of the event. - /// The request that generated the event. - /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. - /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - /// The connected registry information if the event is generated by a connected registry. - /// , , , or is null. - internal ContainerRegistryImagePushedEventData(DateTimeOffset timestamp, ContainerRegistryEventTarget target, ContainerRegistryEventRequest request, ContainerRegistryEventActor actor, ContainerRegistryEventSource source, ContainerRegistryEventConnectedRegistry connectedRegistry) : base(timestamp, target, request, actor, source, connectedRegistry) - { - Argument.AssertNotNull(target, nameof(target)); - Argument.AssertNotNull(request, nameof(request)); - Argument.AssertNotNull(actor, nameof(actor)); - Argument.AssertNotNull(source, nameof(source)); - Argument.AssertNotNull(connectedRegistry, nameof(connectedRegistry)); - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The request that generated the event. - /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. - /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - /// The connected registry information if the event is generated by a connected registry. - /// Keeps track of any properties unknown to the library. - internal ContainerRegistryImagePushedEventData(string id, DateTimeOffset timestamp, string action, string location, ContainerRegistryEventTarget target, ContainerRegistryEventRequest request, ContainerRegistryEventActor actor, ContainerRegistryEventSource source, ContainerRegistryEventConnectedRegistry connectedRegistry, IDictionary serializedAdditionalRawData) : base(id, timestamp, action, location, target, request, actor, source, connectedRegistry, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal ContainerRegistryImagePushedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndedEventData.Serialization.cs deleted file mode 100644 index da702ca3e31f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerServiceClusterSupportEndedEventData : 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(ContainerServiceClusterSupportEndedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ContainerServiceClusterSupportEndedEventData 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(ContainerServiceClusterSupportEndedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceClusterSupportEndedEventData(document.RootElement, options); - } - - internal static ContainerServiceClusterSupportEndedEventData DeserializeContainerServiceClusterSupportEndedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string kubernetesVersion = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kubernetesVersion"u8)) - { - kubernetesVersion = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceClusterSupportEndedEventData(kubernetesVersion, 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(ContainerServiceClusterSupportEndedEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceClusterSupportEndedEventData 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 DeserializeContainerServiceClusterSupportEndedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceClusterSupportEndedEventData)} 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 ContainerServiceClusterSupportEndedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerServiceClusterSupportEndedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndedEventData.cs deleted file mode 100644 index 66ed2b8c4b62..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.ClusterSupportEnded event. - public partial class ContainerServiceClusterSupportEndedEventData : ContainerServiceClusterSupportEventData - { - /// Initializes a new instance of . - internal ContainerServiceClusterSupportEndedEventData() - { - } - - /// Initializes a new instance of . - /// The Kubernetes version of the ManagedCluster resource. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceClusterSupportEndedEventData(string kubernetesVersion, IDictionary serializedAdditionalRawData) : base(kubernetesVersion, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndingEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndingEventData.Serialization.cs deleted file mode 100644 index db44b5ec660c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndingEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerServiceClusterSupportEndingEventData : 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(ContainerServiceClusterSupportEndingEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ContainerServiceClusterSupportEndingEventData 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(ContainerServiceClusterSupportEndingEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceClusterSupportEndingEventData(document.RootElement, options); - } - - internal static ContainerServiceClusterSupportEndingEventData DeserializeContainerServiceClusterSupportEndingEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string kubernetesVersion = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kubernetesVersion"u8)) - { - kubernetesVersion = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceClusterSupportEndingEventData(kubernetesVersion, 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(ContainerServiceClusterSupportEndingEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceClusterSupportEndingEventData 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 DeserializeContainerServiceClusterSupportEndingEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceClusterSupportEndingEventData)} 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 ContainerServiceClusterSupportEndingEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerServiceClusterSupportEndingEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndingEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndingEventData.cs deleted file mode 100644 index 0a3fa362492c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEndingEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.ClusterSupportEnding event. - public partial class ContainerServiceClusterSupportEndingEventData : ContainerServiceClusterSupportEventData - { - /// Initializes a new instance of . - internal ContainerServiceClusterSupportEndingEventData() - { - } - - /// Initializes a new instance of . - /// The Kubernetes version of the ManagedCluster resource. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceClusterSupportEndingEventData(string kubernetesVersion, IDictionary serializedAdditionalRawData) : base(kubernetesVersion, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEventData.Serialization.cs deleted file mode 100644 index 48a01092b872..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerServiceClusterSupportEventData : 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(ContainerServiceClusterSupportEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(KubernetesVersion)) - { - writer.WritePropertyName("kubernetesVersion"u8); - writer.WriteStringValue(KubernetesVersion); - } - 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 - } - } - } - - ContainerServiceClusterSupportEventData 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(ContainerServiceClusterSupportEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceClusterSupportEventData(document.RootElement, options); - } - - internal static ContainerServiceClusterSupportEventData DeserializeContainerServiceClusterSupportEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string kubernetesVersion = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kubernetesVersion"u8)) - { - kubernetesVersion = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceClusterSupportEventData(kubernetesVersion, 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(ContainerServiceClusterSupportEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceClusterSupportEventData 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 DeserializeContainerServiceClusterSupportEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceClusterSupportEventData)} 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 ContainerServiceClusterSupportEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerServiceClusterSupportEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEventData.cs deleted file mode 100644 index 3ad05c8cb79b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceClusterSupportEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of cluster support events. - public partial class ContainerServiceClusterSupportEventData - { - /// - /// 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 . - internal ContainerServiceClusterSupportEventData() - { - } - - /// Initializes a new instance of . - /// The Kubernetes version of the ManagedCluster resource. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceClusterSupportEventData(string kubernetesVersion, IDictionary serializedAdditionalRawData) - { - KubernetesVersion = kubernetesVersion; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The Kubernetes version of the ManagedCluster resource. - public string KubernetesVersion { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNewKubernetesVersionAvailableEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNewKubernetesVersionAvailableEventData.Serialization.cs deleted file mode 100644 index 8836e65a21e0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNewKubernetesVersionAvailableEventData.Serialization.cs +++ /dev/null @@ -1,178 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerServiceNewKubernetesVersionAvailableEventData : 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(ContainerServiceNewKubernetesVersionAvailableEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(LatestSupportedKubernetesVersion)) - { - writer.WritePropertyName("latestSupportedKubernetesVersion"u8); - writer.WriteStringValue(LatestSupportedKubernetesVersion); - } - if (Optional.IsDefined(LatestStableKubernetesVersion)) - { - writer.WritePropertyName("latestStableKubernetesVersion"u8); - writer.WriteStringValue(LatestStableKubernetesVersion); - } - if (Optional.IsDefined(LowestMinorKubernetesVersion)) - { - writer.WritePropertyName("lowestMinorKubernetesVersion"u8); - writer.WriteStringValue(LowestMinorKubernetesVersion); - } - if (Optional.IsDefined(LatestPreviewKubernetesVersion)) - { - writer.WritePropertyName("latestPreviewKubernetesVersion"u8); - writer.WriteStringValue(LatestPreviewKubernetesVersion); - } - 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 - } - } - } - - ContainerServiceNewKubernetesVersionAvailableEventData 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(ContainerServiceNewKubernetesVersionAvailableEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceNewKubernetesVersionAvailableEventData(document.RootElement, options); - } - - internal static ContainerServiceNewKubernetesVersionAvailableEventData DeserializeContainerServiceNewKubernetesVersionAvailableEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string latestSupportedKubernetesVersion = default; - string latestStableKubernetesVersion = default; - string lowestMinorKubernetesVersion = default; - string latestPreviewKubernetesVersion = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("latestSupportedKubernetesVersion"u8)) - { - latestSupportedKubernetesVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("latestStableKubernetesVersion"u8)) - { - latestStableKubernetesVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("lowestMinorKubernetesVersion"u8)) - { - lowestMinorKubernetesVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("latestPreviewKubernetesVersion"u8)) - { - latestPreviewKubernetesVersion = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceNewKubernetesVersionAvailableEventData(latestSupportedKubernetesVersion, latestStableKubernetesVersion, lowestMinorKubernetesVersion, latestPreviewKubernetesVersion, 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(ContainerServiceNewKubernetesVersionAvailableEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceNewKubernetesVersionAvailableEventData 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 DeserializeContainerServiceNewKubernetesVersionAvailableEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceNewKubernetesVersionAvailableEventData)} 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 ContainerServiceNewKubernetesVersionAvailableEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerServiceNewKubernetesVersionAvailableEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNewKubernetesVersionAvailableEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNewKubernetesVersionAvailableEventData.cs deleted file mode 100644 index a220ba99996e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNewKubernetesVersionAvailableEventData.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.NewKubernetesVersionAvailable event. - public partial class ContainerServiceNewKubernetesVersionAvailableEventData - { - /// - /// 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 ContainerServiceNewKubernetesVersionAvailableEventData() - { - } - - /// Initializes a new instance of . - /// The highest PATCH Kubernetes version for the highest MINOR version supported by ManagedCluster resource. - /// The highest PATCH Kubernetes version for the MINOR version considered stable for the ManagedCluster resource. - /// The highest PATCH Kubernetes version for the lowest applicable MINOR version available for the ManagedCluster resource. - /// The highest PATCH Kubernetes version considered preview for the ManagedCluster resource. There might not be any version in preview at the time of publishing the event. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceNewKubernetesVersionAvailableEventData(string latestSupportedKubernetesVersion, string latestStableKubernetesVersion, string lowestMinorKubernetesVersion, string latestPreviewKubernetesVersion, IDictionary serializedAdditionalRawData) - { - LatestSupportedKubernetesVersion = latestSupportedKubernetesVersion; - LatestStableKubernetesVersion = latestStableKubernetesVersion; - LowestMinorKubernetesVersion = lowestMinorKubernetesVersion; - LatestPreviewKubernetesVersion = latestPreviewKubernetesVersion; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The highest PATCH Kubernetes version for the highest MINOR version supported by ManagedCluster resource. - public string LatestSupportedKubernetesVersion { get; } - /// The highest PATCH Kubernetes version for the MINOR version considered stable for the ManagedCluster resource. - public string LatestStableKubernetesVersion { get; } - /// The highest PATCH Kubernetes version for the lowest applicable MINOR version available for the ManagedCluster resource. - public string LowestMinorKubernetesVersion { get; } - /// The highest PATCH Kubernetes version considered preview for the ManagedCluster resource. There might not be any version in preview at the time of publishing the event. - public string LatestPreviewKubernetesVersion { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingEventData.Serialization.cs deleted file mode 100644 index a27699c1016e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerServiceNodePoolRollingEventData : 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(ContainerServiceNodePoolRollingEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(NodePoolName)) - { - writer.WritePropertyName("nodePoolName"u8); - writer.WriteStringValue(NodePoolName); - } - 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 - } - } - } - - ContainerServiceNodePoolRollingEventData 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(ContainerServiceNodePoolRollingEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceNodePoolRollingEventData(document.RootElement, options); - } - - internal static ContainerServiceNodePoolRollingEventData DeserializeContainerServiceNodePoolRollingEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string nodePoolName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("nodePoolName"u8)) - { - nodePoolName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceNodePoolRollingEventData(nodePoolName, 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(ContainerServiceNodePoolRollingEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceNodePoolRollingEventData 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 DeserializeContainerServiceNodePoolRollingEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceNodePoolRollingEventData)} 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 ContainerServiceNodePoolRollingEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerServiceNodePoolRollingEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingEventData.cs deleted file mode 100644 index 3b5580803572..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of common properties of node pool rolling events. - public partial class ContainerServiceNodePoolRollingEventData - { - /// - /// 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 . - internal ContainerServiceNodePoolRollingEventData() - { - } - - /// Initializes a new instance of . - /// The name of the node pool in the ManagedCluster resource. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceNodePoolRollingEventData(string nodePoolName, IDictionary serializedAdditionalRawData) - { - NodePoolName = nodePoolName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The name of the node pool in the ManagedCluster resource. - public string NodePoolName { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingFailedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingFailedEventData.Serialization.cs deleted file mode 100644 index 82cb9599f2c7..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingFailedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerServiceNodePoolRollingFailedEventData : 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(ContainerServiceNodePoolRollingFailedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ContainerServiceNodePoolRollingFailedEventData 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(ContainerServiceNodePoolRollingFailedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceNodePoolRollingFailedEventData(document.RootElement, options); - } - - internal static ContainerServiceNodePoolRollingFailedEventData DeserializeContainerServiceNodePoolRollingFailedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string nodePoolName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("nodePoolName"u8)) - { - nodePoolName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceNodePoolRollingFailedEventData(nodePoolName, 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(ContainerServiceNodePoolRollingFailedEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceNodePoolRollingFailedEventData 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 DeserializeContainerServiceNodePoolRollingFailedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceNodePoolRollingFailedEventData)} 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 ContainerServiceNodePoolRollingFailedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerServiceNodePoolRollingFailedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingFailedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingFailedEventData.cs deleted file mode 100644 index 0bf9331c72ca..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingFailedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.NodePoolRollingFailed event. - public partial class ContainerServiceNodePoolRollingFailedEventData : ContainerServiceNodePoolRollingEventData - { - /// Initializes a new instance of . - internal ContainerServiceNodePoolRollingFailedEventData() - { - } - - /// Initializes a new instance of . - /// The name of the node pool in the ManagedCluster resource. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceNodePoolRollingFailedEventData(string nodePoolName, IDictionary serializedAdditionalRawData) : base(nodePoolName, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingStartedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingStartedEventData.Serialization.cs deleted file mode 100644 index 5ce556b9cfdf..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingStartedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerServiceNodePoolRollingStartedEventData : 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(ContainerServiceNodePoolRollingStartedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ContainerServiceNodePoolRollingStartedEventData 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(ContainerServiceNodePoolRollingStartedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceNodePoolRollingStartedEventData(document.RootElement, options); - } - - internal static ContainerServiceNodePoolRollingStartedEventData DeserializeContainerServiceNodePoolRollingStartedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string nodePoolName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("nodePoolName"u8)) - { - nodePoolName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceNodePoolRollingStartedEventData(nodePoolName, 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(ContainerServiceNodePoolRollingStartedEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceNodePoolRollingStartedEventData 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 DeserializeContainerServiceNodePoolRollingStartedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceNodePoolRollingStartedEventData)} 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 ContainerServiceNodePoolRollingStartedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerServiceNodePoolRollingStartedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingStartedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingStartedEventData.cs deleted file mode 100644 index 88958ee63eef..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingStartedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.NodePoolRollingStarted event. - public partial class ContainerServiceNodePoolRollingStartedEventData : ContainerServiceNodePoolRollingEventData - { - /// Initializes a new instance of . - internal ContainerServiceNodePoolRollingStartedEventData() - { - } - - /// Initializes a new instance of . - /// The name of the node pool in the ManagedCluster resource. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceNodePoolRollingStartedEventData(string nodePoolName, IDictionary serializedAdditionalRawData) : base(nodePoolName, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingSucceededEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingSucceededEventData.Serialization.cs deleted file mode 100644 index e7b4799f29cf..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingSucceededEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ContainerServiceNodePoolRollingSucceededEventData : 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(ContainerServiceNodePoolRollingSucceededEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ContainerServiceNodePoolRollingSucceededEventData 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(ContainerServiceNodePoolRollingSucceededEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceNodePoolRollingSucceededEventData(document.RootElement, options); - } - - internal static ContainerServiceNodePoolRollingSucceededEventData DeserializeContainerServiceNodePoolRollingSucceededEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string nodePoolName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("nodePoolName"u8)) - { - nodePoolName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceNodePoolRollingSucceededEventData(nodePoolName, 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(ContainerServiceNodePoolRollingSucceededEventData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceNodePoolRollingSucceededEventData 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 DeserializeContainerServiceNodePoolRollingSucceededEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceNodePoolRollingSucceededEventData)} 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 ContainerServiceNodePoolRollingSucceededEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeContainerServiceNodePoolRollingSucceededEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingSucceededEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingSucceededEventData.cs deleted file mode 100644 index 18c9e4ada789..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ContainerServiceNodePoolRollingSucceededEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.NodePoolRollingSucceeded event. - public partial class ContainerServiceNodePoolRollingSucceededEventData : ContainerServiceNodePoolRollingEventData - { - /// Initializes a new instance of . - internal ContainerServiceNodePoolRollingSucceededEventData() - { - } - - /// Initializes a new instance of . - /// The name of the node pool in the ManagedCluster resource. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceNodePoolRollingSucceededEventData(string nodePoolName, IDictionary serializedAdditionalRawData) : base(nodePoolName, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyCompletedEventData.Serialization.cs deleted file mode 100644 index 48825fb0fed9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyCompletedEventData.Serialization.cs +++ /dev/null @@ -1,161 +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.Messaging.EventGrid.SystemEvents -{ - public partial class DataBoxCopyCompletedEventData : 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(DataBoxCopyCompletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SerialNumber)) - { - writer.WritePropertyName("serialNumber"u8); - writer.WriteStringValue(SerialNumber); - } - writer.WritePropertyName("stageName"u8); - writer.WriteStringValue(StageName.ToString()); - writer.WritePropertyName("stageTime"u8); - writer.WriteStringValue(StageTime, "O"); - 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 - } - } - } - - DataBoxCopyCompletedEventData 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(DataBoxCopyCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDataBoxCopyCompletedEventData(document.RootElement, options); - } - - internal static DataBoxCopyCompletedEventData DeserializeDataBoxCopyCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string serialNumber = default; - DataBoxStageName stageName = default; - DateTimeOffset stageTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("serialNumber"u8)) - { - serialNumber = property.Value.GetString(); - continue; - } - if (property.NameEquals("stageName"u8)) - { - stageName = new DataBoxStageName(property.Value.GetString()); - continue; - } - if (property.NameEquals("stageTime"u8)) - { - stageTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DataBoxCopyCompletedEventData(serialNumber, stageName, stageTime, 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(DataBoxCopyCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - DataBoxCopyCompletedEventData 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 DeserializeDataBoxCopyCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DataBoxCopyCompletedEventData)} 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 DataBoxCopyCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDataBoxCopyCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyCompletedEventData.cs deleted file mode 100644 index 75a73c0475e9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyCompletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.DataBox.CopyCompleted event. - public partial class DataBoxCopyCompletedEventData - { - /// - /// 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 . - /// Name of the current Stage. - /// The time at which the stage happened. - internal DataBoxCopyCompletedEventData(DataBoxStageName stageName, DateTimeOffset stageTime) - { - StageName = stageName; - StageTime = stageTime; - } - - /// Initializes a new instance of . - /// Serial Number of the device associated with the event. The list is comma separated if more than one serial number is associated. - /// Name of the current Stage. - /// The time at which the stage happened. - /// Keeps track of any properties unknown to the library. - internal DataBoxCopyCompletedEventData(string serialNumber, DataBoxStageName stageName, DateTimeOffset stageTime, IDictionary serializedAdditionalRawData) - { - SerialNumber = serialNumber; - StageName = stageName; - StageTime = stageTime; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DataBoxCopyCompletedEventData() - { - } - - /// Serial Number of the device associated with the event. The list is comma separated if more than one serial number is associated. - public string SerialNumber { get; } - /// Name of the current Stage. - public DataBoxStageName StageName { get; } - /// The time at which the stage happened. - public DateTimeOffset StageTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyStartedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyStartedEventData.Serialization.cs deleted file mode 100644 index e0603dee3265..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyStartedEventData.Serialization.cs +++ /dev/null @@ -1,161 +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.Messaging.EventGrid.SystemEvents -{ - public partial class DataBoxCopyStartedEventData : 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(DataBoxCopyStartedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SerialNumber)) - { - writer.WritePropertyName("serialNumber"u8); - writer.WriteStringValue(SerialNumber); - } - writer.WritePropertyName("stageName"u8); - writer.WriteStringValue(StageName.ToString()); - writer.WritePropertyName("stageTime"u8); - writer.WriteStringValue(StageTime, "O"); - 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 - } - } - } - - DataBoxCopyStartedEventData 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(DataBoxCopyStartedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDataBoxCopyStartedEventData(document.RootElement, options); - } - - internal static DataBoxCopyStartedEventData DeserializeDataBoxCopyStartedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string serialNumber = default; - DataBoxStageName stageName = default; - DateTimeOffset stageTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("serialNumber"u8)) - { - serialNumber = property.Value.GetString(); - continue; - } - if (property.NameEquals("stageName"u8)) - { - stageName = new DataBoxStageName(property.Value.GetString()); - continue; - } - if (property.NameEquals("stageTime"u8)) - { - stageTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DataBoxCopyStartedEventData(serialNumber, stageName, stageTime, 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(DataBoxCopyStartedEventData)} does not support writing '{options.Format}' format."); - } - } - - DataBoxCopyStartedEventData 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 DeserializeDataBoxCopyStartedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DataBoxCopyStartedEventData)} 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 DataBoxCopyStartedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDataBoxCopyStartedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyStartedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyStartedEventData.cs deleted file mode 100644 index 2c607fcec991..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxCopyStartedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.DataBox.CopyStarted event. - public partial class DataBoxCopyStartedEventData - { - /// - /// 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 . - /// Name of the current Stage. - /// The time at which the stage happened. - internal DataBoxCopyStartedEventData(DataBoxStageName stageName, DateTimeOffset stageTime) - { - StageName = stageName; - StageTime = stageTime; - } - - /// Initializes a new instance of . - /// Serial Number of the device associated with the event. The list is comma separated if more than one serial number is associated. - /// Name of the current Stage. - /// The time at which the stage happened. - /// Keeps track of any properties unknown to the library. - internal DataBoxCopyStartedEventData(string serialNumber, DataBoxStageName stageName, DateTimeOffset stageTime, IDictionary serializedAdditionalRawData) - { - SerialNumber = serialNumber; - StageName = stageName; - StageTime = stageTime; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DataBoxCopyStartedEventData() - { - } - - /// Serial Number of the device associated with the event. The list is comma separated if more than one serial number is associated. - public string SerialNumber { get; } - /// Name of the current Stage. - public DataBoxStageName StageName { get; } - /// The time at which the stage happened. - public DateTimeOffset StageTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxOrderCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxOrderCompletedEventData.Serialization.cs deleted file mode 100644 index 036c53c1f5ca..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxOrderCompletedEventData.Serialization.cs +++ /dev/null @@ -1,161 +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.Messaging.EventGrid.SystemEvents -{ - public partial class DataBoxOrderCompletedEventData : 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(DataBoxOrderCompletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SerialNumber)) - { - writer.WritePropertyName("serialNumber"u8); - writer.WriteStringValue(SerialNumber); - } - writer.WritePropertyName("stageName"u8); - writer.WriteStringValue(StageName.ToString()); - writer.WritePropertyName("stageTime"u8); - writer.WriteStringValue(StageTime, "O"); - 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 - } - } - } - - DataBoxOrderCompletedEventData 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(DataBoxOrderCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDataBoxOrderCompletedEventData(document.RootElement, options); - } - - internal static DataBoxOrderCompletedEventData DeserializeDataBoxOrderCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string serialNumber = default; - DataBoxStageName stageName = default; - DateTimeOffset stageTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("serialNumber"u8)) - { - serialNumber = property.Value.GetString(); - continue; - } - if (property.NameEquals("stageName"u8)) - { - stageName = new DataBoxStageName(property.Value.GetString()); - continue; - } - if (property.NameEquals("stageTime"u8)) - { - stageTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DataBoxOrderCompletedEventData(serialNumber, stageName, stageTime, 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(DataBoxOrderCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - DataBoxOrderCompletedEventData 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 DeserializeDataBoxOrderCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DataBoxOrderCompletedEventData)} 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 DataBoxOrderCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDataBoxOrderCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxOrderCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxOrderCompletedEventData.cs deleted file mode 100644 index b610d5819b26..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxOrderCompletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.DataBox.OrderCompleted event. - public partial class DataBoxOrderCompletedEventData - { - /// - /// 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 . - /// Name of the current Stage. - /// The time at which the stage happened. - internal DataBoxOrderCompletedEventData(DataBoxStageName stageName, DateTimeOffset stageTime) - { - StageName = stageName; - StageTime = stageTime; - } - - /// Initializes a new instance of . - /// Serial Number of the device associated with the event. The list is comma separated if more than one serial number is associated. - /// Name of the current Stage. - /// The time at which the stage happened. - /// Keeps track of any properties unknown to the library. - internal DataBoxOrderCompletedEventData(string serialNumber, DataBoxStageName stageName, DateTimeOffset stageTime, IDictionary serializedAdditionalRawData) - { - SerialNumber = serialNumber; - StageName = stageName; - StageTime = stageTime; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DataBoxOrderCompletedEventData() - { - } - - /// Serial Number of the device associated with the event. The list is comma separated if more than one serial number is associated. - public string SerialNumber { get; } - /// Name of the current Stage. - public DataBoxStageName StageName { get; } - /// The time at which the stage happened. - public DateTimeOffset StageTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxStageName.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxStageName.cs deleted file mode 100644 index e96f0f477c10..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DataBoxStageName.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of DataBox Stage Name enumeration. - public readonly partial struct DataBoxStageName : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public DataBoxStageName(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string CopyStartedValue = "CopyStarted"; - private const string CopyCompletedValue = "CopyCompleted"; - private const string OrderCompletedValue = "OrderCompleted"; - - /// Copy has started. - public static DataBoxStageName CopyStarted { get; } = new DataBoxStageName(CopyStartedValue); - /// Copy has completed. - public static DataBoxStageName CopyCompleted { get; } = new DataBoxStageName(CopyCompletedValue); - /// Order has been completed. - public static DataBoxStageName OrderCompleted { get; } = new DataBoxStageName(OrderCompletedValue); - /// Determines if two values are the same. - public static bool operator ==(DataBoxStageName left, DataBoxStageName right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(DataBoxStageName left, DataBoxStageName right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator DataBoxStageName(string value) => new DataBoxStageName(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is DataBoxStageName other && Equals(other); - /// - public bool Equals(DataBoxStageName 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventInfo.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventInfo.Serialization.cs deleted file mode 100644 index e5f7910703dc..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventInfo.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.Messaging.EventGrid.SystemEvents -{ - public partial class DeviceConnectionStateEventInfo : 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(DeviceConnectionStateEventInfo)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SequenceNumber)) - { - writer.WritePropertyName("sequenceNumber"u8); - writer.WriteStringValue(SequenceNumber); - } - 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 - } - } - } - - DeviceConnectionStateEventInfo 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(DeviceConnectionStateEventInfo)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDeviceConnectionStateEventInfo(document.RootElement, options); - } - - internal static DeviceConnectionStateEventInfo DeserializeDeviceConnectionStateEventInfo(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string sequenceNumber = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sequenceNumber"u8)) - { - sequenceNumber = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DeviceConnectionStateEventInfo(sequenceNumber, 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(DeviceConnectionStateEventInfo)} does not support writing '{options.Format}' format."); - } - } - - DeviceConnectionStateEventInfo 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 DeserializeDeviceConnectionStateEventInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DeviceConnectionStateEventInfo)} 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 DeviceConnectionStateEventInfo FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDeviceConnectionStateEventInfo(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventInfo.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventInfo.cs deleted file mode 100644 index 215ec30e9369..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventInfo.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.Messaging.EventGrid.SystemEvents -{ - /// Information about the device connection state event. - public partial class DeviceConnectionStateEventInfo - { - /// - /// 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 DeviceConnectionStateEventInfo() - { - } - - /// Initializes a new instance of . - /// Sequence number is string representation of a hexadecimal number. string compare can be used to identify the larger number because both in ASCII and HEX numbers come after alphabets. If you are converting the string to hex, then the number is a 256 bit number. - /// Keeps track of any properties unknown to the library. - internal DeviceConnectionStateEventInfo(string sequenceNumber, IDictionary serializedAdditionalRawData) - { - SequenceNumber = sequenceNumber; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Sequence number is string representation of a hexadecimal number. string compare can be used to identify the larger number because both in ASCII and HEX numbers come after alphabets. If you are converting the string to hex, then the number is a 256 bit number. - public string SequenceNumber { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventProperties.Serialization.cs deleted file mode 100644 index f281e719035a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventProperties.Serialization.cs +++ /dev/null @@ -1,175 +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.Messaging.EventGrid.SystemEvents -{ - public partial class DeviceConnectionStateEventProperties : 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(DeviceConnectionStateEventProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(DeviceId)) - { - writer.WritePropertyName("deviceId"u8); - writer.WriteStringValue(DeviceId); - } - if (Optional.IsDefined(ModuleId)) - { - writer.WritePropertyName("moduleId"u8); - writer.WriteStringValue(ModuleId); - } - if (Optional.IsDefined(HubName)) - { - writer.WritePropertyName("hubName"u8); - writer.WriteStringValue(HubName); - } - writer.WritePropertyName("deviceConnectionStateEventInfo"u8); - writer.WriteObjectValue(DeviceConnectionStateEventInfo, 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 - } - } - } - - DeviceConnectionStateEventProperties 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(DeviceConnectionStateEventProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDeviceConnectionStateEventProperties(document.RootElement, options); - } - - internal static DeviceConnectionStateEventProperties DeserializeDeviceConnectionStateEventProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string deviceId = default; - string moduleId = default; - string hubName = default; - DeviceConnectionStateEventInfo deviceConnectionStateEventInfo = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deviceId"u8)) - { - deviceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("moduleId"u8)) - { - moduleId = property.Value.GetString(); - continue; - } - if (property.NameEquals("hubName"u8)) - { - hubName = property.Value.GetString(); - continue; - } - if (property.NameEquals("deviceConnectionStateEventInfo"u8)) - { - deviceConnectionStateEventInfo = DeviceConnectionStateEventInfo.DeserializeDeviceConnectionStateEventInfo(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DeviceConnectionStateEventProperties(deviceId, moduleId, hubName, deviceConnectionStateEventInfo, 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(DeviceConnectionStateEventProperties)} does not support writing '{options.Format}' format."); - } - } - - DeviceConnectionStateEventProperties 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 DeserializeDeviceConnectionStateEventProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DeviceConnectionStateEventProperties)} 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 DeviceConnectionStateEventProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDeviceConnectionStateEventProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventProperties.cs deleted file mode 100644 index d271d4d44c8c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceConnectionStateEventProperties.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a device connection state event (DeviceConnected, DeviceDisconnected). - public partial class DeviceConnectionStateEventProperties - { - /// - /// 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 . - /// Information about the device connection state event. - /// is null. - internal DeviceConnectionStateEventProperties(DeviceConnectionStateEventInfo deviceConnectionStateEventInfo) - { - Argument.AssertNotNull(deviceConnectionStateEventInfo, nameof(deviceConnectionStateEventInfo)); - - DeviceConnectionStateEventInfo = deviceConnectionStateEventInfo; - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device connection state event. - /// Keeps track of any properties unknown to the library. - internal DeviceConnectionStateEventProperties(string deviceId, string moduleId, string hubName, DeviceConnectionStateEventInfo deviceConnectionStateEventInfo, IDictionary serializedAdditionalRawData) - { - DeviceId = deviceId; - ModuleId = moduleId; - HubName = hubName; - DeviceConnectionStateEventInfo = deviceConnectionStateEventInfo; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DeviceConnectionStateEventProperties() - { - } - - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - public string DeviceId { get; } - /// The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - public string ModuleId { get; } - /// Name of the IoT Hub where the device was created or deleted. - public string HubName { get; } - /// Information about the device connection state event. - public DeviceConnectionStateEventInfo DeviceConnectionStateEventInfo { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceLifeCycleEventProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceLifeCycleEventProperties.Serialization.cs deleted file mode 100644 index 067326794b32..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceLifeCycleEventProperties.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.Messaging.EventGrid.SystemEvents -{ - public partial class DeviceLifeCycleEventProperties : 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(DeviceLifeCycleEventProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(DeviceId)) - { - writer.WritePropertyName("deviceId"u8); - writer.WriteStringValue(DeviceId); - } - if (Optional.IsDefined(HubName)) - { - writer.WritePropertyName("hubName"u8); - writer.WriteStringValue(HubName); - } - writer.WritePropertyName("twin"u8); - writer.WriteObjectValue(Twin, 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 - } - } - } - - DeviceLifeCycleEventProperties 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(DeviceLifeCycleEventProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDeviceLifeCycleEventProperties(document.RootElement, options); - } - - internal static DeviceLifeCycleEventProperties DeserializeDeviceLifeCycleEventProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string deviceId = default; - string hubName = default; - DeviceTwinInfo twin = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deviceId"u8)) - { - deviceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("hubName"u8)) - { - hubName = property.Value.GetString(); - continue; - } - if (property.NameEquals("twin"u8)) - { - twin = DeviceTwinInfo.DeserializeDeviceTwinInfo(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DeviceLifeCycleEventProperties(deviceId, hubName, twin, 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(DeviceLifeCycleEventProperties)} does not support writing '{options.Format}' format."); - } - } - - DeviceLifeCycleEventProperties 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 DeserializeDeviceLifeCycleEventProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DeviceLifeCycleEventProperties)} 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 DeviceLifeCycleEventProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDeviceLifeCycleEventProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceLifeCycleEventProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceLifeCycleEventProperties.cs deleted file mode 100644 index cb931023ce50..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceLifeCycleEventProperties.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a device life cycle event (DeviceCreated, DeviceDeleted). - public partial class DeviceLifeCycleEventProperties - { - /// - /// 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 . - /// Information about the device twin, which is the cloud representation of application device metadata. - /// is null. - internal DeviceLifeCycleEventProperties(DeviceTwinInfo twin) - { - Argument.AssertNotNull(twin, nameof(twin)); - - Twin = twin; - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device twin, which is the cloud representation of application device metadata. - /// Keeps track of any properties unknown to the library. - internal DeviceLifeCycleEventProperties(string deviceId, string hubName, DeviceTwinInfo twin, IDictionary serializedAdditionalRawData) - { - DeviceId = deviceId; - HubName = hubName; - Twin = twin; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DeviceLifeCycleEventProperties() - { - } - - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - public string DeviceId { get; } - /// Name of the IoT Hub where the device was created or deleted. - public string HubName { get; } - /// Information about the device twin, which is the cloud representation of application device metadata. - public DeviceTwinInfo Twin { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTelemetryEventProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTelemetryEventProperties.Serialization.cs deleted file mode 100644 index 8c040868a652..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTelemetryEventProperties.Serialization.cs +++ /dev/null @@ -1,210 +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.Messaging.EventGrid.SystemEvents -{ - public partial class DeviceTelemetryEventProperties : 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(DeviceTelemetryEventProperties)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("body"u8); - writer.WriteStartObject(); - foreach (var item in Body) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - foreach (var item in Properties) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("systemProperties"u8); - writer.WriteStartObject(); - foreach (var item in SystemProperties) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - 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 - } - } - } - - DeviceTelemetryEventProperties 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(DeviceTelemetryEventProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDeviceTelemetryEventProperties(document.RootElement, options); - } - - internal static DeviceTelemetryEventProperties DeserializeDeviceTelemetryEventProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary body = default; - IReadOnlyDictionary properties = default; - IReadOnlyDictionary systemProperties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("body"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - body = dictionary; - continue; - } - if (property.NameEquals("properties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - properties = dictionary; - continue; - } - if (property.NameEquals("systemProperties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - systemProperties = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DeviceTelemetryEventProperties(body, properties, systemProperties, 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(DeviceTelemetryEventProperties)} does not support writing '{options.Format}' format."); - } - } - - DeviceTelemetryEventProperties 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 DeserializeDeviceTelemetryEventProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DeviceTelemetryEventProperties)} 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 DeviceTelemetryEventProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDeviceTelemetryEventProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTelemetryEventProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTelemetryEventProperties.cs deleted file mode 100644 index 8b142b83e7a6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTelemetryEventProperties.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a device telemetry event (DeviceTelemetry). - public partial class DeviceTelemetryEventProperties - { - /// - /// 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 content of the message from the device. - /// Application properties are user-defined strings that can be added to the message. These fields are optional. - /// System properties help identify contents and source of the messages. - /// , or is null. - internal DeviceTelemetryEventProperties(IReadOnlyDictionary body, IReadOnlyDictionary properties, IReadOnlyDictionary systemProperties) - { - Argument.AssertNotNull(body, nameof(body)); - Argument.AssertNotNull(properties, nameof(properties)); - Argument.AssertNotNull(systemProperties, nameof(systemProperties)); - - Body = body; - Properties = properties; - SystemProperties = systemProperties; - } - - /// Initializes a new instance of . - /// The content of the message from the device. - /// Application properties are user-defined strings that can be added to the message. These fields are optional. - /// System properties help identify contents and source of the messages. - /// Keeps track of any properties unknown to the library. - internal DeviceTelemetryEventProperties(IReadOnlyDictionary body, IReadOnlyDictionary properties, IReadOnlyDictionary systemProperties, IDictionary serializedAdditionalRawData) - { - Body = body; - Properties = properties; - SystemProperties = systemProperties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DeviceTelemetryEventProperties() - { - } - - /// - /// The content of the message from the device. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary Body { get; } - /// Application properties are user-defined strings that can be added to the message. These fields are optional. - public IReadOnlyDictionary Properties { get; } - /// System properties help identify contents and source of the messages. - public IReadOnlyDictionary SystemProperties { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfo.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfo.Serialization.cs deleted file mode 100644 index e5d3ab3d59e6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfo.Serialization.cs +++ /dev/null @@ -1,269 +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.Messaging.EventGrid.SystemEvents -{ - public partial class DeviceTwinInfo : 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(DeviceTwinInfo)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(AuthenticationType)) - { - writer.WritePropertyName("authenticationType"u8); - writer.WriteStringValue(AuthenticationType); - } - if (Optional.IsDefined(CloudToDeviceMessageCount)) - { - writer.WritePropertyName("cloudToDeviceMessageCount"u8); - writer.WriteNumberValue(CloudToDeviceMessageCount.Value); - } - if (Optional.IsDefined(ConnectionState)) - { - writer.WritePropertyName("connectionState"u8); - writer.WriteStringValue(ConnectionState); - } - if (Optional.IsDefined(DeviceId)) - { - writer.WritePropertyName("deviceId"u8); - writer.WriteStringValue(DeviceId); - } - if (Optional.IsDefined(Etag)) - { - writer.WritePropertyName("etag"u8); - writer.WriteStringValue(Etag); - } - if (Optional.IsDefined(LastActivityTime)) - { - writer.WritePropertyName("lastActivityTime"u8); - writer.WriteStringValue(LastActivityTime); - } - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties, options); - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - if (Optional.IsDefined(StatusUpdateTime)) - { - writer.WritePropertyName("statusUpdateTime"u8); - writer.WriteStringValue(StatusUpdateTime); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteNumberValue(Version.Value); - } - writer.WritePropertyName("x509Thumbprint"u8); - writer.WriteObjectValue(X509Thumbprint, 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 - } - } - } - - DeviceTwinInfo 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(DeviceTwinInfo)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDeviceTwinInfo(document.RootElement, options); - } - - internal static DeviceTwinInfo DeserializeDeviceTwinInfo(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string authenticationType = default; - float? cloudToDeviceMessageCount = default; - string connectionState = default; - string deviceId = default; - string etag = default; - string lastActivityTime = default; - DeviceTwinInfoProperties properties = default; - string status = default; - string statusUpdateTime = default; - float? version = default; - DeviceTwinInfoX509Thumbprint x509Thumbprint = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("authenticationType"u8)) - { - authenticationType = property.Value.GetString(); - continue; - } - if (property.NameEquals("cloudToDeviceMessageCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - cloudToDeviceMessageCount = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("connectionState"u8)) - { - connectionState = property.Value.GetString(); - continue; - } - if (property.NameEquals("deviceId"u8)) - { - deviceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - if (property.NameEquals("lastActivityTime"u8)) - { - lastActivityTime = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties"u8)) - { - properties = DeviceTwinInfoProperties.DeserializeDeviceTwinInfoProperties(property.Value, options); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("statusUpdateTime"u8)) - { - statusUpdateTime = property.Value.GetString(); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("x509Thumbprint"u8)) - { - x509Thumbprint = DeviceTwinInfoX509Thumbprint.DeserializeDeviceTwinInfoX509Thumbprint(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DeviceTwinInfo( - authenticationType, - cloudToDeviceMessageCount, - connectionState, - deviceId, - etag, - lastActivityTime, - properties, - status, - statusUpdateTime, - version, - x509Thumbprint, - 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(DeviceTwinInfo)} does not support writing '{options.Format}' format."); - } - } - - DeviceTwinInfo 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 DeserializeDeviceTwinInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DeviceTwinInfo)} 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 DeviceTwinInfo FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDeviceTwinInfo(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfo.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfo.cs deleted file mode 100644 index 8852435012fb..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfo.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Information about the device twin, which is the cloud representation of application device metadata. - public partial class DeviceTwinInfo - { - /// - /// 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 . - /// Properties JSON element. - /// The thumbprint is a unique value for the x509 certificate, commonly used to find a particular certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 algorithm, and does not physically exist in the certificate. - /// or is null. - internal DeviceTwinInfo(DeviceTwinInfoProperties properties, DeviceTwinInfoX509Thumbprint x509Thumbprint) - { - Argument.AssertNotNull(properties, nameof(properties)); - Argument.AssertNotNull(x509Thumbprint, nameof(x509Thumbprint)); - - Properties = properties; - X509Thumbprint = x509Thumbprint; - } - - /// Initializes a new instance of . - /// Authentication type used for this device: either SAS, SelfSigned, or CertificateAuthority. - /// Count of cloud to device messages sent to this device. - /// Whether the device is connected or disconnected. - /// The unique identifier of the device twin. - /// A piece of information that describes the content of the device twin. Each etag is guaranteed to be unique per device twin. - /// The ISO8601 timestamp of the last activity. - /// Properties JSON element. - /// Whether the device twin is enabled or disabled. - /// The ISO8601 timestamp of the last device twin status update. - /// An integer that is incremented by one each time the device twin is updated. - /// The thumbprint is a unique value for the x509 certificate, commonly used to find a particular certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 algorithm, and does not physically exist in the certificate. - /// Keeps track of any properties unknown to the library. - internal DeviceTwinInfo(string authenticationType, float? cloudToDeviceMessageCount, string connectionState, string deviceId, string etag, string lastActivityTime, DeviceTwinInfoProperties properties, string status, string statusUpdateTime, float? version, DeviceTwinInfoX509Thumbprint x509Thumbprint, IDictionary serializedAdditionalRawData) - { - AuthenticationType = authenticationType; - CloudToDeviceMessageCount = cloudToDeviceMessageCount; - ConnectionState = connectionState; - DeviceId = deviceId; - Etag = etag; - LastActivityTime = lastActivityTime; - Properties = properties; - Status = status; - StatusUpdateTime = statusUpdateTime; - Version = version; - X509Thumbprint = x509Thumbprint; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DeviceTwinInfo() - { - } - - /// Authentication type used for this device: either SAS, SelfSigned, or CertificateAuthority. - public string AuthenticationType { get; } - /// Count of cloud to device messages sent to this device. - public float? CloudToDeviceMessageCount { get; } - /// Whether the device is connected or disconnected. - public string ConnectionState { get; } - /// The unique identifier of the device twin. - public string DeviceId { get; } - /// A piece of information that describes the content of the device twin. Each etag is guaranteed to be unique per device twin. - public string Etag { get; } - /// The ISO8601 timestamp of the last activity. - public string LastActivityTime { get; } - /// Properties JSON element. - public DeviceTwinInfoProperties Properties { get; } - /// Whether the device twin is enabled or disabled. - public string Status { get; } - /// The ISO8601 timestamp of the last device twin status update. - public string StatusUpdateTime { get; } - /// An integer that is incremented by one each time the device twin is updated. - public float? Version { get; } - /// The thumbprint is a unique value for the x509 certificate, commonly used to find a particular certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 algorithm, and does not physically exist in the certificate. - public DeviceTwinInfoX509Thumbprint X509Thumbprint { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoProperties.Serialization.cs deleted file mode 100644 index 6cea8bc485d0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoProperties.Serialization.cs +++ /dev/null @@ -1,150 +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.Messaging.EventGrid.SystemEvents -{ - public partial class DeviceTwinInfoProperties : 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(DeviceTwinInfoProperties)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("desired"u8); - writer.WriteObjectValue(Desired, options); - writer.WritePropertyName("reported"u8); - writer.WriteObjectValue(Reported, 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 - } - } - } - - DeviceTwinInfoProperties 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(DeviceTwinInfoProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDeviceTwinInfoProperties(document.RootElement, options); - } - - internal static DeviceTwinInfoProperties DeserializeDeviceTwinInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DeviceTwinProperties desired = default; - DeviceTwinProperties reported = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("desired"u8)) - { - desired = DeviceTwinProperties.DeserializeDeviceTwinProperties(property.Value, options); - continue; - } - if (property.NameEquals("reported"u8)) - { - reported = DeviceTwinProperties.DeserializeDeviceTwinProperties(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DeviceTwinInfoProperties(desired, reported, 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(DeviceTwinInfoProperties)} does not support writing '{options.Format}' format."); - } - } - - DeviceTwinInfoProperties 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 DeserializeDeviceTwinInfoProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DeviceTwinInfoProperties)} 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 DeviceTwinInfoProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDeviceTwinInfoProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoProperties.cs deleted file mode 100644 index 1d970974ba3d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoProperties.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.Messaging.EventGrid.SystemEvents -{ - /// Properties JSON element. - public partial class DeviceTwinInfoProperties - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// A portion of the properties that can be written only by the application back-end, and read by the device. - /// A portion of the properties that can be written only by the device, and read by the application back-end. - /// or is null. - internal DeviceTwinInfoProperties(DeviceTwinProperties desired, DeviceTwinProperties reported) - { - Argument.AssertNotNull(desired, nameof(desired)); - Argument.AssertNotNull(reported, nameof(reported)); - - Desired = desired; - Reported = reported; - } - - /// Initializes a new instance of . - /// A portion of the properties that can be written only by the application back-end, and read by the device. - /// A portion of the properties that can be written only by the device, and read by the application back-end. - /// Keeps track of any properties unknown to the library. - internal DeviceTwinInfoProperties(DeviceTwinProperties desired, DeviceTwinProperties reported, IDictionary serializedAdditionalRawData) - { - Desired = desired; - Reported = reported; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DeviceTwinInfoProperties() - { - } - - /// A portion of the properties that can be written only by the application back-end, and read by the device. - public DeviceTwinProperties Desired { get; } - /// A portion of the properties that can be written only by the device, and read by the application back-end. - public DeviceTwinProperties Reported { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoX509Thumbprint.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoX509Thumbprint.Serialization.cs deleted file mode 100644 index c239f0edb6a5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoX509Thumbprint.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.Messaging.EventGrid.SystemEvents -{ - public partial class DeviceTwinInfoX509Thumbprint : 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(DeviceTwinInfoX509Thumbprint)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(PrimaryThumbprint)) - { - writer.WritePropertyName("primaryThumbprint"u8); - writer.WriteStringValue(PrimaryThumbprint); - } - if (Optional.IsDefined(SecondaryThumbprint)) - { - writer.WritePropertyName("secondaryThumbprint"u8); - writer.WriteStringValue(SecondaryThumbprint); - } - 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 - } - } - } - - DeviceTwinInfoX509Thumbprint 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(DeviceTwinInfoX509Thumbprint)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDeviceTwinInfoX509Thumbprint(document.RootElement, options); - } - - internal static DeviceTwinInfoX509Thumbprint DeserializeDeviceTwinInfoX509Thumbprint(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string primaryThumbprint = default; - string secondaryThumbprint = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("primaryThumbprint"u8)) - { - primaryThumbprint = property.Value.GetString(); - continue; - } - if (property.NameEquals("secondaryThumbprint"u8)) - { - secondaryThumbprint = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DeviceTwinInfoX509Thumbprint(primaryThumbprint, secondaryThumbprint, 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(DeviceTwinInfoX509Thumbprint)} does not support writing '{options.Format}' format."); - } - } - - DeviceTwinInfoX509Thumbprint 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 DeserializeDeviceTwinInfoX509Thumbprint(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DeviceTwinInfoX509Thumbprint)} 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 DeviceTwinInfoX509Thumbprint FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDeviceTwinInfoX509Thumbprint(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoX509Thumbprint.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoX509Thumbprint.cs deleted file mode 100644 index f28b11657691..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinInfoX509Thumbprint.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.Messaging.EventGrid.SystemEvents -{ - /// The thumbprint is a unique value for the x509 certificate, commonly used to find a particular certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 algorithm, and does not physically exist in the certificate. - public partial class DeviceTwinInfoX509Thumbprint - { - /// - /// 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 DeviceTwinInfoX509Thumbprint() - { - } - - /// Initializes a new instance of . - /// Primary thumbprint for the x509 certificate. - /// Secondary thumbprint for the x509 certificate. - /// Keeps track of any properties unknown to the library. - internal DeviceTwinInfoX509Thumbprint(string primaryThumbprint, string secondaryThumbprint, IDictionary serializedAdditionalRawData) - { - PrimaryThumbprint = primaryThumbprint; - SecondaryThumbprint = secondaryThumbprint; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Primary thumbprint for the x509 certificate. - public string PrimaryThumbprint { get; } - /// Secondary thumbprint for the x509 certificate. - public string SecondaryThumbprint { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinMetadata.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinMetadata.Serialization.cs deleted file mode 100644 index 52a1525e9cec..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinMetadata.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.Messaging.EventGrid.SystemEvents -{ - public partial class DeviceTwinMetadata : 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(DeviceTwinMetadata)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(LastUpdated)) - { - writer.WritePropertyName("lastUpdated"u8); - writer.WriteStringValue(LastUpdated); - } - 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 - } - } - } - - DeviceTwinMetadata 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(DeviceTwinMetadata)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDeviceTwinMetadata(document.RootElement, options); - } - - internal static DeviceTwinMetadata DeserializeDeviceTwinMetadata(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string lastUpdated = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("lastUpdated"u8)) - { - lastUpdated = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DeviceTwinMetadata(lastUpdated, 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(DeviceTwinMetadata)} does not support writing '{options.Format}' format."); - } - } - - DeviceTwinMetadata 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 DeserializeDeviceTwinMetadata(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DeviceTwinMetadata)} 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 DeviceTwinMetadata FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDeviceTwinMetadata(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinMetadata.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinMetadata.cs deleted file mode 100644 index f9e2218438b6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinMetadata.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.Messaging.EventGrid.SystemEvents -{ - /// Metadata information for the properties JSON document. - public partial class DeviceTwinMetadata - { - /// - /// 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 DeviceTwinMetadata() - { - } - - /// Initializes a new instance of . - /// The ISO8601 timestamp of the last time the properties were updated. - /// Keeps track of any properties unknown to the library. - internal DeviceTwinMetadata(string lastUpdated, IDictionary serializedAdditionalRawData) - { - LastUpdated = lastUpdated; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The ISO8601 timestamp of the last time the properties were updated. - public string LastUpdated { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinProperties.Serialization.cs deleted file mode 100644 index 1ce535a74966..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinProperties.Serialization.cs +++ /dev/null @@ -1,157 +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.Messaging.EventGrid.SystemEvents -{ - public partial class DeviceTwinProperties : 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(DeviceTwinProperties)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("metadata"u8); - writer.WriteObjectValue(Metadata, options); - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteNumberValue(Version.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - DeviceTwinProperties 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(DeviceTwinProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDeviceTwinProperties(document.RootElement, options); - } - - internal static DeviceTwinProperties DeserializeDeviceTwinProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DeviceTwinMetadata metadata = default; - float? version = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("metadata"u8)) - { - metadata = DeviceTwinMetadata.DeserializeDeviceTwinMetadata(property.Value, options); - continue; - } - if (property.NameEquals("version"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - version = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DeviceTwinProperties(metadata, version, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(DeviceTwinProperties)} does not support writing '{options.Format}' format."); - } - } - - DeviceTwinProperties 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 DeserializeDeviceTwinProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DeviceTwinProperties)} 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 DeviceTwinProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDeviceTwinProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinProperties.cs deleted file mode 100644 index c78e2695137a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/DeviceTwinProperties.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// A portion of the properties that can be written only by the application back-end, and read by the device. - public partial class DeviceTwinProperties - { - /// - /// 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 . - /// Metadata information for the properties JSON document. - /// is null. - internal DeviceTwinProperties(DeviceTwinMetadata metadata) - { - Argument.AssertNotNull(metadata, nameof(metadata)); - - Metadata = metadata; - } - - /// Initializes a new instance of . - /// Metadata information for the properties JSON document. - /// Version of device twin properties. - /// Keeps track of any properties unknown to the library. - internal DeviceTwinProperties(DeviceTwinMetadata metadata, float? version, IDictionary serializedAdditionalRawData) - { - Metadata = metadata; - Version = version; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DeviceTwinProperties() - { - } - - /// Metadata information for the properties JSON document. - public DeviceTwinMetadata Metadata { get; } - /// Version of device twin properties. - public float? Version { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientCreatedOrUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientCreatedOrUpdatedEventData.Serialization.cs deleted file mode 100644 index 6ca3505ba0e6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientCreatedOrUpdatedEventData.Serialization.cs +++ /dev/null @@ -1,189 +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.Messaging.EventGrid.SystemEvents -{ - public partial class EventGridMQTTClientCreatedOrUpdatedEventData : 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(EventGridMQTTClientCreatedOrUpdatedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("state"u8); - writer.WriteStringValue(State.ToString()); - writer.WritePropertyName("createdOn"u8); - writer.WriteStringValue(CreatedOn, "O"); - writer.WritePropertyName("updatedOn"u8); - writer.WriteStringValue(UpdatedOn, "O"); - writer.WritePropertyName("attributes"u8); - writer.WriteStartObject(); - foreach (var item in Attributes) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - - EventGridMQTTClientCreatedOrUpdatedEventData 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(EventGridMQTTClientCreatedOrUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEventGridMQTTClientCreatedOrUpdatedEventData(document.RootElement, options); - } - - internal static EventGridMQTTClientCreatedOrUpdatedEventData DeserializeEventGridMQTTClientCreatedOrUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - EventGridMQTTClientState state = default; - DateTimeOffset createdOn = default; - DateTimeOffset updatedOn = default; - IReadOnlyDictionary attributes = default; - string clientAuthenticationName = default; - string clientName = default; - string namespaceName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("state"u8)) - { - state = new EventGridMQTTClientState(property.Value.GetString()); - continue; - } - if (property.NameEquals("createdOn"u8)) - { - createdOn = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("updatedOn"u8)) - { - updatedOn = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("attributes"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - attributes = dictionary; - continue; - } - if (property.NameEquals("clientAuthenticationName"u8)) - { - clientAuthenticationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientName"u8)) - { - clientName = property.Value.GetString(); - continue; - } - if (property.NameEquals("namespaceName"u8)) - { - namespaceName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new EventGridMQTTClientCreatedOrUpdatedEventData( - clientAuthenticationName, - clientName, - namespaceName, - serializedAdditionalRawData, - state, - createdOn, - updatedOn, - attributes); - } - - 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(EventGridMQTTClientCreatedOrUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - EventGridMQTTClientCreatedOrUpdatedEventData 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 DeserializeEventGridMQTTClientCreatedOrUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(EventGridMQTTClientCreatedOrUpdatedEventData)} 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 EventGridMQTTClientCreatedOrUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEventGridMQTTClientCreatedOrUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientCreatedOrUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientCreatedOrUpdatedEventData.cs deleted file mode 100644 index dde0c575b475..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientCreatedOrUpdatedEventData.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Event data for Microsoft.EventGrid.MQTTClientCreatedOrUpdated event. - public partial class EventGridMQTTClientCreatedOrUpdatedEventData : EventGridMQTTClientEventData - { - /// Initializes a new instance of . - /// Configured state of the client. The value could be Enabled or Disabled. - /// Time the client resource is created based on the provider's UTC time. - /// - /// Time the client resource is last updated based on the provider's UTC time. If - /// the client resource was never updated, this value is identical to the value of - /// the 'createdOn' property. - /// - /// The key-value attributes that are assigned to the client resource. - /// is null. - internal EventGridMQTTClientCreatedOrUpdatedEventData(EventGridMQTTClientState state, DateTimeOffset createdOn, DateTimeOffset updatedOn, IReadOnlyDictionary attributes) - { - Argument.AssertNotNull(attributes, nameof(attributes)); - - State = state; - CreatedOn = createdOn; - UpdatedOn = updatedOn; - Attributes = attributes; - } - - /// Initializes a new instance of . - /// - /// Unique identifier for the MQTT client that the client presents to the service - /// for authentication. This case-sensitive string can be up to 128 characters - /// long, and supports UTF-8 characters. - /// - /// Name of the client resource in the Event Grid namespace. - /// Name of the Event Grid namespace where the MQTT client was created or updated. - /// Keeps track of any properties unknown to the library. - /// Configured state of the client. The value could be Enabled or Disabled. - /// Time the client resource is created based on the provider's UTC time. - /// - /// Time the client resource is last updated based on the provider's UTC time. If - /// the client resource was never updated, this value is identical to the value of - /// the 'createdOn' property. - /// - /// The key-value attributes that are assigned to the client resource. - internal EventGridMQTTClientCreatedOrUpdatedEventData(string clientAuthenticationName, string clientName, string namespaceName, IDictionary serializedAdditionalRawData, EventGridMQTTClientState state, DateTimeOffset createdOn, DateTimeOffset updatedOn, IReadOnlyDictionary attributes) : base(clientAuthenticationName, clientName, namespaceName, serializedAdditionalRawData) - { - State = state; - CreatedOn = createdOn; - UpdatedOn = updatedOn; - Attributes = attributes; - } - - /// Initializes a new instance of for deserialization. - internal EventGridMQTTClientCreatedOrUpdatedEventData() - { - } - - /// Configured state of the client. The value could be Enabled or Disabled. - public EventGridMQTTClientState State { get; } - /// Time the client resource is created based on the provider's UTC time. - public DateTimeOffset CreatedOn { get; } - /// - /// Time the client resource is last updated based on the provider's UTC time. If - /// the client resource was never updated, this value is identical to the value of - /// the 'createdOn' property. - /// - public DateTimeOffset UpdatedOn { get; } - /// The key-value attributes that are assigned to the client resource. - public IReadOnlyDictionary Attributes { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientDeletedEventData.Serialization.cs deleted file mode 100644 index 7e81e11c1acd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class EventGridMQTTClientDeletedEventData : 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(EventGridMQTTClientDeletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - EventGridMQTTClientDeletedEventData 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(EventGridMQTTClientDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEventGridMQTTClientDeletedEventData(document.RootElement, options); - } - - internal static EventGridMQTTClientDeletedEventData DeserializeEventGridMQTTClientDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string clientAuthenticationName = default; - string clientName = default; - string namespaceName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("clientAuthenticationName"u8)) - { - clientAuthenticationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientName"u8)) - { - clientName = property.Value.GetString(); - continue; - } - if (property.NameEquals("namespaceName"u8)) - { - namespaceName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new EventGridMQTTClientDeletedEventData(clientAuthenticationName, clientName, namespaceName, 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(EventGridMQTTClientDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - EventGridMQTTClientDeletedEventData 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 DeserializeEventGridMQTTClientDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(EventGridMQTTClientDeletedEventData)} 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 EventGridMQTTClientDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEventGridMQTTClientDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientDeletedEventData.cs deleted file mode 100644 index a5660854989a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Event data for Microsoft.EventGrid.MQTTClientDeleted event. - public partial class EventGridMQTTClientDeletedEventData : EventGridMQTTClientEventData - { - /// Initializes a new instance of . - internal EventGridMQTTClientDeletedEventData() - { - } - - /// Initializes a new instance of . - /// - /// Unique identifier for the MQTT client that the client presents to the service - /// for authentication. This case-sensitive string can be up to 128 characters - /// long, and supports UTF-8 characters. - /// - /// Name of the client resource in the Event Grid namespace. - /// Name of the Event Grid namespace where the MQTT client was created or updated. - /// Keeps track of any properties unknown to the library. - internal EventGridMQTTClientDeletedEventData(string clientAuthenticationName, string clientName, string namespaceName, IDictionary serializedAdditionalRawData) : base(clientAuthenticationName, clientName, namespaceName, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientDisconnectionReason.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientDisconnectionReason.cs deleted file mode 100644 index a8e88d5b0c30..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientDisconnectionReason.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.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// EventGrid MQTT Client Disconnection Reason. - public readonly partial struct EventGridMQTTClientDisconnectionReason : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EventGridMQTTClientDisconnectionReason(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ClientAuthenticationErrorValue = "ClientAuthenticationError"; - private const string ClientAuthorizationErrorValue = "ClientAuthorizationError"; - private const string ClientErrorValue = "ClientError"; - private const string ClientInitiatedDisconnectValue = "ClientInitiatedDisconnect"; - private const string ConnectionLostValue = "ConnectionLost"; - private const string IpForbiddenValue = "IpForbidden"; - private const string QuotaExceededValue = "QuotaExceeded"; - private const string ServerErrorValue = "ServerError"; - private const string ServerInitiatedDisconnectValue = "ServerInitiatedDisconnect"; - private const string SessionOverflowValue = "SessionOverflow"; - private const string SessionTakenOverValue = "SessionTakenOver"; - - /// The client got disconnected for any authentication reasons (for example, certificate expired, client got disabled, or client configuration changed). - public static EventGridMQTTClientDisconnectionReason ClientAuthenticationError { get; } = new EventGridMQTTClientDisconnectionReason(ClientAuthenticationErrorValue); - /// The client got disconnected for any authorization reasons (for example, because of a change in the configuration of topic spaces, permission bindings, or client groups). - public static EventGridMQTTClientDisconnectionReason ClientAuthorizationError { get; } = new EventGridMQTTClientDisconnectionReason(ClientAuthorizationErrorValue); - /// The client sent a bad request or used one of the unsupported features that resulted in a connection termination by the service. - public static EventGridMQTTClientDisconnectionReason ClientError { get; } = new EventGridMQTTClientDisconnectionReason(ClientErrorValue); - /// The client initiated a graceful disconnect through a DISCONNECT packet for MQTT or a close frame for MQTT over WebSocket. - public static EventGridMQTTClientDisconnectionReason ClientInitiatedDisconnect { get; } = new EventGridMQTTClientDisconnectionReason(ClientInitiatedDisconnectValue); - /// The client-server connection is lost. (EXCHANGE ONLINE PROTECTION). - public static EventGridMQTTClientDisconnectionReason ConnectionLost { get; } = new EventGridMQTTClientDisconnectionReason(ConnectionLostValue); - /// The client's IP address is blocked by IP filter or Private links configuration. - public static EventGridMQTTClientDisconnectionReason IpForbidden { get; } = new EventGridMQTTClientDisconnectionReason(IpForbiddenValue); - /// The client exceeded one or more of the throttling limits that resulted in a connection termination by the service. - public static EventGridMQTTClientDisconnectionReason QuotaExceeded { get; } = new EventGridMQTTClientDisconnectionReason(QuotaExceededValue); - /// The connection got terminated due to an unexpected server error. - public static EventGridMQTTClientDisconnectionReason ServerError { get; } = new EventGridMQTTClientDisconnectionReason(ServerErrorValue); - /// The server initiates a graceful disconnect for any operational reason. - public static EventGridMQTTClientDisconnectionReason ServerInitiatedDisconnect { get; } = new EventGridMQTTClientDisconnectionReason(ServerInitiatedDisconnectValue); - /// The client's queue for unacknowledged QoS1 messages reached its limit, which resulted in a connection termination by the server. - public static EventGridMQTTClientDisconnectionReason SessionOverflow { get; } = new EventGridMQTTClientDisconnectionReason(SessionOverflowValue); - /// The client reconnected with the same authentication name, which resulted in the termination of the previous connection. - public static EventGridMQTTClientDisconnectionReason SessionTakenOver { get; } = new EventGridMQTTClientDisconnectionReason(SessionTakenOverValue); - /// Determines if two values are the same. - public static bool operator ==(EventGridMQTTClientDisconnectionReason left, EventGridMQTTClientDisconnectionReason right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EventGridMQTTClientDisconnectionReason left, EventGridMQTTClientDisconnectionReason right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EventGridMQTTClientDisconnectionReason(string value) => new EventGridMQTTClientDisconnectionReason(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EventGridMQTTClientDisconnectionReason other && Equals(other); - /// - public bool Equals(EventGridMQTTClientDisconnectionReason 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientEventData.Serialization.cs deleted file mode 100644 index eac1ae874e9f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientEventData.Serialization.cs +++ /dev/null @@ -1,167 +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.Messaging.EventGrid.SystemEvents -{ - public partial class EventGridMQTTClientEventData : 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(EventGridMQTTClientEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ClientAuthenticationName)) - { - writer.WritePropertyName("clientAuthenticationName"u8); - writer.WriteStringValue(ClientAuthenticationName); - } - if (Optional.IsDefined(ClientName)) - { - writer.WritePropertyName("clientName"u8); - writer.WriteStringValue(ClientName); - } - if (Optional.IsDefined(NamespaceName)) - { - writer.WritePropertyName("namespaceName"u8); - writer.WriteStringValue(NamespaceName); - } - 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 - } - } - } - - EventGridMQTTClientEventData 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(EventGridMQTTClientEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEventGridMQTTClientEventData(document.RootElement, options); - } - - internal static EventGridMQTTClientEventData DeserializeEventGridMQTTClientEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string clientAuthenticationName = default; - string clientName = default; - string namespaceName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("clientAuthenticationName"u8)) - { - clientAuthenticationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientName"u8)) - { - clientName = property.Value.GetString(); - continue; - } - if (property.NameEquals("namespaceName"u8)) - { - namespaceName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new EventGridMQTTClientEventData(clientAuthenticationName, clientName, namespaceName, 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(EventGridMQTTClientEventData)} does not support writing '{options.Format}' format."); - } - } - - EventGridMQTTClientEventData 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 DeserializeEventGridMQTTClientEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(EventGridMQTTClientEventData)} 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 EventGridMQTTClientEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEventGridMQTTClientEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientEventData.cs deleted file mode 100644 index 8c69eb51fec2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientEventData.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for MQTT Client state changes. - public partial class EventGridMQTTClientEventData - { - /// - /// 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 . - internal EventGridMQTTClientEventData() - { - } - - /// Initializes a new instance of . - /// - /// Unique identifier for the MQTT client that the client presents to the service - /// for authentication. This case-sensitive string can be up to 128 characters - /// long, and supports UTF-8 characters. - /// - /// Name of the client resource in the Event Grid namespace. - /// Name of the Event Grid namespace where the MQTT client was created or updated. - /// Keeps track of any properties unknown to the library. - internal EventGridMQTTClientEventData(string clientAuthenticationName, string clientName, string namespaceName, IDictionary serializedAdditionalRawData) - { - ClientAuthenticationName = clientAuthenticationName; - ClientName = clientName; - NamespaceName = namespaceName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// - /// Unique identifier for the MQTT client that the client presents to the service - /// for authentication. This case-sensitive string can be up to 128 characters - /// long, and supports UTF-8 characters. - /// - public string ClientAuthenticationName { get; } - /// Name of the client resource in the Event Grid namespace. - public string ClientName { get; } - /// Name of the Event Grid namespace where the MQTT client was created or updated. - public string NamespaceName { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionConnectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionConnectedEventData.Serialization.cs deleted file mode 100644 index 79241a95385d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionConnectedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class EventGridMQTTClientSessionConnectedEventData : 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(EventGridMQTTClientSessionConnectedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(ClientSessionName)) - { - writer.WritePropertyName("clientSessionName"u8); - writer.WriteStringValue(ClientSessionName); - } - if (Optional.IsDefined(SequenceNumber)) - { - writer.WritePropertyName("sequenceNumber"u8); - writer.WriteNumberValue(SequenceNumber.Value); - } - } - - EventGridMQTTClientSessionConnectedEventData 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(EventGridMQTTClientSessionConnectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEventGridMQTTClientSessionConnectedEventData(document.RootElement, options); - } - - internal static EventGridMQTTClientSessionConnectedEventData DeserializeEventGridMQTTClientSessionConnectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string clientSessionName = default; - long? sequenceNumber = default; - string clientAuthenticationName = default; - string clientName = default; - string namespaceName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("clientSessionName"u8)) - { - clientSessionName = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequenceNumber"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sequenceNumber = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("clientAuthenticationName"u8)) - { - clientAuthenticationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientName"u8)) - { - clientName = property.Value.GetString(); - continue; - } - if (property.NameEquals("namespaceName"u8)) - { - namespaceName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new EventGridMQTTClientSessionConnectedEventData( - clientAuthenticationName, - clientName, - namespaceName, - serializedAdditionalRawData, - clientSessionName, - sequenceNumber); - } - - 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(EventGridMQTTClientSessionConnectedEventData)} does not support writing '{options.Format}' format."); - } - } - - EventGridMQTTClientSessionConnectedEventData 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 DeserializeEventGridMQTTClientSessionConnectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(EventGridMQTTClientSessionConnectedEventData)} 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 EventGridMQTTClientSessionConnectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEventGridMQTTClientSessionConnectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionConnectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionConnectedEventData.cs deleted file mode 100644 index 3a8dcde09042..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionConnectedEventData.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Event data for Microsoft.EventGrid.MQTTClientSessionConnected event. - public partial class EventGridMQTTClientSessionConnectedEventData : EventGridMQTTClientEventData - { - /// Initializes a new instance of . - internal EventGridMQTTClientSessionConnectedEventData() - { - } - - /// Initializes a new instance of . - /// - /// Unique identifier for the MQTT client that the client presents to the service - /// for authentication. This case-sensitive string can be up to 128 characters - /// long, and supports UTF-8 characters. - /// - /// Name of the client resource in the Event Grid namespace. - /// Name of the Event Grid namespace where the MQTT client was created or updated. - /// Keeps track of any properties unknown to the library. - /// - /// Unique identifier for the MQTT client's session. This case-sensitive string can - /// be up to 128 characters long, and supports UTF-8 characters. - /// - /// - /// A number that helps indicate order of MQTT client session connected or - /// disconnected events. Latest event will have a sequence number that is higher - /// than the previous event. - /// - internal EventGridMQTTClientSessionConnectedEventData(string clientAuthenticationName, string clientName, string namespaceName, IDictionary serializedAdditionalRawData, string clientSessionName, long? sequenceNumber) : base(clientAuthenticationName, clientName, namespaceName, serializedAdditionalRawData) - { - ClientSessionName = clientSessionName; - SequenceNumber = sequenceNumber; - } - - /// - /// Unique identifier for the MQTT client's session. This case-sensitive string can - /// be up to 128 characters long, and supports UTF-8 characters. - /// - public string ClientSessionName { get; } - /// - /// A number that helps indicate order of MQTT client session connected or - /// disconnected events. Latest event will have a sequence number that is higher - /// than the previous event. - /// - public long? SequenceNumber { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionDisconnectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionDisconnectedEventData.Serialization.cs deleted file mode 100644 index b0c2ea8c13df..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionDisconnectedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class EventGridMQTTClientSessionDisconnectedEventData : 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(EventGridMQTTClientSessionDisconnectedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(ClientSessionName)) - { - writer.WritePropertyName("clientSessionName"u8); - writer.WriteStringValue(ClientSessionName); - } - if (Optional.IsDefined(SequenceNumber)) - { - writer.WritePropertyName("sequenceNumber"u8); - writer.WriteNumberValue(SequenceNumber.Value); - } - writer.WritePropertyName("disconnectionReason"u8); - writer.WriteStringValue(DisconnectionReason.ToString()); - } - - EventGridMQTTClientSessionDisconnectedEventData 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(EventGridMQTTClientSessionDisconnectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEventGridMQTTClientSessionDisconnectedEventData(document.RootElement, options); - } - - internal static EventGridMQTTClientSessionDisconnectedEventData DeserializeEventGridMQTTClientSessionDisconnectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string clientSessionName = default; - long? sequenceNumber = default; - EventGridMQTTClientDisconnectionReason disconnectionReason = default; - string clientAuthenticationName = default; - string clientName = default; - string namespaceName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("clientSessionName"u8)) - { - clientSessionName = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequenceNumber"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sequenceNumber = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("disconnectionReason"u8)) - { - disconnectionReason = new EventGridMQTTClientDisconnectionReason(property.Value.GetString()); - continue; - } - if (property.NameEquals("clientAuthenticationName"u8)) - { - clientAuthenticationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientName"u8)) - { - clientName = property.Value.GetString(); - continue; - } - if (property.NameEquals("namespaceName"u8)) - { - namespaceName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new EventGridMQTTClientSessionDisconnectedEventData( - clientAuthenticationName, - clientName, - namespaceName, - serializedAdditionalRawData, - clientSessionName, - sequenceNumber, - disconnectionReason); - } - - 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(EventGridMQTTClientSessionDisconnectedEventData)} does not support writing '{options.Format}' format."); - } - } - - EventGridMQTTClientSessionDisconnectedEventData 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 DeserializeEventGridMQTTClientSessionDisconnectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(EventGridMQTTClientSessionDisconnectedEventData)} 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 EventGridMQTTClientSessionDisconnectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEventGridMQTTClientSessionDisconnectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionDisconnectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionDisconnectedEventData.cs deleted file mode 100644 index 2f9fcb7f6158..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientSessionDisconnectedEventData.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Event data for Microsoft.EventGrid.MQTTClientSessionDisconnected event. - public partial class EventGridMQTTClientSessionDisconnectedEventData : EventGridMQTTClientEventData - { - /// Initializes a new instance of . - /// - /// Reason for the disconnection of the MQTT client's session. The value could be - /// one of the values in the disconnection reasons table. - /// - internal EventGridMQTTClientSessionDisconnectedEventData(EventGridMQTTClientDisconnectionReason disconnectionReason) - { - DisconnectionReason = disconnectionReason; - } - - /// Initializes a new instance of . - /// - /// Unique identifier for the MQTT client that the client presents to the service - /// for authentication. This case-sensitive string can be up to 128 characters - /// long, and supports UTF-8 characters. - /// - /// Name of the client resource in the Event Grid namespace. - /// Name of the Event Grid namespace where the MQTT client was created or updated. - /// Keeps track of any properties unknown to the library. - /// - /// Unique identifier for the MQTT client's session. This case-sensitive string can - /// be up to 128 characters long, and supports UTF-8 characters. - /// - /// - /// A number that helps indicate order of MQTT client session connected or - /// disconnected events. Latest event will have a sequence number that is higher - /// than the previous event. - /// - /// - /// Reason for the disconnection of the MQTT client's session. The value could be - /// one of the values in the disconnection reasons table. - /// - internal EventGridMQTTClientSessionDisconnectedEventData(string clientAuthenticationName, string clientName, string namespaceName, IDictionary serializedAdditionalRawData, string clientSessionName, long? sequenceNumber, EventGridMQTTClientDisconnectionReason disconnectionReason) : base(clientAuthenticationName, clientName, namespaceName, serializedAdditionalRawData) - { - ClientSessionName = clientSessionName; - SequenceNumber = sequenceNumber; - DisconnectionReason = disconnectionReason; - } - - /// Initializes a new instance of for deserialization. - internal EventGridMQTTClientSessionDisconnectedEventData() - { - } - - /// - /// Unique identifier for the MQTT client's session. This case-sensitive string can - /// be up to 128 characters long, and supports UTF-8 characters. - /// - public string ClientSessionName { get; } - /// - /// A number that helps indicate order of MQTT client session connected or - /// disconnected events. Latest event will have a sequence number that is higher - /// than the previous event. - /// - public long? SequenceNumber { get; } - /// - /// Reason for the disconnection of the MQTT client's session. The value could be - /// one of the values in the disconnection reasons table. - /// - public EventGridMQTTClientDisconnectionReason DisconnectionReason { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientState.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientState.cs deleted file mode 100644 index 7d2907bb7bd0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridMQTTClientState.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// EventGrid MQTT Client State. - public readonly partial struct EventGridMQTTClientState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EventGridMQTTClientState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// Enabled. - public static EventGridMQTTClientState Enabled { get; } = new EventGridMQTTClientState(EnabledValue); - /// Disabled. - public static EventGridMQTTClientState Disabled { get; } = new EventGridMQTTClientState(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(EventGridMQTTClientState left, EventGridMQTTClientState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EventGridMQTTClientState left, EventGridMQTTClientState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EventGridMQTTClientState(string value) => new EventGridMQTTClientState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EventGridMQTTClientState other && Equals(other); - /// - public bool Equals(EventGridMQTTClientState 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridSystemEventsModelFactory.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridSystemEventsModelFactory.cs deleted file mode 100644 index e700c3d0b9a1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventGridSystemEventsModelFactory.cs +++ /dev/null @@ -1,5058 +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.Messaging.EventGrid.SystemEvents -{ - /// Model factory for models. - public static partial class EventGridSystemEventsModelFactory - { - /// Initializes a new instance of . - /// API definition title. - /// API definition description. - /// API definition specification. - /// A new instance for mocking. - public static ApiCenterApiDefinitionAddedEventData ApiCenterApiDefinitionAddedEventData(string title = null, string description = null, ApiCenterApiSpecification specification = null) - { - return new ApiCenterApiDefinitionAddedEventData(title, description, specification, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Specification name. - /// Specification version. - /// A new instance for mocking. - public static ApiCenterApiSpecification ApiCenterApiSpecification(string name = null, string version = null) - { - return new ApiCenterApiSpecification(name, version, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// API definition title. - /// API definition description. - /// API definition specification. - /// A new instance for mocking. - public static ApiCenterApiDefinitionUpdatedEventData ApiCenterApiDefinitionUpdatedEventData(string title = null, string description = null, ApiCenterApiSpecification specification = null) - { - return new ApiCenterApiDefinitionUpdatedEventData(title, description, specification, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementUserCreatedEventData ApiManagementUserCreatedEventData(string resourceUri = null) - { - return new ApiManagementUserCreatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementUserUpdatedEventData ApiManagementUserUpdatedEventData(string resourceUri = null) - { - return new ApiManagementUserUpdatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementUserDeletedEventData ApiManagementUserDeletedEventData(string resourceUri = null) - { - return new ApiManagementUserDeletedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementSubscriptionCreatedEventData ApiManagementSubscriptionCreatedEventData(string resourceUri = null) - { - return new ApiManagementSubscriptionCreatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementSubscriptionUpdatedEventData ApiManagementSubscriptionUpdatedEventData(string resourceUri = null) - { - return new ApiManagementSubscriptionUpdatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementSubscriptionDeletedEventData ApiManagementSubscriptionDeletedEventData(string resourceUri = null) - { - return new ApiManagementSubscriptionDeletedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementProductCreatedEventData ApiManagementProductCreatedEventData(string resourceUri = null) - { - return new ApiManagementProductCreatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementProductUpdatedEventData ApiManagementProductUpdatedEventData(string resourceUri = null) - { - return new ApiManagementProductUpdatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementProductDeletedEventData ApiManagementProductDeletedEventData(string resourceUri = null) - { - return new ApiManagementProductDeletedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementApiCreatedEventData ApiManagementApiCreatedEventData(string resourceUri = null) - { - return new ApiManagementApiCreatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementApiUpdatedEventData ApiManagementApiUpdatedEventData(string resourceUri = null) - { - return new ApiManagementApiUpdatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementApiDeletedEventData ApiManagementApiDeletedEventData(string resourceUri = null) - { - return new ApiManagementApiDeletedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementApiReleaseCreatedEventData ApiManagementApiReleaseCreatedEventData(string resourceUri = null) - { - return new ApiManagementApiReleaseCreatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementApiReleaseUpdatedEventData ApiManagementApiReleaseUpdatedEventData(string resourceUri = null) - { - return new ApiManagementApiReleaseUpdatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementApiReleaseDeletedEventData ApiManagementApiReleaseDeletedEventData(string resourceUri = null) - { - return new ApiManagementApiReleaseDeletedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementGatewayCreatedEventData ApiManagementGatewayCreatedEventData(string resourceUri = null) - { - return new ApiManagementGatewayCreatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementGatewayUpdatedEventData ApiManagementGatewayUpdatedEventData(string resourceUri = null) - { - return new ApiManagementGatewayUpdatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementGatewayDeletedEventData ApiManagementGatewayDeletedEventData(string resourceUri = null) - { - return new ApiManagementGatewayDeletedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/hostnameConfigurations/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementGatewayHostnameConfigurationCreatedEventData ApiManagementGatewayHostnameConfigurationCreatedEventData(string resourceUri = null) - { - return new ApiManagementGatewayHostnameConfigurationCreatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/hostnameConfigurations/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementGatewayHostnameConfigurationUpdatedEventData ApiManagementGatewayHostnameConfigurationUpdatedEventData(string resourceUri = null) - { - return new ApiManagementGatewayHostnameConfigurationUpdatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/hostnameConfigurations/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementGatewayHostnameConfigurationDeletedEventData ApiManagementGatewayHostnameConfigurationDeletedEventData(string resourceUri = null) - { - return new ApiManagementGatewayHostnameConfigurationDeletedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/certificateAuthorities/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementGatewayCertificateAuthorityCreatedEventData ApiManagementGatewayCertificateAuthorityCreatedEventData(string resourceUri = null) - { - return new ApiManagementGatewayCertificateAuthorityCreatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/certificateAuthorities/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementGatewayCertificateAuthorityUpdatedEventData ApiManagementGatewayCertificateAuthorityUpdatedEventData(string resourceUri = null) - { - return new ApiManagementGatewayCertificateAuthorityUpdatedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/certificateAuthorities/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementGatewayCertificateAuthorityDeletedEventData ApiManagementGatewayCertificateAuthorityDeletedEventData(string resourceUri = null) - { - return new ApiManagementGatewayCertificateAuthorityDeletedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/apis/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementGatewayApiAddedEventData ApiManagementGatewayApiAddedEventData(string resourceUri = null) - { - return new ApiManagementGatewayApiAddedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, `/subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/gateways/<GatewayName>/apis/<ResourceName>`. - /// A new instance for mocking. - public static ApiManagementGatewayApiRemovedEventData ApiManagementGatewayApiRemovedEventData(string resourceUri = null) - { - return new ApiManagementGatewayApiRemovedEventData(resourceUri, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The key used to identify the key-value that was modified. - /// The label, if any, used to identify the key-value that was modified. - /// The etag representing the new state of the key-value. - /// The sync token representing the server state after the event. - /// A new instance for mocking. - public static AppConfigurationKeyValueModifiedEventData AppConfigurationKeyValueModifiedEventData(string key = null, string label = null, string etag = null, string syncToken = null) - { - return new AppConfigurationKeyValueModifiedEventData(key, label, etag, syncToken, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The key used to identify the key-value that was deleted. - /// The label, if any, used to identify the key-value that was deleted. - /// The etag representing the key-value that was deleted. - /// The sync token representing the server state after the event. - /// A new instance for mocking. - public static AppConfigurationKeyValueDeletedEventData AppConfigurationKeyValueDeletedEventData(string key = null, string label = null, string etag = null, string syncToken = null) - { - return new AppConfigurationKeyValueDeletedEventData(key, label, etag, syncToken, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the snapshot. - /// The etag representing the new state of the snapshot. - /// The sync token representing the server state after the event. - /// A new instance for mocking. - public static AppConfigurationSnapshotEventData AppConfigurationSnapshotEventData(string name = null, string etag = null, string syncToken = null) - { - return new AppConfigurationSnapshotEventData(name, etag, syncToken, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the snapshot. - /// The etag representing the new state of the snapshot. - /// The sync token representing the server state after the event. - /// A new instance for mocking. - public static AppConfigurationSnapshotCreatedEventData AppConfigurationSnapshotCreatedEventData(string name = null, string etag = null, string syncToken = null) - { - return new AppConfigurationSnapshotCreatedEventData(name, etag, syncToken, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the snapshot. - /// The etag representing the new state of the snapshot. - /// The sync token representing the server state after the event. - /// A new instance for mocking. - public static AppConfigurationSnapshotModifiedEventData AppConfigurationSnapshotModifiedEventData(string name = null, string etag = null, string syncToken = null) - { - return new AppConfigurationSnapshotModifiedEventData(name, etag, syncToken, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// A new instance for mocking. - public static AvsPrivateCloudEventData AvsPrivateCloudEventData(string operationId = null) - { - return new AvsPrivateCloudEventData(operationId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// A new instance for mocking. - public static AvsPrivateCloudUpdatingEventData AvsPrivateCloudUpdatingEventData(string operationId = null) - { - return new AvsPrivateCloudUpdatingEventData(operationId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// A new instance for mocking. - public static AvsPrivateCloudUpdatedEventData AvsPrivateCloudUpdatedEventData(string operationId = null) - { - return new AvsPrivateCloudUpdatedEventData(operationId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Failure reason of an event. - /// A new instance for mocking. - public static AvsPrivateCloudFailedEventData AvsPrivateCloudFailedEventData(string operationId = null, string failureMessage = null) - { - return new AvsPrivateCloudFailedEventData(operationId, serializedAdditionalRawData: null, failureMessage); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// A new instance for mocking. - public static AvsClusterEventData AvsClusterEventData(string operationId = null, IEnumerable addedHostNames = null, IEnumerable removedHostNames = null, IEnumerable inMaintenanceHostNames = null) - { - addedHostNames ??= new List(); - removedHostNames ??= new List(); - inMaintenanceHostNames ??= new List(); - - return new AvsClusterEventData(operationId, addedHostNames?.ToList(), removedHostNames?.ToList(), inMaintenanceHostNames?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// A new instance for mocking. - public static AvsClusterCreatedEventData AvsClusterCreatedEventData(string operationId = null, IEnumerable addedHostNames = null, IEnumerable removedHostNames = null, IEnumerable inMaintenanceHostNames = null) - { - addedHostNames ??= new List(); - removedHostNames ??= new List(); - inMaintenanceHostNames ??= new List(); - - return new AvsClusterCreatedEventData(operationId, addedHostNames?.ToList(), removedHostNames?.ToList(), inMaintenanceHostNames?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// A new instance for mocking. - public static AvsClusterDeletedEventData AvsClusterDeletedEventData(string operationId = null, IEnumerable addedHostNames = null, IEnumerable removedHostNames = null, IEnumerable inMaintenanceHostNames = null) - { - addedHostNames ??= new List(); - removedHostNames ??= new List(); - inMaintenanceHostNames ??= new List(); - - return new AvsClusterDeletedEventData(operationId, addedHostNames?.ToList(), removedHostNames?.ToList(), inMaintenanceHostNames?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// A new instance for mocking. - public static AvsClusterUpdatingEventData AvsClusterUpdatingEventData(string operationId = null, IEnumerable addedHostNames = null, IEnumerable removedHostNames = null, IEnumerable inMaintenanceHostNames = null) - { - addedHostNames ??= new List(); - removedHostNames ??= new List(); - inMaintenanceHostNames ??= new List(); - - return new AvsClusterUpdatingEventData(operationId, addedHostNames?.ToList(), removedHostNames?.ToList(), inMaintenanceHostNames?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// A new instance for mocking. - public static AvsClusterUpdatedEventData AvsClusterUpdatedEventData(string operationId = null, IEnumerable addedHostNames = null, IEnumerable removedHostNames = null, IEnumerable inMaintenanceHostNames = null) - { - addedHostNames ??= new List(); - removedHostNames ??= new List(); - inMaintenanceHostNames ??= new List(); - - return new AvsClusterUpdatedEventData(operationId, addedHostNames?.ToList(), removedHostNames?.ToList(), inMaintenanceHostNames?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Hosts added to the cluster in this event, if any. - /// Hosts removed from the cluster in this event, if any. - /// Hosts in Maintenance mode in the cluster, if any. - /// Failure reason of an event. - /// A new instance for mocking. - public static AvsClusterFailedEventData AvsClusterFailedEventData(string operationId = null, IEnumerable addedHostNames = null, IEnumerable removedHostNames = null, IEnumerable inMaintenanceHostNames = null, string failureMessage = null) - { - addedHostNames ??= new List(); - removedHostNames ??= new List(); - inMaintenanceHostNames ??= new List(); - - return new AvsClusterFailedEventData( - operationId, - addedHostNames?.ToList(), - removedHostNames?.ToList(), - inMaintenanceHostNames?.ToList(), - serializedAdditionalRawData: null, - failureMessage); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Cmdlet referenced in the execution that caused this event. - /// Stdout outputs from the execution, if any. - /// A new instance for mocking. - public static AvsScriptExecutionEventData AvsScriptExecutionEventData(string operationId = null, string cmdletId = null, IEnumerable output = null) - { - output ??= new List(); - - return new AvsScriptExecutionEventData(operationId, cmdletId, output?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Cmdlet referenced in the execution that caused this event. - /// Stdout outputs from the execution, if any. - /// A new instance for mocking. - public static AvsScriptExecutionStartedEventData AvsScriptExecutionStartedEventData(string operationId = null, string cmdletId = null, IEnumerable output = null) - { - output ??= new List(); - - return new AvsScriptExecutionStartedEventData(operationId, cmdletId, output?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Cmdlet referenced in the execution that caused this event. - /// Stdout outputs from the execution, if any. - /// Named outputs of completed execution, if any. - /// A new instance for mocking. - public static AvsScriptExecutionFinishedEventData AvsScriptExecutionFinishedEventData(string operationId = null, string cmdletId = null, IEnumerable output = null, IReadOnlyDictionary namedOutputs = null) - { - output ??= new List(); - namedOutputs ??= new Dictionary(); - - return new AvsScriptExecutionFinishedEventData(operationId, cmdletId, output?.ToList(), serializedAdditionalRawData: null, namedOutputs); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Cmdlet referenced in the execution that caused this event. - /// Stdout outputs from the execution, if any. - /// A new instance for mocking. - public static AvsScriptExecutionCancelledEventData AvsScriptExecutionCancelledEventData(string operationId = null, string cmdletId = null, IEnumerable output = null) - { - output ??= new List(); - - return new AvsScriptExecutionCancelledEventData(operationId, cmdletId, output?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the operation that caused this event. - /// Cmdlet referenced in the execution that caused this event. - /// Stdout outputs from the execution, if any. - /// Failure reason of an event. - /// A new instance for mocking. - public static AvsScriptExecutionFailedEventData AvsScriptExecutionFailedEventData(string operationId = null, string cmdletId = null, IEnumerable output = null, string failureMessage = null) - { - output ??= new List(); - - return new AvsScriptExecutionFailedEventData(operationId, cmdletId, output?.ToList(), serializedAdditionalRawData: null, failureMessage); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The communication identifier of the user who initiated the call. - /// The Id of the server call. - /// Display name of caller. - /// Custom Context of Incoming Call. - /// Signed incoming call context. - /// CorrelationId (CallId). - /// A new instance for mocking. - public static AcsIncomingCallEventData AcsIncomingCallEventData(CommunicationIdentifierModel toCommunicationIdentifier = null, CommunicationIdentifierModel fromCommunicationIdentifier = null, string serverCallId = null, string callerDisplayName = null, AcsIncomingCallCustomContext customContext = null, string incomingCallContext = null, string correlationId = null) - { - return new AcsIncomingCallEventData( - toCommunicationIdentifier, - fromCommunicationIdentifier, - serverCallId, - callerDisplayName, - customContext, - incomingCallContext, - correlationId, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The identifier kind. Only required in responses. - /// Raw Id of the identifier. Optional in requests, required in responses. - /// The communication user. - /// The phone number. - /// The Microsoft Teams user. - /// The Microsoft Teams application. - /// A new instance for mocking. - public static CommunicationIdentifierModel CommunicationIdentifierModel(CommunicationIdentifierModelKind kind = default, string rawId = null, CommunicationUserIdentifierModel communicationUser = null, PhoneNumberIdentifierModel phoneNumber = null, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser = null, MicrosoftTeamsAppIdentifierModel microsoftTeamsApp = null) - { - return new CommunicationIdentifierModel( - kind, - rawId, - communicationUser, - phoneNumber, - microsoftTeamsUser, - microsoftTeamsApp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Id of the communication user. - /// A new instance for mocking. - public static CommunicationUserIdentifierModel CommunicationUserIdentifierModel(string id = null) - { - return new CommunicationUserIdentifierModel(id, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The phone number in E.164 format. - /// A new instance for mocking. - public static PhoneNumberIdentifierModel PhoneNumberIdentifierModel(string value = null) - { - return new PhoneNumberIdentifierModel(value, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. - /// True if the Microsoft Teams user is anonymous. By default false if missing. - /// The cloud that the Microsoft Teams user belongs to. By default 'public' if missing. - /// A new instance for mocking. - public static MicrosoftTeamsUserIdentifierModel MicrosoftTeamsUserIdentifierModel(string userId = null, bool? isAnonymous = null, CommunicationCloudEnvironmentModel cloud = default) - { - return new MicrosoftTeamsUserIdentifierModel(userId, isAnonymous, cloud, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Id of the Microsoft Teams application. - /// The cloud that the Microsoft Teams application belongs to. By default 'public' if missing. - /// A new instance for mocking. - public static MicrosoftTeamsAppIdentifierModel MicrosoftTeamsAppIdentifierModel(string appId = null, CommunicationCloudEnvironmentModel cloud = default) - { - return new MicrosoftTeamsAppIdentifierModel(appId, cloud, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Sip Headers for incoming call. - /// Voip Headers for incoming call. - /// A new instance for mocking. - public static AcsIncomingCallCustomContext AcsIncomingCallCustomContext(IReadOnlyDictionary sipHeaders = null, IReadOnlyDictionary voipHeaders = null) - { - sipHeaders ??= new Dictionary(); - voipHeaders ??= new Dictionary(); - - return new AcsIncomingCallCustomContext(sipHeaders, voipHeaders, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The communication identifier of the user who was disconnected. - /// A new instance for mocking. - public static AcsUserDisconnectedEventData AcsUserDisconnectedEventData(CommunicationIdentifierModel userCommunicationIdentifier = null) - { - return new AcsUserDisconnectedEventData(userCommunicationIdentifier, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// A new instance for mocking. - public static AcsChatEventBaseProperties AcsChatEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null) - { - return new AcsChatEventBaseProperties(recipientCommunicationIdentifier, transactionId, threadId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// A new instance for mocking. - public static AcsChatEventInThreadBaseProperties AcsChatEventInThreadBaseProperties(string transactionId = null, string threadId = null) - { - return new AcsChatEventInThreadBaseProperties(transactionId, threadId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// A new instance for mocking. - public static AcsChatMessageEventBaseProperties AcsChatMessageEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset composeTime = default, string type = null, long? version = null) - { - return new AcsChatMessageEventBaseProperties( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData: null, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The body of the chat message. - /// The chat message metadata. - /// A new instance for mocking. - public static AcsChatMessageReceivedEventData AcsChatMessageReceivedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset composeTime = default, string type = null, long? version = null, string messageBody = null, IReadOnlyDictionary metadata = null) - { - metadata ??= new Dictionary(); - - return new AcsChatMessageReceivedEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData: null, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - messageBody, - metadata); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// A new instance for mocking. - public static AcsChatMessageEventInThreadBaseProperties AcsChatMessageEventInThreadBaseProperties(string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset composeTime = default, string type = null, long? version = null) - { - return new AcsChatMessageEventInThreadBaseProperties( - transactionId, - threadId, - serializedAdditionalRawData: null, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The body of the chat message. - /// The chat message metadata. - /// A new instance for mocking. - public static AcsChatMessageReceivedInThreadEventData AcsChatMessageReceivedInThreadEventData(string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset composeTime = default, string type = null, long? version = null, string messageBody = null, IReadOnlyDictionary metadata = null) - { - metadata ??= new Dictionary(); - - return new AcsChatMessageReceivedInThreadEventData( - transactionId, - threadId, - serializedAdditionalRawData: null, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - messageBody, - metadata); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The body of the chat message. - /// The chat message metadata. - /// The time at which the message was edited. - /// A new instance for mocking. - public static AcsChatMessageEditedEventData AcsChatMessageEditedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset composeTime = default, string type = null, long? version = null, string messageBody = null, IReadOnlyDictionary metadata = null, DateTimeOffset editTime = default) - { - metadata ??= new Dictionary(); - - return new AcsChatMessageEditedEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData: null, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - messageBody, - metadata, - editTime); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The body of the chat message. - /// The chat message metadata. - /// The time at which the message was edited. - /// A new instance for mocking. - public static AcsChatMessageEditedInThreadEventData AcsChatMessageEditedInThreadEventData(string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset composeTime = default, string type = null, long? version = null, string messageBody = null, IReadOnlyDictionary metadata = null, DateTimeOffset editTime = default) - { - metadata ??= new Dictionary(); - - return new AcsChatMessageEditedInThreadEventData( - transactionId, - threadId, - serializedAdditionalRawData: null, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - messageBody, - metadata, - editTime); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The time at which the message was deleted. - /// A new instance for mocking. - public static AcsChatMessageDeletedEventData AcsChatMessageDeletedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset composeTime = default, string type = null, long? version = null, DateTimeOffset deleteTime = default) - { - return new AcsChatMessageDeletedEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData: null, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - deleteTime); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The time at which the message was deleted. - /// A new instance for mocking. - public static AcsChatMessageDeletedInThreadEventData AcsChatMessageDeletedInThreadEventData(string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset composeTime = default, string type = null, long? version = null, DateTimeOffset deleteTime = default) - { - return new AcsChatMessageDeletedInThreadEventData( - transactionId, - threadId, - serializedAdditionalRawData: null, - messageId, - senderCommunicationIdentifier, - senderDisplayName, - composeTime, - type, - version, - deleteTime); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The original creation time of the thread. - /// The version of the thread. - /// A new instance for mocking. - public static AcsChatThreadEventBaseProperties AcsChatThreadEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, DateTimeOffset createTime = default, long? version = null) - { - return new AcsChatThreadEventBaseProperties( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData: null, - createTime, - version); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who created the thread. - /// The thread properties. - /// The thread metadata. - /// The list of properties of participants who are part of the thread. - /// A new instance for mocking. - public static AcsChatThreadCreatedWithUserEventData AcsChatThreadCreatedWithUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, DateTimeOffset createTime = default, long? version = null, CommunicationIdentifierModel createdByCommunicationIdentifier = null, IReadOnlyDictionary properties = null, IReadOnlyDictionary metadata = null, IEnumerable participants = null) - { - properties ??= new Dictionary(); - metadata ??= new Dictionary(); - participants ??= new List(); - - return new AcsChatThreadCreatedWithUserEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData: null, - createTime, - version, - createdByCommunicationIdentifier, - properties, - metadata, - participants?.ToList()); - } - - /// Initializes a new instance of . - /// The name of the user. - /// The communication identifier of the user. - /// The metadata of the user. - /// A new instance for mocking. - public static AcsChatThreadParticipantProperties AcsChatThreadParticipantProperties(string displayName = null, CommunicationIdentifierModel participantCommunicationIdentifier = null, IReadOnlyDictionary metadata = null) - { - metadata ??= new Dictionary(); - - return new AcsChatThreadParticipantProperties(displayName, participantCommunicationIdentifier, metadata, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The original creation time of the thread. - /// The version of the thread. - /// A new instance for mocking. - public static AcsChatThreadEventInThreadBaseProperties AcsChatThreadEventInThreadBaseProperties(string transactionId = null, string threadId = null, DateTimeOffset createTime = default, long? version = null) - { - return new AcsChatThreadEventInThreadBaseProperties(transactionId, threadId, serializedAdditionalRawData: null, createTime, version); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who created the thread. - /// The thread properties. - /// The thread metadata. - /// The list of properties of participants who are part of the thread. - /// A new instance for mocking. - public static AcsChatThreadCreatedEventData AcsChatThreadCreatedEventData(string transactionId = null, string threadId = null, DateTimeOffset createTime = default, long? version = null, CommunicationIdentifierModel createdByCommunicationIdentifier = null, IReadOnlyDictionary properties = null, IReadOnlyDictionary metadata = null, IEnumerable participants = null) - { - properties ??= new Dictionary(); - metadata ??= new Dictionary(); - participants ??= new List(); - - return new AcsChatThreadCreatedEventData( - transactionId, - threadId, - serializedAdditionalRawData: null, - createTime, - version, - createdByCommunicationIdentifier, - properties, - metadata, - participants?.ToList()); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who deleted the thread. - /// The deletion time of the thread. - /// A new instance for mocking. - public static AcsChatThreadWithUserDeletedEventData AcsChatThreadWithUserDeletedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, DateTimeOffset createTime = default, long? version = null, CommunicationIdentifierModel deletedByCommunicationIdentifier = null, DateTimeOffset deleteTime = default) - { - return new AcsChatThreadWithUserDeletedEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData: null, - createTime, - version, - deletedByCommunicationIdentifier, - deleteTime); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who deleted the thread. - /// The deletion time of the thread. - /// A new instance for mocking. - public static AcsChatThreadDeletedEventData AcsChatThreadDeletedEventData(string transactionId = null, string threadId = null, DateTimeOffset createTime = default, long? version = null, CommunicationIdentifierModel deletedByCommunicationIdentifier = null, DateTimeOffset deleteTime = default) - { - return new AcsChatThreadDeletedEventData( - transactionId, - threadId, - serializedAdditionalRawData: null, - createTime, - version, - deletedByCommunicationIdentifier, - deleteTime); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who updated the thread properties. - /// The time at which the properties of the thread were updated. - /// The thread metadata. - /// The updated thread properties. - /// A new instance for mocking. - public static AcsChatThreadPropertiesUpdatedPerUserEventData AcsChatThreadPropertiesUpdatedPerUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, DateTimeOffset createTime = default, long? version = null, CommunicationIdentifierModel editedByCommunicationIdentifier = null, DateTimeOffset editTime = default, IReadOnlyDictionary metadata = null, IReadOnlyDictionary properties = null) - { - metadata ??= new Dictionary(); - properties ??= new Dictionary(); - - return new AcsChatThreadPropertiesUpdatedPerUserEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData: null, - createTime, - version, - editedByCommunicationIdentifier, - editTime, - metadata, - properties); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The original creation time of the thread. - /// The version of the thread. - /// The communication identifier of the user who updated the thread properties. - /// The time at which the properties of the thread were updated. - /// The updated thread properties. - /// The thread metadata. - /// A new instance for mocking. - public static AcsChatThreadPropertiesUpdatedEventData AcsChatThreadPropertiesUpdatedEventData(string transactionId = null, string threadId = null, DateTimeOffset createTime = default, long? version = null, CommunicationIdentifierModel editedByCommunicationIdentifier = null, DateTimeOffset editTime = default, IReadOnlyDictionary properties = null, IReadOnlyDictionary metadata = null) - { - properties ??= new Dictionary(); - metadata ??= new Dictionary(); - - return new AcsChatThreadPropertiesUpdatedEventData( - transactionId, - threadId, - serializedAdditionalRawData: null, - createTime, - version, - editedByCommunicationIdentifier, - editTime, - properties, - metadata); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The original creation time of the thread. - /// The version of the thread. - /// The time at which the user was added to the thread. - /// The communication identifier of the user who added the user. - /// The details of the user who was added. - /// A new instance for mocking. - public static AcsChatParticipantAddedToThreadWithUserEventData AcsChatParticipantAddedToThreadWithUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, DateTimeOffset createTime = default, long? version = null, DateTimeOffset time = default, CommunicationIdentifierModel addedByCommunicationIdentifier = null, AcsChatThreadParticipantProperties participantAdded = null) - { - return new AcsChatParticipantAddedToThreadWithUserEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData: null, - createTime, - version, - time, - addedByCommunicationIdentifier, - participantAdded); - } - - /// Initializes a new instance of . - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The original creation time of the thread. - /// The version of the thread. - /// The time at which the user was removed to the thread. - /// The communication identifier of the user who removed the user. - /// The details of the user who was removed. - /// A new instance for mocking. - public static AcsChatParticipantRemovedFromThreadWithUserEventData AcsChatParticipantRemovedFromThreadWithUserEventData(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, DateTimeOffset createTime = default, long? version = null, DateTimeOffset time = default, CommunicationIdentifierModel removedByCommunicationIdentifier = null, AcsChatThreadParticipantProperties participantRemoved = null) - { - return new AcsChatParticipantRemovedFromThreadWithUserEventData( - recipientCommunicationIdentifier, - transactionId, - threadId, - serializedAdditionalRawData: null, - createTime, - version, - time, - removedByCommunicationIdentifier, - participantRemoved); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The time at which the user was added to the thread. - /// The communication identifier of the user who added the user. - /// The details of the user who was added. - /// The version of the thread. - /// A new instance for mocking. - public static AcsChatParticipantAddedToThreadEventData AcsChatParticipantAddedToThreadEventData(string transactionId = null, string threadId = null, DateTimeOffset time = default, CommunicationIdentifierModel addedByCommunicationIdentifier = null, AcsChatThreadParticipantProperties participantAdded = null, long? version = null) - { - return new AcsChatParticipantAddedToThreadEventData( - transactionId, - threadId, - serializedAdditionalRawData: null, - time, - addedByCommunicationIdentifier, - participantAdded, - version); - } - - /// Initializes a new instance of . - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The time at which the user was removed to the thread. - /// The communication identifier of the user who removed the user. - /// The details of the user who was removed. - /// The version of the thread. - /// A new instance for mocking. - public static AcsChatParticipantRemovedFromThreadEventData AcsChatParticipantRemovedFromThreadEventData(string transactionId = null, string threadId = null, DateTimeOffset time = default, CommunicationIdentifierModel removedByCommunicationIdentifier = null, AcsChatThreadParticipantProperties participantRemoved = null, long? version = null) - { - return new AcsChatParticipantRemovedFromThreadEventData( - transactionId, - threadId, - serializedAdditionalRawData: null, - time, - removedByCommunicationIdentifier, - participantRemoved, - version); - } - - /// Initializes a new instance of . - /// The identity of the SMS message. - /// The identity of SMS message sender. - /// The identity of SMS message receiver. - /// A new instance for mocking. - public static AcsSmsEventBaseProperties AcsSmsEventBaseProperties(string messageId = null, string @from = null, string to = null) - { - return new AcsSmsEventBaseProperties(messageId, @from, to, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The identity of the SMS message. - /// The identity of SMS message sender. - /// The identity of SMS message receiver. - /// Status of Delivery. - /// Details about Delivery Status. - /// List of details of delivery attempts made. - /// The time at which the SMS delivery report was received. - /// Customer Content. - /// A new instance for mocking. - public static AcsSmsDeliveryReportReceivedEventData AcsSmsDeliveryReportReceivedEventData(string messageId = null, string @from = null, string to = null, string deliveryStatus = null, string deliveryStatusDetails = null, IEnumerable deliveryAttempts = null, DateTimeOffset receivedTimestamp = default, string tag = null) - { - deliveryAttempts ??= new List(); - - return new AcsSmsDeliveryReportReceivedEventData( - messageId, - @from, - to, - serializedAdditionalRawData: null, - deliveryStatus, - deliveryStatusDetails, - deliveryAttempts?.ToList(), - receivedTimestamp, - tag); - } - - /// Initializes a new instance of . - /// TimeStamp when delivery was attempted. - /// Number of segments that were successfully delivered. - /// Number of segments whose delivery failed. - /// A new instance for mocking. - public static AcsSmsDeliveryAttemptProperties AcsSmsDeliveryAttemptProperties(DateTimeOffset timestamp = default, int? segmentsSucceeded = null, int? segmentsFailed = null) - { - return new AcsSmsDeliveryAttemptProperties(timestamp, segmentsSucceeded, segmentsFailed, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The identity of the SMS message. - /// The identity of SMS message sender. - /// The identity of SMS message receiver. - /// The SMS content. - /// The time at which the SMS was received. - /// A new instance for mocking. - public static AcsSmsReceivedEventData AcsSmsReceivedEventData(string messageId = null, string @from = null, string to = null, string message = null, DateTimeOffset receivedTimestamp = default) - { - return new AcsSmsReceivedEventData( - messageId, - @from, - to, - serializedAdditionalRawData: null, - message, - receivedTimestamp); - } - - /// Initializes a new instance of . - /// The details of recording storage information. - /// The time at which the recording started. - /// The recording duration in milliseconds. - /// The recording content type- AudioVideo, or Audio. - /// The recording channel type - Mixed, Unmixed. - /// The recording format type - Mp4, Mp3, Wav. - /// The reason for ending recording session. - /// A new instance for mocking. - public static AcsRecordingFileStatusUpdatedEventData AcsRecordingFileStatusUpdatedEventData(AcsRecordingStorageInfoProperties recordingStorageInfo = null, DateTimeOffset recordingStartTime = default, long? recordingDurationMs = null, RecordingContentType recordingContentType = default, RecordingChannelType recordingChannelKind = default, RecordingFormatType recordingFormatType = default, string sessionEndReason = null) - { - return new AcsRecordingFileStatusUpdatedEventData( - recordingStorageInfo, - recordingStartTime, - recordingDurationMs, - recordingContentType, - recordingChannelKind, - recordingFormatType, - sessionEndReason, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// List of details of recording chunks information. - /// A new instance for mocking. - public static AcsRecordingStorageInfoProperties AcsRecordingStorageInfoProperties(IEnumerable recordingChunks = null) - { - recordingChunks ??= new List(); - - return new AcsRecordingStorageInfoProperties(recordingChunks?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The documentId of the recording chunk. - /// The index of the recording chunk. - /// The reason for ending the recording chunk. - /// The location of the metadata for this chunk. - /// The location of the content for this chunk. - /// The location to delete all chunk storage. - /// A new instance for mocking. - public static AcsRecordingChunkInfoProperties AcsRecordingChunkInfoProperties(string documentId = null, long? index = null, string endReason = null, string metadataLocation = null, string contentLocation = null, string deleteLocation = null) - { - return new AcsRecordingChunkInfoProperties( - documentId, - index, - endReason, - metadataLocation, - contentLocation, - deleteLocation, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Sender Email Address. - /// The recipient Email Address. - /// The Id of the email been sent. - /// The status of the email. Any value other than Delivered is considered failed. - /// Detailed information about the status if any. - /// The time at which the email delivery report received timestamp. - /// A new instance for mocking. - public static AcsEmailDeliveryReportReceivedEventData AcsEmailDeliveryReportReceivedEventData(string sender = null, string recipient = null, string messageId = null, AcsEmailDeliveryReportStatus status = default, AcsEmailDeliveryReportStatusDetails deliveryStatusDetails = null, DateTimeOffset deliveryAttemptTimestamp = default) - { - return new AcsEmailDeliveryReportReceivedEventData( - sender, - recipient, - messageId, - status, - deliveryStatusDetails, - deliveryAttemptTimestamp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detailed status message. - /// A new instance for mocking. - public static AcsEmailDeliveryReportStatusDetails AcsEmailDeliveryReportStatusDetails(string statusMessage = null) - { - return new AcsEmailDeliveryReportStatusDetails(statusMessage, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Sender Email Address. - /// The Recipient Email Address. - /// The Id of the email that has been sent. - /// The time at which the user interacted with the email. - /// The context of the type of engagement user had with email. - /// The user agent interacting with the email. - /// The type of engagement user have with email. - /// A new instance for mocking. - public static AcsEmailEngagementTrackingReportReceivedEventData AcsEmailEngagementTrackingReportReceivedEventData(string sender = null, string recipient = null, string messageId = null, DateTimeOffset userActionTimestamp = default, string engagementContext = null, string userAgent = null, AcsUserEngagement engagement = default) - { - return new AcsEmailEngagementTrackingReportReceivedEventData( - sender, - recipient, - messageId, - userActionTimestamp, - engagementContext, - userAgent, - engagement, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// A new instance for mocking. - public static AcsRouterEventData AcsRouterEventData(string jobId = null, string channelReference = null, string channelId = null) - { - return new AcsRouterEventData(jobId, channelReference, channelId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// A new instance for mocking. - public static AcsRouterJobEventData AcsRouterJobEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - - return new AcsRouterJobEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Note. - /// Router Job Disposition Code. - /// A new instance for mocking. - public static AcsRouterJobCancelledEventData AcsRouterJobCancelledEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, string note = null, string dispositionCode = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - - return new AcsRouterJobCancelledEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - note, - dispositionCode); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Classification Policy Id. - /// Router Job Classification Failed Errors. - /// A new instance for mocking. - public static AcsRouterJobClassificationFailedEventData AcsRouterJobClassificationFailedEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, string classificationPolicyId = null, IEnumerable errors = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - errors ??= new List(); - - return new AcsRouterJobClassificationFailedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - classificationPolicyId, - errors?.ToList()); - } - - /// Initializes a new instance of . - /// Router Communication Error Code. - /// Router Communication Error Message. - /// Router Communication Error Target. - /// Router Communication Inner Error. - /// List of Router Communication Errors. - /// A new instance for mocking. - public static AcsRouterCommunicationError AcsRouterCommunicationError(string code = null, string message = null, string target = null, AcsRouterCommunicationError innererror = null, IEnumerable details = null) - { - details ??= new List(); - - return new AcsRouterCommunicationError( - code, - message, - target, - innererror, - details?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Queue Info. - /// Router Job Classification Policy Id. - /// Router Job Priority. - /// Router Job Attached Worker Selector. - /// A new instance for mocking. - public static AcsRouterJobClassifiedEventData AcsRouterJobClassifiedEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, AcsRouterQueueDetails queueDetails = null, string classificationPolicyId = null, int? priority = null, IEnumerable attachedWorkerSelectors = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - attachedWorkerSelectors ??= new List(); - - return new AcsRouterJobClassifiedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - queueDetails, - classificationPolicyId, - priority, - attachedWorkerSelectors?.ToList()); - } - - /// Initializes a new instance of . - /// Router Queue Id. - /// Router Queue Name. - /// Router Queue Labels. - /// A new instance for mocking. - public static AcsRouterQueueDetails AcsRouterQueueDetails(string id = null, string name = null, IReadOnlyDictionary labels = null) - { - labels ??= new Dictionary(); - - return new AcsRouterQueueDetails(id, name, labels, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Router Job Worker Selector Key. - /// Router Job Worker Selector Label Operator. - /// Router Job Worker Selector Value. - /// Router Job Worker Selector Time to Live in Seconds. - /// Router Job Worker Selector State. - /// Router Job Worker Selector Expiration Time. - /// A new instance for mocking. - public static AcsRouterWorkerSelector AcsRouterWorkerSelector(string key = null, AcsRouterLabelOperator labelOperator = default, BinaryData labelValue = null, double timeToLive = default, AcsRouterWorkerSelectorState selectorState = default, DateTimeOffset expirationTime = default) - { - return new AcsRouterWorkerSelector( - key, - labelOperator, - labelValue, - timeToLive, - selectorState, - expirationTime, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Closed Assignment Id. - /// Router Job Closed Worker Id. - /// Router Job Closed Disposition Code. - /// A new instance for mocking. - public static AcsRouterJobClosedEventData AcsRouterJobClosedEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, string assignmentId = null, string workerId = null, string dispositionCode = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - - return new AcsRouterJobClosedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - assignmentId, - workerId, - dispositionCode); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Completed Assignment Id. - /// Router Job Completed Worker Id. - /// A new instance for mocking. - public static AcsRouterJobCompletedEventData AcsRouterJobCompletedEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, string assignmentId = null, string workerId = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - - return new AcsRouterJobCompletedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - assignmentId, - workerId); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// A new instance for mocking. - public static AcsRouterJobDeletedEventData AcsRouterJobDeletedEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - - return new AcsRouterJobDeletedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Exception Triggered Rule Key. - /// Router Job Exception Triggered Rule Id. - /// A new instance for mocking. - public static AcsRouterJobExceptionTriggeredEventData AcsRouterJobExceptionTriggeredEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, string ruleKey = null, string exceptionRuleId = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - - return new AcsRouterJobExceptionTriggeredEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - ruleKey, - exceptionRuleId); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Priority. - /// Router Job Queued Attached Worker Selector. - /// Router Job Queued Requested Worker Selector. - /// A new instance for mocking. - public static AcsRouterJobQueuedEventData AcsRouterJobQueuedEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, int? priority = null, IEnumerable attachedWorkerSelectors = null, IEnumerable requestedWorkerSelectors = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - attachedWorkerSelectors ??= new List(); - requestedWorkerSelectors ??= new List(); - - return new AcsRouterJobQueuedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - priority, - attachedWorkerSelectors?.ToList(), - requestedWorkerSelectors?.ToList()); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Received Job Status. - /// Router Job Classification Policy Id. - /// Router Job Priority. - /// Router Job Received Requested Worker Selectors. - /// Router Job Received Scheduled Time in UTC. - /// Unavailable For Matching for Router Job Received. - /// A new instance for mocking. - public static AcsRouterJobReceivedEventData AcsRouterJobReceivedEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, AcsRouterJobStatus jobStatus = default, string classificationPolicyId = null, int? priority = null, IEnumerable requestedWorkerSelectors = null, DateTimeOffset scheduledOn = default, bool unavailableForMatching = default) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - requestedWorkerSelectors ??= new List(); - - return new AcsRouterJobReceivedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - jobStatus, - classificationPolicyId, - priority, - requestedWorkerSelectors?.ToList(), - scheduledOn, - unavailableForMatching); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Priority. - /// Router Job Scheduling Failed Attached Worker Selector Expired. - /// Router Job Scheduling Failed Requested Worker Selector Expired. - /// Router Job Scheduling Failed Scheduled Time in UTC. - /// Router Job Scheduling Failed Reason. - /// A new instance for mocking. - public static AcsRouterJobSchedulingFailedEventData AcsRouterJobSchedulingFailedEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, int? priority = null, IEnumerable expiredAttachedWorkerSelectors = null, IEnumerable expiredRequestedWorkerSelectors = null, DateTimeOffset scheduledOn = default, string failureReason = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - expiredAttachedWorkerSelectors ??= new List(); - expiredRequestedWorkerSelectors ??= new List(); - - return new AcsRouterJobSchedulingFailedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - priority, - expiredAttachedWorkerSelectors?.ToList(), - expiredRequestedWorkerSelectors?.ToList(), - scheduledOn, - failureReason); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Unassigned Assignment Id. - /// Router Job Unassigned Worker Id. - /// A new instance for mocking. - public static AcsRouterJobUnassignedEventData AcsRouterJobUnassignedEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, string assignmentId = null, string workerId = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - - return new AcsRouterJobUnassignedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - assignmentId, - workerId); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Waiting For Activation Priority. - /// Router Job Waiting For Activation Worker Selector Expired. - /// Router Job Waiting For Activation Requested Worker Selector Expired. - /// Router Job Waiting For Activation Scheduled Time in UTC. - /// Router Job Waiting For Activation Unavailable For Matching. - /// A new instance for mocking. - public static AcsRouterJobWaitingForActivationEventData AcsRouterJobWaitingForActivationEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, int? priority = null, IEnumerable expiredAttachedWorkerSelectors = null, IEnumerable expiredRequestedWorkerSelectors = null, DateTimeOffset scheduledOn = default, bool unavailableForMatching = default) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - expiredAttachedWorkerSelectors ??= new List(); - expiredRequestedWorkerSelectors ??= new List(); - - return new AcsRouterJobWaitingForActivationEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - priority, - expiredAttachedWorkerSelectors?.ToList(), - expiredRequestedWorkerSelectors?.ToList(), - scheduledOn, - unavailableForMatching); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Job events Queue Id. - /// Router Job events Labels. - /// Router Jobs events Tags. - /// Router Job Worker Selectors Expired Requested Worker Selectors. - /// Router Job Worker Selectors Expired Attached Worker Selectors. - /// A new instance for mocking. - public static AcsRouterJobWorkerSelectorsExpiredEventData AcsRouterJobWorkerSelectorsExpiredEventData(string jobId = null, string channelReference = null, string channelId = null, string queueId = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, IEnumerable expiredRequestedWorkerSelectors = null, IEnumerable expiredAttachedWorkerSelectors = null) - { - labels ??= new Dictionary(); - tags ??= new Dictionary(); - expiredRequestedWorkerSelectors ??= new List(); - expiredAttachedWorkerSelectors ??= new List(); - - return new AcsRouterJobWorkerSelectorsExpiredEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - queueId, - labels, - tags, - expiredRequestedWorkerSelectors?.ToList(), - expiredAttachedWorkerSelectors?.ToList()); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Worker events Worker Id. - /// A new instance for mocking. - public static AcsRouterWorkerEventData AcsRouterWorkerEventData(string jobId = null, string channelReference = null, string channelId = null, string workerId = null) - { - return new AcsRouterWorkerEventData(jobId, channelReference, channelId, serializedAdditionalRawData: null, workerId); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Worker events Worker Id. - /// A new instance for mocking. - public static AcsRouterWorkerDeletedEventData AcsRouterWorkerDeletedEventData(string jobId = null, string channelReference = null, string channelId = null, string workerId = null) - { - return new AcsRouterWorkerDeletedEventData(jobId, channelReference, channelId, serializedAdditionalRawData: null, workerId); - } - - /// Initializes a new instance of . - /// Router Worker Deregistered Worker Id. - /// A new instance for mocking. - public static AcsRouterWorkerDeregisteredEventData AcsRouterWorkerDeregisteredEventData(string workerId = null) - { - return new AcsRouterWorkerDeregisteredEventData(workerId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Worker events Worker Id. - /// Router Worker Offer Accepted Queue Id. - /// Router Worker Offer Accepted Offer Id. - /// Router Worker Offer Accepted Assignment Id. - /// Router Worker Offer Accepted Job Priority. - /// Router Worker Offer Accepted Worker Labels. - /// Router Worker Offer Accepted Worker Tags. - /// Router Worker Offer Accepted Job Labels. - /// Router Worker Offer Accepted Job Tags. - /// A new instance for mocking. - public static AcsRouterWorkerOfferAcceptedEventData AcsRouterWorkerOfferAcceptedEventData(string jobId = null, string channelReference = null, string channelId = null, string workerId = null, string queueId = null, string offerId = null, string assignmentId = null, int? jobPriority = null, IReadOnlyDictionary workerLabels = null, IReadOnlyDictionary workerTags = null, IReadOnlyDictionary jobLabels = null, IReadOnlyDictionary jobTags = null) - { - workerLabels ??= new Dictionary(); - workerTags ??= new Dictionary(); - jobLabels ??= new Dictionary(); - jobTags ??= new Dictionary(); - - return new AcsRouterWorkerOfferAcceptedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - workerId, - queueId, - offerId, - assignmentId, - jobPriority, - workerLabels, - workerTags, - jobLabels, - jobTags); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Worker events Worker Id. - /// Router Worker Offer Declined Queue Id. - /// Router Worker Offer Declined Offer Id. - /// A new instance for mocking. - public static AcsRouterWorkerOfferDeclinedEventData AcsRouterWorkerOfferDeclinedEventData(string jobId = null, string channelReference = null, string channelId = null, string workerId = null, string queueId = null, string offerId = null) - { - return new AcsRouterWorkerOfferDeclinedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - workerId, - queueId, - offerId); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Worker events Worker Id. - /// Router Worker Offer Expired Queue Id. - /// Router Worker Offer Expired Offer Id. - /// A new instance for mocking. - public static AcsRouterWorkerOfferExpiredEventData AcsRouterWorkerOfferExpiredEventData(string jobId = null, string channelReference = null, string channelId = null, string workerId = null, string queueId = null, string offerId = null) - { - return new AcsRouterWorkerOfferExpiredEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - workerId, - queueId, - offerId); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Worker events Worker Id. - /// Router Worker Offer Issued Queue Id. - /// Router Worker Offer Issued Offer Id. - /// Router Worker Offer Issued Job Priority. - /// Router Worker Offer Issued Worker Labels. - /// Router Worker Offer Issued Time in UTC. - /// Router Worker Offer Issued Expiration Time in UTC. - /// Router Worker Offer Issued Worker Tags. - /// Router Worker Offer Issued Job Labels. - /// Router Worker Offer Issued Job Tags. - /// A new instance for mocking. - public static AcsRouterWorkerOfferIssuedEventData AcsRouterWorkerOfferIssuedEventData(string jobId = null, string channelReference = null, string channelId = null, string workerId = null, string queueId = null, string offerId = null, int? jobPriority = null, IReadOnlyDictionary workerLabels = null, DateTimeOffset offeredOn = default, DateTimeOffset expiresOn = default, IReadOnlyDictionary workerTags = null, IReadOnlyDictionary jobLabels = null, IReadOnlyDictionary jobTags = null) - { - workerLabels ??= new Dictionary(); - workerTags ??= new Dictionary(); - jobLabels ??= new Dictionary(); - jobTags ??= new Dictionary(); - - return new AcsRouterWorkerOfferIssuedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - workerId, - queueId, - offerId, - jobPriority, - workerLabels, - offeredOn, - expiresOn, - workerTags, - jobLabels, - jobTags); - } - - /// Initializes a new instance of . - /// Router Event Job ID. - /// Router Event Channel Reference. - /// Router Event Channel ID. - /// Router Worker events Worker Id. - /// Router Worker Offer Revoked Queue Id. - /// Router Worker Offer Revoked Offer Id. - /// A new instance for mocking. - public static AcsRouterWorkerOfferRevokedEventData AcsRouterWorkerOfferRevokedEventData(string jobId = null, string channelReference = null, string channelId = null, string workerId = null, string queueId = null, string offerId = null) - { - return new AcsRouterWorkerOfferRevokedEventData( - jobId, - channelReference, - channelId, - serializedAdditionalRawData: null, - workerId, - queueId, - offerId); - } - - /// Initializes a new instance of . - /// Router Worker Registered Worker Id. - /// Router Worker Registered Queue Info. - /// Router Worker Registered Channel Configuration. - /// Router Worker Register Total Capacity. - /// Router Worker Registered Labels. - /// Router Worker Registered Tags. - /// A new instance for mocking. - public static AcsRouterWorkerRegisteredEventData AcsRouterWorkerRegisteredEventData(string workerId = null, IEnumerable queueAssignments = null, IEnumerable channelConfigurations = null, int? totalCapacity = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null) - { - queueAssignments ??= new List(); - channelConfigurations ??= new List(); - labels ??= new Dictionary(); - tags ??= new Dictionary(); - - return new AcsRouterWorkerRegisteredEventData( - workerId, - queueAssignments?.ToList(), - channelConfigurations?.ToList(), - totalCapacity, - labels, - tags, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Channel ID for Router Job. - /// Capacity Cost Per Job for Router Job. - /// Max Number of Jobs for Router Job. - /// A new instance for mocking. - public static AcsRouterChannelConfiguration AcsRouterChannelConfiguration(string channelId = null, int? capacityCostPerJob = null, int? maxNumberOfJobs = null) - { - return new AcsRouterChannelConfiguration(channelId, capacityCostPerJob, maxNumberOfJobs, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Router Worker Updated Worker Id. - /// Router Worker Updated Queue Info. - /// Router Worker Updated Channel Configuration. - /// Router Worker Updated Total Capacity. - /// Router Worker Updated Labels. - /// Router Worker Updated Tags. - /// Router Worker Properties Updated. - /// A new instance for mocking. - public static AcsRouterWorkerUpdatedEventData AcsRouterWorkerUpdatedEventData(string workerId = null, IEnumerable queueAssignments = null, IEnumerable channelConfigurations = null, int? totalCapacity = null, IReadOnlyDictionary labels = null, IReadOnlyDictionary tags = null, IEnumerable updatedWorkerProperties = null) - { - queueAssignments ??= new List(); - channelConfigurations ??= new List(); - labels ??= new Dictionary(); - tags ??= new Dictionary(); - updatedWorkerProperties ??= new List(); - - return new AcsRouterWorkerUpdatedEventData( - workerId, - queueAssignments?.ToList(), - channelConfigurations?.ToList(), - totalCapacity, - labels, - tags, - updatedWorkerProperties?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The message sender. - /// The message recipient. - /// The time message was received. - /// The channel event error. - /// A new instance for mocking. - public static AcsMessageEventData AcsMessageEventData(string @from = null, string to = null, DateTimeOffset receivedTimestamp = default, AcsMessageChannelEventError error = null) - { - return new AcsMessageEventData(@from, to, receivedTimestamp, error, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The channel error code. - /// The channel error message. - /// A new instance for mocking. - public static AcsMessageChannelEventError AcsMessageChannelEventError(string channelCode = null, string channelMessage = null) - { - return new AcsMessageChannelEventError(channelCode, channelMessage, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The message sender. - /// The message recipient. - /// The time message was received. - /// The channel event error. - /// The message id. - /// The updated message status. - /// The updated message channel type. - /// A new instance for mocking. - public static AcsMessageDeliveryStatusUpdatedEventData AcsMessageDeliveryStatusUpdatedEventData(string @from = null, string to = null, DateTimeOffset receivedTimestamp = default, AcsMessageChannelEventError error = null, string messageId = null, AcsMessageDeliveryStatus status = default, AcsMessageChannelKind channelKind = default) - { - return new AcsMessageDeliveryStatusUpdatedEventData( - @from, - to, - receivedTimestamp, - error, - serializedAdditionalRawData: null, - messageId, - status, - channelKind); - } - - /// Initializes a new instance of . - /// The message sender. - /// The message recipient. - /// The time message was received. - /// The channel event error. - /// The message content. - /// The message channel type. - /// The received message media content. - /// The received message context. - /// The received message button content. - /// The received message interactive content. - /// A new instance for mocking. - public static AcsMessageReceivedEventData AcsMessageReceivedEventData(string @from = null, string to = null, DateTimeOffset receivedTimestamp = default, AcsMessageChannelEventError error = null, string content = null, AcsMessageChannelKind channelKind = default, AcsMessageMediaContent mediaContent = null, AcsMessageContext context = null, AcsMessageButtonContent button = null, AcsMessageInteractiveContent interactiveContent = null) - { - return new AcsMessageReceivedEventData( - @from, - to, - receivedTimestamp, - error, - serializedAdditionalRawData: null, - content, - channelKind, - mediaContent, - context, - button, - interactiveContent); - } - - /// Initializes a new instance of . - /// The MIME type of the file this media represents. - /// The media identifier. - /// The filename of the underlying media file as specified when uploaded. - /// The caption for the media object, if supported and provided. - /// A new instance for mocking. - public static AcsMessageMediaContent AcsMessageMediaContent(string mimeType = null, string mediaId = null, string fileName = null, string caption = null) - { - return new AcsMessageMediaContent(mimeType, mediaId, fileName, caption, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The WhatsApp ID for the customer who replied to an inbound message. - /// The message ID for the sent message for an inbound reply. - /// A new instance for mocking. - public static AcsMessageContext AcsMessageContext(string @from = null, string messageId = null) - { - return new AcsMessageContext(@from, messageId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Text of the button. - /// The Payload of the button which was clicked by the user, setup by the business. - /// A new instance for mocking. - public static AcsMessageButtonContent AcsMessageButtonContent(string text = null, string payload = null) - { - return new AcsMessageButtonContent(text, payload, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Message interactive reply type. - /// The Message Sent when a customer clicks a button. - /// The Message Sent when a customer selects an item from a list. - /// A new instance for mocking. - public static AcsMessageInteractiveContent AcsMessageInteractiveContent(AcsInteractiveReplyKind replyKind = default, AcsMessageInteractiveButtonReplyContent buttonReply = null, AcsMessageInteractiveListReplyContent listReply = null) - { - return new AcsMessageInteractiveContent(replyKind, buttonReply, listReply, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The ID of the button. - /// The title of the button. - /// A new instance for mocking. - public static AcsMessageInteractiveButtonReplyContent AcsMessageInteractiveButtonReplyContent(string buttonId = null, string title = null) - { - return new AcsMessageInteractiveButtonReplyContent(buttonId, title, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The ID of the selected list item. - /// The title of the selected list item. - /// The description of the selected row. - /// A new instance for mocking. - public static AcsMessageInteractiveListReplyContent AcsMessageInteractiveListReplyContent(string listItemId = null, string title = null, string description = null) - { - return new AcsMessageInteractiveListReplyContent(listItemId, title, description, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The request that generated the event. - /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. - /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - /// The connected registry information if the event is generated by a connected registry. - /// A new instance for mocking. - public static ContainerRegistryEventData ContainerRegistryEventData(string id = null, DateTimeOffset timestamp = default, string action = null, string location = null, ContainerRegistryEventTarget target = null, ContainerRegistryEventRequest request = null, ContainerRegistryEventActor actor = null, ContainerRegistryEventSource source = null, ContainerRegistryEventConnectedRegistry connectedRegistry = null) - { - return new ContainerRegistryEventData( - id, - timestamp, - action, - location, - target, - request, - actor, - source, - connectedRegistry, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The MIME type of the referenced object. - /// The number of bytes of the content. Same as Length field. - /// The digest of the content, as defined by the Registry V2 HTTP API Specification. - /// The number of bytes of the content. Same as Size field. - /// The repository name. - /// The direct URL to the content. - /// The tag name. - /// A new instance for mocking. - public static ContainerRegistryEventTarget ContainerRegistryEventTarget(string mediaType = null, long? size = null, string digest = null, long? length = null, string repository = null, string url = null, string tag = null) - { - return new ContainerRegistryEventTarget( - mediaType, - size, - digest, - length, - repository, - url, - tag, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The ID of the request that initiated the event. - /// The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - /// The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - /// The request method that generated the event. - /// The user agent header of the request. - /// A new instance for mocking. - public static ContainerRegistryEventRequest ContainerRegistryEventRequest(string id = null, string addr = null, string host = null, string method = null, string useragent = null) - { - return new ContainerRegistryEventRequest( - id, - addr, - host, - method, - useragent, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The subject or username associated with the request context that generated the event. - /// A new instance for mocking. - public static ContainerRegistryEventActor ContainerRegistryEventActor(string name = null) - { - return new ContainerRegistryEventActor(name, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - /// The running instance of an application. Changes after each restart. - /// A new instance for mocking. - public static ContainerRegistryEventSource ContainerRegistryEventSource(string addr = null, string instanceID = null) - { - return new ContainerRegistryEventSource(addr, instanceID, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the connected registry that generated this event. - /// A new instance for mocking. - public static ContainerRegistryEventConnectedRegistry ContainerRegistryEventConnectedRegistry(string name = null) - { - return new ContainerRegistryEventConnectedRegistry(name, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The request that generated the event. - /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. - /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - /// The connected registry information if the event is generated by a connected registry. - /// A new instance for mocking. - public static ContainerRegistryImagePushedEventData ContainerRegistryImagePushedEventData(string id = null, DateTimeOffset timestamp = default, string action = null, string location = null, ContainerRegistryEventTarget target = null, ContainerRegistryEventRequest request = null, ContainerRegistryEventActor actor = null, ContainerRegistryEventSource source = null, ContainerRegistryEventConnectedRegistry connectedRegistry = null) - { - return new ContainerRegistryImagePushedEventData( - id, - timestamp, - action, - location, - target, - request, - actor, - source, - connectedRegistry, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The request that generated the event. - /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. - /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - /// The connected registry information if the event is generated by a connected registry. - /// A new instance for mocking. - public static ContainerRegistryImageDeletedEventData ContainerRegistryImageDeletedEventData(string id = null, DateTimeOffset timestamp = default, string action = null, string location = null, ContainerRegistryEventTarget target = null, ContainerRegistryEventRequest request = null, ContainerRegistryEventActor actor = null, ContainerRegistryEventSource source = null, ContainerRegistryEventConnectedRegistry connectedRegistry = null) - { - return new ContainerRegistryImageDeletedEventData( - id, - timestamp, - action, - location, - target, - request, - actor, - source, - connectedRegistry, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The connected registry information if the event is generated by a connected registry. - /// A new instance for mocking. - public static ContainerRegistryArtifactEventData ContainerRegistryArtifactEventData(string id = null, DateTimeOffset timestamp = default, string action = null, string location = null, ContainerRegistryArtifactEventTarget target = null, ContainerRegistryEventConnectedRegistry connectedRegistry = null) - { - return new ContainerRegistryArtifactEventData( - id, - timestamp, - action, - location, - target, - connectedRegistry, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The MIME type of the artifact. - /// The size in bytes of the artifact. - /// The digest of the artifact. - /// The repository name of the artifact. - /// The tag of the artifact. - /// The name of the artifact. - /// The version of the artifact. - /// A new instance for mocking. - public static ContainerRegistryArtifactEventTarget ContainerRegistryArtifactEventTarget(string mediaType = null, long? size = null, string digest = null, string repository = null, string tag = null, string name = null, string version = null) - { - return new ContainerRegistryArtifactEventTarget( - mediaType, - size, - digest, - repository, - tag, - name, - version, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The connected registry information if the event is generated by a connected registry. - /// A new instance for mocking. - public static ContainerRegistryChartPushedEventData ContainerRegistryChartPushedEventData(string id = null, DateTimeOffset timestamp = default, string action = null, string location = null, ContainerRegistryArtifactEventTarget target = null, ContainerRegistryEventConnectedRegistry connectedRegistry = null) - { - return new ContainerRegistryChartPushedEventData( - id, - timestamp, - action, - location, - target, - connectedRegistry, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The event ID. - /// The time at which the event occurred. - /// The action that encompasses the provided event. - /// The location of the event. - /// The target of the event. - /// The connected registry information if the event is generated by a connected registry. - /// A new instance for mocking. - public static ContainerRegistryChartDeletedEventData ContainerRegistryChartDeletedEventData(string id = null, DateTimeOffset timestamp = default, string action = null, string location = null, ContainerRegistryArtifactEventTarget target = null, ContainerRegistryEventConnectedRegistry connectedRegistry = null) - { - return new ContainerRegistryChartDeletedEventData( - id, - timestamp, - action, - location, - target, - connectedRegistry, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The highest PATCH Kubernetes version for the highest MINOR version supported by ManagedCluster resource. - /// The highest PATCH Kubernetes version for the MINOR version considered stable for the ManagedCluster resource. - /// The highest PATCH Kubernetes version for the lowest applicable MINOR version available for the ManagedCluster resource. - /// The highest PATCH Kubernetes version considered preview for the ManagedCluster resource. There might not be any version in preview at the time of publishing the event. - /// A new instance for mocking. - public static ContainerServiceNewKubernetesVersionAvailableEventData ContainerServiceNewKubernetesVersionAvailableEventData(string latestSupportedKubernetesVersion = null, string latestStableKubernetesVersion = null, string lowestMinorKubernetesVersion = null, string latestPreviewKubernetesVersion = null) - { - return new ContainerServiceNewKubernetesVersionAvailableEventData(latestSupportedKubernetesVersion, latestStableKubernetesVersion, lowestMinorKubernetesVersion, latestPreviewKubernetesVersion, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Kubernetes version of the ManagedCluster resource. - /// A new instance for mocking. - public static ContainerServiceClusterSupportEventData ContainerServiceClusterSupportEventData(string kubernetesVersion = null) - { - return new ContainerServiceClusterSupportEventData(kubernetesVersion, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Kubernetes version of the ManagedCluster resource. - /// A new instance for mocking. - public static ContainerServiceClusterSupportEndedEventData ContainerServiceClusterSupportEndedEventData(string kubernetesVersion = null) - { - return new ContainerServiceClusterSupportEndedEventData(kubernetesVersion, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Kubernetes version of the ManagedCluster resource. - /// A new instance for mocking. - public static ContainerServiceClusterSupportEndingEventData ContainerServiceClusterSupportEndingEventData(string kubernetesVersion = null) - { - return new ContainerServiceClusterSupportEndingEventData(kubernetesVersion, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the node pool in the ManagedCluster resource. - /// A new instance for mocking. - public static ContainerServiceNodePoolRollingEventData ContainerServiceNodePoolRollingEventData(string nodePoolName = null) - { - return new ContainerServiceNodePoolRollingEventData(nodePoolName, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the node pool in the ManagedCluster resource. - /// A new instance for mocking. - public static ContainerServiceNodePoolRollingStartedEventData ContainerServiceNodePoolRollingStartedEventData(string nodePoolName = null) - { - return new ContainerServiceNodePoolRollingStartedEventData(nodePoolName, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the node pool in the ManagedCluster resource. - /// A new instance for mocking. - public static ContainerServiceNodePoolRollingSucceededEventData ContainerServiceNodePoolRollingSucceededEventData(string nodePoolName = null) - { - return new ContainerServiceNodePoolRollingSucceededEventData(nodePoolName, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the node pool in the ManagedCluster resource. - /// A new instance for mocking. - public static ContainerServiceNodePoolRollingFailedEventData ContainerServiceNodePoolRollingFailedEventData(string nodePoolName = null) - { - return new ContainerServiceNodePoolRollingFailedEventData(nodePoolName, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Serial Number of the device associated with the event. The list is comma separated if more than one serial number is associated. - /// Name of the current Stage. - /// The time at which the stage happened. - /// A new instance for mocking. - public static DataBoxCopyStartedEventData DataBoxCopyStartedEventData(string serialNumber = null, DataBoxStageName stageName = default, DateTimeOffset stageTime = default) - { - return new DataBoxCopyStartedEventData(serialNumber, stageName, stageTime, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Serial Number of the device associated with the event. The list is comma separated if more than one serial number is associated. - /// Name of the current Stage. - /// The time at which the stage happened. - /// A new instance for mocking. - public static DataBoxCopyCompletedEventData DataBoxCopyCompletedEventData(string serialNumber = null, DataBoxStageName stageName = default, DateTimeOffset stageTime = default) - { - return new DataBoxCopyCompletedEventData(serialNumber, stageName, stageTime, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Serial Number of the device associated with the event. The list is comma separated if more than one serial number is associated. - /// Name of the current Stage. - /// The time at which the stage happened. - /// A new instance for mocking. - public static DataBoxOrderCompletedEventData DataBoxOrderCompletedEventData(string serialNumber = null, DataBoxStageName stageName = default, DateTimeOffset stageTime = default) - { - return new DataBoxOrderCompletedEventData(serialNumber, stageName, stageTime, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The path to the capture file. - /// The file type of the capture file. - /// The shard ID. - /// The file size. - /// The number of events in the file. - /// The smallest sequence number from the queue. - /// The last sequence number from the queue. - /// The first time from the queue. - /// The last time from the queue. - /// A new instance for mocking. - public static EventHubCaptureFileCreatedEventData EventHubCaptureFileCreatedEventData(string fileurl = null, string fileType = null, string partitionId = null, int? sizeInBytes = null, int? eventCount = null, int? firstSequenceNumber = null, int? lastSequenceNumber = null, DateTimeOffset firstEnqueueTime = default, DateTimeOffset lastEnqueueTime = default) - { - return new EventHubCaptureFileCreatedEventData( - fileurl, - fileType, - partitionId, - sizeInBytes, - eventCount, - firstSequenceNumber, - lastSequenceNumber, - firstEnqueueTime, - lastEnqueueTime, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Lists of the geometry ID of the geofence which is expired relative to the user time in the request. - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. - /// True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. - /// A new instance for mocking. - public static MapsGeofenceEventProperties MapsGeofenceEventProperties(IEnumerable expiredGeofenceGeometryId = null, IEnumerable geometries = null, IEnumerable invalidPeriodGeofenceGeometryId = null, bool? isEventPublished = null) - { - expiredGeofenceGeometryId ??= new List(); - geometries ??= new List(); - invalidPeriodGeofenceGeometryId ??= new List(); - - return new MapsGeofenceEventProperties(expiredGeofenceGeometryId?.ToList(), geometries?.ToList(), invalidPeriodGeofenceGeometryId?.ToList(), isEventPublished, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// ID of the device. - /// Distance from the coordinate to the closest border of the geofence. Positive means the coordinate is outside of the geofence. If the coordinate is outside of the geofence, but more than the value of searchBuffer away from the closest geofence border, then the value is 999. Negative means the coordinate is inside of the geofence. If the coordinate is inside the polygon, but more than the value of searchBuffer away from the closest geofencing border,then the value is -999. A value of 999 means that there is great confidence the coordinate is well outside the geofence. A value of -999 means that there is great confidence the coordinate is well within the geofence. - /// The unique ID for the geofence geometry. - /// Latitude of the nearest point of the geometry. - /// Longitude of the nearest point of the geometry. - /// The unique id returned from user upload service when uploading a geofence. Will not be included in geofencing post API. - /// A new instance for mocking. - public static MapsGeofenceGeometry MapsGeofenceGeometry(string deviceId = null, float? distance = null, string geometryId = null, float? nearestLat = null, float? nearestLon = null, string udId = null) - { - return new MapsGeofenceGeometry( - deviceId, - distance, - geometryId, - nearestLat, - nearestLon, - udId, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Lists of the geometry ID of the geofence which is expired relative to the user time in the request. - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. - /// True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. - /// A new instance for mocking. - public static MapsGeofenceEnteredEventData MapsGeofenceEnteredEventData(IEnumerable expiredGeofenceGeometryId = null, IEnumerable geometries = null, IEnumerable invalidPeriodGeofenceGeometryId = null, bool? isEventPublished = null) - { - expiredGeofenceGeometryId ??= new List(); - geometries ??= new List(); - invalidPeriodGeofenceGeometryId ??= new List(); - - return new MapsGeofenceEnteredEventData(expiredGeofenceGeometryId?.ToList(), geometries?.ToList(), invalidPeriodGeofenceGeometryId?.ToList(), isEventPublished, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Lists of the geometry ID of the geofence which is expired relative to the user time in the request. - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. - /// True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. - /// A new instance for mocking. - public static MapsGeofenceExitedEventData MapsGeofenceExitedEventData(IEnumerable expiredGeofenceGeometryId = null, IEnumerable geometries = null, IEnumerable invalidPeriodGeofenceGeometryId = null, bool? isEventPublished = null) - { - expiredGeofenceGeometryId ??= new List(); - geometries ??= new List(); - invalidPeriodGeofenceGeometryId ??= new List(); - - return new MapsGeofenceExitedEventData(expiredGeofenceGeometryId?.ToList(), geometries?.ToList(), invalidPeriodGeofenceGeometryId?.ToList(), isEventPublished, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Lists of the geometry ID of the geofence which is expired relative to the user time in the request. - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. - /// True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. - /// A new instance for mocking. - public static MapsGeofenceResultEventData MapsGeofenceResultEventData(IEnumerable expiredGeofenceGeometryId = null, IEnumerable geometries = null, IEnumerable invalidPeriodGeofenceGeometryId = null, bool? isEventPublished = null) - { - expiredGeofenceGeometryId ??= new List(); - geometries ??= new List(); - invalidPeriodGeofenceGeometryId ??= new List(); - - return new MapsGeofenceResultEventData(expiredGeofenceGeometryId?.ToList(), geometries?.ToList(), invalidPeriodGeofenceGeometryId?.ToList(), isEventPublished, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device twin, which is the cloud representation of application device metadata. - /// A new instance for mocking. - public static DeviceLifeCycleEventProperties DeviceLifeCycleEventProperties(string deviceId = null, string hubName = null, DeviceTwinInfo twin = null) - { - return new DeviceLifeCycleEventProperties(deviceId, hubName, twin, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Authentication type used for this device: either SAS, SelfSigned, or CertificateAuthority. - /// Count of cloud to device messages sent to this device. - /// Whether the device is connected or disconnected. - /// The unique identifier of the device twin. - /// A piece of information that describes the content of the device twin. Each etag is guaranteed to be unique per device twin. - /// The ISO8601 timestamp of the last activity. - /// Properties JSON element. - /// Whether the device twin is enabled or disabled. - /// The ISO8601 timestamp of the last device twin status update. - /// An integer that is incremented by one each time the device twin is updated. - /// The thumbprint is a unique value for the x509 certificate, commonly used to find a particular certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 algorithm, and does not physically exist in the certificate. - /// A new instance for mocking. - public static DeviceTwinInfo DeviceTwinInfo(string authenticationType = null, float? cloudToDeviceMessageCount = null, string connectionState = null, string deviceId = null, string etag = null, string lastActivityTime = null, DeviceTwinInfoProperties properties = null, string status = null, string statusUpdateTime = null, float? version = null, DeviceTwinInfoX509Thumbprint x509Thumbprint = null) - { - return new DeviceTwinInfo( - authenticationType, - cloudToDeviceMessageCount, - connectionState, - deviceId, - etag, - lastActivityTime, - properties, - status, - statusUpdateTime, - version, - x509Thumbprint, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// A portion of the properties that can be written only by the application back-end, and read by the device. - /// A portion of the properties that can be written only by the device, and read by the application back-end. - /// A new instance for mocking. - public static DeviceTwinInfoProperties DeviceTwinInfoProperties(DeviceTwinProperties desired = null, DeviceTwinProperties reported = null) - { - return new DeviceTwinInfoProperties(desired, reported, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Metadata information for the properties JSON document. - /// Version of device twin properties. - /// A new instance for mocking. - public static DeviceTwinProperties DeviceTwinProperties(DeviceTwinMetadata metadata = null, float? version = null) - { - return new DeviceTwinProperties(metadata, version, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The ISO8601 timestamp of the last time the properties were updated. - /// A new instance for mocking. - public static DeviceTwinMetadata DeviceTwinMetadata(string lastUpdated = null) - { - return new DeviceTwinMetadata(lastUpdated, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Primary thumbprint for the x509 certificate. - /// Secondary thumbprint for the x509 certificate. - /// A new instance for mocking. - public static DeviceTwinInfoX509Thumbprint DeviceTwinInfoX509Thumbprint(string primaryThumbprint = null, string secondaryThumbprint = null) - { - return new DeviceTwinInfoX509Thumbprint(primaryThumbprint, secondaryThumbprint, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device connection state event. - /// A new instance for mocking. - public static DeviceConnectionStateEventProperties DeviceConnectionStateEventProperties(string deviceId = null, string moduleId = null, string hubName = null, DeviceConnectionStateEventInfo deviceConnectionStateEventInfo = null) - { - return new DeviceConnectionStateEventProperties(deviceId, moduleId, hubName, deviceConnectionStateEventInfo, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Sequence number is string representation of a hexadecimal number. string compare can be used to identify the larger number because both in ASCII and HEX numbers come after alphabets. If you are converting the string to hex, then the number is a 256 bit number. - /// A new instance for mocking. - public static DeviceConnectionStateEventInfo DeviceConnectionStateEventInfo(string sequenceNumber = null) - { - return new DeviceConnectionStateEventInfo(sequenceNumber, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The content of the message from the device. - /// Application properties are user-defined strings that can be added to the message. These fields are optional. - /// System properties help identify contents and source of the messages. - /// A new instance for mocking. - public static DeviceTelemetryEventProperties DeviceTelemetryEventProperties(IReadOnlyDictionary body = null, IReadOnlyDictionary properties = null, IReadOnlyDictionary systemProperties = null) - { - body ??= new Dictionary(); - properties ??= new Dictionary(); - systemProperties ??= new Dictionary(); - - return new DeviceTelemetryEventProperties(body, properties, systemProperties, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device twin, which is the cloud representation of application device metadata. - /// A new instance for mocking. - public static IotHubDeviceCreatedEventData IotHubDeviceCreatedEventData(string deviceId = null, string hubName = null, DeviceTwinInfo twin = null) - { - return new IotHubDeviceCreatedEventData(deviceId, hubName, twin, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device twin, which is the cloud representation of application device metadata. - /// A new instance for mocking. - public static IotHubDeviceDeletedEventData IotHubDeviceDeletedEventData(string deviceId = null, string hubName = null, DeviceTwinInfo twin = null) - { - return new IotHubDeviceDeletedEventData(deviceId, hubName, twin, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device connection state event. - /// A new instance for mocking. - public static IotHubDeviceConnectedEventData IotHubDeviceConnectedEventData(string deviceId = null, string moduleId = null, string hubName = null, DeviceConnectionStateEventInfo deviceConnectionStateEventInfo = null) - { - return new IotHubDeviceConnectedEventData(deviceId, moduleId, hubName, deviceConnectionStateEventInfo, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device connection state event. - /// A new instance for mocking. - public static IotHubDeviceDisconnectedEventData IotHubDeviceDisconnectedEventData(string deviceId = null, string moduleId = null, string hubName = null, DeviceConnectionStateEventInfo deviceConnectionStateEventInfo = null) - { - return new IotHubDeviceDisconnectedEventData(deviceId, moduleId, hubName, deviceConnectionStateEventInfo, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The content of the message from the device. - /// Application properties are user-defined strings that can be added to the message. These fields are optional. - /// System properties help identify contents and source of the messages. - /// A new instance for mocking. - public static IotHubDeviceTelemetryEventData IotHubDeviceTelemetryEventData(IReadOnlyDictionary body = null, IReadOnlyDictionary properties = null, IReadOnlyDictionary systemProperties = null) - { - body ??= new Dictionary(); - properties ??= new Dictionary(); - systemProperties ??= new Dictionary(); - - return new IotHubDeviceTelemetryEventData(body, properties, systemProperties, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Type of HL7 FHIR resource. - /// Domain name of FHIR account for this resource. - /// Id of HL7 FHIR resource. - /// VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or deleted(soft-deletion). - /// A new instance for mocking. - public static HealthcareFhirResourceCreatedEventData HealthcareFhirResourceCreatedEventData(HealthcareFhirResourceType fhirResourceType = default, string fhirServiceHostName = null, string fhirResourceId = null, long? fhirResourceVersionId = null) - { - return new HealthcareFhirResourceCreatedEventData(fhirResourceType, fhirServiceHostName, fhirResourceId, fhirResourceVersionId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Type of HL7 FHIR resource. - /// Domain name of FHIR account for this resource. - /// Id of HL7 FHIR resource. - /// VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or deleted(soft-deletion). - /// A new instance for mocking. - public static HealthcareFhirResourceUpdatedEventData HealthcareFhirResourceUpdatedEventData(HealthcareFhirResourceType fhirResourceType = default, string fhirServiceHostName = null, string fhirResourceId = null, long? fhirResourceVersionId = null) - { - return new HealthcareFhirResourceUpdatedEventData(fhirResourceType, fhirServiceHostName, fhirResourceId, fhirResourceVersionId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Type of HL7 FHIR resource. - /// Domain name of FHIR account for this resource. - /// Id of HL7 FHIR resource. - /// VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or deleted(soft-deletion). - /// A new instance for mocking. - public static HealthcareFhirResourceDeletedEventData HealthcareFhirResourceDeletedEventData(HealthcareFhirResourceType fhirResourceType = default, string fhirServiceHostName = null, string fhirResourceId = null, long? fhirResourceVersionId = null) - { - return new HealthcareFhirResourceDeletedEventData(fhirResourceType, fhirServiceHostName, fhirResourceId, fhirResourceVersionId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Data partition name. - /// Unique identifier for the Study. - /// Unique identifier for the Series. - /// Unique identifier for the DICOM Image. - /// Domain name of the DICOM account for this image. - /// Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every image creation and deletion within the service. - /// A new instance for mocking. - public static HealthcareDicomImageCreatedEventData HealthcareDicomImageCreatedEventData(string partitionName = null, string imageStudyInstanceUid = null, string imageSeriesInstanceUid = null, string imageSopInstanceUid = null, string serviceHostName = null, long? sequenceNumber = null) - { - return new HealthcareDicomImageCreatedEventData( - partitionName, - imageStudyInstanceUid, - imageSeriesInstanceUid, - imageSopInstanceUid, - serviceHostName, - sequenceNumber, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Data partition name. - /// Unique identifier for the Study. - /// Unique identifier for the Series. - /// Unique identifier for the DICOM Image. - /// Host name of the DICOM account for this image. - /// Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every image creation and deletion within the service. - /// A new instance for mocking. - public static HealthcareDicomImageDeletedEventData HealthcareDicomImageDeletedEventData(string partitionName = null, string imageStudyInstanceUid = null, string imageSeriesInstanceUid = null, string imageSopInstanceUid = null, string serviceHostName = null, long? sequenceNumber = null) - { - return new HealthcareDicomImageDeletedEventData( - partitionName, - imageStudyInstanceUid, - imageSeriesInstanceUid, - imageSopInstanceUid, - serviceHostName, - sequenceNumber, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Data partition name. - /// Unique identifier for the Study. - /// Unique identifier for the Series. - /// Unique identifier for the DICOM Image. - /// Domain name of the DICOM account for this image. - /// Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every image creation, updation and deletion within the service. - /// A new instance for mocking. - public static HealthcareDicomImageUpdatedEventData HealthcareDicomImageUpdatedEventData(string partitionName = null, string imageStudyInstanceUid = null, string imageSeriesInstanceUid = null, string imageSopInstanceUid = null, string serviceHostName = null, long? sequenceNumber = null) - { - return new HealthcareDicomImageUpdatedEventData( - partitionName, - imageStudyInstanceUid, - imageSeriesInstanceUid, - imageSopInstanceUid, - serviceHostName, - sequenceNumber, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// A new instance for mocking. - public static KeyVaultCertificateNewVersionCreatedEventData KeyVaultCertificateNewVersionCreatedEventData(string id = null, string vaultName = null, string objectType = null, string objectName = null, string version = null, float? nbf = null, float? exp = null) - { - return new KeyVaultCertificateNewVersionCreatedEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// A new instance for mocking. - public static KeyVaultCertificateNearExpiryEventData KeyVaultCertificateNearExpiryEventData(string id = null, string vaultName = null, string objectType = null, string objectName = null, string version = null, float? nbf = null, float? exp = null) - { - return new KeyVaultCertificateNearExpiryEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// A new instance for mocking. - public static KeyVaultCertificateExpiredEventData KeyVaultCertificateExpiredEventData(string id = null, string vaultName = null, string objectType = null, string objectName = null, string version = null, float? nbf = null, float? exp = null) - { - return new KeyVaultCertificateExpiredEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// A new instance for mocking. - public static KeyVaultKeyNewVersionCreatedEventData KeyVaultKeyNewVersionCreatedEventData(string id = null, string vaultName = null, string objectType = null, string objectName = null, string version = null, float? nbf = null, float? exp = null) - { - return new KeyVaultKeyNewVersionCreatedEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// A new instance for mocking. - public static KeyVaultKeyNearExpiryEventData KeyVaultKeyNearExpiryEventData(string id = null, string vaultName = null, string objectType = null, string objectName = null, string version = null, float? nbf = null, float? exp = null) - { - return new KeyVaultKeyNearExpiryEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// A new instance for mocking. - public static KeyVaultKeyExpiredEventData KeyVaultKeyExpiredEventData(string id = null, string vaultName = null, string objectType = null, string objectName = null, string version = null, float? nbf = null, float? exp = null) - { - return new KeyVaultKeyExpiredEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// A new instance for mocking. - public static KeyVaultSecretNewVersionCreatedEventData KeyVaultSecretNewVersionCreatedEventData(string id = null, string vaultName = null, string objectType = null, string objectName = null, string version = null, float? nbf = null, float? exp = null) - { - return new KeyVaultSecretNewVersionCreatedEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// A new instance for mocking. - public static KeyVaultSecretNearExpiryEventData KeyVaultSecretNearExpiryEventData(string id = null, string vaultName = null, string objectType = null, string objectName = null, string version = null, float? nbf = null, float? exp = null) - { - return new KeyVaultSecretNearExpiryEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// A new instance for mocking. - public static KeyVaultSecretExpiredEventData KeyVaultSecretExpiredEventData(string id = null, string vaultName = null, string objectType = null, string objectName = null, string version = null, float? nbf = null, float? exp = null) - { - return new KeyVaultSecretExpiredEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// A new instance for mocking. - public static KeyVaultAccessPolicyChangedEventData KeyVaultAccessPolicyChangedEventData(string id = null, string vaultName = null, string objectType = null, string objectName = null, string version = null, float? nbf = null, float? exp = null) - { - return new KeyVaultAccessPolicyChangedEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the model that was registered. - /// The version of the model that was registered. - /// The tags of the model that was registered. - /// The properties of the model that was registered. - /// A new instance for mocking. - public static MachineLearningServicesModelRegisteredEventData MachineLearningServicesModelRegisteredEventData(string modelName = null, string modelVersion = null, IReadOnlyDictionary modelTags = null, IReadOnlyDictionary modelProperties = null) - { - modelTags ??= new Dictionary(); - modelProperties ??= new Dictionary(); - - return new MachineLearningServicesModelRegisteredEventData(modelName, modelVersion, modelTags, modelProperties, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the deployed service. - /// The compute type (e.g. ACI, AKS) of the deployed service. - /// A common separated list of model IDs. The IDs of the models deployed in the service. - /// The tags of the deployed service. - /// The properties of the deployed service. - /// A new instance for mocking. - public static MachineLearningServicesModelDeployedEventData MachineLearningServicesModelDeployedEventData(string serviceName = null, string serviceComputeType = null, string modelIds = null, IReadOnlyDictionary serviceTags = null, IReadOnlyDictionary serviceProperties = null) - { - serviceTags ??= new Dictionary(); - serviceProperties ??= new Dictionary(); - - return new MachineLearningServicesModelDeployedEventData( - serviceName, - serviceComputeType, - modelIds, - serviceTags, - serviceProperties, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The ID of the experiment that the run belongs to. - /// The name of the experiment that the run belongs to. - /// The ID of the Run that was completed. - /// The Run Type of the completed Run. - /// The tags of the completed Run. - /// The properties of the completed Run. - /// A new instance for mocking. - public static MachineLearningServicesRunCompletedEventData MachineLearningServicesRunCompletedEventData(string experimentId = null, string experimentName = null, string runId = null, string runType = null, IReadOnlyDictionary runTags = null, IReadOnlyDictionary runProperties = null) - { - runTags ??= new Dictionary(); - runProperties ??= new Dictionary(); - - return new MachineLearningServicesRunCompletedEventData( - experimentId, - experimentName, - runId, - runType, - runTags, - runProperties, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The ID of the data drift monitor that triggered the event. - /// The name of the data drift monitor that triggered the event. - /// The ID of the Run that detected data drift. - /// The ID of the base Dataset used to detect drift. - /// The ID of the target Dataset used to detect drift. - /// The coefficient result that triggered the event. - /// The start time of the target dataset time series that resulted in drift detection. - /// The end time of the target dataset time series that resulted in drift detection. - /// A new instance for mocking. - public static MachineLearningServicesDatasetDriftDetectedEventData MachineLearningServicesDatasetDriftDetectedEventData(string dataDriftId = null, string dataDriftName = null, string runId = null, string baseDatasetId = null, string targetDatasetId = null, double? driftCoefficient = null, DateTimeOffset startTime = default, DateTimeOffset endTime = default) - { - return new MachineLearningServicesDatasetDriftDetectedEventData( - dataDriftId, - dataDriftName, - runId, - baseDatasetId, - targetDatasetId, - driftCoefficient, - startTime, - endTime, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The ID of the experiment that the Machine Learning Run belongs to. - /// The name of the experiment that the Machine Learning Run belongs to. - /// The ID of the Machine Learning Run. - /// The Run Type of the Machine Learning Run. - /// The tags of the Machine Learning Run. - /// The properties of the Machine Learning Run. - /// The status of the Machine Learning Run. - /// A new instance for mocking. - public static MachineLearningServicesRunStatusChangedEventData MachineLearningServicesRunStatusChangedEventData(string experimentId = null, string experimentName = null, string runId = null, string runType = null, IReadOnlyDictionary runTags = null, IReadOnlyDictionary runProperties = null, string runStatus = null) - { - runTags ??= new Dictionary(); - runProperties ??= new Dictionary(); - - return new MachineLearningServicesRunStatusChangedEventData( - experimentId, - experimentName, - runId, - runType, - runTags, - runProperties, - runStatus, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobStateChangeEventData MediaJobStateChangeEventData(MediaJobState previousState = default, MediaJobState state = default, IReadOnlyDictionary correlationData = null) - { - correlationData ??= new Dictionary(); - - return new MediaJobStateChangeEventData(previousState, state, correlationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Error code describing the error. - /// A human-readable language-dependent representation of the error. - /// Helps with categorization of errors. - /// Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact Azure support via Azure Portal. - /// An array of details about specific errors that led to this reported error. - /// A new instance for mocking. - public static MediaJobError MediaJobError(MediaJobErrorCode code = default, string message = null, MediaJobErrorCategory category = default, MediaJobRetry retry = default, IEnumerable details = null) - { - details ??= new List(); - - return new MediaJobError( - code, - message, - category, - retry, - details?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Code describing the error detail. - /// A human-readable representation of the error. - /// A new instance for mocking. - public static MediaJobErrorDetail MediaJobErrorDetail(string code = null, string message = null) - { - return new MediaJobErrorDetail(code, message, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The discriminator for derived types. - /// Gets the Job output error. - /// Gets the Job output label. - /// Gets the Job output progress. - /// Gets the Job output state. - /// A new instance for mocking. - public static MediaJobOutput MediaJobOutput(string odataType = null, MediaJobError error = null, string label = null, long progress = default, MediaJobState state = default) - { - return new UnknownMediaJobOutput( - odataType, - error, - label, - progress, - state, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the Job output error. - /// Gets the Job output label. - /// Gets the Job output progress. - /// Gets the Job output state. - /// Gets the Job output asset name. - /// A new instance for mocking. - public static MediaJobOutputAsset MediaJobOutputAsset(MediaJobError error = null, string label = null, long progress = default, MediaJobState state = default, string assetName = null) - { - return new MediaJobOutputAsset( - "#Microsoft.Media.JobOutputAsset", - error, - label, - progress, - state, - serializedAdditionalRawData: null, - assetName); - } - - /// Initializes a new instance of . - /// Gets the Job output label. - /// Gets the Job output progress. - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobOutputProgressEventData MediaJobOutputProgressEventData(string label = null, long? progress = null, IReadOnlyDictionary jobCorrelationData = null) - { - jobCorrelationData ??= new Dictionary(); - - return new MediaJobOutputProgressEventData(label, progress, jobCorrelationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobOutputStateChangeEventData MediaJobOutputStateChangeEventData(MediaJobState previousState = default, MediaJobOutput output = null, IReadOnlyDictionary jobCorrelationData = null) - { - jobCorrelationData ??= new Dictionary(); - - return new MediaJobOutputStateChangeEventData(previousState, output, jobCorrelationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobScheduledEventData MediaJobScheduledEventData(MediaJobState previousState = default, MediaJobState state = default, IReadOnlyDictionary correlationData = null) - { - correlationData ??= new Dictionary(); - - return new MediaJobScheduledEventData(previousState, state, correlationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobProcessingEventData MediaJobProcessingEventData(MediaJobState previousState = default, MediaJobState state = default, IReadOnlyDictionary correlationData = null) - { - correlationData ??= new Dictionary(); - - return new MediaJobProcessingEventData(previousState, state, correlationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobCancelingEventData MediaJobCancelingEventData(MediaJobState previousState = default, MediaJobState state = default, IReadOnlyDictionary correlationData = null) - { - correlationData ??= new Dictionary(); - - return new MediaJobCancelingEventData(previousState, state, correlationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// - /// Gets the Job outputs. - /// 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 . - /// - /// A new instance for mocking. - public static MediaJobFinishedEventData MediaJobFinishedEventData(MediaJobState previousState = default, MediaJobState state = default, IReadOnlyDictionary correlationData = null, IEnumerable outputs = null) - { - correlationData ??= new Dictionary(); - outputs ??= new List(); - - return new MediaJobFinishedEventData(previousState, state, correlationData, serializedAdditionalRawData: null, outputs?.ToList()); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// - /// Gets the Job outputs. - /// 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 . - /// - /// A new instance for mocking. - public static MediaJobCanceledEventData MediaJobCanceledEventData(MediaJobState previousState = default, MediaJobState state = default, IReadOnlyDictionary correlationData = null, IEnumerable outputs = null) - { - correlationData ??= new Dictionary(); - outputs ??= new List(); - - return new MediaJobCanceledEventData(previousState, state, correlationData, serializedAdditionalRawData: null, outputs?.ToList()); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// - /// Gets the Job outputs. - /// 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 . - /// - /// A new instance for mocking. - public static MediaJobErroredEventData MediaJobErroredEventData(MediaJobState previousState = default, MediaJobState state = default, IReadOnlyDictionary correlationData = null, IEnumerable outputs = null) - { - correlationData ??= new Dictionary(); - outputs ??= new List(); - - return new MediaJobErroredEventData(previousState, state, correlationData, serializedAdditionalRawData: null, outputs?.ToList()); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobOutputCanceledEventData MediaJobOutputCanceledEventData(MediaJobState previousState = default, MediaJobOutput output = null, IReadOnlyDictionary jobCorrelationData = null) - { - jobCorrelationData ??= new Dictionary(); - - return new MediaJobOutputCanceledEventData(previousState, output, jobCorrelationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobOutputCancelingEventData MediaJobOutputCancelingEventData(MediaJobState previousState = default, MediaJobOutput output = null, IReadOnlyDictionary jobCorrelationData = null) - { - jobCorrelationData ??= new Dictionary(); - - return new MediaJobOutputCancelingEventData(previousState, output, jobCorrelationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobOutputErroredEventData MediaJobOutputErroredEventData(MediaJobState previousState = default, MediaJobOutput output = null, IReadOnlyDictionary jobCorrelationData = null) - { - jobCorrelationData ??= new Dictionary(); - - return new MediaJobOutputErroredEventData(previousState, output, jobCorrelationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobOutputFinishedEventData MediaJobOutputFinishedEventData(MediaJobState previousState = default, MediaJobOutput output = null, IReadOnlyDictionary jobCorrelationData = null) - { - jobCorrelationData ??= new Dictionary(); - - return new MediaJobOutputFinishedEventData(previousState, output, jobCorrelationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobOutputProcessingEventData MediaJobOutputProcessingEventData(MediaJobState previousState = default, MediaJobOutput output = null, IReadOnlyDictionary jobCorrelationData = null) - { - jobCorrelationData ??= new Dictionary(); - - return new MediaJobOutputProcessingEventData(previousState, output, jobCorrelationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// A new instance for mocking. - public static MediaJobOutputScheduledEventData MediaJobOutputScheduledEventData(MediaJobState previousState = default, MediaJobOutput output = null, IReadOnlyDictionary jobCorrelationData = null) - { - jobCorrelationData ??= new Dictionary(); - - return new MediaJobOutputScheduledEventData(previousState, output, jobCorrelationData, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the ingest URL provided by the live event. - /// Gets the stream Id. - /// Gets the remote IP. - /// Gets the remote port. - /// A new instance for mocking. - public static MediaLiveEventEncoderConnectedEventData MediaLiveEventEncoderConnectedEventData(string ingestUrl = null, string streamId = null, string encoderIp = null, string encoderPort = null) - { - return new MediaLiveEventEncoderConnectedEventData(ingestUrl, streamId, encoderIp, encoderPort, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the ingest URL provided by the live event. - /// Gets the stream Id. - /// Gets the remote IP. - /// Gets the remote port. - /// Gets the result code. - /// A new instance for mocking. - public static MediaLiveEventConnectionRejectedEventData MediaLiveEventConnectionRejectedEventData(string ingestUrl = null, string streamId = null, string encoderIp = null, string encoderPort = null, string resultCode = null) - { - return new MediaLiveEventConnectionRejectedEventData( - ingestUrl, - streamId, - encoderIp, - encoderPort, - resultCode, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the ingest URL provided by the live event. - /// Gets the stream Id. - /// Gets the remote IP. - /// Gets the remote port. - /// Gets the result code. - /// A new instance for mocking. - public static MediaLiveEventEncoderDisconnectedEventData MediaLiveEventEncoderDisconnectedEventData(string ingestUrl = null, string streamId = null, string encoderIp = null, string encoderPort = null, string resultCode = null) - { - return new MediaLiveEventEncoderDisconnectedEventData( - ingestUrl, - streamId, - encoderIp, - encoderPort, - resultCode, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the ingest URL provided by the live event. - /// Gets the type of the track (Audio / Video). - /// Gets the track name. - /// Gets the bitrate of the track. - /// Gets the remote IP. - /// Gets the remote port. - /// Gets the first timestamp of the data chunk received. - /// Gets the duration of the first data chunk. - /// Gets the timescale in which timestamp is represented. - /// A new instance for mocking. - public static MediaLiveEventIncomingStreamReceivedEventData MediaLiveEventIncomingStreamReceivedEventData(string ingestUrl = null, string trackType = null, string trackName = null, long? bitrate = null, string encoderIp = null, string encoderPort = null, string timestamp = null, string duration = null, string timescale = null) - { - return new MediaLiveEventIncomingStreamReceivedEventData( - ingestUrl, - trackType, - trackName, - bitrate, - encoderIp, - encoderPort, - timestamp, - duration, - timescale, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the minimum last timestamp received. - /// Gets the type of stream with minimum last timestamp. - /// Gets the maximum timestamp among all the tracks (audio or video). - /// Gets the type of stream with maximum last timestamp. - /// Gets the timescale in which \"MinLastTimestamp\" is represented. - /// Gets the timescale in which \"MaxLastTimestamp\" is represented. - /// A new instance for mocking. - public static MediaLiveEventIncomingStreamsOutOfSyncEventData MediaLiveEventIncomingStreamsOutOfSyncEventData(string minLastTimestamp = null, string typeOfStreamWithMinLastTimestamp = null, string maxLastTimestamp = null, string typeOfStreamWithMaxLastTimestamp = null, string timescaleOfMinLastTimestamp = null, string timescaleOfMaxLastTimestamp = null) - { - return new MediaLiveEventIncomingStreamsOutOfSyncEventData( - minLastTimestamp, - typeOfStreamWithMinLastTimestamp, - maxLastTimestamp, - typeOfStreamWithMaxLastTimestamp, - timescaleOfMinLastTimestamp, - timescaleOfMaxLastTimestamp, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the first timestamp received for one of the quality levels. - /// Gets the duration of the data chunk with first timestamp. - /// Gets the timestamp received for some other quality levels. - /// Gets the duration of the data chunk with second timestamp. - /// Gets the timescale in which both the timestamps and durations are represented. - /// A new instance for mocking. - public static MediaLiveEventIncomingVideoStreamsOutOfSyncEventData MediaLiveEventIncomingVideoStreamsOutOfSyncEventData(string firstTimestamp = null, string firstDuration = null, string secondTimestamp = null, string secondDuration = null, string timescale = null) - { - return new MediaLiveEventIncomingVideoStreamsOutOfSyncEventData( - firstTimestamp, - firstDuration, - secondTimestamp, - secondDuration, - timescale, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the timestamp of the data chunk dropped. - /// Gets the type of the track (Audio / Video). - /// Gets the bitrate of the track. - /// Gets the result code for fragment drop operation. - /// Gets the name of the track for which fragment is dropped. - /// A new instance for mocking. - public static MediaLiveEventIncomingDataChunkDroppedEventData MediaLiveEventIncomingDataChunkDroppedEventData(string timestamp = null, string trackType = null, long? bitrate = null, string resultCode = null, string trackName = null) - { - return new MediaLiveEventIncomingDataChunkDroppedEventData( - timestamp, - trackType, - bitrate, - resultCode, - trackName, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the type of the track (Audio / Video). - /// Gets the track name. - /// Gets the Live Transcription language. - /// Gets the Live Transcription state. - /// Gets the bitrate of the track. - /// Gets the incoming bitrate. - /// Gets the track ingest drift value. - /// Gets the arrival UTC time of the last fragment. - /// Gets the last timestamp. - /// Gets the timescale of the last timestamp. - /// Gets the fragment Overlap count. - /// Gets the fragment Discontinuity count. - /// Gets Non increasing count. - /// Gets a value indicating whether unexpected bitrate is present or not. - /// Gets the state of the live event. - /// Gets a value indicating whether preview is healthy or not. - /// A new instance for mocking. - public static MediaLiveEventIngestHeartbeatEventData MediaLiveEventIngestHeartbeatEventData(string trackType = null, string trackName = null, string transcriptionLanguage = null, string transcriptionState = null, long? bitrate = null, long? incomingBitrate = null, string ingestDriftValue = null, string lastFragmentArrivalTime = null, string lastTimestamp = null, string timescale = null, long? overlapCount = null, long? discontinuityCount = null, long? nonincreasingCount = null, bool? unexpectedBitrate = null, string state = null, bool? healthy = null) - { - return new MediaLiveEventIngestHeartbeatEventData( - trackType, - trackName, - transcriptionLanguage, - transcriptionState, - bitrate, - incomingBitrate, - ingestDriftValue, - lastFragmentArrivalTime, - lastTimestamp, - timescale, - overlapCount, - discontinuityCount, - nonincreasingCount, - unexpectedBitrate, - state, - healthy, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the type of the track (Audio / Video). - /// Gets the track name. - /// Gets the bitrate. - /// Gets the timestamp of the previous fragment. - /// Gets the timestamp of the current fragment. - /// Gets the timescale in which both timestamps and discontinuity gap are represented. - /// Gets the discontinuity gap between PreviousTimestamp and NewTimestamp. - /// A new instance for mocking. - public static MediaLiveEventTrackDiscontinuityDetectedEventData MediaLiveEventTrackDiscontinuityDetectedEventData(string trackType = null, string trackName = null, long? bitrate = null, string previousTimestamp = null, string newTimestamp = null, string timescale = null, string discontinuityGap = null) - { - return new MediaLiveEventTrackDiscontinuityDetectedEventData( - trackType, - trackName, - bitrate, - previousTimestamp, - newTimestamp, - timescale, - discontinuityGap, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the channel latency in ms. - /// Gets the latency result code. - /// A new instance for mocking. - public static MediaLiveEventChannelArchiveHeartbeatEventData MediaLiveEventChannelArchiveHeartbeatEventData(string channelLatencyMs = null, string latencyResultCode = null) - { - return new MediaLiveEventChannelArchiveHeartbeatEventData(channelLatencyMs, latencyResultCode, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - /// The resource ID of the policy assignment. - /// The resource ID of the policy definition. - /// The reference ID for the policy definition inside the initiative definition, if the policy assignment is for an initiative. May be empty. - /// The compliance state of the resource with respect to the policy assignment. - /// The subscription ID of the resource. - /// The compliance reason code. May be empty. - /// A new instance for mocking. - public static PolicyInsightsPolicyStateCreatedEventData PolicyInsightsPolicyStateCreatedEventData(DateTimeOffset timestamp = default, string policyAssignmentId = null, string policyDefinitionId = null, string policyDefinitionReferenceId = null, string complianceState = null, string subscriptionId = null, string complianceReasonCode = null) - { - return new PolicyInsightsPolicyStateCreatedEventData( - timestamp, - policyAssignmentId, - policyDefinitionId, - policyDefinitionReferenceId, - complianceState, - subscriptionId, - complianceReasonCode, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - /// The resource ID of the policy assignment. - /// The resource ID of the policy definition. - /// The reference ID for the policy definition inside the initiative definition, if the policy assignment is for an initiative. May be empty. - /// The compliance state of the resource with respect to the policy assignment. - /// The subscription ID of the resource. - /// The compliance reason code. May be empty. - /// A new instance for mocking. - public static PolicyInsightsPolicyStateChangedEventData PolicyInsightsPolicyStateChangedEventData(DateTimeOffset timestamp = default, string policyAssignmentId = null, string policyDefinitionId = null, string policyDefinitionReferenceId = null, string complianceState = null, string subscriptionId = null, string complianceReasonCode = null) - { - return new PolicyInsightsPolicyStateChangedEventData( - timestamp, - policyAssignmentId, - policyDefinitionId, - policyDefinitionReferenceId, - complianceState, - subscriptionId, - complianceReasonCode, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - /// The resource ID of the policy assignment. - /// The resource ID of the policy definition. - /// The reference ID for the policy definition inside the initiative definition, if the policy assignment is for an initiative. May be empty. - /// The compliance state of the resource with respect to the policy assignment. - /// The subscription ID of the resource. - /// The compliance reason code. May be empty. - /// A new instance for mocking. - public static PolicyInsightsPolicyStateDeletedEventData PolicyInsightsPolicyStateDeletedEventData(DateTimeOffset timestamp = default, string policyAssignmentId = null, string policyDefinitionId = null, string policyDefinitionReferenceId = null, string complianceState = null, string subscriptionId = null, string complianceReasonCode = null) - { - return new PolicyInsightsPolicyStateDeletedEventData( - timestamp, - policyAssignmentId, - policyDefinitionId, - policyDefinitionReferenceId, - complianceState, - subscriptionId, - complianceReasonCode, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The name of this event. - /// The status of this event. Failed or succeeded. - /// A new instance for mocking. - public static RedisPatchingCompletedEventData RedisPatchingCompletedEventData(DateTimeOffset timestamp = default, string name = null, string status = null) - { - return new RedisPatchingCompletedEventData(timestamp, name, status, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The name of this event. - /// The status of this event. Failed or succeeded. - /// A new instance for mocking. - public static RedisScalingCompletedEventData RedisScalingCompletedEventData(DateTimeOffset timestamp = default, string name = null, string status = null) - { - return new RedisScalingCompletedEventData(timestamp, name, status, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The name of this event. - /// The status of this event. Failed or succeeded. - /// A new instance for mocking. - public static RedisExportRDBCompletedEventData RedisExportRDBCompletedEventData(DateTimeOffset timestamp = default, string name = null, string status = null) - { - return new RedisExportRDBCompletedEventData(timestamp, name, status, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The name of this event. - /// The status of this event. Failed or succeeded. - /// A new instance for mocking. - public static RedisImportRDBCompletedEventData RedisImportRDBCompletedEventData(DateTimeOffset timestamp = default, string name = null, string status = null) - { - return new RedisImportRDBCompletedEventData(timestamp, name, status, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// A new instance for mocking. - public static ResourceWriteSuccessEventData ResourceWriteSuccessEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, ResourceAuthorization authorization = null, IReadOnlyDictionary claims = null, string correlationId = null, ResourceHttpRequest httpRequest = null) - { - claims ??= new Dictionary(); - - return new ResourceWriteSuccessEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The scope of the authorization. - /// The action being requested. - /// The evidence for the authorization. - /// A new instance for mocking. - public static ResourceAuthorization ResourceAuthorization(string scope = null, string action = null, IReadOnlyDictionary evidence = null) - { - evidence ??= new Dictionary(); - - return new ResourceAuthorization(scope, action, evidence, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The client request ID. - /// The client IP address. - /// The request method. - /// The url used in the request. - /// A new instance for mocking. - public static ResourceHttpRequest ResourceHttpRequest(string clientRequestId = null, string clientIpAddress = null, string method = null, string url = null) - { - return new ResourceHttpRequest(clientRequestId, clientIpAddress, method, url, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// A new instance for mocking. - public static ResourceWriteFailureEventData ResourceWriteFailureEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, ResourceAuthorization authorization = null, IReadOnlyDictionary claims = null, string correlationId = null, ResourceHttpRequest httpRequest = null) - { - claims ??= new Dictionary(); - - return new ResourceWriteFailureEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// A new instance for mocking. - public static ResourceWriteCancelEventData ResourceWriteCancelEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, ResourceAuthorization authorization = null, IReadOnlyDictionary claims = null, string correlationId = null, ResourceHttpRequest httpRequest = null) - { - claims ??= new Dictionary(); - - return new ResourceWriteCancelEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// A new instance for mocking. - public static ResourceDeleteSuccessEventData ResourceDeleteSuccessEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, ResourceAuthorization authorization = null, IReadOnlyDictionary claims = null, string correlationId = null, ResourceHttpRequest httpRequest = null) - { - claims ??= new Dictionary(); - - return new ResourceDeleteSuccessEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// A new instance for mocking. - public static ResourceDeleteFailureEventData ResourceDeleteFailureEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, ResourceAuthorization authorization = null, IReadOnlyDictionary claims = null, string correlationId = null, ResourceHttpRequest httpRequest = null) - { - claims ??= new Dictionary(); - - return new ResourceDeleteFailureEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// A new instance for mocking. - public static ResourceDeleteCancelEventData ResourceDeleteCancelEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, ResourceAuthorization authorization = null, IReadOnlyDictionary claims = null, string correlationId = null, ResourceHttpRequest httpRequest = null) - { - claims ??= new Dictionary(); - - return new ResourceDeleteCancelEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// A new instance for mocking. - public static ResourceActionSuccessEventData ResourceActionSuccessEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, ResourceAuthorization authorization = null, IReadOnlyDictionary claims = null, string correlationId = null, ResourceHttpRequest httpRequest = null) - { - claims ??= new Dictionary(); - - return new ResourceActionSuccessEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// A new instance for mocking. - public static ResourceActionFailureEventData ResourceActionFailureEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, ResourceAuthorization authorization = null, IReadOnlyDictionary claims = null, string correlationId = null, ResourceHttpRequest httpRequest = null) - { - claims ??= new Dictionary(); - - return new ResourceActionFailureEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// A new instance for mocking. - public static ResourceActionCancelEventData ResourceActionCancelEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, ResourceAuthorization authorization = null, IReadOnlyDictionary claims = null, string correlationId = null, ResourceHttpRequest httpRequest = null) - { - claims ??= new Dictionary(); - - return new ResourceActionCancelEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The namespace name of the Microsoft.ServiceBus resource. - /// The endpoint of the Microsoft.ServiceBus resource. - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - /// A new instance for mocking. - public static ServiceBusActiveMessagesAvailableWithNoListenersEventData ServiceBusActiveMessagesAvailableWithNoListenersEventData(string namespaceName = null, string requestUri = null, string entityType = null, string queueName = null, string topicName = null, string subscriptionName = null) - { - return new ServiceBusActiveMessagesAvailableWithNoListenersEventData( - namespaceName, - requestUri, - entityType, - queueName, - topicName, - subscriptionName, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The namespace name of the Microsoft.ServiceBus resource. - /// The endpoint of the Microsoft.ServiceBus resource. - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - /// A new instance for mocking. - public static ServiceBusDeadletterMessagesAvailableWithNoListenersEventData ServiceBusDeadletterMessagesAvailableWithNoListenersEventData(string namespaceName = null, string requestUri = null, string entityType = null, string queueName = null, string topicName = null, string subscriptionName = null) - { - return new ServiceBusDeadletterMessagesAvailableWithNoListenersEventData( - namespaceName, - requestUri, - entityType, - queueName, - topicName, - subscriptionName, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The namespace name of the Microsoft.ServiceBus resource. - /// The endpoint of the Microsoft.ServiceBus resource. - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - /// A new instance for mocking. - public static ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData(string namespaceName = null, string requestUri = null, string entityType = null, string queueName = null, string topicName = null, string subscriptionName = null) - { - return new ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData( - namespaceName, - requestUri, - entityType, - queueName, - topicName, - subscriptionName, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The namespace name of the Microsoft.ServiceBus resource. - /// The endpoint of the Microsoft.ServiceBus resource. - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - /// A new instance for mocking. - public static ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData(string namespaceName = null, string requestUri = null, string entityType = null, string queueName = null, string topicName = null, string subscriptionName = null) - { - return new ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData( - namespaceName, - requestUri, - entityType, - queueName, - topicName, - subscriptionName, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The hub of connected client connection. - /// The connection Id of connected client connection. - /// The user Id of connected client connection. - /// A new instance for mocking. - public static SignalRServiceClientConnectionConnectedEventData SignalRServiceClientConnectionConnectedEventData(DateTimeOffset timestamp = default, string hubName = null, string connectionId = null, string userId = null) - { - return new SignalRServiceClientConnectionConnectedEventData(timestamp, hubName, connectionId, userId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The hub of connected client connection. - /// The connection Id of connected client connection. - /// The user Id of connected client connection. - /// The message of error that cause the client connection disconnected. - /// A new instance for mocking. - public static SignalRServiceClientConnectionDisconnectedEventData SignalRServiceClientConnectionDisconnectedEventData(DateTimeOffset timestamp = default, string hubName = null, string connectionId = null, string userId = null, string errorMessage = null) - { - return new SignalRServiceClientConnectionDisconnectedEventData( - timestamp, - hubName, - connectionId, - userId, - errorMessage, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The etag of the blob at the time this event was triggered. - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - /// The size of the blob in bytes. This is the same as what would be returned in the Content-Length header from the blob. - /// The offset of the blob in bytes. - /// The type of blob. - /// The path to the blob. - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// A new instance for mocking. - public static StorageBlobCreatedEventData StorageBlobCreatedEventData(string api = null, string clientRequestId = null, string requestId = null, string eTag = null, string contentType = null, long? contentLength = null, long? contentOffset = null, string blobType = null, string url = null, string sequencer = null, string identity = null, IReadOnlyDictionary storageDiagnostics = null) - { - storageDiagnostics ??= new Dictionary(); - - return new StorageBlobCreatedEventData( - api, - clientRequestId, - requestId, - eTag, - contentType, - contentLength, - contentOffset, - blobType, - url, - sequencer, - identity, - storageDiagnostics, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - /// The type of blob. - /// The path to the blob. - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// A new instance for mocking. - public static StorageBlobDeletedEventData StorageBlobDeletedEventData(string api = null, string clientRequestId = null, string requestId = null, string contentType = null, string blobType = null, string url = null, string sequencer = null, string identity = null, IReadOnlyDictionary storageDiagnostics = null) - { - storageDiagnostics ??= new Dictionary(); - - return new StorageBlobDeletedEventData( - api, - clientRequestId, - requestId, - contentType, - blobType, - url, - sequencer, - identity, - storageDiagnostics, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The etag of the directory at the time this event was triggered. - /// The path to the directory. - /// An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// A new instance for mocking. - public static StorageDirectoryCreatedEventData StorageDirectoryCreatedEventData(string api = null, string clientRequestId = null, string requestId = null, string eTag = null, string url = null, string sequencer = null, string identity = null, IReadOnlyDictionary storageDiagnostics = null) - { - storageDiagnostics ??= new Dictionary(); - - return new StorageDirectoryCreatedEventData( - api, - clientRequestId, - requestId, - eTag, - url, - sequencer, - identity, - storageDiagnostics, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The path to the deleted directory. - /// Is this event for a recursive delete operation. - /// An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// A new instance for mocking. - public static StorageDirectoryDeletedEventData StorageDirectoryDeletedEventData(string api = null, string clientRequestId = null, string requestId = null, string url = null, string recursive = null, string sequencer = null, string identity = null, IReadOnlyDictionary storageDiagnostics = null) - { - storageDiagnostics ??= new Dictionary(); - - return new StorageDirectoryDeletedEventData( - api, - clientRequestId, - requestId, - url, - recursive, - sequencer, - identity, - storageDiagnostics, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The path to the blob that was renamed. - /// The new path to the blob after the rename operation. - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// A new instance for mocking. - public static StorageBlobRenamedEventData StorageBlobRenamedEventData(string api = null, string clientRequestId = null, string requestId = null, string sourceUrl = null, string destinationUrl = null, string sequencer = null, string identity = null, IReadOnlyDictionary storageDiagnostics = null) - { - storageDiagnostics ??= new Dictionary(); - - return new StorageBlobRenamedEventData( - api, - clientRequestId, - requestId, - sourceUrl, - destinationUrl, - sequencer, - identity, - storageDiagnostics, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The path to the directory that was renamed. - /// The new path to the directory after the rename operation. - /// An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// A new instance for mocking. - public static StorageDirectoryRenamedEventData StorageDirectoryRenamedEventData(string api = null, string clientRequestId = null, string requestId = null, string sourceUrl = null, string destinationUrl = null, string sequencer = null, string identity = null, IReadOnlyDictionary storageDiagnostics = null) - { - storageDiagnostics ??= new Dictionary(); - - return new StorageDirectoryRenamedEventData( - api, - clientRequestId, - requestId, - sourceUrl, - destinationUrl, - sequencer, - identity, - storageDiagnostics, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time the policy task was scheduled. - /// Execution statistics of a specific policy action in a Blob Management cycle. - /// Execution statistics of a specific policy action in a Blob Management cycle. - /// Execution statistics of a specific policy action in a Blob Management cycle. - /// A new instance for mocking. - public static StorageLifecyclePolicyCompletedEventData StorageLifecyclePolicyCompletedEventData(string scheduleTime = null, StorageLifecyclePolicyActionSummaryDetail deleteSummary = null, StorageLifecyclePolicyActionSummaryDetail tierToCoolSummary = null, StorageLifecyclePolicyActionSummaryDetail tierToArchiveSummary = null) - { - return new StorageLifecyclePolicyCompletedEventData(scheduleTime, deleteSummary, tierToCoolSummary, tierToArchiveSummary, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Total number of objects to be acted on by this action. - /// Number of success operations of this action. - /// Error messages of this action if any. - /// A new instance for mocking. - public static StorageLifecyclePolicyActionSummaryDetail StorageLifecyclePolicyActionSummaryDetail(long? totalObjectsCount = null, long? successCount = null, string errorList = null) - { - return new StorageLifecyclePolicyActionSummaryDetail(totalObjectsCount, successCount, errorList, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - /// The size of the blob in bytes. This is the same as what would be returned in the Content-Length header from the blob. - /// The type of blob. - /// The path to the blob. - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// A new instance for mocking. - public static StorageBlobTierChangedEventData StorageBlobTierChangedEventData(string api = null, string clientRequestId = null, string requestId = null, string contentType = null, long? contentLength = null, string blobType = null, string url = null, string sequencer = null, string identity = null, IReadOnlyDictionary storageDiagnostics = null) - { - storageDiagnostics ??= new Dictionary(); - - return new StorageBlobTierChangedEventData( - api, - clientRequestId, - requestId, - contentType, - contentLength, - blobType, - url, - sequencer, - identity, - storageDiagnostics, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - /// The size of the blob in bytes. This is the same as what would be returned in the Content-Length header from the blob. - /// The type of blob. - /// The path to the blob. - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// A new instance for mocking. - public static StorageAsyncOperationInitiatedEventData StorageAsyncOperationInitiatedEventData(string api = null, string clientRequestId = null, string requestId = null, string contentType = null, long? contentLength = null, string blobType = null, string url = null, string sequencer = null, string identity = null, IReadOnlyDictionary storageDiagnostics = null) - { - storageDiagnostics ??= new Dictionary(); - - return new StorageAsyncOperationInitiatedEventData( - api, - clientRequestId, - requestId, - contentType, - contentLength, - blobType, - url, - sequencer, - identity, - storageDiagnostics, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time at which inventory policy was scheduled. - /// The account name for which inventory policy is registered. - /// The rule name for inventory policy. - /// The status of inventory run, it can be Succeeded/PartiallySucceeded/Failed. - /// The status message for inventory run. - /// The policy run id for inventory run. - /// The blob URL for manifest file for inventory run. - /// A new instance for mocking. - public static StorageBlobInventoryPolicyCompletedEventData StorageBlobInventoryPolicyCompletedEventData(DateTimeOffset scheduleDateTime = default, string accountName = null, string ruleName = null, string policyRunStatus = null, string policyRunStatusMessage = null, string policyRunId = null, string manifestBlobUrl = null) - { - return new StorageBlobInventoryPolicyCompletedEventData( - scheduleDateTime, - accountName, - ruleName, - policyRunStatus, - policyRunStatusMessage, - policyRunId, - manifestBlobUrl, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The status for a storage task. - /// The time at which a storage task was completed. - /// The execution id for a storage task. - /// The task name for a storage task. - /// The summary report blob url for a storage task. - /// A new instance for mocking. - public static StorageTaskCompletedEventData StorageTaskCompletedEventData(StorageTaskCompletedStatus status = default, DateTimeOffset completedDateTime = default, string taskExecutionId = null, string taskName = null, Uri summaryReportBlobUrl = null) - { - return new StorageTaskCompletedEventData( - status, - completedDateTime, - taskExecutionId, - taskName, - summaryReportBlobUrl, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time at which a storage task was queued. - /// The execution id for a storage task. - /// A new instance for mocking. - public static StorageTaskQueuedEventData StorageTaskQueuedEventData(DateTimeOffset queuedDateTime = default, string taskExecutionId = null) - { - return new StorageTaskQueuedEventData(queuedDateTime, taskExecutionId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The time at which a storage task was queued. - /// The execution id for a storage task. - /// A new instance for mocking. - public static StorageTaskAssignmentQueuedEventData StorageTaskAssignmentQueuedEventData(DateTimeOffset queuedOn = default, string taskExecutionId = null) - { - return new StorageTaskAssignmentQueuedEventData(queuedOn, taskExecutionId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The status for a storage task. - /// The time at which a storage task was completed. - /// The execution id for a storage task. - /// The task name for a storage task. - /// The summary report blob url for a storage task. - /// A new instance for mocking. - public static StorageTaskAssignmentCompletedEventData StorageTaskAssignmentCompletedEventData(StorageTaskAssignmentCompletedStatus status = default, DateTimeOffset completedOn = default, string taskExecutionId = null, string taskName = null, Uri summaryReportBlobUri = null) - { - return new StorageTaskAssignmentCompletedEventData( - status, - completedOn, - taskExecutionId, - taskName, - summaryReportBlobUri, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Type of action of the operation. - /// A new instance for mocking. - public static AppEventTypeDetail AppEventTypeDetail(AppAction action = default) - { - return new AppEventTypeDetail(action, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebAppUpdatedEventData WebAppUpdatedEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebAppUpdatedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebBackupOperationStartedEventData WebBackupOperationStartedEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebBackupOperationStartedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebBackupOperationCompletedEventData WebBackupOperationCompletedEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebBackupOperationCompletedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebBackupOperationFailedEventData WebBackupOperationFailedEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebBackupOperationFailedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebRestoreOperationStartedEventData WebRestoreOperationStartedEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebRestoreOperationStartedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebRestoreOperationCompletedEventData WebRestoreOperationCompletedEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebRestoreOperationCompletedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebRestoreOperationFailedEventData WebRestoreOperationFailedEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebRestoreOperationFailedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebSlotSwapStartedEventData WebSlotSwapStartedEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebSlotSwapStartedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebSlotSwapCompletedEventData WebSlotSwapCompletedEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebSlotSwapCompletedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebSlotSwapFailedEventData WebSlotSwapFailedEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebSlotSwapFailedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebSlotSwapWithPreviewStartedEventData WebSlotSwapWithPreviewStartedEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebSlotSwapWithPreviewStartedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebSlotSwapWithPreviewCancelledEventData WebSlotSwapWithPreviewCancelledEventData(AppEventTypeDetail appEventTypeDetail = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebSlotSwapWithPreviewCancelledEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Detail of action on the app service plan. - /// sku of app service plan. - /// name of the app service plan that had this event. - /// The client request id generated by the app service for the app service plan API operation that triggered this event. - /// The correlation request id generated by the app service for the app service plan API operation that triggered this event. - /// The request id generated by the app service for the app service plan API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// A new instance for mocking. - public static WebAppServicePlanUpdatedEventData WebAppServicePlanUpdatedEventData(AppServicePlanEventTypeDetail appServicePlanEventTypeDetail = null, WebAppServicePlanUpdatedEventDataSku sku = null, string name = null, string clientRequestId = null, string correlationRequestId = null, string requestId = null, string address = null, string verb = null) - { - return new WebAppServicePlanUpdatedEventData( - appServicePlanEventTypeDetail, - sku, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Kind of environment where app service plan is. - /// Type of action on the app service plan. - /// Asynchronous operation status of the operation on the app service plan. - /// A new instance for mocking. - public static AppServicePlanEventTypeDetail AppServicePlanEventTypeDetail(StampKind stampKind = default, AppServicePlanAction action = default, AsyncStatus status = default) - { - return new AppServicePlanEventTypeDetail(stampKind, action, status, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// name of app service plan sku. - /// tier of app service plan sku. - /// size of app service plan sku. - /// family of app service plan sku. - /// capacity of app service plan sku. - /// A new instance for mocking. - public static WebAppServicePlanUpdatedEventDataSku WebAppServicePlanUpdatedEventDataSku(string name = null, string tier = null, string size = null, string family = null, string capacity = null) - { - return new WebAppServicePlanUpdatedEventDataSku( - name, - tier, - size, - family, - capacity, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// The validation code sent by Azure Event Grid to validate an event subscription. - /// To complete the validation handshake, the subscriber must either respond with this validation code as part of the validation response, - /// or perform a GET request on the validationUrl (available starting version 2018-05-01-preview). - /// - /// - /// The validation URL sent by Azure Event Grid (available starting version 2018-05-01-preview). - /// To complete the validation handshake, the subscriber must either respond with the validationCode as part of the validation response, - /// or perform a GET request on the validationUrl (available starting version 2018-05-01-preview). - /// - /// A new instance for mocking. - public static SubscriptionValidationEventData SubscriptionValidationEventData(string validationCode = null, string validationUrl = null) - { - return new SubscriptionValidationEventData(validationCode, validationUrl, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The validation response sent by the subscriber to Azure Event Grid to complete the validation of an event subscription. - /// A new instance for mocking. - public static SubscriptionValidationResponse SubscriptionValidationResponse(string validationResponse = null) - { - return new SubscriptionValidationResponse(validationResponse, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Azure resource ID of the deleted event subscription. - /// A new instance for mocking. - public static SubscriptionDeletedEventData SubscriptionDeletedEventData(string eventSubscriptionId = null) - { - return new SubscriptionDeletedEventData(eventSubscriptionId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// Unique identifier for the MQTT client that the client presents to the service - /// for authentication. This case-sensitive string can be up to 128 characters - /// long, and supports UTF-8 characters. - /// - /// Name of the client resource in the Event Grid namespace. - /// Name of the Event Grid namespace where the MQTT client was created or updated. - /// A new instance for mocking. - public static EventGridMQTTClientEventData EventGridMQTTClientEventData(string clientAuthenticationName = null, string clientName = null, string namespaceName = null) - { - return new EventGridMQTTClientEventData(clientAuthenticationName, clientName, namespaceName, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// Unique identifier for the MQTT client that the client presents to the service - /// for authentication. This case-sensitive string can be up to 128 characters - /// long, and supports UTF-8 characters. - /// - /// Name of the client resource in the Event Grid namespace. - /// Name of the Event Grid namespace where the MQTT client was created or updated. - /// Configured state of the client. The value could be Enabled or Disabled. - /// Time the client resource is created based on the provider's UTC time. - /// - /// Time the client resource is last updated based on the provider's UTC time. If - /// the client resource was never updated, this value is identical to the value of - /// the 'createdOn' property. - /// - /// The key-value attributes that are assigned to the client resource. - /// A new instance for mocking. - public static EventGridMQTTClientCreatedOrUpdatedEventData EventGridMQTTClientCreatedOrUpdatedEventData(string clientAuthenticationName = null, string clientName = null, string namespaceName = null, EventGridMQTTClientState state = default, DateTimeOffset createdOn = default, DateTimeOffset updatedOn = default, IReadOnlyDictionary attributes = null) - { - attributes ??= new Dictionary(); - - return new EventGridMQTTClientCreatedOrUpdatedEventData( - clientAuthenticationName, - clientName, - namespaceName, - serializedAdditionalRawData: null, - state, - createdOn, - updatedOn, - attributes); - } - - /// Initializes a new instance of . - /// - /// Unique identifier for the MQTT client that the client presents to the service - /// for authentication. This case-sensitive string can be up to 128 characters - /// long, and supports UTF-8 characters. - /// - /// Name of the client resource in the Event Grid namespace. - /// Name of the Event Grid namespace where the MQTT client was created or updated. - /// A new instance for mocking. - public static EventGridMQTTClientDeletedEventData EventGridMQTTClientDeletedEventData(string clientAuthenticationName = null, string clientName = null, string namespaceName = null) - { - return new EventGridMQTTClientDeletedEventData(clientAuthenticationName, clientName, namespaceName, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// Unique identifier for the MQTT client that the client presents to the service - /// for authentication. This case-sensitive string can be up to 128 characters - /// long, and supports UTF-8 characters. - /// - /// Name of the client resource in the Event Grid namespace. - /// Name of the Event Grid namespace where the MQTT client was created or updated. - /// - /// Unique identifier for the MQTT client's session. This case-sensitive string can - /// be up to 128 characters long, and supports UTF-8 characters. - /// - /// - /// A number that helps indicate order of MQTT client session connected or - /// disconnected events. Latest event will have a sequence number that is higher - /// than the previous event. - /// - /// A new instance for mocking. - public static EventGridMQTTClientSessionConnectedEventData EventGridMQTTClientSessionConnectedEventData(string clientAuthenticationName = null, string clientName = null, string namespaceName = null, string clientSessionName = null, long? sequenceNumber = null) - { - return new EventGridMQTTClientSessionConnectedEventData( - clientAuthenticationName, - clientName, - namespaceName, - serializedAdditionalRawData: null, - clientSessionName, - sequenceNumber); - } - - /// Initializes a new instance of . - /// - /// Unique identifier for the MQTT client that the client presents to the service - /// for authentication. This case-sensitive string can be up to 128 characters - /// long, and supports UTF-8 characters. - /// - /// Name of the client resource in the Event Grid namespace. - /// Name of the Event Grid namespace where the MQTT client was created or updated. - /// - /// Unique identifier for the MQTT client's session. This case-sensitive string can - /// be up to 128 characters long, and supports UTF-8 characters. - /// - /// - /// A number that helps indicate order of MQTT client session connected or - /// disconnected events. Latest event will have a sequence number that is higher - /// than the previous event. - /// - /// - /// Reason for the disconnection of the MQTT client's session. The value could be - /// one of the values in the disconnection reasons table. - /// - /// A new instance for mocking. - public static EventGridMQTTClientSessionDisconnectedEventData EventGridMQTTClientSessionDisconnectedEventData(string clientAuthenticationName = null, string clientName = null, string namespaceName = null, string clientSessionName = null, long? sequenceNumber = null, EventGridMQTTClientDisconnectionReason disconnectionReason = default) - { - return new EventGridMQTTClientSessionDisconnectedEventData( - clientAuthenticationName, - clientName, - namespaceName, - serializedAdditionalRawData: null, - clientSessionName, - sequenceNumber, - disconnectionReason); - } - - /// Initializes a new instance of . - /// resourceInfo details for update event. - /// details about operational info. - /// api version of the resource properties bag. - /// A new instance for mocking. - public static ResourceNotificationsResourceUpdatedEventData ResourceNotificationsResourceUpdatedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails = null, ResourceNotificationsOperationalDetails operationalDetails = null, string apiVersion = null) - { - return new ResourceNotificationsResourceUpdatedEventData(resourceDetails, operationalDetails, apiVersion, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// id of the resource for which the event is being emitted. - /// name of the resource for which the event is being emitted. - /// the type of the resource for which the event is being emitted. - /// the location of the resource for which the event is being emitted. - /// the tags on the resource for which the event is being emitted. - /// properties in the payload of the resource for which the event is being emitted. - /// A new instance for mocking. - public static ResourceNotificationsResourceUpdatedDetails ResourceNotificationsResourceUpdatedDetails(string id = null, string name = null, string type = null, string location = null, IReadOnlyDictionary tags = null, IReadOnlyDictionary properties = null) - { - tags ??= new Dictionary(); - properties ??= new Dictionary(); - - return new ResourceNotificationsResourceUpdatedDetails( - id, - name, - type, - location, - tags, - properties, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Date and Time when resource was updated. - /// A new instance for mocking. - public static ResourceNotificationsOperationalDetails ResourceNotificationsOperationalDetails(DateTimeOffset resourceEventTime = default) - { - return new ResourceNotificationsOperationalDetails(resourceEventTime, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// resourceInfo details for update event. - /// details about operational info. - /// api version of the resource properties bag. - /// A new instance for mocking. - public static ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails = null, ResourceNotificationsOperationalDetails operationalDetails = null, string apiVersion = null) - { - return new ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(resourceDetails, operationalDetails, apiVersion, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// resourceInfo details for update event. - /// details about operational info. - /// api version of the resource properties bag. - /// A new instance for mocking. - public static ResourceNotificationsHealthResourcesAnnotatedEventData ResourceNotificationsHealthResourcesAnnotatedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails = null, ResourceNotificationsOperationalDetails operationalDetails = null, string apiVersion = null) - { - return new ResourceNotificationsHealthResourcesAnnotatedEventData(resourceDetails, operationalDetails, apiVersion, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// resourceInfo details for update event. - /// details about operational info. - /// api version of the resource properties bag. - /// A new instance for mocking. - public static ResourceNotificationsResourceManagementCreatedOrUpdatedEventData ResourceNotificationsResourceManagementCreatedOrUpdatedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails = null, ResourceNotificationsOperationalDetails operationalDetails = null, string apiVersion = null) - { - return new ResourceNotificationsResourceManagementCreatedOrUpdatedEventData(resourceDetails, operationalDetails, apiVersion, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// resourceInfo details for delete event. - /// details about operational info. - /// A new instance for mocking. - public static ResourceNotificationsResourceDeletedEventData ResourceNotificationsResourceDeletedEventData(ResourceNotificationsResourceDeletedDetails resourceDetails = null, ResourceNotificationsOperationalDetails operationalDetails = null) - { - return new ResourceNotificationsResourceDeletedEventData(resourceDetails, operationalDetails, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// id of the resource for which the event is being emitted. - /// name of the resource for which the event is being emitted. - /// the type of the resource for which the event is being emitted. - /// A new instance for mocking. - public static ResourceNotificationsResourceDeletedDetails ResourceNotificationsResourceDeletedDetails(string id = null, string name = null, string type = null) - { - return new ResourceNotificationsResourceDeletedDetails(id, name, type, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// resourceInfo details for delete event. - /// details about operational info. - /// A new instance for mocking. - public static ResourceNotificationsResourceManagementDeletedEventData ResourceNotificationsResourceManagementDeletedEventData(ResourceNotificationsResourceDeletedDetails resourceDetails = null, ResourceNotificationsOperationalDetails operationalDetails = null) - { - return new ResourceNotificationsResourceManagementDeletedEventData(resourceDetails, operationalDetails, serializedAdditionalRawData: null); - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventHubCaptureFileCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventHubCaptureFileCreatedEventData.Serialization.cs deleted file mode 100644 index 1df0132a3c36..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventHubCaptureFileCreatedEventData.Serialization.cs +++ /dev/null @@ -1,253 +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.Messaging.EventGrid.SystemEvents -{ - public partial class EventHubCaptureFileCreatedEventData : 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(EventHubCaptureFileCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Fileurl)) - { - writer.WritePropertyName("fileUrl"u8); - writer.WriteStringValue(Fileurl); - } - if (Optional.IsDefined(FileType)) - { - writer.WritePropertyName("fileType"u8); - writer.WriteStringValue(FileType); - } - if (Optional.IsDefined(PartitionId)) - { - writer.WritePropertyName("partitionId"u8); - writer.WriteStringValue(PartitionId); - } - if (Optional.IsDefined(SizeInBytes)) - { - writer.WritePropertyName("sizeInBytes"u8); - writer.WriteNumberValue(SizeInBytes.Value); - } - if (Optional.IsDefined(EventCount)) - { - writer.WritePropertyName("eventCount"u8); - writer.WriteNumberValue(EventCount.Value); - } - if (Optional.IsDefined(FirstSequenceNumber)) - { - writer.WritePropertyName("firstSequenceNumber"u8); - writer.WriteNumberValue(FirstSequenceNumber.Value); - } - if (Optional.IsDefined(LastSequenceNumber)) - { - writer.WritePropertyName("lastSequenceNumber"u8); - writer.WriteNumberValue(LastSequenceNumber.Value); - } - writer.WritePropertyName("firstEnqueueTime"u8); - writer.WriteStringValue(FirstEnqueueTime, "O"); - writer.WritePropertyName("lastEnqueueTime"u8); - writer.WriteStringValue(LastEnqueueTime, "O"); - 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 - } - } - } - - EventHubCaptureFileCreatedEventData 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(EventHubCaptureFileCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeEventHubCaptureFileCreatedEventData(document.RootElement, options); - } - - internal static EventHubCaptureFileCreatedEventData DeserializeEventHubCaptureFileCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string fileUrl = default; - string fileType = default; - string partitionId = default; - int? sizeInBytes = default; - int? eventCount = default; - int? firstSequenceNumber = default; - int? lastSequenceNumber = default; - DateTimeOffset firstEnqueueTime = default; - DateTimeOffset lastEnqueueTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("fileUrl"u8)) - { - fileUrl = property.Value.GetString(); - continue; - } - if (property.NameEquals("fileType"u8)) - { - fileType = property.Value.GetString(); - continue; - } - if (property.NameEquals("partitionId"u8)) - { - partitionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("sizeInBytes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sizeInBytes = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("eventCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - eventCount = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("firstSequenceNumber"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - firstSequenceNumber = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("lastSequenceNumber"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - lastSequenceNumber = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("firstEnqueueTime"u8)) - { - firstEnqueueTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("lastEnqueueTime"u8)) - { - lastEnqueueTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new EventHubCaptureFileCreatedEventData( - fileUrl, - fileType, - partitionId, - sizeInBytes, - eventCount, - firstSequenceNumber, - lastSequenceNumber, - firstEnqueueTime, - lastEnqueueTime, - 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(EventHubCaptureFileCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - EventHubCaptureFileCreatedEventData 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 DeserializeEventHubCaptureFileCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(EventHubCaptureFileCreatedEventData)} 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 EventHubCaptureFileCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEventHubCaptureFileCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventHubCaptureFileCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventHubCaptureFileCreatedEventData.cs deleted file mode 100644 index 0c670ab7b195..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/EventHubCaptureFileCreatedEventData.cs +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.EventHub.CaptureFileCreated event. - public partial class EventHubCaptureFileCreatedEventData - { - /// - /// 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 first time from the queue. - /// The last time from the queue. - internal EventHubCaptureFileCreatedEventData(DateTimeOffset firstEnqueueTime, DateTimeOffset lastEnqueueTime) - { - FirstEnqueueTime = firstEnqueueTime; - LastEnqueueTime = lastEnqueueTime; - } - - /// Initializes a new instance of . - /// The path to the capture file. - /// The file type of the capture file. - /// The shard ID. - /// The file size. - /// The number of events in the file. - /// The smallest sequence number from the queue. - /// The last sequence number from the queue. - /// The first time from the queue. - /// The last time from the queue. - /// Keeps track of any properties unknown to the library. - internal EventHubCaptureFileCreatedEventData(string fileurl, string fileType, string partitionId, int? sizeInBytes, int? eventCount, int? firstSequenceNumber, int? lastSequenceNumber, DateTimeOffset firstEnqueueTime, DateTimeOffset lastEnqueueTime, IDictionary serializedAdditionalRawData) - { - Fileurl = fileurl; - FileType = fileType; - PartitionId = partitionId; - SizeInBytes = sizeInBytes; - EventCount = eventCount; - FirstSequenceNumber = firstSequenceNumber; - LastSequenceNumber = lastSequenceNumber; - FirstEnqueueTime = firstEnqueueTime; - LastEnqueueTime = lastEnqueueTime; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal EventHubCaptureFileCreatedEventData() - { - } - - /// The path to the capture file. - public string Fileurl { get; } - /// The file type of the capture file. - public string FileType { get; } - /// The shard ID. - public string PartitionId { get; } - /// The file size. - public int? SizeInBytes { get; } - /// The number of events in the file. - public int? EventCount { get; } - /// The smallest sequence number from the queue. - public int? FirstSequenceNumber { get; } - /// The last sequence number from the queue. - public int? LastSequenceNumber { get; } - /// The first time from the queue. - public DateTimeOffset FirstEnqueueTime { get; } - /// The last time from the queue. - public DateTimeOffset LastEnqueueTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageCreatedEventData.Serialization.cs deleted file mode 100644 index feacefff2563..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageCreatedEventData.Serialization.cs +++ /dev/null @@ -1,211 +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.Messaging.EventGrid.SystemEvents -{ - public partial class HealthcareDicomImageCreatedEventData : 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(HealthcareDicomImageCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(PartitionName)) - { - writer.WritePropertyName("partitionName"u8); - writer.WriteStringValue(PartitionName); - } - if (Optional.IsDefined(ImageStudyInstanceUid)) - { - writer.WritePropertyName("imageStudyInstanceUid"u8); - writer.WriteStringValue(ImageStudyInstanceUid); - } - if (Optional.IsDefined(ImageSeriesInstanceUid)) - { - writer.WritePropertyName("imageSeriesInstanceUid"u8); - writer.WriteStringValue(ImageSeriesInstanceUid); - } - if (Optional.IsDefined(ImageSopInstanceUid)) - { - writer.WritePropertyName("imageSopInstanceUid"u8); - writer.WriteStringValue(ImageSopInstanceUid); - } - if (Optional.IsDefined(ServiceHostName)) - { - writer.WritePropertyName("serviceHostName"u8); - writer.WriteStringValue(ServiceHostName); - } - if (Optional.IsDefined(SequenceNumber)) - { - writer.WritePropertyName("sequenceNumber"u8); - writer.WriteNumberValue(SequenceNumber.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - HealthcareDicomImageCreatedEventData 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(HealthcareDicomImageCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeHealthcareDicomImageCreatedEventData(document.RootElement, options); - } - - internal static HealthcareDicomImageCreatedEventData DeserializeHealthcareDicomImageCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string partitionName = default; - string imageStudyInstanceUid = default; - string imageSeriesInstanceUid = default; - string imageSopInstanceUid = default; - string serviceHostName = default; - long? sequenceNumber = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("partitionName"u8)) - { - partitionName = property.Value.GetString(); - continue; - } - if (property.NameEquals("imageStudyInstanceUid"u8)) - { - imageStudyInstanceUid = property.Value.GetString(); - continue; - } - if (property.NameEquals("imageSeriesInstanceUid"u8)) - { - imageSeriesInstanceUid = property.Value.GetString(); - continue; - } - if (property.NameEquals("imageSopInstanceUid"u8)) - { - imageSopInstanceUid = property.Value.GetString(); - continue; - } - if (property.NameEquals("serviceHostName"u8)) - { - serviceHostName = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequenceNumber"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sequenceNumber = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new HealthcareDicomImageCreatedEventData( - partitionName, - imageStudyInstanceUid, - imageSeriesInstanceUid, - imageSopInstanceUid, - serviceHostName, - sequenceNumber, - 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(HealthcareDicomImageCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - HealthcareDicomImageCreatedEventData 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 DeserializeHealthcareDicomImageCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(HealthcareDicomImageCreatedEventData)} 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 HealthcareDicomImageCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeHealthcareDicomImageCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageCreatedEventData.cs deleted file mode 100644 index debb8542d70c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageCreatedEventData.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.HealthcareApis.DicomImageCreated event. - public partial class HealthcareDicomImageCreatedEventData - { - /// - /// 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 HealthcareDicomImageCreatedEventData() - { - } - - /// Initializes a new instance of . - /// Data partition name. - /// Unique identifier for the Study. - /// Unique identifier for the Series. - /// Unique identifier for the DICOM Image. - /// Domain name of the DICOM account for this image. - /// Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every image creation and deletion within the service. - /// Keeps track of any properties unknown to the library. - internal HealthcareDicomImageCreatedEventData(string partitionName, string imageStudyInstanceUid, string imageSeriesInstanceUid, string imageSopInstanceUid, string serviceHostName, long? sequenceNumber, IDictionary serializedAdditionalRawData) - { - PartitionName = partitionName; - ImageStudyInstanceUid = imageStudyInstanceUid; - ImageSeriesInstanceUid = imageSeriesInstanceUid; - ImageSopInstanceUid = imageSopInstanceUid; - ServiceHostName = serviceHostName; - SequenceNumber = sequenceNumber; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Data partition name. - public string PartitionName { get; } - /// Unique identifier for the Study. - public string ImageStudyInstanceUid { get; } - /// Unique identifier for the Series. - public string ImageSeriesInstanceUid { get; } - /// Unique identifier for the DICOM Image. - public string ImageSopInstanceUid { get; } - /// Domain name of the DICOM account for this image. - public string ServiceHostName { get; } - /// Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every image creation and deletion within the service. - public long? SequenceNumber { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageDeletedEventData.Serialization.cs deleted file mode 100644 index bb9a3dfd42ae..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageDeletedEventData.Serialization.cs +++ /dev/null @@ -1,211 +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.Messaging.EventGrid.SystemEvents -{ - public partial class HealthcareDicomImageDeletedEventData : 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(HealthcareDicomImageDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(PartitionName)) - { - writer.WritePropertyName("partitionName"u8); - writer.WriteStringValue(PartitionName); - } - if (Optional.IsDefined(ImageStudyInstanceUid)) - { - writer.WritePropertyName("imageStudyInstanceUid"u8); - writer.WriteStringValue(ImageStudyInstanceUid); - } - if (Optional.IsDefined(ImageSeriesInstanceUid)) - { - writer.WritePropertyName("imageSeriesInstanceUid"u8); - writer.WriteStringValue(ImageSeriesInstanceUid); - } - if (Optional.IsDefined(ImageSopInstanceUid)) - { - writer.WritePropertyName("imageSopInstanceUid"u8); - writer.WriteStringValue(ImageSopInstanceUid); - } - if (Optional.IsDefined(ServiceHostName)) - { - writer.WritePropertyName("serviceHostName"u8); - writer.WriteStringValue(ServiceHostName); - } - if (Optional.IsDefined(SequenceNumber)) - { - writer.WritePropertyName("sequenceNumber"u8); - writer.WriteNumberValue(SequenceNumber.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - HealthcareDicomImageDeletedEventData 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(HealthcareDicomImageDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeHealthcareDicomImageDeletedEventData(document.RootElement, options); - } - - internal static HealthcareDicomImageDeletedEventData DeserializeHealthcareDicomImageDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string partitionName = default; - string imageStudyInstanceUid = default; - string imageSeriesInstanceUid = default; - string imageSopInstanceUid = default; - string serviceHostName = default; - long? sequenceNumber = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("partitionName"u8)) - { - partitionName = property.Value.GetString(); - continue; - } - if (property.NameEquals("imageStudyInstanceUid"u8)) - { - imageStudyInstanceUid = property.Value.GetString(); - continue; - } - if (property.NameEquals("imageSeriesInstanceUid"u8)) - { - imageSeriesInstanceUid = property.Value.GetString(); - continue; - } - if (property.NameEquals("imageSopInstanceUid"u8)) - { - imageSopInstanceUid = property.Value.GetString(); - continue; - } - if (property.NameEquals("serviceHostName"u8)) - { - serviceHostName = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequenceNumber"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sequenceNumber = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new HealthcareDicomImageDeletedEventData( - partitionName, - imageStudyInstanceUid, - imageSeriesInstanceUid, - imageSopInstanceUid, - serviceHostName, - sequenceNumber, - 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(HealthcareDicomImageDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - HealthcareDicomImageDeletedEventData 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 DeserializeHealthcareDicomImageDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(HealthcareDicomImageDeletedEventData)} 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 HealthcareDicomImageDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeHealthcareDicomImageDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageDeletedEventData.cs deleted file mode 100644 index abac35f2b0bc..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageDeletedEventData.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.HealthcareApis.DicomImageDeleted event. - public partial class HealthcareDicomImageDeletedEventData - { - /// - /// 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 HealthcareDicomImageDeletedEventData() - { - } - - /// Initializes a new instance of . - /// Data partition name. - /// Unique identifier for the Study. - /// Unique identifier for the Series. - /// Unique identifier for the DICOM Image. - /// Host name of the DICOM account for this image. - /// Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every image creation and deletion within the service. - /// Keeps track of any properties unknown to the library. - internal HealthcareDicomImageDeletedEventData(string partitionName, string imageStudyInstanceUid, string imageSeriesInstanceUid, string imageSopInstanceUid, string serviceHostName, long? sequenceNumber, IDictionary serializedAdditionalRawData) - { - PartitionName = partitionName; - ImageStudyInstanceUid = imageStudyInstanceUid; - ImageSeriesInstanceUid = imageSeriesInstanceUid; - ImageSopInstanceUid = imageSopInstanceUid; - ServiceHostName = serviceHostName; - SequenceNumber = sequenceNumber; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Data partition name. - public string PartitionName { get; } - /// Unique identifier for the Study. - public string ImageStudyInstanceUid { get; } - /// Unique identifier for the Series. - public string ImageSeriesInstanceUid { get; } - /// Unique identifier for the DICOM Image. - public string ImageSopInstanceUid { get; } - /// Host name of the DICOM account for this image. - public string ServiceHostName { get; } - /// Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every image creation and deletion within the service. - public long? SequenceNumber { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageUpdatedEventData.Serialization.cs deleted file mode 100644 index 54bba1c9d572..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageUpdatedEventData.Serialization.cs +++ /dev/null @@ -1,211 +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.Messaging.EventGrid.SystemEvents -{ - public partial class HealthcareDicomImageUpdatedEventData : 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(HealthcareDicomImageUpdatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(PartitionName)) - { - writer.WritePropertyName("partitionName"u8); - writer.WriteStringValue(PartitionName); - } - if (Optional.IsDefined(ImageStudyInstanceUid)) - { - writer.WritePropertyName("imageStudyInstanceUid"u8); - writer.WriteStringValue(ImageStudyInstanceUid); - } - if (Optional.IsDefined(ImageSeriesInstanceUid)) - { - writer.WritePropertyName("imageSeriesInstanceUid"u8); - writer.WriteStringValue(ImageSeriesInstanceUid); - } - if (Optional.IsDefined(ImageSopInstanceUid)) - { - writer.WritePropertyName("imageSopInstanceUid"u8); - writer.WriteStringValue(ImageSopInstanceUid); - } - if (Optional.IsDefined(ServiceHostName)) - { - writer.WritePropertyName("serviceHostName"u8); - writer.WriteStringValue(ServiceHostName); - } - if (Optional.IsDefined(SequenceNumber)) - { - writer.WritePropertyName("sequenceNumber"u8); - writer.WriteNumberValue(SequenceNumber.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - HealthcareDicomImageUpdatedEventData 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(HealthcareDicomImageUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeHealthcareDicomImageUpdatedEventData(document.RootElement, options); - } - - internal static HealthcareDicomImageUpdatedEventData DeserializeHealthcareDicomImageUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string partitionName = default; - string imageStudyInstanceUid = default; - string imageSeriesInstanceUid = default; - string imageSopInstanceUid = default; - string serviceHostName = default; - long? sequenceNumber = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("partitionName"u8)) - { - partitionName = property.Value.GetString(); - continue; - } - if (property.NameEquals("imageStudyInstanceUid"u8)) - { - imageStudyInstanceUid = property.Value.GetString(); - continue; - } - if (property.NameEquals("imageSeriesInstanceUid"u8)) - { - imageSeriesInstanceUid = property.Value.GetString(); - continue; - } - if (property.NameEquals("imageSopInstanceUid"u8)) - { - imageSopInstanceUid = property.Value.GetString(); - continue; - } - if (property.NameEquals("serviceHostName"u8)) - { - serviceHostName = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequenceNumber"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sequenceNumber = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new HealthcareDicomImageUpdatedEventData( - partitionName, - imageStudyInstanceUid, - imageSeriesInstanceUid, - imageSopInstanceUid, - serviceHostName, - sequenceNumber, - 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(HealthcareDicomImageUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - HealthcareDicomImageUpdatedEventData 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 DeserializeHealthcareDicomImageUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(HealthcareDicomImageUpdatedEventData)} 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 HealthcareDicomImageUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeHealthcareDicomImageUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageUpdatedEventData.cs deleted file mode 100644 index eb248a7f72ad..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareDicomImageUpdatedEventData.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.HealthcareApis.DicomImageUpdated event. - public partial class HealthcareDicomImageUpdatedEventData - { - /// - /// 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 HealthcareDicomImageUpdatedEventData() - { - } - - /// Initializes a new instance of . - /// Data partition name. - /// Unique identifier for the Study. - /// Unique identifier for the Series. - /// Unique identifier for the DICOM Image. - /// Domain name of the DICOM account for this image. - /// Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every image creation, updation and deletion within the service. - /// Keeps track of any properties unknown to the library. - internal HealthcareDicomImageUpdatedEventData(string partitionName, string imageStudyInstanceUid, string imageSeriesInstanceUid, string imageSopInstanceUid, string serviceHostName, long? sequenceNumber, IDictionary serializedAdditionalRawData) - { - PartitionName = partitionName; - ImageStudyInstanceUid = imageStudyInstanceUid; - ImageSeriesInstanceUid = imageSeriesInstanceUid; - ImageSopInstanceUid = imageSopInstanceUid; - ServiceHostName = serviceHostName; - SequenceNumber = sequenceNumber; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Data partition name. - public string PartitionName { get; } - /// Unique identifier for the Study. - public string ImageStudyInstanceUid { get; } - /// Unique identifier for the Series. - public string ImageSeriesInstanceUid { get; } - /// Unique identifier for the DICOM Image. - public string ImageSopInstanceUid { get; } - /// Domain name of the DICOM account for this image. - public string ServiceHostName { get; } - /// Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every image creation, updation and deletion within the service. - public long? SequenceNumber { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceCreatedEventData.Serialization.cs deleted file mode 100644 index 5750aeda70b5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class HealthcareFhirResourceCreatedEventData : 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(HealthcareFhirResourceCreatedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("resourceType"u8); - writer.WriteStringValue(FhirResourceType.ToString()); - if (Optional.IsDefined(FhirServiceHostName)) - { - writer.WritePropertyName("resourceFhirAccount"u8); - writer.WriteStringValue(FhirServiceHostName); - } - if (Optional.IsDefined(FhirResourceId)) - { - writer.WritePropertyName("resourceFhirId"u8); - writer.WriteStringValue(FhirResourceId); - } - if (Optional.IsDefined(FhirResourceVersionId)) - { - writer.WritePropertyName("resourceVersionId"u8); - writer.WriteNumberValue(FhirResourceVersionId.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - HealthcareFhirResourceCreatedEventData 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(HealthcareFhirResourceCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeHealthcareFhirResourceCreatedEventData(document.RootElement, options); - } - - internal static HealthcareFhirResourceCreatedEventData DeserializeHealthcareFhirResourceCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - HealthcareFhirResourceType resourceType = default; - string resourceFhirAccount = default; - string resourceFhirId = default; - long? resourceVersionId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceType"u8)) - { - resourceType = new HealthcareFhirResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("resourceFhirAccount"u8)) - { - resourceFhirAccount = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceFhirId"u8)) - { - resourceFhirId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceVersionId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resourceVersionId = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new HealthcareFhirResourceCreatedEventData(resourceType, resourceFhirAccount, resourceFhirId, resourceVersionId, 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(HealthcareFhirResourceCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - HealthcareFhirResourceCreatedEventData 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 DeserializeHealthcareFhirResourceCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(HealthcareFhirResourceCreatedEventData)} 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 HealthcareFhirResourceCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeHealthcareFhirResourceCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceCreatedEventData.cs deleted file mode 100644 index ed48894c3e41..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceCreatedEventData.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.HealthcareApis.FhirResourceCreated event. - public partial class HealthcareFhirResourceCreatedEventData - { - /// - /// 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 . - /// Type of HL7 FHIR resource. - internal HealthcareFhirResourceCreatedEventData(HealthcareFhirResourceType fhirResourceType) - { - FhirResourceType = fhirResourceType; - } - - /// Initializes a new instance of . - /// Type of HL7 FHIR resource. - /// Domain name of FHIR account for this resource. - /// Id of HL7 FHIR resource. - /// VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or deleted(soft-deletion). - /// Keeps track of any properties unknown to the library. - internal HealthcareFhirResourceCreatedEventData(HealthcareFhirResourceType fhirResourceType, string fhirServiceHostName, string fhirResourceId, long? fhirResourceVersionId, IDictionary serializedAdditionalRawData) - { - FhirResourceType = fhirResourceType; - FhirServiceHostName = fhirServiceHostName; - FhirResourceId = fhirResourceId; - FhirResourceVersionId = fhirResourceVersionId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal HealthcareFhirResourceCreatedEventData() - { - } - - /// Type of HL7 FHIR resource. - public HealthcareFhirResourceType FhirResourceType { get; } - /// Domain name of FHIR account for this resource. - public string FhirServiceHostName { get; } - /// Id of HL7 FHIR resource. - public string FhirResourceId { get; } - /// VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or deleted(soft-deletion). - public long? FhirResourceVersionId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceDeletedEventData.Serialization.cs deleted file mode 100644 index f51a529553b5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class HealthcareFhirResourceDeletedEventData : 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(HealthcareFhirResourceDeletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("resourceType"u8); - writer.WriteStringValue(FhirResourceType.ToString()); - if (Optional.IsDefined(FhirServiceHostName)) - { - writer.WritePropertyName("resourceFhirAccount"u8); - writer.WriteStringValue(FhirServiceHostName); - } - if (Optional.IsDefined(FhirResourceId)) - { - writer.WritePropertyName("resourceFhirId"u8); - writer.WriteStringValue(FhirResourceId); - } - if (Optional.IsDefined(FhirResourceVersionId)) - { - writer.WritePropertyName("resourceVersionId"u8); - writer.WriteNumberValue(FhirResourceVersionId.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - HealthcareFhirResourceDeletedEventData 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(HealthcareFhirResourceDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeHealthcareFhirResourceDeletedEventData(document.RootElement, options); - } - - internal static HealthcareFhirResourceDeletedEventData DeserializeHealthcareFhirResourceDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - HealthcareFhirResourceType resourceType = default; - string resourceFhirAccount = default; - string resourceFhirId = default; - long? resourceVersionId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceType"u8)) - { - resourceType = new HealthcareFhirResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("resourceFhirAccount"u8)) - { - resourceFhirAccount = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceFhirId"u8)) - { - resourceFhirId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceVersionId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resourceVersionId = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new HealthcareFhirResourceDeletedEventData(resourceType, resourceFhirAccount, resourceFhirId, resourceVersionId, 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(HealthcareFhirResourceDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - HealthcareFhirResourceDeletedEventData 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 DeserializeHealthcareFhirResourceDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(HealthcareFhirResourceDeletedEventData)} 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 HealthcareFhirResourceDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeHealthcareFhirResourceDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceDeletedEventData.cs deleted file mode 100644 index 6e883f6f61e4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceDeletedEventData.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.HealthcareApis.FhirResourceDeleted event. - public partial class HealthcareFhirResourceDeletedEventData - { - /// - /// 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 . - /// Type of HL7 FHIR resource. - internal HealthcareFhirResourceDeletedEventData(HealthcareFhirResourceType fhirResourceType) - { - FhirResourceType = fhirResourceType; - } - - /// Initializes a new instance of . - /// Type of HL7 FHIR resource. - /// Domain name of FHIR account for this resource. - /// Id of HL7 FHIR resource. - /// VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or deleted(soft-deletion). - /// Keeps track of any properties unknown to the library. - internal HealthcareFhirResourceDeletedEventData(HealthcareFhirResourceType fhirResourceType, string fhirServiceHostName, string fhirResourceId, long? fhirResourceVersionId, IDictionary serializedAdditionalRawData) - { - FhirResourceType = fhirResourceType; - FhirServiceHostName = fhirServiceHostName; - FhirResourceId = fhirResourceId; - FhirResourceVersionId = fhirResourceVersionId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal HealthcareFhirResourceDeletedEventData() - { - } - - /// Type of HL7 FHIR resource. - public HealthcareFhirResourceType FhirResourceType { get; } - /// Domain name of FHIR account for this resource. - public string FhirServiceHostName { get; } - /// Id of HL7 FHIR resource. - public string FhirResourceId { get; } - /// VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or deleted(soft-deletion). - public long? FhirResourceVersionId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceType.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceType.cs deleted file mode 100644 index 895fc9c8b46f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceType.cs +++ /dev/null @@ -1,528 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of FHIR resource type enumeration. - public readonly partial struct HealthcareFhirResourceType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public HealthcareFhirResourceType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AccountValue = "Account"; - private const string ActivityDefinitionValue = "ActivityDefinition"; - private const string AdverseEventValue = "AdverseEvent"; - private const string AllergyIntoleranceValue = "AllergyIntolerance"; - private const string AppointmentValue = "Appointment"; - private const string AppointmentResponseValue = "AppointmentResponse"; - private const string AuditEventValue = "AuditEvent"; - private const string BasicValue = "Basic"; - private const string BinaryValue = "Binary"; - private const string BiologicallyDerivedProductValue = "BiologicallyDerivedProduct"; - private const string BodySiteValue = "BodySite"; - private const string BodyStructureValue = "BodyStructure"; - private const string BundleValue = "Bundle"; - private const string CapabilityStatementValue = "CapabilityStatement"; - private const string CarePlanValue = "CarePlan"; - private const string CareTeamValue = "CareTeam"; - private const string CatalogEntryValue = "CatalogEntry"; - private const string ChargeItemValue = "ChargeItem"; - private const string ChargeItemDefinitionValue = "ChargeItemDefinition"; - private const string ClaimValue = "Claim"; - private const string ClaimResponseValue = "ClaimResponse"; - private const string ClinicalImpressionValue = "ClinicalImpression"; - private const string CodeSystemValue = "CodeSystem"; - private const string CommunicationValue = "Communication"; - private const string CommunicationRequestValue = "CommunicationRequest"; - private const string CompartmentDefinitionValue = "CompartmentDefinition"; - private const string CompositionValue = "Composition"; - private const string ConceptMapValue = "ConceptMap"; - private const string ConditionValue = "Condition"; - private const string ConsentValue = "Consent"; - private const string ContractValue = "Contract"; - private const string CoverageValue = "Coverage"; - private const string CoverageEligibilityRequestValue = "CoverageEligibilityRequest"; - private const string CoverageEligibilityResponseValue = "CoverageEligibilityResponse"; - private const string DataElementValue = "DataElement"; - private const string DetectedIssueValue = "DetectedIssue"; - private const string DeviceValue = "Device"; - private const string DeviceComponentValue = "DeviceComponent"; - private const string DeviceDefinitionValue = "DeviceDefinition"; - private const string DeviceMetricValue = "DeviceMetric"; - private const string DeviceRequestValue = "DeviceRequest"; - private const string DeviceUseStatementValue = "DeviceUseStatement"; - private const string DiagnosticReportValue = "DiagnosticReport"; - private const string DocumentManifestValue = "DocumentManifest"; - private const string DocumentReferenceValue = "DocumentReference"; - private const string DomainResourceValue = "DomainResource"; - private const string EffectEvidenceSynthesisValue = "EffectEvidenceSynthesis"; - private const string EligibilityRequestValue = "EligibilityRequest"; - private const string EligibilityResponseValue = "EligibilityResponse"; - private const string EncounterValue = "Encounter"; - private const string EndpointValue = "Endpoint"; - private const string EnrollmentRequestValue = "EnrollmentRequest"; - private const string EnrollmentResponseValue = "EnrollmentResponse"; - private const string EpisodeOfCareValue = "EpisodeOfCare"; - private const string EventDefinitionValue = "EventDefinition"; - private const string EvidenceValue = "Evidence"; - private const string EvidenceVariableValue = "EvidenceVariable"; - private const string ExampleScenarioValue = "ExampleScenario"; - private const string ExpansionProfileValue = "ExpansionProfile"; - private const string ExplanationOfBenefitValue = "ExplanationOfBenefit"; - private const string FamilyMemberHistoryValue = "FamilyMemberHistory"; - private const string FlagValue = "Flag"; - private const string GoalValue = "Goal"; - private const string GraphDefinitionValue = "GraphDefinition"; - private const string GroupValue = "Group"; - private const string GuidanceResponseValue = "GuidanceResponse"; - private const string HealthcareServiceValue = "HealthcareService"; - private const string ImagingManifestValue = "ImagingManifest"; - private const string ImagingStudyValue = "ImagingStudy"; - private const string ImmunizationValue = "Immunization"; - private const string ImmunizationEvaluationValue = "ImmunizationEvaluation"; - private const string ImmunizationRecommendationValue = "ImmunizationRecommendation"; - private const string ImplementationGuideValue = "ImplementationGuide"; - private const string InsurancePlanValue = "InsurancePlan"; - private const string InvoiceValue = "Invoice"; - private const string LibraryValue = "Library"; - private const string LinkageValue = "Linkage"; - private const string ListValue = "List"; - private const string LocationValue = "Location"; - private const string MeasureValue = "Measure"; - private const string MeasureReportValue = "MeasureReport"; - private const string MediaValue = "Media"; - private const string MedicationValue = "Medication"; - private const string MedicationAdministrationValue = "MedicationAdministration"; - private const string MedicationDispenseValue = "MedicationDispense"; - private const string MedicationKnowledgeValue = "MedicationKnowledge"; - private const string MedicationRequestValue = "MedicationRequest"; - private const string MedicationStatementValue = "MedicationStatement"; - private const string MedicinalProductValue = "MedicinalProduct"; - private const string MedicinalProductAuthorizationValue = "MedicinalProductAuthorization"; - private const string MedicinalProductContraindicationValue = "MedicinalProductContraindication"; - private const string MedicinalProductIndicationValue = "MedicinalProductIndication"; - private const string MedicinalProductIngredientValue = "MedicinalProductIngredient"; - private const string MedicinalProductInteractionValue = "MedicinalProductInteraction"; - private const string MedicinalProductManufacturedValue = "MedicinalProductManufactured"; - private const string MedicinalProductPackagedValue = "MedicinalProductPackaged"; - private const string MedicinalProductPharmaceuticalValue = "MedicinalProductPharmaceutical"; - private const string MedicinalProductUndesirableEffectValue = "MedicinalProductUndesirableEffect"; - private const string MessageDefinitionValue = "MessageDefinition"; - private const string MessageHeaderValue = "MessageHeader"; - private const string MolecularSequenceValue = "MolecularSequence"; - private const string NamingSystemValue = "NamingSystem"; - private const string NutritionOrderValue = "NutritionOrder"; - private const string ObservationValue = "Observation"; - private const string ObservationDefinitionValue = "ObservationDefinition"; - private const string OperationDefinitionValue = "OperationDefinition"; - private const string OperationOutcomeValue = "OperationOutcome"; - private const string OrganizationValue = "Organization"; - private const string OrganizationAffiliationValue = "OrganizationAffiliation"; - private const string ParametersValue = "Parameters"; - private const string PatientValue = "Patient"; - private const string PaymentNoticeValue = "PaymentNotice"; - private const string PaymentReconciliationValue = "PaymentReconciliation"; - private const string PersonValue = "Person"; - private const string PlanDefinitionValue = "PlanDefinition"; - private const string PractitionerValue = "Practitioner"; - private const string PractitionerRoleValue = "PractitionerRole"; - private const string ProcedureValue = "Procedure"; - private const string ProcedureRequestValue = "ProcedureRequest"; - private const string ProcessRequestValue = "ProcessRequest"; - private const string ProcessResponseValue = "ProcessResponse"; - private const string ProvenanceValue = "Provenance"; - private const string QuestionnaireValue = "Questionnaire"; - private const string QuestionnaireResponseValue = "QuestionnaireResponse"; - private const string ReferralRequestValue = "ReferralRequest"; - private const string RelatedPersonValue = "RelatedPerson"; - private const string RequestGroupValue = "RequestGroup"; - private const string ResearchDefinitionValue = "ResearchDefinition"; - private const string ResearchElementDefinitionValue = "ResearchElementDefinition"; - private const string ResearchStudyValue = "ResearchStudy"; - private const string ResearchSubjectValue = "ResearchSubject"; - private const string ResourceValue = "Resource"; - private const string RiskAssessmentValue = "RiskAssessment"; - private const string RiskEvidenceSynthesisValue = "RiskEvidenceSynthesis"; - private const string ScheduleValue = "Schedule"; - private const string SearchParameterValue = "SearchParameter"; - private const string SequenceValue = "Sequence"; - private const string ServiceDefinitionValue = "ServiceDefinition"; - private const string ServiceRequestValue = "ServiceRequest"; - private const string SlotValue = "Slot"; - private const string SpecimenValue = "Specimen"; - private const string SpecimenDefinitionValue = "SpecimenDefinition"; - private const string StructureDefinitionValue = "StructureDefinition"; - private const string StructureMapValue = "StructureMap"; - private const string SubscriptionValue = "Subscription"; - private const string SubstanceValue = "Substance"; - private const string SubstanceNucleicAcidValue = "SubstanceNucleicAcid"; - private const string SubstancePolymerValue = "SubstancePolymer"; - private const string SubstanceProteinValue = "SubstanceProtein"; - private const string SubstanceReferenceInformationValue = "SubstanceReferenceInformation"; - private const string SubstanceSourceMaterialValue = "SubstanceSourceMaterial"; - private const string SubstanceSpecificationValue = "SubstanceSpecification"; - private const string SupplyDeliveryValue = "SupplyDelivery"; - private const string SupplyRequestValue = "SupplyRequest"; - private const string TaskValue = "Task"; - private const string TerminologyCapabilitiesValue = "TerminologyCapabilities"; - private const string TestReportValue = "TestReport"; - private const string TestScriptValue = "TestScript"; - private const string ValueSetValue = "ValueSet"; - private const string VerificationResultValue = "VerificationResult"; - private const string VisionPrescriptionValue = "VisionPrescription"; - - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Account { get; } = new HealthcareFhirResourceType(AccountValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ActivityDefinition { get; } = new HealthcareFhirResourceType(ActivityDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType AdverseEvent { get; } = new HealthcareFhirResourceType(AdverseEventValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType AllergyIntolerance { get; } = new HealthcareFhirResourceType(AllergyIntoleranceValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Appointment { get; } = new HealthcareFhirResourceType(AppointmentValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType AppointmentResponse { get; } = new HealthcareFhirResourceType(AppointmentResponseValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType AuditEvent { get; } = new HealthcareFhirResourceType(AuditEventValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Basic { get; } = new HealthcareFhirResourceType(BasicValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Binary { get; } = new HealthcareFhirResourceType(BinaryValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType BiologicallyDerivedProduct { get; } = new HealthcareFhirResourceType(BiologicallyDerivedProductValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType BodySite { get; } = new HealthcareFhirResourceType(BodySiteValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType BodyStructure { get; } = new HealthcareFhirResourceType(BodyStructureValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Bundle { get; } = new HealthcareFhirResourceType(BundleValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType CapabilityStatement { get; } = new HealthcareFhirResourceType(CapabilityStatementValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType CarePlan { get; } = new HealthcareFhirResourceType(CarePlanValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType CareTeam { get; } = new HealthcareFhirResourceType(CareTeamValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType CatalogEntry { get; } = new HealthcareFhirResourceType(CatalogEntryValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ChargeItem { get; } = new HealthcareFhirResourceType(ChargeItemValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType ChargeItemDefinition { get; } = new HealthcareFhirResourceType(ChargeItemDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Claim { get; } = new HealthcareFhirResourceType(ClaimValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ClaimResponse { get; } = new HealthcareFhirResourceType(ClaimResponseValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ClinicalImpression { get; } = new HealthcareFhirResourceType(ClinicalImpressionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType CodeSystem { get; } = new HealthcareFhirResourceType(CodeSystemValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Communication { get; } = new HealthcareFhirResourceType(CommunicationValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType CommunicationRequest { get; } = new HealthcareFhirResourceType(CommunicationRequestValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType CompartmentDefinition { get; } = new HealthcareFhirResourceType(CompartmentDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Composition { get; } = new HealthcareFhirResourceType(CompositionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ConceptMap { get; } = new HealthcareFhirResourceType(ConceptMapValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Condition { get; } = new HealthcareFhirResourceType(ConditionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Consent { get; } = new HealthcareFhirResourceType(ConsentValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Contract { get; } = new HealthcareFhirResourceType(ContractValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Coverage { get; } = new HealthcareFhirResourceType(CoverageValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType CoverageEligibilityRequest { get; } = new HealthcareFhirResourceType(CoverageEligibilityRequestValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType CoverageEligibilityResponse { get; } = new HealthcareFhirResourceType(CoverageEligibilityResponseValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType DataElement { get; } = new HealthcareFhirResourceType(DataElementValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType DetectedIssue { get; } = new HealthcareFhirResourceType(DetectedIssueValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Device { get; } = new HealthcareFhirResourceType(DeviceValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType DeviceComponent { get; } = new HealthcareFhirResourceType(DeviceComponentValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType DeviceDefinition { get; } = new HealthcareFhirResourceType(DeviceDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType DeviceMetric { get; } = new HealthcareFhirResourceType(DeviceMetricValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType DeviceRequest { get; } = new HealthcareFhirResourceType(DeviceRequestValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType DeviceUseStatement { get; } = new HealthcareFhirResourceType(DeviceUseStatementValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType DiagnosticReport { get; } = new HealthcareFhirResourceType(DiagnosticReportValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType DocumentManifest { get; } = new HealthcareFhirResourceType(DocumentManifestValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType DocumentReference { get; } = new HealthcareFhirResourceType(DocumentReferenceValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType DomainResource { get; } = new HealthcareFhirResourceType(DomainResourceValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType EffectEvidenceSynthesis { get; } = new HealthcareFhirResourceType(EffectEvidenceSynthesisValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType EligibilityRequest { get; } = new HealthcareFhirResourceType(EligibilityRequestValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType EligibilityResponse { get; } = new HealthcareFhirResourceType(EligibilityResponseValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Encounter { get; } = new HealthcareFhirResourceType(EncounterValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Endpoint { get; } = new HealthcareFhirResourceType(EndpointValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType EnrollmentRequest { get; } = new HealthcareFhirResourceType(EnrollmentRequestValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType EnrollmentResponse { get; } = new HealthcareFhirResourceType(EnrollmentResponseValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType EpisodeOfCare { get; } = new HealthcareFhirResourceType(EpisodeOfCareValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType EventDefinition { get; } = new HealthcareFhirResourceType(EventDefinitionValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType Evidence { get; } = new HealthcareFhirResourceType(EvidenceValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType EvidenceVariable { get; } = new HealthcareFhirResourceType(EvidenceVariableValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType ExampleScenario { get; } = new HealthcareFhirResourceType(ExampleScenarioValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType ExpansionProfile { get; } = new HealthcareFhirResourceType(ExpansionProfileValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ExplanationOfBenefit { get; } = new HealthcareFhirResourceType(ExplanationOfBenefitValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType FamilyMemberHistory { get; } = new HealthcareFhirResourceType(FamilyMemberHistoryValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Flag { get; } = new HealthcareFhirResourceType(FlagValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Goal { get; } = new HealthcareFhirResourceType(GoalValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType GraphDefinition { get; } = new HealthcareFhirResourceType(GraphDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Group { get; } = new HealthcareFhirResourceType(GroupValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType GuidanceResponse { get; } = new HealthcareFhirResourceType(GuidanceResponseValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType HealthcareService { get; } = new HealthcareFhirResourceType(HealthcareServiceValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType ImagingManifest { get; } = new HealthcareFhirResourceType(ImagingManifestValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ImagingStudy { get; } = new HealthcareFhirResourceType(ImagingStudyValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Immunization { get; } = new HealthcareFhirResourceType(ImmunizationValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType ImmunizationEvaluation { get; } = new HealthcareFhirResourceType(ImmunizationEvaluationValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ImmunizationRecommendation { get; } = new HealthcareFhirResourceType(ImmunizationRecommendationValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ImplementationGuide { get; } = new HealthcareFhirResourceType(ImplementationGuideValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType InsurancePlan { get; } = new HealthcareFhirResourceType(InsurancePlanValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType Invoice { get; } = new HealthcareFhirResourceType(InvoiceValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Library { get; } = new HealthcareFhirResourceType(LibraryValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Linkage { get; } = new HealthcareFhirResourceType(LinkageValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType List { get; } = new HealthcareFhirResourceType(ListValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Location { get; } = new HealthcareFhirResourceType(LocationValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Measure { get; } = new HealthcareFhirResourceType(MeasureValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType MeasureReport { get; } = new HealthcareFhirResourceType(MeasureReportValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Media { get; } = new HealthcareFhirResourceType(MediaValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Medication { get; } = new HealthcareFhirResourceType(MedicationValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType MedicationAdministration { get; } = new HealthcareFhirResourceType(MedicationAdministrationValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType MedicationDispense { get; } = new HealthcareFhirResourceType(MedicationDispenseValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MedicationKnowledge { get; } = new HealthcareFhirResourceType(MedicationKnowledgeValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType MedicationRequest { get; } = new HealthcareFhirResourceType(MedicationRequestValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType MedicationStatement { get; } = new HealthcareFhirResourceType(MedicationStatementValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MedicinalProduct { get; } = new HealthcareFhirResourceType(MedicinalProductValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MedicinalProductAuthorization { get; } = new HealthcareFhirResourceType(MedicinalProductAuthorizationValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MedicinalProductContraindication { get; } = new HealthcareFhirResourceType(MedicinalProductContraindicationValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MedicinalProductIndication { get; } = new HealthcareFhirResourceType(MedicinalProductIndicationValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MedicinalProductIngredient { get; } = new HealthcareFhirResourceType(MedicinalProductIngredientValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MedicinalProductInteraction { get; } = new HealthcareFhirResourceType(MedicinalProductInteractionValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MedicinalProductManufactured { get; } = new HealthcareFhirResourceType(MedicinalProductManufacturedValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MedicinalProductPackaged { get; } = new HealthcareFhirResourceType(MedicinalProductPackagedValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MedicinalProductPharmaceutical { get; } = new HealthcareFhirResourceType(MedicinalProductPharmaceuticalValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MedicinalProductUndesirableEffect { get; } = new HealthcareFhirResourceType(MedicinalProductUndesirableEffectValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType MessageDefinition { get; } = new HealthcareFhirResourceType(MessageDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType MessageHeader { get; } = new HealthcareFhirResourceType(MessageHeaderValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType MolecularSequence { get; } = new HealthcareFhirResourceType(MolecularSequenceValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType NamingSystem { get; } = new HealthcareFhirResourceType(NamingSystemValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType NutritionOrder { get; } = new HealthcareFhirResourceType(NutritionOrderValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Observation { get; } = new HealthcareFhirResourceType(ObservationValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType ObservationDefinition { get; } = new HealthcareFhirResourceType(ObservationDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType OperationDefinition { get; } = new HealthcareFhirResourceType(OperationDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType OperationOutcome { get; } = new HealthcareFhirResourceType(OperationOutcomeValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Organization { get; } = new HealthcareFhirResourceType(OrganizationValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType OrganizationAffiliation { get; } = new HealthcareFhirResourceType(OrganizationAffiliationValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Parameters { get; } = new HealthcareFhirResourceType(ParametersValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Patient { get; } = new HealthcareFhirResourceType(PatientValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType PaymentNotice { get; } = new HealthcareFhirResourceType(PaymentNoticeValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType PaymentReconciliation { get; } = new HealthcareFhirResourceType(PaymentReconciliationValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Person { get; } = new HealthcareFhirResourceType(PersonValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType PlanDefinition { get; } = new HealthcareFhirResourceType(PlanDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Practitioner { get; } = new HealthcareFhirResourceType(PractitionerValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType PractitionerRole { get; } = new HealthcareFhirResourceType(PractitionerRoleValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Procedure { get; } = new HealthcareFhirResourceType(ProcedureValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType ProcedureRequest { get; } = new HealthcareFhirResourceType(ProcedureRequestValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType ProcessRequest { get; } = new HealthcareFhirResourceType(ProcessRequestValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType ProcessResponse { get; } = new HealthcareFhirResourceType(ProcessResponseValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Provenance { get; } = new HealthcareFhirResourceType(ProvenanceValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Questionnaire { get; } = new HealthcareFhirResourceType(QuestionnaireValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType QuestionnaireResponse { get; } = new HealthcareFhirResourceType(QuestionnaireResponseValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType ReferralRequest { get; } = new HealthcareFhirResourceType(ReferralRequestValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType RelatedPerson { get; } = new HealthcareFhirResourceType(RelatedPersonValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType RequestGroup { get; } = new HealthcareFhirResourceType(RequestGroupValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType ResearchDefinition { get; } = new HealthcareFhirResourceType(ResearchDefinitionValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType ResearchElementDefinition { get; } = new HealthcareFhirResourceType(ResearchElementDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ResearchStudy { get; } = new HealthcareFhirResourceType(ResearchStudyValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ResearchSubject { get; } = new HealthcareFhirResourceType(ResearchSubjectValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Resource { get; } = new HealthcareFhirResourceType(ResourceValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType RiskAssessment { get; } = new HealthcareFhirResourceType(RiskAssessmentValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType RiskEvidenceSynthesis { get; } = new HealthcareFhirResourceType(RiskEvidenceSynthesisValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Schedule { get; } = new HealthcareFhirResourceType(ScheduleValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType SearchParameter { get; } = new HealthcareFhirResourceType(SearchParameterValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType Sequence { get; } = new HealthcareFhirResourceType(SequenceValue); - /// The FHIR resource type defined in STU3. - public static HealthcareFhirResourceType ServiceDefinition { get; } = new HealthcareFhirResourceType(ServiceDefinitionValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType ServiceRequest { get; } = new HealthcareFhirResourceType(ServiceRequestValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Slot { get; } = new HealthcareFhirResourceType(SlotValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Specimen { get; } = new HealthcareFhirResourceType(SpecimenValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType SpecimenDefinition { get; } = new HealthcareFhirResourceType(SpecimenDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType StructureDefinition { get; } = new HealthcareFhirResourceType(StructureDefinitionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType StructureMap { get; } = new HealthcareFhirResourceType(StructureMapValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Subscription { get; } = new HealthcareFhirResourceType(SubscriptionValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Substance { get; } = new HealthcareFhirResourceType(SubstanceValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType SubstanceNucleicAcid { get; } = new HealthcareFhirResourceType(SubstanceNucleicAcidValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType SubstancePolymer { get; } = new HealthcareFhirResourceType(SubstancePolymerValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType SubstanceProtein { get; } = new HealthcareFhirResourceType(SubstanceProteinValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType SubstanceReferenceInformation { get; } = new HealthcareFhirResourceType(SubstanceReferenceInformationValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType SubstanceSourceMaterial { get; } = new HealthcareFhirResourceType(SubstanceSourceMaterialValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType SubstanceSpecification { get; } = new HealthcareFhirResourceType(SubstanceSpecificationValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType SupplyDelivery { get; } = new HealthcareFhirResourceType(SupplyDeliveryValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType SupplyRequest { get; } = new HealthcareFhirResourceType(SupplyRequestValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType Task { get; } = new HealthcareFhirResourceType(TaskValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType TerminologyCapabilities { get; } = new HealthcareFhirResourceType(TerminologyCapabilitiesValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType TestReport { get; } = new HealthcareFhirResourceType(TestReportValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType TestScript { get; } = new HealthcareFhirResourceType(TestScriptValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType ValueSet { get; } = new HealthcareFhirResourceType(ValueSetValue); - /// The FHIR resource type defined in R4. - public static HealthcareFhirResourceType VerificationResult { get; } = new HealthcareFhirResourceType(VerificationResultValue); - /// The FHIR resource type defined in STU3 and R4. - public static HealthcareFhirResourceType VisionPrescription { get; } = new HealthcareFhirResourceType(VisionPrescriptionValue); - /// Determines if two values are the same. - public static bool operator ==(HealthcareFhirResourceType left, HealthcareFhirResourceType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(HealthcareFhirResourceType left, HealthcareFhirResourceType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator HealthcareFhirResourceType(string value) => new HealthcareFhirResourceType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is HealthcareFhirResourceType other && Equals(other); - /// - public bool Equals(HealthcareFhirResourceType 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceUpdatedEventData.Serialization.cs deleted file mode 100644 index c8002a984a9c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class HealthcareFhirResourceUpdatedEventData : 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(HealthcareFhirResourceUpdatedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("resourceType"u8); - writer.WriteStringValue(FhirResourceType.ToString()); - if (Optional.IsDefined(FhirServiceHostName)) - { - writer.WritePropertyName("resourceFhirAccount"u8); - writer.WriteStringValue(FhirServiceHostName); - } - if (Optional.IsDefined(FhirResourceId)) - { - writer.WritePropertyName("resourceFhirId"u8); - writer.WriteStringValue(FhirResourceId); - } - if (Optional.IsDefined(FhirResourceVersionId)) - { - writer.WritePropertyName("resourceVersionId"u8); - writer.WriteNumberValue(FhirResourceVersionId.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - HealthcareFhirResourceUpdatedEventData 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(HealthcareFhirResourceUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeHealthcareFhirResourceUpdatedEventData(document.RootElement, options); - } - - internal static HealthcareFhirResourceUpdatedEventData DeserializeHealthcareFhirResourceUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - HealthcareFhirResourceType resourceType = default; - string resourceFhirAccount = default; - string resourceFhirId = default; - long? resourceVersionId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceType"u8)) - { - resourceType = new HealthcareFhirResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("resourceFhirAccount"u8)) - { - resourceFhirAccount = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceFhirId"u8)) - { - resourceFhirId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceVersionId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resourceVersionId = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new HealthcareFhirResourceUpdatedEventData(resourceType, resourceFhirAccount, resourceFhirId, resourceVersionId, 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(HealthcareFhirResourceUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - HealthcareFhirResourceUpdatedEventData 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 DeserializeHealthcareFhirResourceUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(HealthcareFhirResourceUpdatedEventData)} 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 HealthcareFhirResourceUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeHealthcareFhirResourceUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceUpdatedEventData.cs deleted file mode 100644 index 7133f01a47d2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/HealthcareFhirResourceUpdatedEventData.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.HealthcareApis.FhirResourceUpdated event. - public partial class HealthcareFhirResourceUpdatedEventData - { - /// - /// 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 . - /// Type of HL7 FHIR resource. - internal HealthcareFhirResourceUpdatedEventData(HealthcareFhirResourceType fhirResourceType) - { - FhirResourceType = fhirResourceType; - } - - /// Initializes a new instance of . - /// Type of HL7 FHIR resource. - /// Domain name of FHIR account for this resource. - /// Id of HL7 FHIR resource. - /// VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or deleted(soft-deletion). - /// Keeps track of any properties unknown to the library. - internal HealthcareFhirResourceUpdatedEventData(HealthcareFhirResourceType fhirResourceType, string fhirServiceHostName, string fhirResourceId, long? fhirResourceVersionId, IDictionary serializedAdditionalRawData) - { - FhirResourceType = fhirResourceType; - FhirServiceHostName = fhirServiceHostName; - FhirResourceId = fhirResourceId; - FhirResourceVersionId = fhirResourceVersionId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal HealthcareFhirResourceUpdatedEventData() - { - } - - /// Type of HL7 FHIR resource. - public HealthcareFhirResourceType FhirResourceType { get; } - /// Domain name of FHIR account for this resource. - public string FhirServiceHostName { get; } - /// Id of HL7 FHIR resource. - public string FhirResourceId { get; } - /// VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or deleted(soft-deletion). - public long? FhirResourceVersionId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/ChangeTrackingDictionary.cs deleted file mode 100644 index 89cfa4f97177..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/ChangeTrackingDictionary.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull - { - private IDictionary _innerDictionary; - - public ChangeTrackingDictionary() - { - } - - public ChangeTrackingDictionary(IDictionary dictionary) - { - if (dictionary == null) - { - return; - } - _innerDictionary = new Dictionary(dictionary); - } - - public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) - { - if (dictionary == null) - { - return; - } - _innerDictionary = new Dictionary(); - foreach (var pair in dictionary) - { - _innerDictionary.Add(pair); - } - } - - public bool IsUndefined => _innerDictionary == null; - - public int Count => IsUndefined ? 0 : EnsureDictionary().Count; - - public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; - - public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; - - public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; - - public TValue this[TKey key] - { - get - { - if (IsUndefined) - { - throw new KeyNotFoundException(nameof(key)); - } - return EnsureDictionary()[key]; - } - set - { - EnsureDictionary()[key] = value; - } - } - - IEnumerable IReadOnlyDictionary.Keys => Keys; - - IEnumerable IReadOnlyDictionary.Values => Values; - - public IEnumerator> GetEnumerator() - { - if (IsUndefined) - { - IEnumerator> enumerateEmpty() - { - yield break; - } - return enumerateEmpty(); - } - return EnsureDictionary().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public void Add(KeyValuePair item) - { - EnsureDictionary().Add(item); - } - - public void Clear() - { - EnsureDictionary().Clear(); - } - - public bool Contains(KeyValuePair item) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Contains(item); - } - - public void CopyTo(KeyValuePair[] array, int index) - { - if (IsUndefined) - { - return; - } - EnsureDictionary().CopyTo(array, index); - } - - public bool Remove(KeyValuePair item) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Remove(item); - } - - public void Add(TKey key, TValue value) - { - EnsureDictionary().Add(key, value); - } - - public bool ContainsKey(TKey key) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().ContainsKey(key); - } - - public bool Remove(TKey key) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Remove(key); - } - - public bool TryGetValue(TKey key, out TValue value) - { - if (IsUndefined) - { - value = default; - return false; - } - return EnsureDictionary().TryGetValue(key, out value); - } - - public IDictionary EnsureDictionary() - { - return _innerDictionary ??= new Dictionary(); - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/ChangeTrackingList.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/ChangeTrackingList.cs deleted file mode 100644 index 08861102824c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/ChangeTrackingList.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.Collections; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - internal class ChangeTrackingList : IList, IReadOnlyList - { - private IList _innerList; - - public ChangeTrackingList() - { - } - - public ChangeTrackingList(IList innerList) - { - if (innerList != null) - { - _innerList = innerList; - } - } - - public ChangeTrackingList(IReadOnlyList innerList) - { - if (innerList != null) - { - _innerList = innerList.ToList(); - } - } - - public bool IsUndefined => _innerList == null; - - public int Count => IsUndefined ? 0 : EnsureList().Count; - - public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; - - public T this[int index] - { - get - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - return EnsureList()[index]; - } - set - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - EnsureList()[index] = value; - } - } - - public void Reset() - { - _innerList = null; - } - - public IEnumerator GetEnumerator() - { - if (IsUndefined) - { - IEnumerator enumerateEmpty() - { - yield break; - } - return enumerateEmpty(); - } - return EnsureList().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public void Add(T item) - { - EnsureList().Add(item); - } - - public void Clear() - { - EnsureList().Clear(); - } - - public bool Contains(T item) - { - if (IsUndefined) - { - return false; - } - return EnsureList().Contains(item); - } - - public void CopyTo(T[] array, int arrayIndex) - { - if (IsUndefined) - { - return; - } - EnsureList().CopyTo(array, arrayIndex); - } - - public bool Remove(T item) - { - if (IsUndefined) - { - return false; - } - return EnsureList().Remove(item); - } - - public int IndexOf(T item) - { - if (IsUndefined) - { - return -1; - } - return EnsureList().IndexOf(item); - } - - public void Insert(int index, T item) - { - EnsureList().Insert(index, item); - } - - public void RemoveAt(int index) - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - EnsureList().RemoveAt(index); - } - - public IList EnsureList() - { - return _innerList ??= new List(); - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/ModelSerializationExtensions.cs deleted file mode 100644 index 5c826bd5ab24..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/ModelSerializationExtensions.cs +++ /dev/null @@ -1,398 +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.Diagnostics; -using System.Globalization; -using System.Text.Json; -using System.Xml; -using Azure.Core; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - internal static class ModelSerializationExtensions - { - internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - - public static object GetObject(this JsonElement element) - { - switch (element.ValueKind) - { - case JsonValueKind.String: - return element.GetString(); - case JsonValueKind.Number: - if (element.TryGetInt32(out int intValue)) - { - return intValue; - } - if (element.TryGetInt64(out long longValue)) - { - return longValue; - } - return element.GetDouble(); - case JsonValueKind.True: - return true; - case JsonValueKind.False: - return false; - case JsonValueKind.Undefined: - case JsonValueKind.Null: - return null; - case JsonValueKind.Object: - var dictionary = new Dictionary(); - foreach (var jsonProperty in element.EnumerateObject()) - { - dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); - } - return dictionary; - case JsonValueKind.Array: - var list = new List(); - foreach (var item in element.EnumerateArray()) - { - list.Add(item.GetObject()); - } - return list.ToArray(); - default: - throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); - } - } - - public static byte[] GetBytesFromBase64(this JsonElement element, string format) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - - return format switch - { - "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), - "D" => element.GetBytesFromBase64(), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - } - - public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch - { - "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), - _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) - }; - - public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); - - public static char GetChar(this JsonElement element) - { - if (element.ValueKind == JsonValueKind.String) - { - var text = element.GetString(); - if (text == null || text.Length != 1) - { - throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); - } - return text[0]; - } - else - { - throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); - } - } - - [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) - { - throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); - } - - public static string GetRequiredString(this JsonElement element) - { - var value = element.GetString(); - if (value == null) - { - throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); - } - return value; - } - - public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, char value) - { - writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); - } - - public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) - { - if (value == null) - { - writer.WriteNullValue(); - return; - } - switch (format) - { - case "U": - writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); - break; - case "D": - writer.WriteBase64StringValue(value); - break; - default: - throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); - } - } - - public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) - { - if (format != "U") - { - throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); - } - writer.WriteNumberValue(value.ToUnixTimeSeconds()); - } - - public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) - { - switch (value) - { - case null: - writer.WriteNullValue(); - break; - case IJsonModel jsonModel: - jsonModel.Write(writer, options ?? WireOptions); - break; - case IUtf8JsonSerializable serializable: - serializable.Write(writer); - break; - case byte[] bytes: - writer.WriteBase64StringValue(bytes); - break; - case BinaryData bytes0: - writer.WriteBase64StringValue(bytes0); - break; - case JsonElement json: - json.WriteTo(writer); - break; - case int i: - writer.WriteNumberValue(i); - break; - case decimal d: - writer.WriteNumberValue(d); - break; - case double d0: - if (double.IsNaN(d0)) - { - writer.WriteStringValue("NaN"); - } - else - { - writer.WriteNumberValue(d0); - } - break; - case float f: - writer.WriteNumberValue(f); - break; - case long l: - writer.WriteNumberValue(l); - break; - case string s: - writer.WriteStringValue(s); - break; - case bool b: - writer.WriteBooleanValue(b); - break; - case Guid g: - writer.WriteStringValue(g); - break; - case DateTimeOffset dateTimeOffset: - writer.WriteStringValue(dateTimeOffset, "O"); - break; - case DateTime dateTime: - writer.WriteStringValue(dateTime, "O"); - break; - case IEnumerable> enumerable: - writer.WriteStartObject(); - foreach (var pair in enumerable) - { - writer.WritePropertyName(pair.Key); - writer.WriteObjectValue(pair.Value, options); - } - writer.WriteEndObject(); - break; - case IEnumerable objectEnumerable: - writer.WriteStartArray(); - foreach (var item in objectEnumerable) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - break; - case TimeSpan timeSpan: - writer.WriteStringValue(timeSpan, "P"); - break; - default: - throw new NotSupportedException($"Not supported type {value.GetType()}"); - } - } - - public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) - { - writer.WriteObjectValue(value, options); - } - - internal static class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; - int size = checked(numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ConvertToString(object value, string format = null) => value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when format != null => ToString(b0, format), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when format != null => ToString(dateTime, format), - TimeSpan timeSpan when format != null => ToString(timeSpan, format), - TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/Optional.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/Optional.cs deleted file mode 100644 index 0c812e3a4640..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/Optional.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - internal static class Optional - { - public static bool IsCollectionDefined(IEnumerable collection) - { - return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); - } - - public static bool IsCollectionDefined(IDictionary collection) - { - return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); - } - - public static bool IsCollectionDefined(IReadOnlyDictionary collection) - { - return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); - } - - public static bool IsDefined(T? value) - where T : struct - { - return value.HasValue; - } - - public static bool IsDefined(object value) - { - return value != null; - } - - public static bool IsDefined(JsonElement value) - { - return value.ValueKind != JsonValueKind.Undefined; - } - - public static bool IsDefined(string value) - { - return value != null; - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/Utf8JsonRequestContent.cs deleted file mode 100644 index 94cc4cc536d5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/Internal/Utf8JsonRequestContent.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.IO; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - internal class Utf8JsonRequestContent : RequestContent - { - private readonly MemoryStream _stream; - private readonly RequestContent _content; - - public Utf8JsonRequestContent() - { - _stream = new MemoryStream(); - _content = Create(_stream); - JsonWriter = new Utf8JsonWriter(_stream); - } - - public Utf8JsonWriter JsonWriter { get; } - - public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) - { - await JsonWriter.FlushAsync().ConfigureAwait(false); - await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); - } - - public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) - { - JsonWriter.Flush(); - _content.WriteTo(stream, cancellationToken); - } - - public override bool TryComputeLength(out long length) - { - length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; - return true; - } - - public override void Dispose() - { - JsonWriter.Dispose(); - _content.Dispose(); - _stream.Dispose(); - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceConnectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceConnectedEventData.Serialization.cs deleted file mode 100644 index 0cde2d5698c8..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceConnectedEventData.Serialization.cs +++ /dev/null @@ -1,144 +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.Messaging.EventGrid.SystemEvents -{ - public partial class IotHubDeviceConnectedEventData : 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(IotHubDeviceConnectedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - IotHubDeviceConnectedEventData 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(IotHubDeviceConnectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIotHubDeviceConnectedEventData(document.RootElement, options); - } - - internal static IotHubDeviceConnectedEventData DeserializeIotHubDeviceConnectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string deviceId = default; - string moduleId = default; - string hubName = default; - DeviceConnectionStateEventInfo deviceConnectionStateEventInfo = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deviceId"u8)) - { - deviceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("moduleId"u8)) - { - moduleId = property.Value.GetString(); - continue; - } - if (property.NameEquals("hubName"u8)) - { - hubName = property.Value.GetString(); - continue; - } - if (property.NameEquals("deviceConnectionStateEventInfo"u8)) - { - deviceConnectionStateEventInfo = DeviceConnectionStateEventInfo.DeserializeDeviceConnectionStateEventInfo(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new IotHubDeviceConnectedEventData(deviceId, moduleId, hubName, deviceConnectionStateEventInfo, 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(IotHubDeviceConnectedEventData)} does not support writing '{options.Format}' format."); - } - } - - IotHubDeviceConnectedEventData 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 DeserializeIotHubDeviceConnectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(IotHubDeviceConnectedEventData)} 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 IotHubDeviceConnectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeIotHubDeviceConnectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceConnectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceConnectedEventData.cs deleted file mode 100644 index bab1f7fd67b6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceConnectedEventData.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Event data for Microsoft.Devices.DeviceConnected event. - public partial class IotHubDeviceConnectedEventData : DeviceConnectionStateEventProperties - { - /// Initializes a new instance of . - /// Information about the device connection state event. - /// is null. - internal IotHubDeviceConnectedEventData(DeviceConnectionStateEventInfo deviceConnectionStateEventInfo) : base(deviceConnectionStateEventInfo) - { - Argument.AssertNotNull(deviceConnectionStateEventInfo, nameof(deviceConnectionStateEventInfo)); - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device connection state event. - /// Keeps track of any properties unknown to the library. - internal IotHubDeviceConnectedEventData(string deviceId, string moduleId, string hubName, DeviceConnectionStateEventInfo deviceConnectionStateEventInfo, IDictionary serializedAdditionalRawData) : base(deviceId, moduleId, hubName, deviceConnectionStateEventInfo, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal IotHubDeviceConnectedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceCreatedEventData.Serialization.cs deleted file mode 100644 index 119996600f1b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class IotHubDeviceCreatedEventData : 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(IotHubDeviceCreatedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - IotHubDeviceCreatedEventData 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(IotHubDeviceCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIotHubDeviceCreatedEventData(document.RootElement, options); - } - - internal static IotHubDeviceCreatedEventData DeserializeIotHubDeviceCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string deviceId = default; - string hubName = default; - DeviceTwinInfo twin = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deviceId"u8)) - { - deviceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("hubName"u8)) - { - hubName = property.Value.GetString(); - continue; - } - if (property.NameEquals("twin"u8)) - { - twin = DeviceTwinInfo.DeserializeDeviceTwinInfo(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new IotHubDeviceCreatedEventData(deviceId, hubName, twin, 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(IotHubDeviceCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - IotHubDeviceCreatedEventData 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 DeserializeIotHubDeviceCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(IotHubDeviceCreatedEventData)} 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 IotHubDeviceCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeIotHubDeviceCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceCreatedEventData.cs deleted file mode 100644 index 6fff044ca2cd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceCreatedEventData.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Event data for Microsoft.Devices.DeviceCreated event. - public partial class IotHubDeviceCreatedEventData : DeviceLifeCycleEventProperties - { - /// Initializes a new instance of . - /// Information about the device twin, which is the cloud representation of application device metadata. - /// is null. - internal IotHubDeviceCreatedEventData(DeviceTwinInfo twin) : base(twin) - { - Argument.AssertNotNull(twin, nameof(twin)); - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device twin, which is the cloud representation of application device metadata. - /// Keeps track of any properties unknown to the library. - internal IotHubDeviceCreatedEventData(string deviceId, string hubName, DeviceTwinInfo twin, IDictionary serializedAdditionalRawData) : base(deviceId, hubName, twin, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal IotHubDeviceCreatedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDeletedEventData.Serialization.cs deleted file mode 100644 index 14432f7ca5dd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class IotHubDeviceDeletedEventData : 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(IotHubDeviceDeletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - IotHubDeviceDeletedEventData 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(IotHubDeviceDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIotHubDeviceDeletedEventData(document.RootElement, options); - } - - internal static IotHubDeviceDeletedEventData DeserializeIotHubDeviceDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string deviceId = default; - string hubName = default; - DeviceTwinInfo twin = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deviceId"u8)) - { - deviceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("hubName"u8)) - { - hubName = property.Value.GetString(); - continue; - } - if (property.NameEquals("twin"u8)) - { - twin = DeviceTwinInfo.DeserializeDeviceTwinInfo(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new IotHubDeviceDeletedEventData(deviceId, hubName, twin, 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(IotHubDeviceDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - IotHubDeviceDeletedEventData 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 DeserializeIotHubDeviceDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(IotHubDeviceDeletedEventData)} 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 IotHubDeviceDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeIotHubDeviceDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDeletedEventData.cs deleted file mode 100644 index 3bc2d22cdc0e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDeletedEventData.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Event data for Microsoft.Devices.DeviceDeleted event. - public partial class IotHubDeviceDeletedEventData : DeviceLifeCycleEventProperties - { - /// Initializes a new instance of . - /// Information about the device twin, which is the cloud representation of application device metadata. - /// is null. - internal IotHubDeviceDeletedEventData(DeviceTwinInfo twin) : base(twin) - { - Argument.AssertNotNull(twin, nameof(twin)); - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device twin, which is the cloud representation of application device metadata. - /// Keeps track of any properties unknown to the library. - internal IotHubDeviceDeletedEventData(string deviceId, string hubName, DeviceTwinInfo twin, IDictionary serializedAdditionalRawData) : base(deviceId, hubName, twin, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal IotHubDeviceDeletedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDisconnectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDisconnectedEventData.Serialization.cs deleted file mode 100644 index 2c2e9879f65f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDisconnectedEventData.Serialization.cs +++ /dev/null @@ -1,144 +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.Messaging.EventGrid.SystemEvents -{ - public partial class IotHubDeviceDisconnectedEventData : 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(IotHubDeviceDisconnectedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - IotHubDeviceDisconnectedEventData 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(IotHubDeviceDisconnectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIotHubDeviceDisconnectedEventData(document.RootElement, options); - } - - internal static IotHubDeviceDisconnectedEventData DeserializeIotHubDeviceDisconnectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string deviceId = default; - string moduleId = default; - string hubName = default; - DeviceConnectionStateEventInfo deviceConnectionStateEventInfo = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deviceId"u8)) - { - deviceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("moduleId"u8)) - { - moduleId = property.Value.GetString(); - continue; - } - if (property.NameEquals("hubName"u8)) - { - hubName = property.Value.GetString(); - continue; - } - if (property.NameEquals("deviceConnectionStateEventInfo"u8)) - { - deviceConnectionStateEventInfo = DeviceConnectionStateEventInfo.DeserializeDeviceConnectionStateEventInfo(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new IotHubDeviceDisconnectedEventData(deviceId, moduleId, hubName, deviceConnectionStateEventInfo, 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(IotHubDeviceDisconnectedEventData)} does not support writing '{options.Format}' format."); - } - } - - IotHubDeviceDisconnectedEventData 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 DeserializeIotHubDeviceDisconnectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(IotHubDeviceDisconnectedEventData)} 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 IotHubDeviceDisconnectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeIotHubDeviceDisconnectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDisconnectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDisconnectedEventData.cs deleted file mode 100644 index 3d5cbc20be6d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceDisconnectedEventData.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Event data for Microsoft.Devices.DeviceDisconnected event. - public partial class IotHubDeviceDisconnectedEventData : DeviceConnectionStateEventProperties - { - /// Initializes a new instance of . - /// Information about the device connection state event. - /// is null. - internal IotHubDeviceDisconnectedEventData(DeviceConnectionStateEventInfo deviceConnectionStateEventInfo) : base(deviceConnectionStateEventInfo) - { - Argument.AssertNotNull(deviceConnectionStateEventInfo, nameof(deviceConnectionStateEventInfo)); - } - - /// Initializes a new instance of . - /// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ &#35; * ? ! ( ) , = `@` ; $ '. - /// Name of the IoT Hub where the device was created or deleted. - /// Information about the device connection state event. - /// Keeps track of any properties unknown to the library. - internal IotHubDeviceDisconnectedEventData(string deviceId, string moduleId, string hubName, DeviceConnectionStateEventInfo deviceConnectionStateEventInfo, IDictionary serializedAdditionalRawData) : base(deviceId, moduleId, hubName, deviceConnectionStateEventInfo, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal IotHubDeviceDisconnectedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceTelemetryEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceTelemetryEventData.Serialization.cs deleted file mode 100644 index c58260903dc9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceTelemetryEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class IotHubDeviceTelemetryEventData : 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(IotHubDeviceTelemetryEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - IotHubDeviceTelemetryEventData 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(IotHubDeviceTelemetryEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIotHubDeviceTelemetryEventData(document.RootElement, options); - } - - internal static IotHubDeviceTelemetryEventData DeserializeIotHubDeviceTelemetryEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary body = default; - IReadOnlyDictionary properties = default; - IReadOnlyDictionary systemProperties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("body"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - body = dictionary; - continue; - } - if (property.NameEquals("properties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - properties = dictionary; - continue; - } - if (property.NameEquals("systemProperties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - systemProperties = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new IotHubDeviceTelemetryEventData(body, properties, systemProperties, 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(IotHubDeviceTelemetryEventData)} does not support writing '{options.Format}' format."); - } - } - - IotHubDeviceTelemetryEventData 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 DeserializeIotHubDeviceTelemetryEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(IotHubDeviceTelemetryEventData)} 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 IotHubDeviceTelemetryEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeIotHubDeviceTelemetryEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceTelemetryEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceTelemetryEventData.cs deleted file mode 100644 index f269b3b95bfa..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/IotHubDeviceTelemetryEventData.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Event data for Microsoft.Devices.DeviceTelemetry event. - public partial class IotHubDeviceTelemetryEventData : DeviceTelemetryEventProperties - { - /// Initializes a new instance of . - /// The content of the message from the device. - /// Application properties are user-defined strings that can be added to the message. These fields are optional. - /// System properties help identify contents and source of the messages. - /// , or is null. - internal IotHubDeviceTelemetryEventData(IReadOnlyDictionary body, IReadOnlyDictionary properties, IReadOnlyDictionary systemProperties) : base(body, properties, systemProperties) - { - Argument.AssertNotNull(body, nameof(body)); - Argument.AssertNotNull(properties, nameof(properties)); - Argument.AssertNotNull(systemProperties, nameof(systemProperties)); - } - - /// Initializes a new instance of . - /// The content of the message from the device. - /// Application properties are user-defined strings that can be added to the message. These fields are optional. - /// System properties help identify contents and source of the messages. - /// Keeps track of any properties unknown to the library. - internal IotHubDeviceTelemetryEventData(IReadOnlyDictionary body, IReadOnlyDictionary properties, IReadOnlyDictionary systemProperties, IDictionary serializedAdditionalRawData) : base(body, properties, systemProperties, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal IotHubDeviceTelemetryEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultAccessPolicyChangedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultAccessPolicyChangedEventData.Serialization.cs deleted file mode 100644 index 1889a7a88d95..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultAccessPolicyChangedEventData.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class KeyVaultAccessPolicyChangedEventData : 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(KeyVaultAccessPolicyChangedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("Id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(VaultName)) - { - writer.WritePropertyName("VaultName"u8); - writer.WriteStringValue(VaultName); - } - if (Optional.IsDefined(ObjectType)) - { - writer.WritePropertyName("ObjectType"u8); - writer.WriteStringValue(ObjectType); - } - if (Optional.IsDefined(ObjectName)) - { - writer.WritePropertyName("ObjectName"u8); - writer.WriteStringValue(ObjectName); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("Version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(NBF)) - { - writer.WritePropertyName("NBF"u8); - writer.WriteNumberValue(NBF.Value); - } - if (Optional.IsDefined(EXP)) - { - writer.WritePropertyName("EXP"u8); - writer.WriteNumberValue(EXP.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultAccessPolicyChangedEventData 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(KeyVaultAccessPolicyChangedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultAccessPolicyChangedEventData(document.RootElement, options); - } - - internal static KeyVaultAccessPolicyChangedEventData DeserializeKeyVaultAccessPolicyChangedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string vaultName = default; - string objectType = default; - string objectName = default; - string version = default; - float? nbf = default; - float? exp = 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("VaultName"u8)) - { - vaultName = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectType"u8)) - { - objectType = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectName"u8)) - { - objectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("Version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (property.NameEquals("NBF"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nbf = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("EXP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exp = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultAccessPolicyChangedEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - 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(KeyVaultAccessPolicyChangedEventData)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultAccessPolicyChangedEventData 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 DeserializeKeyVaultAccessPolicyChangedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultAccessPolicyChangedEventData)} 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 KeyVaultAccessPolicyChangedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyVaultAccessPolicyChangedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultAccessPolicyChangedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultAccessPolicyChangedEventData.cs deleted file mode 100644 index 98eb5f13d699..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultAccessPolicyChangedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.VaultAccessPolicyChanged event. - public partial class KeyVaultAccessPolicyChangedEventData - { - /// - /// 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 KeyVaultAccessPolicyChangedEventData() - { - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// Keeps track of any properties unknown to the library. - internal KeyVaultAccessPolicyChangedEventData(string id, string vaultName, string objectType, string objectName, string version, float? nbf, float? exp, IDictionary serializedAdditionalRawData) - { - Id = id; - VaultName = vaultName; - ObjectType = objectType; - ObjectName = objectName; - Version = version; - NBF = nbf; - EXP = exp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The id of the object that triggered this event. - public string Id { get; } - /// Key vault name of the object that triggered this event. - public string VaultName { get; } - /// The type of the object that triggered this event. - public string ObjectType { get; } - /// The name of the object that triggered this event. - public string ObjectName { get; } - /// The version of the object that triggered this event. - public string Version { get; } - /// Not before date of the object that triggered this event. - public float? NBF { get; } - /// The expiration date of the object that triggered this event. - public float? EXP { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateExpiredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateExpiredEventData.Serialization.cs deleted file mode 100644 index 97133d32eff4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateExpiredEventData.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class KeyVaultCertificateExpiredEventData : 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(KeyVaultCertificateExpiredEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("Id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(VaultName)) - { - writer.WritePropertyName("VaultName"u8); - writer.WriteStringValue(VaultName); - } - if (Optional.IsDefined(ObjectType)) - { - writer.WritePropertyName("ObjectType"u8); - writer.WriteStringValue(ObjectType); - } - if (Optional.IsDefined(ObjectName)) - { - writer.WritePropertyName("ObjectName"u8); - writer.WriteStringValue(ObjectName); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("Version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(NBF)) - { - writer.WritePropertyName("NBF"u8); - writer.WriteNumberValue(NBF.Value); - } - if (Optional.IsDefined(EXP)) - { - writer.WritePropertyName("EXP"u8); - writer.WriteNumberValue(EXP.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultCertificateExpiredEventData 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(KeyVaultCertificateExpiredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultCertificateExpiredEventData(document.RootElement, options); - } - - internal static KeyVaultCertificateExpiredEventData DeserializeKeyVaultCertificateExpiredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string vaultName = default; - string objectType = default; - string objectName = default; - string version = default; - float? nbf = default; - float? exp = 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("VaultName"u8)) - { - vaultName = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectType"u8)) - { - objectType = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectName"u8)) - { - objectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("Version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (property.NameEquals("NBF"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nbf = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("EXP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exp = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultCertificateExpiredEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - 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(KeyVaultCertificateExpiredEventData)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultCertificateExpiredEventData 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 DeserializeKeyVaultCertificateExpiredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultCertificateExpiredEventData)} 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 KeyVaultCertificateExpiredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyVaultCertificateExpiredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateExpiredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateExpiredEventData.cs deleted file mode 100644 index c210c2b0a99a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateExpiredEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.CertificateExpired event. - public partial class KeyVaultCertificateExpiredEventData - { - /// - /// 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 KeyVaultCertificateExpiredEventData() - { - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// Keeps track of any properties unknown to the library. - internal KeyVaultCertificateExpiredEventData(string id, string vaultName, string objectType, string objectName, string version, float? nbf, float? exp, IDictionary serializedAdditionalRawData) - { - Id = id; - VaultName = vaultName; - ObjectType = objectType; - ObjectName = objectName; - Version = version; - NBF = nbf; - EXP = exp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The id of the object that triggered this event. - public string Id { get; } - /// Key vault name of the object that triggered this event. - public string VaultName { get; } - /// The type of the object that triggered this event. - public string ObjectType { get; } - /// The name of the object that triggered this event. - public string ObjectName { get; } - /// The version of the object that triggered this event. - public string Version { get; } - /// Not before date of the object that triggered this event. - public float? NBF { get; } - /// The expiration date of the object that triggered this event. - public float? EXP { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNearExpiryEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNearExpiryEventData.Serialization.cs deleted file mode 100644 index 93bdba22a7c9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNearExpiryEventData.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class KeyVaultCertificateNearExpiryEventData : 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(KeyVaultCertificateNearExpiryEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("Id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(VaultName)) - { - writer.WritePropertyName("VaultName"u8); - writer.WriteStringValue(VaultName); - } - if (Optional.IsDefined(ObjectType)) - { - writer.WritePropertyName("ObjectType"u8); - writer.WriteStringValue(ObjectType); - } - if (Optional.IsDefined(ObjectName)) - { - writer.WritePropertyName("ObjectName"u8); - writer.WriteStringValue(ObjectName); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("Version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(NBF)) - { - writer.WritePropertyName("NBF"u8); - writer.WriteNumberValue(NBF.Value); - } - if (Optional.IsDefined(EXP)) - { - writer.WritePropertyName("EXP"u8); - writer.WriteNumberValue(EXP.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultCertificateNearExpiryEventData 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(KeyVaultCertificateNearExpiryEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultCertificateNearExpiryEventData(document.RootElement, options); - } - - internal static KeyVaultCertificateNearExpiryEventData DeserializeKeyVaultCertificateNearExpiryEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string vaultName = default; - string objectType = default; - string objectName = default; - string version = default; - float? nbf = default; - float? exp = 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("VaultName"u8)) - { - vaultName = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectType"u8)) - { - objectType = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectName"u8)) - { - objectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("Version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (property.NameEquals("NBF"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nbf = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("EXP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exp = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultCertificateNearExpiryEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - 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(KeyVaultCertificateNearExpiryEventData)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultCertificateNearExpiryEventData 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 DeserializeKeyVaultCertificateNearExpiryEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultCertificateNearExpiryEventData)} 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 KeyVaultCertificateNearExpiryEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyVaultCertificateNearExpiryEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNearExpiryEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNearExpiryEventData.cs deleted file mode 100644 index 149ea3648db0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNearExpiryEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.CertificateNearExpiry event. - public partial class KeyVaultCertificateNearExpiryEventData - { - /// - /// 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 KeyVaultCertificateNearExpiryEventData() - { - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// Keeps track of any properties unknown to the library. - internal KeyVaultCertificateNearExpiryEventData(string id, string vaultName, string objectType, string objectName, string version, float? nbf, float? exp, IDictionary serializedAdditionalRawData) - { - Id = id; - VaultName = vaultName; - ObjectType = objectType; - ObjectName = objectName; - Version = version; - NBF = nbf; - EXP = exp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The id of the object that triggered this event. - public string Id { get; } - /// Key vault name of the object that triggered this event. - public string VaultName { get; } - /// The type of the object that triggered this event. - public string ObjectType { get; } - /// The name of the object that triggered this event. - public string ObjectName { get; } - /// The version of the object that triggered this event. - public string Version { get; } - /// Not before date of the object that triggered this event. - public float? NBF { get; } - /// The expiration date of the object that triggered this event. - public float? EXP { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNewVersionCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNewVersionCreatedEventData.Serialization.cs deleted file mode 100644 index 20a19baa3ea8..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNewVersionCreatedEventData.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class KeyVaultCertificateNewVersionCreatedEventData : 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(KeyVaultCertificateNewVersionCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("Id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(VaultName)) - { - writer.WritePropertyName("VaultName"u8); - writer.WriteStringValue(VaultName); - } - if (Optional.IsDefined(ObjectType)) - { - writer.WritePropertyName("ObjectType"u8); - writer.WriteStringValue(ObjectType); - } - if (Optional.IsDefined(ObjectName)) - { - writer.WritePropertyName("ObjectName"u8); - writer.WriteStringValue(ObjectName); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("Version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(NBF)) - { - writer.WritePropertyName("NBF"u8); - writer.WriteNumberValue(NBF.Value); - } - if (Optional.IsDefined(EXP)) - { - writer.WritePropertyName("EXP"u8); - writer.WriteNumberValue(EXP.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultCertificateNewVersionCreatedEventData 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(KeyVaultCertificateNewVersionCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultCertificateNewVersionCreatedEventData(document.RootElement, options); - } - - internal static KeyVaultCertificateNewVersionCreatedEventData DeserializeKeyVaultCertificateNewVersionCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string vaultName = default; - string objectType = default; - string objectName = default; - string version = default; - float? nbf = default; - float? exp = 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("VaultName"u8)) - { - vaultName = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectType"u8)) - { - objectType = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectName"u8)) - { - objectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("Version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (property.NameEquals("NBF"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nbf = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("EXP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exp = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultCertificateNewVersionCreatedEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - 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(KeyVaultCertificateNewVersionCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultCertificateNewVersionCreatedEventData 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 DeserializeKeyVaultCertificateNewVersionCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultCertificateNewVersionCreatedEventData)} 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 KeyVaultCertificateNewVersionCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyVaultCertificateNewVersionCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNewVersionCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNewVersionCreatedEventData.cs deleted file mode 100644 index 317264ad4e2e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultCertificateNewVersionCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.CertificateNewVersionCreated event. - public partial class KeyVaultCertificateNewVersionCreatedEventData - { - /// - /// 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 KeyVaultCertificateNewVersionCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// Keeps track of any properties unknown to the library. - internal KeyVaultCertificateNewVersionCreatedEventData(string id, string vaultName, string objectType, string objectName, string version, float? nbf, float? exp, IDictionary serializedAdditionalRawData) - { - Id = id; - VaultName = vaultName; - ObjectType = objectType; - ObjectName = objectName; - Version = version; - NBF = nbf; - EXP = exp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The id of the object that triggered this event. - public string Id { get; } - /// Key vault name of the object that triggered this event. - public string VaultName { get; } - /// The type of the object that triggered this event. - public string ObjectType { get; } - /// The name of the object that triggered this event. - public string ObjectName { get; } - /// The version of the object that triggered this event. - public string Version { get; } - /// Not before date of the object that triggered this event. - public float? NBF { get; } - /// The expiration date of the object that triggered this event. - public float? EXP { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyExpiredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyExpiredEventData.Serialization.cs deleted file mode 100644 index f3399ac7eb99..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyExpiredEventData.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class KeyVaultKeyExpiredEventData : 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(KeyVaultKeyExpiredEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("Id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(VaultName)) - { - writer.WritePropertyName("VaultName"u8); - writer.WriteStringValue(VaultName); - } - if (Optional.IsDefined(ObjectType)) - { - writer.WritePropertyName("ObjectType"u8); - writer.WriteStringValue(ObjectType); - } - if (Optional.IsDefined(ObjectName)) - { - writer.WritePropertyName("ObjectName"u8); - writer.WriteStringValue(ObjectName); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("Version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(NBF)) - { - writer.WritePropertyName("NBF"u8); - writer.WriteNumberValue(NBF.Value); - } - if (Optional.IsDefined(EXP)) - { - writer.WritePropertyName("EXP"u8); - writer.WriteNumberValue(EXP.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultKeyExpiredEventData 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(KeyVaultKeyExpiredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultKeyExpiredEventData(document.RootElement, options); - } - - internal static KeyVaultKeyExpiredEventData DeserializeKeyVaultKeyExpiredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string vaultName = default; - string objectType = default; - string objectName = default; - string version = default; - float? nbf = default; - float? exp = 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("VaultName"u8)) - { - vaultName = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectType"u8)) - { - objectType = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectName"u8)) - { - objectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("Version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (property.NameEquals("NBF"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nbf = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("EXP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exp = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultKeyExpiredEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - 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(KeyVaultKeyExpiredEventData)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultKeyExpiredEventData 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 DeserializeKeyVaultKeyExpiredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultKeyExpiredEventData)} 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 KeyVaultKeyExpiredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyVaultKeyExpiredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyExpiredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyExpiredEventData.cs deleted file mode 100644 index 673c5bcc5b78..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyExpiredEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.KeyExpired event. - public partial class KeyVaultKeyExpiredEventData - { - /// - /// 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 KeyVaultKeyExpiredEventData() - { - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// Keeps track of any properties unknown to the library. - internal KeyVaultKeyExpiredEventData(string id, string vaultName, string objectType, string objectName, string version, float? nbf, float? exp, IDictionary serializedAdditionalRawData) - { - Id = id; - VaultName = vaultName; - ObjectType = objectType; - ObjectName = objectName; - Version = version; - NBF = nbf; - EXP = exp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The id of the object that triggered this event. - public string Id { get; } - /// Key vault name of the object that triggered this event. - public string VaultName { get; } - /// The type of the object that triggered this event. - public string ObjectType { get; } - /// The name of the object that triggered this event. - public string ObjectName { get; } - /// The version of the object that triggered this event. - public string Version { get; } - /// Not before date of the object that triggered this event. - public float? NBF { get; } - /// The expiration date of the object that triggered this event. - public float? EXP { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNearExpiryEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNearExpiryEventData.Serialization.cs deleted file mode 100644 index 57bfc5f4618c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNearExpiryEventData.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class KeyVaultKeyNearExpiryEventData : 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(KeyVaultKeyNearExpiryEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("Id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(VaultName)) - { - writer.WritePropertyName("VaultName"u8); - writer.WriteStringValue(VaultName); - } - if (Optional.IsDefined(ObjectType)) - { - writer.WritePropertyName("ObjectType"u8); - writer.WriteStringValue(ObjectType); - } - if (Optional.IsDefined(ObjectName)) - { - writer.WritePropertyName("ObjectName"u8); - writer.WriteStringValue(ObjectName); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("Version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(NBF)) - { - writer.WritePropertyName("NBF"u8); - writer.WriteNumberValue(NBF.Value); - } - if (Optional.IsDefined(EXP)) - { - writer.WritePropertyName("EXP"u8); - writer.WriteNumberValue(EXP.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultKeyNearExpiryEventData 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(KeyVaultKeyNearExpiryEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultKeyNearExpiryEventData(document.RootElement, options); - } - - internal static KeyVaultKeyNearExpiryEventData DeserializeKeyVaultKeyNearExpiryEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string vaultName = default; - string objectType = default; - string objectName = default; - string version = default; - float? nbf = default; - float? exp = 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("VaultName"u8)) - { - vaultName = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectType"u8)) - { - objectType = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectName"u8)) - { - objectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("Version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (property.NameEquals("NBF"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nbf = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("EXP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exp = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultKeyNearExpiryEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - 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(KeyVaultKeyNearExpiryEventData)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultKeyNearExpiryEventData 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 DeserializeKeyVaultKeyNearExpiryEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultKeyNearExpiryEventData)} 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 KeyVaultKeyNearExpiryEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyVaultKeyNearExpiryEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNearExpiryEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNearExpiryEventData.cs deleted file mode 100644 index 97ceefad9691..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNearExpiryEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.KeyNearExpiry event. - public partial class KeyVaultKeyNearExpiryEventData - { - /// - /// 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 KeyVaultKeyNearExpiryEventData() - { - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// Keeps track of any properties unknown to the library. - internal KeyVaultKeyNearExpiryEventData(string id, string vaultName, string objectType, string objectName, string version, float? nbf, float? exp, IDictionary serializedAdditionalRawData) - { - Id = id; - VaultName = vaultName; - ObjectType = objectType; - ObjectName = objectName; - Version = version; - NBF = nbf; - EXP = exp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The id of the object that triggered this event. - public string Id { get; } - /// Key vault name of the object that triggered this event. - public string VaultName { get; } - /// The type of the object that triggered this event. - public string ObjectType { get; } - /// The name of the object that triggered this event. - public string ObjectName { get; } - /// The version of the object that triggered this event. - public string Version { get; } - /// Not before date of the object that triggered this event. - public float? NBF { get; } - /// The expiration date of the object that triggered this event. - public float? EXP { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNewVersionCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNewVersionCreatedEventData.Serialization.cs deleted file mode 100644 index ff158b77a99d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNewVersionCreatedEventData.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class KeyVaultKeyNewVersionCreatedEventData : 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(KeyVaultKeyNewVersionCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("Id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(VaultName)) - { - writer.WritePropertyName("VaultName"u8); - writer.WriteStringValue(VaultName); - } - if (Optional.IsDefined(ObjectType)) - { - writer.WritePropertyName("ObjectType"u8); - writer.WriteStringValue(ObjectType); - } - if (Optional.IsDefined(ObjectName)) - { - writer.WritePropertyName("ObjectName"u8); - writer.WriteStringValue(ObjectName); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("Version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(NBF)) - { - writer.WritePropertyName("NBF"u8); - writer.WriteNumberValue(NBF.Value); - } - if (Optional.IsDefined(EXP)) - { - writer.WritePropertyName("EXP"u8); - writer.WriteNumberValue(EXP.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultKeyNewVersionCreatedEventData 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(KeyVaultKeyNewVersionCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultKeyNewVersionCreatedEventData(document.RootElement, options); - } - - internal static KeyVaultKeyNewVersionCreatedEventData DeserializeKeyVaultKeyNewVersionCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string vaultName = default; - string objectType = default; - string objectName = default; - string version = default; - float? nbf = default; - float? exp = 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("VaultName"u8)) - { - vaultName = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectType"u8)) - { - objectType = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectName"u8)) - { - objectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("Version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (property.NameEquals("NBF"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nbf = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("EXP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exp = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultKeyNewVersionCreatedEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - 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(KeyVaultKeyNewVersionCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultKeyNewVersionCreatedEventData 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 DeserializeKeyVaultKeyNewVersionCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultKeyNewVersionCreatedEventData)} 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 KeyVaultKeyNewVersionCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyVaultKeyNewVersionCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNewVersionCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNewVersionCreatedEventData.cs deleted file mode 100644 index 1f656d1e5b92..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultKeyNewVersionCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.KeyNewVersionCreated event. - public partial class KeyVaultKeyNewVersionCreatedEventData - { - /// - /// 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 KeyVaultKeyNewVersionCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// Keeps track of any properties unknown to the library. - internal KeyVaultKeyNewVersionCreatedEventData(string id, string vaultName, string objectType, string objectName, string version, float? nbf, float? exp, IDictionary serializedAdditionalRawData) - { - Id = id; - VaultName = vaultName; - ObjectType = objectType; - ObjectName = objectName; - Version = version; - NBF = nbf; - EXP = exp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The id of the object that triggered this event. - public string Id { get; } - /// Key vault name of the object that triggered this event. - public string VaultName { get; } - /// The type of the object that triggered this event. - public string ObjectType { get; } - /// The name of the object that triggered this event. - public string ObjectName { get; } - /// The version of the object that triggered this event. - public string Version { get; } - /// Not before date of the object that triggered this event. - public float? NBF { get; } - /// The expiration date of the object that triggered this event. - public float? EXP { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretExpiredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretExpiredEventData.Serialization.cs deleted file mode 100644 index efa809daa4ef..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretExpiredEventData.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class KeyVaultSecretExpiredEventData : 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(KeyVaultSecretExpiredEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("Id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(VaultName)) - { - writer.WritePropertyName("VaultName"u8); - writer.WriteStringValue(VaultName); - } - if (Optional.IsDefined(ObjectType)) - { - writer.WritePropertyName("ObjectType"u8); - writer.WriteStringValue(ObjectType); - } - if (Optional.IsDefined(ObjectName)) - { - writer.WritePropertyName("ObjectName"u8); - writer.WriteStringValue(ObjectName); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("Version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(NBF)) - { - writer.WritePropertyName("NBF"u8); - writer.WriteNumberValue(NBF.Value); - } - if (Optional.IsDefined(EXP)) - { - writer.WritePropertyName("EXP"u8); - writer.WriteNumberValue(EXP.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultSecretExpiredEventData 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(KeyVaultSecretExpiredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultSecretExpiredEventData(document.RootElement, options); - } - - internal static KeyVaultSecretExpiredEventData DeserializeKeyVaultSecretExpiredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string vaultName = default; - string objectType = default; - string objectName = default; - string version = default; - float? nbf = default; - float? exp = 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("VaultName"u8)) - { - vaultName = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectType"u8)) - { - objectType = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectName"u8)) - { - objectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("Version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (property.NameEquals("NBF"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nbf = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("EXP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exp = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultSecretExpiredEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - 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(KeyVaultSecretExpiredEventData)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultSecretExpiredEventData 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 DeserializeKeyVaultSecretExpiredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultSecretExpiredEventData)} 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 KeyVaultSecretExpiredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyVaultSecretExpiredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretExpiredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretExpiredEventData.cs deleted file mode 100644 index 8746341b9068..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretExpiredEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.SecretExpired event. - public partial class KeyVaultSecretExpiredEventData - { - /// - /// 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 KeyVaultSecretExpiredEventData() - { - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// Keeps track of any properties unknown to the library. - internal KeyVaultSecretExpiredEventData(string id, string vaultName, string objectType, string objectName, string version, float? nbf, float? exp, IDictionary serializedAdditionalRawData) - { - Id = id; - VaultName = vaultName; - ObjectType = objectType; - ObjectName = objectName; - Version = version; - NBF = nbf; - EXP = exp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The id of the object that triggered this event. - public string Id { get; } - /// Key vault name of the object that triggered this event. - public string VaultName { get; } - /// The type of the object that triggered this event. - public string ObjectType { get; } - /// The name of the object that triggered this event. - public string ObjectName { get; } - /// The version of the object that triggered this event. - public string Version { get; } - /// Not before date of the object that triggered this event. - public float? NBF { get; } - /// The expiration date of the object that triggered this event. - public float? EXP { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNearExpiryEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNearExpiryEventData.Serialization.cs deleted file mode 100644 index 563a0c32ffe0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNearExpiryEventData.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class KeyVaultSecretNearExpiryEventData : 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(KeyVaultSecretNearExpiryEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("Id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(VaultName)) - { - writer.WritePropertyName("VaultName"u8); - writer.WriteStringValue(VaultName); - } - if (Optional.IsDefined(ObjectType)) - { - writer.WritePropertyName("ObjectType"u8); - writer.WriteStringValue(ObjectType); - } - if (Optional.IsDefined(ObjectName)) - { - writer.WritePropertyName("ObjectName"u8); - writer.WriteStringValue(ObjectName); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("Version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(NBF)) - { - writer.WritePropertyName("NBF"u8); - writer.WriteNumberValue(NBF.Value); - } - if (Optional.IsDefined(EXP)) - { - writer.WritePropertyName("EXP"u8); - writer.WriteNumberValue(EXP.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultSecretNearExpiryEventData 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(KeyVaultSecretNearExpiryEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultSecretNearExpiryEventData(document.RootElement, options); - } - - internal static KeyVaultSecretNearExpiryEventData DeserializeKeyVaultSecretNearExpiryEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string vaultName = default; - string objectType = default; - string objectName = default; - string version = default; - float? nbf = default; - float? exp = 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("VaultName"u8)) - { - vaultName = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectType"u8)) - { - objectType = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectName"u8)) - { - objectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("Version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (property.NameEquals("NBF"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nbf = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("EXP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exp = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultSecretNearExpiryEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - 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(KeyVaultSecretNearExpiryEventData)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultSecretNearExpiryEventData 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 DeserializeKeyVaultSecretNearExpiryEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultSecretNearExpiryEventData)} 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 KeyVaultSecretNearExpiryEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyVaultSecretNearExpiryEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNearExpiryEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNearExpiryEventData.cs deleted file mode 100644 index a80db5eef3f0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNearExpiryEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.SecretNearExpiry event. - public partial class KeyVaultSecretNearExpiryEventData - { - /// - /// 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 KeyVaultSecretNearExpiryEventData() - { - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// Keeps track of any properties unknown to the library. - internal KeyVaultSecretNearExpiryEventData(string id, string vaultName, string objectType, string objectName, string version, float? nbf, float? exp, IDictionary serializedAdditionalRawData) - { - Id = id; - VaultName = vaultName; - ObjectType = objectType; - ObjectName = objectName; - Version = version; - NBF = nbf; - EXP = exp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The id of the object that triggered this event. - public string Id { get; } - /// Key vault name of the object that triggered this event. - public string VaultName { get; } - /// The type of the object that triggered this event. - public string ObjectType { get; } - /// The name of the object that triggered this event. - public string ObjectName { get; } - /// The version of the object that triggered this event. - public string Version { get; } - /// Not before date of the object that triggered this event. - public float? NBF { get; } - /// The expiration date of the object that triggered this event. - public float? EXP { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNewVersionCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNewVersionCreatedEventData.Serialization.cs deleted file mode 100644 index 867bf49c9495..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNewVersionCreatedEventData.Serialization.cs +++ /dev/null @@ -1,227 +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.Messaging.EventGrid.SystemEvents -{ - public partial class KeyVaultSecretNewVersionCreatedEventData : 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(KeyVaultSecretNewVersionCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("Id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(VaultName)) - { - writer.WritePropertyName("VaultName"u8); - writer.WriteStringValue(VaultName); - } - if (Optional.IsDefined(ObjectType)) - { - writer.WritePropertyName("ObjectType"u8); - writer.WriteStringValue(ObjectType); - } - if (Optional.IsDefined(ObjectName)) - { - writer.WritePropertyName("ObjectName"u8); - writer.WriteStringValue(ObjectName); - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("Version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(NBF)) - { - writer.WritePropertyName("NBF"u8); - writer.WriteNumberValue(NBF.Value); - } - if (Optional.IsDefined(EXP)) - { - writer.WritePropertyName("EXP"u8); - writer.WriteNumberValue(EXP.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultSecretNewVersionCreatedEventData 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(KeyVaultSecretNewVersionCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultSecretNewVersionCreatedEventData(document.RootElement, options); - } - - internal static KeyVaultSecretNewVersionCreatedEventData DeserializeKeyVaultSecretNewVersionCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string vaultName = default; - string objectType = default; - string objectName = default; - string version = default; - float? nbf = default; - float? exp = 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("VaultName"u8)) - { - vaultName = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectType"u8)) - { - objectType = property.Value.GetString(); - continue; - } - if (property.NameEquals("ObjectName"u8)) - { - objectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("Version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (property.NameEquals("NBF"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nbf = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("EXP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exp = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultSecretNewVersionCreatedEventData( - id, - vaultName, - objectType, - objectName, - version, - nbf, - exp, - 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(KeyVaultSecretNewVersionCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultSecretNewVersionCreatedEventData 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 DeserializeKeyVaultSecretNewVersionCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultSecretNewVersionCreatedEventData)} 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 KeyVaultSecretNewVersionCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyVaultSecretNewVersionCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNewVersionCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNewVersionCreatedEventData.cs deleted file mode 100644 index b3c890bb7462..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/KeyVaultSecretNewVersionCreatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.SecretNewVersionCreated event. - public partial class KeyVaultSecretNewVersionCreatedEventData - { - /// - /// 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 KeyVaultSecretNewVersionCreatedEventData() - { - } - - /// Initializes a new instance of . - /// The id of the object that triggered this event. - /// Key vault name of the object that triggered this event. - /// The type of the object that triggered this event. - /// The name of the object that triggered this event. - /// The version of the object that triggered this event. - /// Not before date of the object that triggered this event. - /// The expiration date of the object that triggered this event. - /// Keeps track of any properties unknown to the library. - internal KeyVaultSecretNewVersionCreatedEventData(string id, string vaultName, string objectType, string objectName, string version, float? nbf, float? exp, IDictionary serializedAdditionalRawData) - { - Id = id; - VaultName = vaultName; - ObjectType = objectType; - ObjectName = objectName; - Version = version; - NBF = nbf; - EXP = exp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The id of the object that triggered this event. - public string Id { get; } - /// Key vault name of the object that triggered this event. - public string VaultName { get; } - /// The type of the object that triggered this event. - public string ObjectType { get; } - /// The name of the object that triggered this event. - public string ObjectName { get; } - /// The version of the object that triggered this event. - public string Version { get; } - /// Not before date of the object that triggered this event. - public float? NBF { get; } - /// The expiration date of the object that triggered this event. - public float? EXP { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesDatasetDriftDetectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesDatasetDriftDetectedEventData.Serialization.cs deleted file mode 100644 index 09b738ad26da..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesDatasetDriftDetectedEventData.Serialization.cs +++ /dev/null @@ -1,229 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MachineLearningServicesDatasetDriftDetectedEventData : 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(MachineLearningServicesDatasetDriftDetectedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(DataDriftId)) - { - writer.WritePropertyName("dataDriftId"u8); - writer.WriteStringValue(DataDriftId); - } - if (Optional.IsDefined(DataDriftName)) - { - writer.WritePropertyName("dataDriftName"u8); - writer.WriteStringValue(DataDriftName); - } - if (Optional.IsDefined(RunId)) - { - writer.WritePropertyName("runId"u8); - writer.WriteStringValue(RunId); - } - if (Optional.IsDefined(BaseDatasetId)) - { - writer.WritePropertyName("baseDatasetId"u8); - writer.WriteStringValue(BaseDatasetId); - } - if (Optional.IsDefined(TargetDatasetId)) - { - writer.WritePropertyName("targetDatasetId"u8); - writer.WriteStringValue(TargetDatasetId); - } - if (Optional.IsDefined(DriftCoefficient)) - { - writer.WritePropertyName("driftCoefficient"u8); - writer.WriteNumberValue(DriftCoefficient.Value); - } - writer.WritePropertyName("startTime"u8); - writer.WriteStringValue(StartTime, "O"); - writer.WritePropertyName("endTime"u8); - writer.WriteStringValue(EndTime, "O"); - 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 - } - } - } - - MachineLearningServicesDatasetDriftDetectedEventData 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(MachineLearningServicesDatasetDriftDetectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMachineLearningServicesDatasetDriftDetectedEventData(document.RootElement, options); - } - - internal static MachineLearningServicesDatasetDriftDetectedEventData DeserializeMachineLearningServicesDatasetDriftDetectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string dataDriftId = default; - string dataDriftName = default; - string runId = default; - string baseDatasetId = default; - string targetDatasetId = default; - double? driftCoefficient = default; - DateTimeOffset startTime = default; - DateTimeOffset endTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("dataDriftId"u8)) - { - dataDriftId = property.Value.GetString(); - continue; - } - if (property.NameEquals("dataDriftName"u8)) - { - dataDriftName = property.Value.GetString(); - continue; - } - if (property.NameEquals("runId"u8)) - { - runId = property.Value.GetString(); - continue; - } - if (property.NameEquals("baseDatasetId"u8)) - { - baseDatasetId = property.Value.GetString(); - continue; - } - if (property.NameEquals("targetDatasetId"u8)) - { - targetDatasetId = property.Value.GetString(); - continue; - } - if (property.NameEquals("driftCoefficient"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - driftCoefficient = property.Value.GetDouble(); - continue; - } - if (property.NameEquals("startTime"u8)) - { - startTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("endTime"u8)) - { - endTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MachineLearningServicesDatasetDriftDetectedEventData( - dataDriftId, - dataDriftName, - runId, - baseDatasetId, - targetDatasetId, - driftCoefficient, - startTime, - endTime, - 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(MachineLearningServicesDatasetDriftDetectedEventData)} does not support writing '{options.Format}' format."); - } - } - - MachineLearningServicesDatasetDriftDetectedEventData 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 DeserializeMachineLearningServicesDatasetDriftDetectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MachineLearningServicesDatasetDriftDetectedEventData)} 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 MachineLearningServicesDatasetDriftDetectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMachineLearningServicesDatasetDriftDetectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesDatasetDriftDetectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesDatasetDriftDetectedEventData.cs deleted file mode 100644 index 9027d0c37322..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesDatasetDriftDetectedEventData.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.MachineLearningServices.DatasetDriftDetected event. - public partial class MachineLearningServicesDatasetDriftDetectedEventData - { - /// - /// 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 start time of the target dataset time series that resulted in drift detection. - /// The end time of the target dataset time series that resulted in drift detection. - internal MachineLearningServicesDatasetDriftDetectedEventData(DateTimeOffset startTime, DateTimeOffset endTime) - { - StartTime = startTime; - EndTime = endTime; - } - - /// Initializes a new instance of . - /// The ID of the data drift monitor that triggered the event. - /// The name of the data drift monitor that triggered the event. - /// The ID of the Run that detected data drift. - /// The ID of the base Dataset used to detect drift. - /// The ID of the target Dataset used to detect drift. - /// The coefficient result that triggered the event. - /// The start time of the target dataset time series that resulted in drift detection. - /// The end time of the target dataset time series that resulted in drift detection. - /// Keeps track of any properties unknown to the library. - internal MachineLearningServicesDatasetDriftDetectedEventData(string dataDriftId, string dataDriftName, string runId, string baseDatasetId, string targetDatasetId, double? driftCoefficient, DateTimeOffset startTime, DateTimeOffset endTime, IDictionary serializedAdditionalRawData) - { - DataDriftId = dataDriftId; - DataDriftName = dataDriftName; - RunId = runId; - BaseDatasetId = baseDatasetId; - TargetDatasetId = targetDatasetId; - DriftCoefficient = driftCoefficient; - StartTime = startTime; - EndTime = endTime; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MachineLearningServicesDatasetDriftDetectedEventData() - { - } - - /// The ID of the data drift monitor that triggered the event. - public string DataDriftId { get; } - /// The name of the data drift monitor that triggered the event. - public string DataDriftName { get; } - /// The ID of the Run that detected data drift. - public string RunId { get; } - /// The ID of the base Dataset used to detect drift. - public string BaseDatasetId { get; } - /// The ID of the target Dataset used to detect drift. - public string TargetDatasetId { get; } - /// The coefficient result that triggered the event. - public double? DriftCoefficient { get; } - /// The start time of the target dataset time series that resulted in drift detection. - public DateTimeOffset StartTime { get; } - /// The end time of the target dataset time series that resulted in drift detection. - public DateTimeOffset EndTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelDeployedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelDeployedEventData.Serialization.cs deleted file mode 100644 index 508c46bcc98e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelDeployedEventData.Serialization.cs +++ /dev/null @@ -1,249 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MachineLearningServicesModelDeployedEventData : 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(MachineLearningServicesModelDeployedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ServiceName)) - { - writer.WritePropertyName("serviceName"u8); - writer.WriteStringValue(ServiceName); - } - if (Optional.IsDefined(ServiceComputeType)) - { - writer.WritePropertyName("serviceComputeType"u8); - writer.WriteStringValue(ServiceComputeType); - } - if (Optional.IsDefined(ModelIds)) - { - writer.WritePropertyName("modelIds"u8); - writer.WriteStringValue(ModelIds); - } - writer.WritePropertyName("serviceTags"u8); - writer.WriteStartObject(); - foreach (var item in ServiceTags) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - writer.WritePropertyName("serviceProperties"u8); - writer.WriteStartObject(); - foreach (var item in ServiceProperties) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - MachineLearningServicesModelDeployedEventData 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(MachineLearningServicesModelDeployedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMachineLearningServicesModelDeployedEventData(document.RootElement, options); - } - - internal static MachineLearningServicesModelDeployedEventData DeserializeMachineLearningServicesModelDeployedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string serviceName = default; - string serviceComputeType = default; - string modelIds = default; - IReadOnlyDictionary serviceTags = default; - IReadOnlyDictionary serviceProperties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("serviceName"u8)) - { - serviceName = property.Value.GetString(); - continue; - } - if (property.NameEquals("serviceComputeType"u8)) - { - serviceComputeType = property.Value.GetString(); - continue; - } - if (property.NameEquals("modelIds"u8)) - { - modelIds = property.Value.GetString(); - continue; - } - if (property.NameEquals("serviceTags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - serviceTags = dictionary; - continue; - } - if (property.NameEquals("serviceProperties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - serviceProperties = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MachineLearningServicesModelDeployedEventData( - serviceName, - serviceComputeType, - modelIds, - serviceTags, - serviceProperties, - 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(MachineLearningServicesModelDeployedEventData)} does not support writing '{options.Format}' format."); - } - } - - MachineLearningServicesModelDeployedEventData 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 DeserializeMachineLearningServicesModelDeployedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MachineLearningServicesModelDeployedEventData)} 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 MachineLearningServicesModelDeployedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMachineLearningServicesModelDeployedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelDeployedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelDeployedEventData.cs deleted file mode 100644 index 8d759992c57d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelDeployedEventData.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.MachineLearningServices.ModelDeployed event. - public partial class MachineLearningServicesModelDeployedEventData - { - /// - /// 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 tags of the deployed service. - /// The properties of the deployed service. - /// or is null. - internal MachineLearningServicesModelDeployedEventData(IReadOnlyDictionary serviceTags, IReadOnlyDictionary serviceProperties) - { - Argument.AssertNotNull(serviceTags, nameof(serviceTags)); - Argument.AssertNotNull(serviceProperties, nameof(serviceProperties)); - - ServiceTags = serviceTags; - ServiceProperties = serviceProperties; - } - - /// Initializes a new instance of . - /// The name of the deployed service. - /// The compute type (e.g. ACI, AKS) of the deployed service. - /// A common separated list of model IDs. The IDs of the models deployed in the service. - /// The tags of the deployed service. - /// The properties of the deployed service. - /// Keeps track of any properties unknown to the library. - internal MachineLearningServicesModelDeployedEventData(string serviceName, string serviceComputeType, string modelIds, IReadOnlyDictionary serviceTags, IReadOnlyDictionary serviceProperties, IDictionary serializedAdditionalRawData) - { - ServiceName = serviceName; - ServiceComputeType = serviceComputeType; - ModelIds = modelIds; - ServiceTags = serviceTags; - ServiceProperties = serviceProperties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MachineLearningServicesModelDeployedEventData() - { - } - - /// The name of the deployed service. - public string ServiceName { get; } - /// The compute type (e.g. ACI, AKS) of the deployed service. - public string ServiceComputeType { get; } - /// A common separated list of model IDs. The IDs of the models deployed in the service. - public string ModelIds { get; } - /// - /// The tags of the deployed service. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary ServiceTags { get; } - /// - /// The properties of the deployed service. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary ServiceProperties { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelRegisteredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelRegisteredEventData.Serialization.cs deleted file mode 100644 index 8c623627b80b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelRegisteredEventData.Serialization.cs +++ /dev/null @@ -1,232 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MachineLearningServicesModelRegisteredEventData : 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(MachineLearningServicesModelRegisteredEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ModelName)) - { - writer.WritePropertyName("modelName"u8); - writer.WriteStringValue(ModelName); - } - if (Optional.IsDefined(ModelVersion)) - { - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - } - writer.WritePropertyName("modelTags"u8); - writer.WriteStartObject(); - foreach (var item in ModelTags) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - writer.WritePropertyName("modelProperties"u8); - writer.WriteStartObject(); - foreach (var item in ModelProperties) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - MachineLearningServicesModelRegisteredEventData 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(MachineLearningServicesModelRegisteredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMachineLearningServicesModelRegisteredEventData(document.RootElement, options); - } - - internal static MachineLearningServicesModelRegisteredEventData DeserializeMachineLearningServicesModelRegisteredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string modelName = default; - string modelVersion = default; - IReadOnlyDictionary modelTags = default; - IReadOnlyDictionary modelProperties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("modelName"u8)) - { - modelName = property.Value.GetString(); - continue; - } - if (property.NameEquals("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("modelTags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - modelTags = dictionary; - continue; - } - if (property.NameEquals("modelProperties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - modelProperties = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MachineLearningServicesModelRegisteredEventData(modelName, modelVersion, modelTags, modelProperties, 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(MachineLearningServicesModelRegisteredEventData)} does not support writing '{options.Format}' format."); - } - } - - MachineLearningServicesModelRegisteredEventData 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 DeserializeMachineLearningServicesModelRegisteredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MachineLearningServicesModelRegisteredEventData)} 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 MachineLearningServicesModelRegisteredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMachineLearningServicesModelRegisteredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelRegisteredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelRegisteredEventData.cs deleted file mode 100644 index 66af5a595773..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesModelRegisteredEventData.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.MachineLearningServices.ModelRegistered event. - public partial class MachineLearningServicesModelRegisteredEventData - { - /// - /// 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 tags of the model that was registered. - /// The properties of the model that was registered. - /// or is null. - internal MachineLearningServicesModelRegisteredEventData(IReadOnlyDictionary modelTags, IReadOnlyDictionary modelProperties) - { - Argument.AssertNotNull(modelTags, nameof(modelTags)); - Argument.AssertNotNull(modelProperties, nameof(modelProperties)); - - ModelTags = modelTags; - ModelProperties = modelProperties; - } - - /// Initializes a new instance of . - /// The name of the model that was registered. - /// The version of the model that was registered. - /// The tags of the model that was registered. - /// The properties of the model that was registered. - /// Keeps track of any properties unknown to the library. - internal MachineLearningServicesModelRegisteredEventData(string modelName, string modelVersion, IReadOnlyDictionary modelTags, IReadOnlyDictionary modelProperties, IDictionary serializedAdditionalRawData) - { - ModelName = modelName; - ModelVersion = modelVersion; - ModelTags = modelTags; - ModelProperties = modelProperties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MachineLearningServicesModelRegisteredEventData() - { - } - - /// The name of the model that was registered. - public string ModelName { get; } - /// The version of the model that was registered. - public string ModelVersion { get; } - /// - /// The tags of the model that was registered. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary ModelTags { get; } - /// - /// The properties of the model that was registered. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary ModelProperties { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunCompletedEventData.Serialization.cs deleted file mode 100644 index afd9a764a504..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunCompletedEventData.Serialization.cs +++ /dev/null @@ -1,261 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MachineLearningServicesRunCompletedEventData : 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(MachineLearningServicesRunCompletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ExperimentId)) - { - writer.WritePropertyName("experimentId"u8); - writer.WriteStringValue(ExperimentId); - } - if (Optional.IsDefined(ExperimentName)) - { - writer.WritePropertyName("experimentName"u8); - writer.WriteStringValue(ExperimentName); - } - if (Optional.IsDefined(RunId)) - { - writer.WritePropertyName("runId"u8); - writer.WriteStringValue(RunId); - } - if (Optional.IsDefined(RunType)) - { - writer.WritePropertyName("runType"u8); - writer.WriteStringValue(RunType); - } - writer.WritePropertyName("runTags"u8); - writer.WriteStartObject(); - foreach (var item in RunTags) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - writer.WritePropertyName("runProperties"u8); - writer.WriteStartObject(); - foreach (var item in RunProperties) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - MachineLearningServicesRunCompletedEventData 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(MachineLearningServicesRunCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMachineLearningServicesRunCompletedEventData(document.RootElement, options); - } - - internal static MachineLearningServicesRunCompletedEventData DeserializeMachineLearningServicesRunCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string experimentId = default; - string experimentName = default; - string runId = default; - string runType = default; - IReadOnlyDictionary runTags = default; - IReadOnlyDictionary runProperties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("experimentId"u8)) - { - experimentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("experimentName"u8)) - { - experimentName = property.Value.GetString(); - continue; - } - if (property.NameEquals("runId"u8)) - { - runId = property.Value.GetString(); - continue; - } - if (property.NameEquals("runType"u8)) - { - runType = property.Value.GetString(); - continue; - } - if (property.NameEquals("runTags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - runTags = dictionary; - continue; - } - if (property.NameEquals("runProperties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - runProperties = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MachineLearningServicesRunCompletedEventData( - experimentId, - experimentName, - runId, - runType, - runTags, - runProperties, - 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(MachineLearningServicesRunCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - MachineLearningServicesRunCompletedEventData 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 DeserializeMachineLearningServicesRunCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MachineLearningServicesRunCompletedEventData)} 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 MachineLearningServicesRunCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMachineLearningServicesRunCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunCompletedEventData.cs deleted file mode 100644 index e8c1fb9d4264..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunCompletedEventData.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.MachineLearningServices.RunCompleted event. - public partial class MachineLearningServicesRunCompletedEventData - { - /// - /// 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 tags of the completed Run. - /// The properties of the completed Run. - /// or is null. - internal MachineLearningServicesRunCompletedEventData(IReadOnlyDictionary runTags, IReadOnlyDictionary runProperties) - { - Argument.AssertNotNull(runTags, nameof(runTags)); - Argument.AssertNotNull(runProperties, nameof(runProperties)); - - RunTags = runTags; - RunProperties = runProperties; - } - - /// Initializes a new instance of . - /// The ID of the experiment that the run belongs to. - /// The name of the experiment that the run belongs to. - /// The ID of the Run that was completed. - /// The Run Type of the completed Run. - /// The tags of the completed Run. - /// The properties of the completed Run. - /// Keeps track of any properties unknown to the library. - internal MachineLearningServicesRunCompletedEventData(string experimentId, string experimentName, string runId, string runType, IReadOnlyDictionary runTags, IReadOnlyDictionary runProperties, IDictionary serializedAdditionalRawData) - { - ExperimentId = experimentId; - ExperimentName = experimentName; - RunId = runId; - RunType = runType; - RunTags = runTags; - RunProperties = runProperties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MachineLearningServicesRunCompletedEventData() - { - } - - /// The ID of the experiment that the run belongs to. - public string ExperimentId { get; } - /// The name of the experiment that the run belongs to. - public string ExperimentName { get; } - /// The ID of the Run that was completed. - public string RunId { get; } - /// The Run Type of the completed Run. - public string RunType { get; } - /// - /// The tags of the completed Run. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary RunTags { get; } - /// - /// The properties of the completed Run. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary RunProperties { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunStatusChangedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunStatusChangedEventData.Serialization.cs deleted file mode 100644 index bf9acb0dc685..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunStatusChangedEventData.Serialization.cs +++ /dev/null @@ -1,273 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MachineLearningServicesRunStatusChangedEventData : 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(MachineLearningServicesRunStatusChangedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ExperimentId)) - { - writer.WritePropertyName("experimentId"u8); - writer.WriteStringValue(ExperimentId); - } - if (Optional.IsDefined(ExperimentName)) - { - writer.WritePropertyName("experimentName"u8); - writer.WriteStringValue(ExperimentName); - } - if (Optional.IsDefined(RunId)) - { - writer.WritePropertyName("runId"u8); - writer.WriteStringValue(RunId); - } - if (Optional.IsDefined(RunType)) - { - writer.WritePropertyName("runType"u8); - writer.WriteStringValue(RunType); - } - writer.WritePropertyName("runTags"u8); - writer.WriteStartObject(); - foreach (var item in RunTags) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - writer.WritePropertyName("runProperties"u8); - writer.WriteStartObject(); - foreach (var item in RunProperties) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - if (Optional.IsDefined(RunStatus)) - { - writer.WritePropertyName("runStatus"u8); - writer.WriteStringValue(RunStatus); - } - 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 - } - } - } - - MachineLearningServicesRunStatusChangedEventData 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(MachineLearningServicesRunStatusChangedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMachineLearningServicesRunStatusChangedEventData(document.RootElement, options); - } - - internal static MachineLearningServicesRunStatusChangedEventData DeserializeMachineLearningServicesRunStatusChangedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string experimentId = default; - string experimentName = default; - string runId = default; - string runType = default; - IReadOnlyDictionary runTags = default; - IReadOnlyDictionary runProperties = default; - string runStatus = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("experimentId"u8)) - { - experimentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("experimentName"u8)) - { - experimentName = property.Value.GetString(); - continue; - } - if (property.NameEquals("runId"u8)) - { - runId = property.Value.GetString(); - continue; - } - if (property.NameEquals("runType"u8)) - { - runType = property.Value.GetString(); - continue; - } - if (property.NameEquals("runTags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - runTags = dictionary; - continue; - } - if (property.NameEquals("runProperties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - runProperties = dictionary; - continue; - } - if (property.NameEquals("runStatus"u8)) - { - runStatus = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MachineLearningServicesRunStatusChangedEventData( - experimentId, - experimentName, - runId, - runType, - runTags, - runProperties, - runStatus, - 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(MachineLearningServicesRunStatusChangedEventData)} does not support writing '{options.Format}' format."); - } - } - - MachineLearningServicesRunStatusChangedEventData 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 DeserializeMachineLearningServicesRunStatusChangedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MachineLearningServicesRunStatusChangedEventData)} 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 MachineLearningServicesRunStatusChangedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMachineLearningServicesRunStatusChangedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunStatusChangedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunStatusChangedEventData.cs deleted file mode 100644 index 8af67e302b82..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MachineLearningServicesRunStatusChangedEventData.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.MachineLearningServices.RunStatusChanged event. - public partial class MachineLearningServicesRunStatusChangedEventData - { - /// - /// 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 tags of the Machine Learning Run. - /// The properties of the Machine Learning Run. - /// or is null. - internal MachineLearningServicesRunStatusChangedEventData(IReadOnlyDictionary runTags, IReadOnlyDictionary runProperties) - { - Argument.AssertNotNull(runTags, nameof(runTags)); - Argument.AssertNotNull(runProperties, nameof(runProperties)); - - RunTags = runTags; - RunProperties = runProperties; - } - - /// Initializes a new instance of . - /// The ID of the experiment that the Machine Learning Run belongs to. - /// The name of the experiment that the Machine Learning Run belongs to. - /// The ID of the Machine Learning Run. - /// The Run Type of the Machine Learning Run. - /// The tags of the Machine Learning Run. - /// The properties of the Machine Learning Run. - /// The status of the Machine Learning Run. - /// Keeps track of any properties unknown to the library. - internal MachineLearningServicesRunStatusChangedEventData(string experimentId, string experimentName, string runId, string runType, IReadOnlyDictionary runTags, IReadOnlyDictionary runProperties, string runStatus, IDictionary serializedAdditionalRawData) - { - ExperimentId = experimentId; - ExperimentName = experimentName; - RunId = runId; - RunType = runType; - RunTags = runTags; - RunProperties = runProperties; - RunStatus = runStatus; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MachineLearningServicesRunStatusChangedEventData() - { - } - - /// The ID of the experiment that the Machine Learning Run belongs to. - public string ExperimentId { get; } - /// The name of the experiment that the Machine Learning Run belongs to. - public string ExperimentName { get; } - /// The ID of the Machine Learning Run. - public string RunId { get; } - /// The Run Type of the Machine Learning Run. - public string RunType { get; } - /// - /// The tags of the Machine Learning Run. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary RunTags { get; } - /// - /// The properties of the Machine Learning Run. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary RunProperties { get; } - /// The status of the Machine Learning Run. - public string RunStatus { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEnteredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEnteredEventData.Serialization.cs deleted file mode 100644 index f7b0985ec757..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEnteredEventData.Serialization.cs +++ /dev/null @@ -1,171 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MapsGeofenceEnteredEventData : 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(MapsGeofenceEnteredEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MapsGeofenceEnteredEventData 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(MapsGeofenceEnteredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMapsGeofenceEnteredEventData(document.RootElement, options); - } - - internal static MapsGeofenceEnteredEventData DeserializeMapsGeofenceEnteredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList expiredGeofenceGeometryId = default; - IReadOnlyList geometries = default; - IReadOnlyList invalidPeriodGeofenceGeometryId = default; - bool? isEventPublished = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("expiredGeofenceGeometryId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - expiredGeofenceGeometryId = array; - continue; - } - if (property.NameEquals("geometries"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MapsGeofenceGeometry.DeserializeMapsGeofenceGeometry(item, options)); - } - geometries = array; - continue; - } - if (property.NameEquals("invalidPeriodGeofenceGeometryId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - invalidPeriodGeofenceGeometryId = array; - continue; - } - if (property.NameEquals("isEventPublished"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isEventPublished = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MapsGeofenceEnteredEventData(expiredGeofenceGeometryId ?? new ChangeTrackingList(), geometries, invalidPeriodGeofenceGeometryId ?? new ChangeTrackingList(), isEventPublished, 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(MapsGeofenceEnteredEventData)} does not support writing '{options.Format}' format."); - } - } - - MapsGeofenceEnteredEventData 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 DeserializeMapsGeofenceEnteredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MapsGeofenceEnteredEventData)} 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 MapsGeofenceEnteredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMapsGeofenceEnteredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEnteredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEnteredEventData.cs deleted file mode 100644 index caa8d8598b3a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEnteredEventData.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceEntered event. - public partial class MapsGeofenceEnteredEventData : MapsGeofenceEventProperties - { - /// Initializes a new instance of . - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// is null. - internal MapsGeofenceEnteredEventData(IEnumerable geometries) : base(geometries) - { - Argument.AssertNotNull(geometries, nameof(geometries)); - } - - /// Initializes a new instance of . - /// Lists of the geometry ID of the geofence which is expired relative to the user time in the request. - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. - /// True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. - /// Keeps track of any properties unknown to the library. - internal MapsGeofenceEnteredEventData(IReadOnlyList expiredGeofenceGeometryId, IReadOnlyList geometries, IReadOnlyList invalidPeriodGeofenceGeometryId, bool? isEventPublished, IDictionary serializedAdditionalRawData) : base(expiredGeofenceGeometryId, geometries, invalidPeriodGeofenceGeometryId, isEventPublished, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MapsGeofenceEnteredEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEventProperties.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEventProperties.Serialization.cs deleted file mode 100644 index 635983826079..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEventProperties.Serialization.cs +++ /dev/null @@ -1,217 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MapsGeofenceEventProperties : 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(MapsGeofenceEventProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(ExpiredGeofenceGeometryId)) - { - writer.WritePropertyName("expiredGeofenceGeometryId"u8); - writer.WriteStartArray(); - foreach (var item in ExpiredGeofenceGeometryId) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - writer.WritePropertyName("geometries"u8); - writer.WriteStartArray(); - foreach (var item in Geometries) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (Optional.IsCollectionDefined(InvalidPeriodGeofenceGeometryId)) - { - writer.WritePropertyName("invalidPeriodGeofenceGeometryId"u8); - writer.WriteStartArray(); - foreach (var item in InvalidPeriodGeofenceGeometryId) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(IsEventPublished)) - { - writer.WritePropertyName("isEventPublished"u8); - writer.WriteBooleanValue(IsEventPublished.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MapsGeofenceEventProperties 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(MapsGeofenceEventProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMapsGeofenceEventProperties(document.RootElement, options); - } - - internal static MapsGeofenceEventProperties DeserializeMapsGeofenceEventProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList expiredGeofenceGeometryId = default; - IReadOnlyList geometries = default; - IReadOnlyList invalidPeriodGeofenceGeometryId = default; - bool? isEventPublished = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("expiredGeofenceGeometryId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - expiredGeofenceGeometryId = array; - continue; - } - if (property.NameEquals("geometries"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MapsGeofenceGeometry.DeserializeMapsGeofenceGeometry(item, options)); - } - geometries = array; - continue; - } - if (property.NameEquals("invalidPeriodGeofenceGeometryId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - invalidPeriodGeofenceGeometryId = array; - continue; - } - if (property.NameEquals("isEventPublished"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isEventPublished = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MapsGeofenceEventProperties(expiredGeofenceGeometryId ?? new ChangeTrackingList(), geometries, invalidPeriodGeofenceGeometryId ?? new ChangeTrackingList(), isEventPublished, 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(MapsGeofenceEventProperties)} does not support writing '{options.Format}' format."); - } - } - - MapsGeofenceEventProperties 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 DeserializeMapsGeofenceEventProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MapsGeofenceEventProperties)} 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 MapsGeofenceEventProperties FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMapsGeofenceEventProperties(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEventProperties.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEventProperties.cs deleted file mode 100644 index 24bbadc64e67..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceEventProperties.cs +++ /dev/null @@ -1,90 +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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Geofence event (GeofenceEntered, GeofenceExited, GeofenceResult). - public partial class MapsGeofenceEventProperties - { - /// - /// 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 . - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// is null. - internal MapsGeofenceEventProperties(IEnumerable geometries) - { - Argument.AssertNotNull(geometries, nameof(geometries)); - - ExpiredGeofenceGeometryId = new ChangeTrackingList(); - Geometries = geometries.ToList(); - InvalidPeriodGeofenceGeometryId = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Lists of the geometry ID of the geofence which is expired relative to the user time in the request. - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. - /// True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. - /// Keeps track of any properties unknown to the library. - internal MapsGeofenceEventProperties(IReadOnlyList expiredGeofenceGeometryId, IReadOnlyList geometries, IReadOnlyList invalidPeriodGeofenceGeometryId, bool? isEventPublished, IDictionary serializedAdditionalRawData) - { - ExpiredGeofenceGeometryId = expiredGeofenceGeometryId; - Geometries = geometries; - InvalidPeriodGeofenceGeometryId = invalidPeriodGeofenceGeometryId; - IsEventPublished = isEventPublished; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MapsGeofenceEventProperties() - { - } - - /// Lists of the geometry ID of the geofence which is expired relative to the user time in the request. - public IReadOnlyList ExpiredGeofenceGeometryId { get; } - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - public IReadOnlyList Geometries { get; } - /// Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. - public IReadOnlyList InvalidPeriodGeofenceGeometryId { get; } - /// True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. - public bool? IsEventPublished { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceExitedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceExitedEventData.Serialization.cs deleted file mode 100644 index 935bd573b2b1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceExitedEventData.Serialization.cs +++ /dev/null @@ -1,171 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MapsGeofenceExitedEventData : 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(MapsGeofenceExitedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MapsGeofenceExitedEventData 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(MapsGeofenceExitedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMapsGeofenceExitedEventData(document.RootElement, options); - } - - internal static MapsGeofenceExitedEventData DeserializeMapsGeofenceExitedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList expiredGeofenceGeometryId = default; - IReadOnlyList geometries = default; - IReadOnlyList invalidPeriodGeofenceGeometryId = default; - bool? isEventPublished = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("expiredGeofenceGeometryId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - expiredGeofenceGeometryId = array; - continue; - } - if (property.NameEquals("geometries"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MapsGeofenceGeometry.DeserializeMapsGeofenceGeometry(item, options)); - } - geometries = array; - continue; - } - if (property.NameEquals("invalidPeriodGeofenceGeometryId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - invalidPeriodGeofenceGeometryId = array; - continue; - } - if (property.NameEquals("isEventPublished"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isEventPublished = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MapsGeofenceExitedEventData(expiredGeofenceGeometryId ?? new ChangeTrackingList(), geometries, invalidPeriodGeofenceGeometryId ?? new ChangeTrackingList(), isEventPublished, 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(MapsGeofenceExitedEventData)} does not support writing '{options.Format}' format."); - } - } - - MapsGeofenceExitedEventData 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 DeserializeMapsGeofenceExitedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MapsGeofenceExitedEventData)} 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 MapsGeofenceExitedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMapsGeofenceExitedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceExitedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceExitedEventData.cs deleted file mode 100644 index 3503ee43ec5b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceExitedEventData.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceExited event. - public partial class MapsGeofenceExitedEventData : MapsGeofenceEventProperties - { - /// Initializes a new instance of . - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// is null. - internal MapsGeofenceExitedEventData(IEnumerable geometries) : base(geometries) - { - Argument.AssertNotNull(geometries, nameof(geometries)); - } - - /// Initializes a new instance of . - /// Lists of the geometry ID of the geofence which is expired relative to the user time in the request. - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. - /// True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. - /// Keeps track of any properties unknown to the library. - internal MapsGeofenceExitedEventData(IReadOnlyList expiredGeofenceGeometryId, IReadOnlyList geometries, IReadOnlyList invalidPeriodGeofenceGeometryId, bool? isEventPublished, IDictionary serializedAdditionalRawData) : base(expiredGeofenceGeometryId, geometries, invalidPeriodGeofenceGeometryId, isEventPublished, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MapsGeofenceExitedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceGeometry.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceGeometry.Serialization.cs deleted file mode 100644 index b0c581705604..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceGeometry.Serialization.cs +++ /dev/null @@ -1,219 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MapsGeofenceGeometry : 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(MapsGeofenceGeometry)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(DeviceId)) - { - writer.WritePropertyName("deviceId"u8); - writer.WriteStringValue(DeviceId); - } - if (Optional.IsDefined(Distance)) - { - writer.WritePropertyName("distance"u8); - writer.WriteNumberValue(Distance.Value); - } - if (Optional.IsDefined(GeometryId)) - { - writer.WritePropertyName("geometryId"u8); - writer.WriteStringValue(GeometryId); - } - if (Optional.IsDefined(NearestLat)) - { - writer.WritePropertyName("nearestLat"u8); - writer.WriteNumberValue(NearestLat.Value); - } - if (Optional.IsDefined(NearestLon)) - { - writer.WritePropertyName("nearestLon"u8); - writer.WriteNumberValue(NearestLon.Value); - } - if (Optional.IsDefined(UdId)) - { - writer.WritePropertyName("udId"u8); - writer.WriteStringValue(UdId); - } - 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 - } - } - } - - MapsGeofenceGeometry 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(MapsGeofenceGeometry)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMapsGeofenceGeometry(document.RootElement, options); - } - - internal static MapsGeofenceGeometry DeserializeMapsGeofenceGeometry(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string deviceId = default; - float? distance = default; - string geometryId = default; - float? nearestLat = default; - float? nearestLon = default; - string udId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("deviceId"u8)) - { - deviceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("distance"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - distance = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("geometryId"u8)) - { - geometryId = property.Value.GetString(); - continue; - } - if (property.NameEquals("nearestLat"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nearestLat = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("nearestLon"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nearestLon = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("udId"u8)) - { - udId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MapsGeofenceGeometry( - deviceId, - distance, - geometryId, - nearestLat, - nearestLon, - udId, - 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(MapsGeofenceGeometry)} does not support writing '{options.Format}' format."); - } - } - - MapsGeofenceGeometry 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 DeserializeMapsGeofenceGeometry(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MapsGeofenceGeometry)} 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 MapsGeofenceGeometry FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMapsGeofenceGeometry(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceGeometry.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceGeometry.cs deleted file mode 100644 index cbbb6ca42ac1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceGeometry.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// The geofence geometry. - public partial class MapsGeofenceGeometry - { - /// - /// 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 MapsGeofenceGeometry() - { - } - - /// Initializes a new instance of . - /// ID of the device. - /// Distance from the coordinate to the closest border of the geofence. Positive means the coordinate is outside of the geofence. If the coordinate is outside of the geofence, but more than the value of searchBuffer away from the closest geofence border, then the value is 999. Negative means the coordinate is inside of the geofence. If the coordinate is inside the polygon, but more than the value of searchBuffer away from the closest geofencing border,then the value is -999. A value of 999 means that there is great confidence the coordinate is well outside the geofence. A value of -999 means that there is great confidence the coordinate is well within the geofence. - /// The unique ID for the geofence geometry. - /// Latitude of the nearest point of the geometry. - /// Longitude of the nearest point of the geometry. - /// The unique id returned from user upload service when uploading a geofence. Will not be included in geofencing post API. - /// Keeps track of any properties unknown to the library. - internal MapsGeofenceGeometry(string deviceId, float? distance, string geometryId, float? nearestLat, float? nearestLon, string udId, IDictionary serializedAdditionalRawData) - { - DeviceId = deviceId; - Distance = distance; - GeometryId = geometryId; - NearestLat = nearestLat; - NearestLon = nearestLon; - UdId = udId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// ID of the device. - public string DeviceId { get; } - /// Distance from the coordinate to the closest border of the geofence. Positive means the coordinate is outside of the geofence. If the coordinate is outside of the geofence, but more than the value of searchBuffer away from the closest geofence border, then the value is 999. Negative means the coordinate is inside of the geofence. If the coordinate is inside the polygon, but more than the value of searchBuffer away from the closest geofencing border,then the value is -999. A value of 999 means that there is great confidence the coordinate is well outside the geofence. A value of -999 means that there is great confidence the coordinate is well within the geofence. - public float? Distance { get; } - /// The unique ID for the geofence geometry. - public string GeometryId { get; } - /// Latitude of the nearest point of the geometry. - public float? NearestLat { get; } - /// Longitude of the nearest point of the geometry. - public float? NearestLon { get; } - /// The unique id returned from user upload service when uploading a geofence. Will not be included in geofencing post API. - public string UdId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceResultEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceResultEventData.Serialization.cs deleted file mode 100644 index a17622e006ac..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceResultEventData.Serialization.cs +++ /dev/null @@ -1,171 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MapsGeofenceResultEventData : 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(MapsGeofenceResultEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MapsGeofenceResultEventData 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(MapsGeofenceResultEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMapsGeofenceResultEventData(document.RootElement, options); - } - - internal static MapsGeofenceResultEventData DeserializeMapsGeofenceResultEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList expiredGeofenceGeometryId = default; - IReadOnlyList geometries = default; - IReadOnlyList invalidPeriodGeofenceGeometryId = default; - bool? isEventPublished = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("expiredGeofenceGeometryId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - expiredGeofenceGeometryId = array; - continue; - } - if (property.NameEquals("geometries"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MapsGeofenceGeometry.DeserializeMapsGeofenceGeometry(item, options)); - } - geometries = array; - continue; - } - if (property.NameEquals("invalidPeriodGeofenceGeometryId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - invalidPeriodGeofenceGeometryId = array; - continue; - } - if (property.NameEquals("isEventPublished"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isEventPublished = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MapsGeofenceResultEventData(expiredGeofenceGeometryId ?? new ChangeTrackingList(), geometries, invalidPeriodGeofenceGeometryId ?? new ChangeTrackingList(), isEventPublished, 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(MapsGeofenceResultEventData)} does not support writing '{options.Format}' format."); - } - } - - MapsGeofenceResultEventData 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 DeserializeMapsGeofenceResultEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MapsGeofenceResultEventData)} 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 MapsGeofenceResultEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMapsGeofenceResultEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceResultEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceResultEventData.cs deleted file mode 100644 index e7568ca67003..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MapsGeofenceResultEventData.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceResult event. - public partial class MapsGeofenceResultEventData : MapsGeofenceEventProperties - { - /// Initializes a new instance of . - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// is null. - internal MapsGeofenceResultEventData(IEnumerable geometries) : base(geometries) - { - Argument.AssertNotNull(geometries, nameof(geometries)); - } - - /// Initializes a new instance of . - /// Lists of the geometry ID of the geofence which is expired relative to the user time in the request. - /// Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. - /// Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. - /// True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. - /// Keeps track of any properties unknown to the library. - internal MapsGeofenceResultEventData(IReadOnlyList expiredGeofenceGeometryId, IReadOnlyList geometries, IReadOnlyList invalidPeriodGeofenceGeometryId, bool? isEventPublished, IDictionary serializedAdditionalRawData) : base(expiredGeofenceGeometryId, geometries, invalidPeriodGeofenceGeometryId, isEventPublished, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MapsGeofenceResultEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCanceledEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCanceledEventData.Serialization.cs deleted file mode 100644 index 1a4b66647616..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCanceledEventData.Serialization.cs +++ /dev/null @@ -1,161 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobCanceledEventData : 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(MediaJobCanceledEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("outputs"u8); - writer.WriteStartArray(); - foreach (var item in Outputs) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - - MediaJobCanceledEventData 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(MediaJobCanceledEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobCanceledEventData(document.RootElement, options); - } - - internal static MediaJobCanceledEventData DeserializeMediaJobCanceledEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList outputs = default; - MediaJobState previousState = default; - MediaJobState state = default; - IReadOnlyDictionary correlationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("outputs"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MediaJobOutput.DeserializeMediaJobOutput(item, options)); - } - outputs = array; - continue; - } - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("state"u8)) - { - state = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("correlationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - correlationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobCanceledEventData(previousState, state, correlationData, serializedAdditionalRawData, outputs); - } - - 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(MediaJobCanceledEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobCanceledEventData 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 DeserializeMediaJobCanceledEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobCanceledEventData)} 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 MediaJobCanceledEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobCanceledEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCanceledEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCanceledEventData.cs deleted file mode 100644 index 953505804d20..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCanceledEventData.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; -using System.Linq; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Job canceled event data. Schema of the data property of an EventGridEvent for a - /// Microsoft.Media.JobCanceled event. - /// - public partial class MediaJobCanceledEventData : MediaJobStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// - /// Gets the Job outputs. - /// 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 . - /// - /// or is null. - internal MediaJobCanceledEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData, IEnumerable outputs) : base(previousState, state, correlationData) - { - Argument.AssertNotNull(correlationData, nameof(correlationData)); - Argument.AssertNotNull(outputs, nameof(outputs)); - - Outputs = outputs.ToList(); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - /// - /// Gets the Job outputs. - /// 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 . - /// - internal MediaJobCanceledEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData, IDictionary serializedAdditionalRawData, IReadOnlyList outputs) : base(previousState, state, correlationData, serializedAdditionalRawData) - { - Outputs = outputs; - } - - /// Initializes a new instance of for deserialization. - internal MediaJobCanceledEventData() - { - } - - /// - /// Gets the Job outputs. - /// 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 . - /// - public IReadOnlyList Outputs { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCancelingEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCancelingEventData.Serialization.cs deleted file mode 100644 index 45fd962e0fcd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCancelingEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobCancelingEventData : 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(MediaJobCancelingEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MediaJobCancelingEventData 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(MediaJobCancelingEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobCancelingEventData(document.RootElement, options); - } - - internal static MediaJobCancelingEventData DeserializeMediaJobCancelingEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobState previousState = default; - MediaJobState state = default; - IReadOnlyDictionary correlationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("state"u8)) - { - state = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("correlationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - correlationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobCancelingEventData(previousState, state, correlationData, 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(MediaJobCancelingEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobCancelingEventData 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 DeserializeMediaJobCancelingEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobCancelingEventData)} 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 MediaJobCancelingEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobCancelingEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCancelingEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCancelingEventData.cs deleted file mode 100644 index c1493f0f200e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobCancelingEventData.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.Messaging.EventGrid.SystemEvents -{ - /// - /// Job canceling event data. Schema of the data property of an EventGridEvent for - /// a Microsoft.Media.JobCanceling event. - /// - public partial class MediaJobCancelingEventData : MediaJobStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// is null. - internal MediaJobCancelingEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData) : base(previousState, state, correlationData) - { - Argument.AssertNotNull(correlationData, nameof(correlationData)); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobCancelingEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData, IDictionary serializedAdditionalRawData) : base(previousState, state, correlationData, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MediaJobCancelingEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobError.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobError.Serialization.cs deleted file mode 100644 index c3fae6ec7856..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobError.Serialization.cs +++ /dev/null @@ -1,193 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobError : 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(MediaJobError)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("code"u8); - writer.WriteStringValue(Code.ToString()); - if (Optional.IsDefined(Message)) - { - writer.WritePropertyName("message"u8); - writer.WriteStringValue(Message); - } - writer.WritePropertyName("category"u8); - writer.WriteStringValue(Category.ToString()); - writer.WritePropertyName("retry"u8); - writer.WriteStringValue(Retry.ToString()); - writer.WritePropertyName("details"u8); - writer.WriteStartArray(); - foreach (var item in Details) - { - 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 - } - } - } - - MediaJobError 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(MediaJobError)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobError(document.RootElement, options); - } - - internal static MediaJobError DeserializeMediaJobError(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobErrorCode code = default; - string message = default; - MediaJobErrorCategory category = default; - MediaJobRetry retry = default; - IReadOnlyList details = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code"u8)) - { - code = new MediaJobErrorCode(property.Value.GetString()); - continue; - } - if (property.NameEquals("message"u8)) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("category"u8)) - { - category = new MediaJobErrorCategory(property.Value.GetString()); - continue; - } - if (property.NameEquals("retry"u8)) - { - retry = new MediaJobRetry(property.Value.GetString()); - continue; - } - if (property.NameEquals("details"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MediaJobErrorDetail.DeserializeMediaJobErrorDetail(item, options)); - } - details = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobError( - code, - message, - category, - retry, - details, - 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(MediaJobError)} does not support writing '{options.Format}' format."); - } - } - - MediaJobError 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 DeserializeMediaJobError(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobError)} 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 MediaJobError FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobError(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobError.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobError.cs deleted file mode 100644 index 751ed7d395fe..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobError.cs +++ /dev/null @@ -1,98 +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.Messaging.EventGrid.SystemEvents -{ - /// Details of JobOutput errors. - public partial class MediaJobError - { - /// - /// 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 . - /// Error code describing the error. - /// Helps with categorization of errors. - /// Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact Azure support via Azure Portal. - /// An array of details about specific errors that led to this reported error. - /// is null. - internal MediaJobError(MediaJobErrorCode code, MediaJobErrorCategory category, MediaJobRetry retry, IEnumerable details) - { - Argument.AssertNotNull(details, nameof(details)); - - Code = code; - Category = category; - Retry = retry; - Details = details.ToList(); - } - - /// Initializes a new instance of . - /// Error code describing the error. - /// A human-readable language-dependent representation of the error. - /// Helps with categorization of errors. - /// Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact Azure support via Azure Portal. - /// An array of details about specific errors that led to this reported error. - /// Keeps track of any properties unknown to the library. - internal MediaJobError(MediaJobErrorCode code, string message, MediaJobErrorCategory category, MediaJobRetry retry, IReadOnlyList details, IDictionary serializedAdditionalRawData) - { - Code = code; - Message = message; - Category = category; - Retry = retry; - Details = details; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MediaJobError() - { - } - - /// Error code describing the error. - public MediaJobErrorCode Code { get; } - /// A human-readable language-dependent representation of the error. - public string Message { get; } - /// Helps with categorization of errors. - public MediaJobErrorCategory Category { get; } - /// Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact Azure support via Azure Portal. - public MediaJobRetry Retry { get; } - /// An array of details about specific errors that led to this reported error. - public IReadOnlyList Details { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorCategory.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorCategory.cs deleted file mode 100644 index 1500025725f5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorCategory.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Error categories for Media Job Errors. - public readonly partial struct MediaJobErrorCategory : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MediaJobErrorCategory(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ServiceValue = "Service"; - private const string DownloadValue = "Download"; - private const string UploadValue = "Upload"; - private const string ConfigurationValue = "Configuration"; - private const string ContentValue = "Content"; - private const string AccountValue = "Account"; - - /// The error is service related. - public static MediaJobErrorCategory Service { get; } = new MediaJobErrorCategory(ServiceValue); - /// The error is download related. - public static MediaJobErrorCategory Download { get; } = new MediaJobErrorCategory(DownloadValue); - /// The error is upload related. - public static MediaJobErrorCategory Upload { get; } = new MediaJobErrorCategory(UploadValue); - /// The error is configuration related. - public static MediaJobErrorCategory Configuration { get; } = new MediaJobErrorCategory(ConfigurationValue); - /// The error is related to data in the input files. - public static MediaJobErrorCategory Content { get; } = new MediaJobErrorCategory(ContentValue); - /// The error is related to account information. - public static MediaJobErrorCategory Account { get; } = new MediaJobErrorCategory(AccountValue); - /// Determines if two values are the same. - public static bool operator ==(MediaJobErrorCategory left, MediaJobErrorCategory right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MediaJobErrorCategory left, MediaJobErrorCategory right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator MediaJobErrorCategory(string value) => new MediaJobErrorCategory(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MediaJobErrorCategory other && Equals(other); - /// - public bool Equals(MediaJobErrorCategory 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorCode.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorCode.cs deleted file mode 100644 index a306a0f40470..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorCode.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.Messaging.EventGrid.SystemEvents -{ - /// Media Job Error Codes. - public readonly partial struct MediaJobErrorCode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MediaJobErrorCode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ServiceErrorValue = "ServiceError"; - private const string ServiceTransientErrorValue = "ServiceTransientError"; - private const string DownloadNotAccessibleValue = "DownloadNotAccessible"; - private const string DownloadTransientErrorValue = "DownloadTransientError"; - private const string UploadNotAccessibleValue = "UploadNotAccessible"; - private const string UploadTransientErrorValue = "UploadTransientError"; - private const string ConfigurationUnsupportedValue = "ConfigurationUnsupported"; - private const string ContentMalformedValue = "ContentMalformed"; - private const string ContentUnsupportedValue = "ContentUnsupported"; - private const string IdentityUnsupportedValue = "IdentityUnsupported"; - - /// Fatal service error, please contact support. - public static MediaJobErrorCode ServiceError { get; } = new MediaJobErrorCode(ServiceErrorValue); - /// Transient error, please retry, if retry is unsuccessful, please contact support. - public static MediaJobErrorCode ServiceTransientError { get; } = new MediaJobErrorCode(ServiceTransientErrorValue); - /// While trying to download the input files, the files were not accessible, please check the availability of the source. - public static MediaJobErrorCode DownloadNotAccessible { get; } = new MediaJobErrorCode(DownloadNotAccessibleValue); - /// While trying to download the input files, there was an issue during transfer (storage service, network errors), see details and check your source. - public static MediaJobErrorCode DownloadTransientError { get; } = new MediaJobErrorCode(DownloadTransientErrorValue); - /// While trying to upload the output files, the destination was not reachable, please check the availability of the destination. - public static MediaJobErrorCode UploadNotAccessible { get; } = new MediaJobErrorCode(UploadNotAccessibleValue); - /// While trying to upload the output files, there was an issue during transfer (storage service, network errors), see details and check your destination. - public static MediaJobErrorCode UploadTransientError { get; } = new MediaJobErrorCode(UploadTransientErrorValue); - /// There was a problem with the combination of input files and the configuration settings applied, fix the configuration settings and retry with the same input, or change input to match the configuration. - public static MediaJobErrorCode ConfigurationUnsupported { get; } = new MediaJobErrorCode(ConfigurationUnsupportedValue); - /// There was a problem with the input content (for example: zero byte files, or corrupt/non-decodable files), check the input files. - public static MediaJobErrorCode ContentMalformed { get; } = new MediaJobErrorCode(ContentMalformedValue); - /// There was a problem with the format of the input (not valid media file, or an unsupported file/codec), check the validity of the input files. - public static MediaJobErrorCode ContentUnsupported { get; } = new MediaJobErrorCode(ContentUnsupportedValue); - /// There is an error verifying to the account identity. Check and fix the identity configurations and retry. If unsuccessful, please contact support. - public static MediaJobErrorCode IdentityUnsupported { get; } = new MediaJobErrorCode(IdentityUnsupportedValue); - /// Determines if two values are the same. - public static bool operator ==(MediaJobErrorCode left, MediaJobErrorCode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MediaJobErrorCode left, MediaJobErrorCode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator MediaJobErrorCode(string value) => new MediaJobErrorCode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MediaJobErrorCode other && Equals(other); - /// - public bool Equals(MediaJobErrorCode 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorDetail.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorDetail.Serialization.cs deleted file mode 100644 index 61ea5a6e9dfd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorDetail.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobErrorDetail : 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(MediaJobErrorDetail)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Code)) - { - writer.WritePropertyName("code"u8); - writer.WriteStringValue(Code); - } - if (Optional.IsDefined(Message)) - { - writer.WritePropertyName("message"u8); - writer.WriteStringValue(Message); - } - 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 - } - } - } - - MediaJobErrorDetail 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(MediaJobErrorDetail)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobErrorDetail(document.RootElement, options); - } - - internal static MediaJobErrorDetail DeserializeMediaJobErrorDetail(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string code = default; - string message = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code"u8)) - { - code = property.Value.GetString(); - continue; - } - if (property.NameEquals("message"u8)) - { - message = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobErrorDetail(code, message, 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(MediaJobErrorDetail)} does not support writing '{options.Format}' format."); - } - } - - MediaJobErrorDetail 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 DeserializeMediaJobErrorDetail(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobErrorDetail)} 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 MediaJobErrorDetail FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobErrorDetail(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorDetail.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorDetail.cs deleted file mode 100644 index 4db19c083c43..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErrorDetail.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.Messaging.EventGrid.SystemEvents -{ - /// Details of JobOutput errors. - public partial class MediaJobErrorDetail - { - /// - /// 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 MediaJobErrorDetail() - { - } - - /// Initializes a new instance of . - /// Code describing the error detail. - /// A human-readable representation of the error. - /// Keeps track of any properties unknown to the library. - internal MediaJobErrorDetail(string code, string message, IDictionary serializedAdditionalRawData) - { - Code = code; - Message = message; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Code describing the error detail. - public string Code { get; } - /// A human-readable representation of the error. - public string Message { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErroredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErroredEventData.Serialization.cs deleted file mode 100644 index 2453e6462a1e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErroredEventData.Serialization.cs +++ /dev/null @@ -1,161 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobErroredEventData : 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(MediaJobErroredEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("outputs"u8); - writer.WriteStartArray(); - foreach (var item in Outputs) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - - MediaJobErroredEventData 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(MediaJobErroredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobErroredEventData(document.RootElement, options); - } - - internal static MediaJobErroredEventData DeserializeMediaJobErroredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList outputs = default; - MediaJobState previousState = default; - MediaJobState state = default; - IReadOnlyDictionary correlationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("outputs"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MediaJobOutput.DeserializeMediaJobOutput(item, options)); - } - outputs = array; - continue; - } - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("state"u8)) - { - state = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("correlationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - correlationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobErroredEventData(previousState, state, correlationData, serializedAdditionalRawData, outputs); - } - - 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(MediaJobErroredEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobErroredEventData 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 DeserializeMediaJobErroredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobErroredEventData)} 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 MediaJobErroredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobErroredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErroredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErroredEventData.cs deleted file mode 100644 index 0c76f70e4bc5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobErroredEventData.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; -using System.Linq; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Job error state event data. Schema of the data property of an EventGridEvent - /// for a Microsoft.Media.JobErrored event. - /// - public partial class MediaJobErroredEventData : MediaJobStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// - /// Gets the Job outputs. - /// 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 . - /// - /// or is null. - internal MediaJobErroredEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData, IEnumerable outputs) : base(previousState, state, correlationData) - { - Argument.AssertNotNull(correlationData, nameof(correlationData)); - Argument.AssertNotNull(outputs, nameof(outputs)); - - Outputs = outputs.ToList(); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - /// - /// Gets the Job outputs. - /// 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 . - /// - internal MediaJobErroredEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData, IDictionary serializedAdditionalRawData, IReadOnlyList outputs) : base(previousState, state, correlationData, serializedAdditionalRawData) - { - Outputs = outputs; - } - - /// Initializes a new instance of for deserialization. - internal MediaJobErroredEventData() - { - } - - /// - /// Gets the Job outputs. - /// 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 . - /// - public IReadOnlyList Outputs { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobFinishedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobFinishedEventData.Serialization.cs deleted file mode 100644 index 5c0168553591..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobFinishedEventData.Serialization.cs +++ /dev/null @@ -1,161 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobFinishedEventData : 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(MediaJobFinishedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("outputs"u8); - writer.WriteStartArray(); - foreach (var item in Outputs) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - - MediaJobFinishedEventData 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(MediaJobFinishedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobFinishedEventData(document.RootElement, options); - } - - internal static MediaJobFinishedEventData DeserializeMediaJobFinishedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList outputs = default; - MediaJobState previousState = default; - MediaJobState state = default; - IReadOnlyDictionary correlationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("outputs"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MediaJobOutput.DeserializeMediaJobOutput(item, options)); - } - outputs = array; - continue; - } - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("state"u8)) - { - state = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("correlationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - correlationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobFinishedEventData(previousState, state, correlationData, serializedAdditionalRawData, outputs); - } - - 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(MediaJobFinishedEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobFinishedEventData 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 DeserializeMediaJobFinishedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobFinishedEventData)} 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 MediaJobFinishedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobFinishedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobFinishedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobFinishedEventData.cs deleted file mode 100644 index 64a495eac9b8..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobFinishedEventData.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; -using System.Linq; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Job finished event data. Schema of the data property of an EventGridEvent for a - /// Microsoft.Media.JobFinished event. - /// - public partial class MediaJobFinishedEventData : MediaJobStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// - /// Gets the Job outputs. - /// 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 . - /// - /// or is null. - internal MediaJobFinishedEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData, IEnumerable outputs) : base(previousState, state, correlationData) - { - Argument.AssertNotNull(correlationData, nameof(correlationData)); - Argument.AssertNotNull(outputs, nameof(outputs)); - - Outputs = outputs.ToList(); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - /// - /// Gets the Job outputs. - /// 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 . - /// - internal MediaJobFinishedEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData, IDictionary serializedAdditionalRawData, IReadOnlyList outputs) : base(previousState, state, correlationData, serializedAdditionalRawData) - { - Outputs = outputs; - } - - /// Initializes a new instance of for deserialization. - internal MediaJobFinishedEventData() - { - } - - /// - /// Gets the Job outputs. - /// 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 . - /// - public IReadOnlyList Outputs { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutput.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutput.Serialization.cs deleted file mode 100644 index 0e23a14437ba..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutput.Serialization.cs +++ /dev/null @@ -1,144 +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.Messaging.EventGrid.SystemEvents -{ - [PersistableModelProxy(typeof(UnknownMediaJobOutput))] - public partial class MediaJobOutput : 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(MediaJobOutput)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("@odata.type"u8); - writer.WriteStringValue(OdataType); - writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error, options); - if (Optional.IsDefined(Label)) - { - writer.WritePropertyName("label"u8); - writer.WriteStringValue(Label); - } - writer.WritePropertyName("progress"u8); - writer.WriteNumberValue(Progress); - writer.WritePropertyName("state"u8); - writer.WriteStringValue(State.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MediaJobOutput 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(MediaJobOutput)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobOutput(document.RootElement, options); - } - - internal static MediaJobOutput DeserializeMediaJobOutput(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("@odata.type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "#Microsoft.Media.JobOutputAsset": return MediaJobOutputAsset.DeserializeMediaJobOutputAsset(element, options); - } - } - return UnknownMediaJobOutput.DeserializeUnknownMediaJobOutput(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(MediaJobOutput)} does not support writing '{options.Format}' format."); - } - } - - MediaJobOutput 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 DeserializeMediaJobOutput(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobOutput)} 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 MediaJobOutput FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobOutput(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutput.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutput.cs deleted file mode 100644 index 2a5881ab7ec5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutput.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// The event data for a Job 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 . - /// - public abstract partial class MediaJobOutput - { - /// - /// 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 . - /// Gets the Job output error. - /// Gets the Job output progress. - /// Gets the Job output state. - /// is null. - protected MediaJobOutput(MediaJobError error, long progress, MediaJobState state) - { - Argument.AssertNotNull(error, nameof(error)); - - Error = error; - Progress = progress; - State = state; - } - - /// Initializes a new instance of . - /// The discriminator for derived types. - /// Gets the Job output error. - /// Gets the Job output label. - /// Gets the Job output progress. - /// Gets the Job output state. - /// Keeps track of any properties unknown to the library. - internal MediaJobOutput(string odataType, MediaJobError error, string label, long progress, MediaJobState state, IDictionary serializedAdditionalRawData) - { - OdataType = odataType; - Error = error; - Label = label; - Progress = progress; - State = state; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MediaJobOutput() - { - } - - /// The discriminator for derived types. - internal string OdataType { get; set; } - /// Gets the Job output error. - public MediaJobError Error { get; } - /// Gets the Job output label. - public string Label { get; } - /// Gets the Job output progress. - public long Progress { get; } - /// Gets the Job output state. - public MediaJobState State { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputAsset.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputAsset.Serialization.cs deleted file mode 100644 index b9d1022e7fc9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputAsset.Serialization.cs +++ /dev/null @@ -1,168 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobOutputAsset : 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(MediaJobOutputAsset)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(AssetName)) - { - writer.WritePropertyName("assetName"u8); - writer.WriteStringValue(AssetName); - } - } - - MediaJobOutputAsset 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(MediaJobOutputAsset)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobOutputAsset(document.RootElement, options); - } - - internal static MediaJobOutputAsset DeserializeMediaJobOutputAsset(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string assetName = default; - string odataType = default; - MediaJobError error = default; - string label = default; - long progress = default; - MediaJobState state = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("assetName"u8)) - { - assetName = property.Value.GetString(); - continue; - } - if (property.NameEquals("@odata.type"u8)) - { - odataType = property.Value.GetString(); - continue; - } - if (property.NameEquals("error"u8)) - { - error = MediaJobError.DeserializeMediaJobError(property.Value, options); - continue; - } - if (property.NameEquals("label"u8)) - { - label = property.Value.GetString(); - continue; - } - if (property.NameEquals("progress"u8)) - { - progress = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("state"u8)) - { - state = new MediaJobState(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobOutputAsset( - odataType, - error, - label, - progress, - state, - serializedAdditionalRawData, - assetName); - } - - 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(MediaJobOutputAsset)} does not support writing '{options.Format}' format."); - } - } - - MediaJobOutputAsset 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 DeserializeMediaJobOutputAsset(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobOutputAsset)} 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 MediaJobOutputAsset FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobOutputAsset(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputAsset.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputAsset.cs deleted file mode 100644 index b43e0081261b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputAsset.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// The event data for a Job output asset. - public partial class MediaJobOutputAsset : MediaJobOutput - { - /// Initializes a new instance of . - /// Gets the Job output error. - /// Gets the Job output progress. - /// Gets the Job output state. - /// is null. - internal MediaJobOutputAsset(MediaJobError error, long progress, MediaJobState state) : base(error, progress, state) - { - Argument.AssertNotNull(error, nameof(error)); - - OdataType = "#Microsoft.Media.JobOutputAsset"; - } - - /// Initializes a new instance of . - /// The discriminator for derived types. - /// Gets the Job output error. - /// Gets the Job output label. - /// Gets the Job output progress. - /// Gets the Job output state. - /// Keeps track of any properties unknown to the library. - /// Gets the Job output asset name. - internal MediaJobOutputAsset(string odataType, MediaJobError error, string label, long progress, MediaJobState state, IDictionary serializedAdditionalRawData, string assetName) : base(odataType, error, label, progress, state, serializedAdditionalRawData) - { - AssetName = assetName; - } - - /// Initializes a new instance of for deserialization. - internal MediaJobOutputAsset() - { - } - - /// Gets the Job output asset name. - public string AssetName { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCanceledEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCanceledEventData.Serialization.cs deleted file mode 100644 index 0ac5b829f1dc..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCanceledEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobOutputCanceledEventData : 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(MediaJobOutputCanceledEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MediaJobOutputCanceledEventData 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(MediaJobOutputCanceledEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobOutputCanceledEventData(document.RootElement, options); - } - - internal static MediaJobOutputCanceledEventData DeserializeMediaJobOutputCanceledEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobState previousState = default; - MediaJobOutput output = default; - IReadOnlyDictionary jobCorrelationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("output"u8)) - { - output = MediaJobOutput.DeserializeMediaJobOutput(property.Value, options); - continue; - } - if (property.NameEquals("jobCorrelationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobCorrelationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobOutputCanceledEventData(previousState, output, jobCorrelationData, 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(MediaJobOutputCanceledEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobOutputCanceledEventData 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 DeserializeMediaJobOutputCanceledEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobOutputCanceledEventData)} 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 MediaJobOutputCanceledEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobOutputCanceledEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCanceledEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCanceledEventData.cs deleted file mode 100644 index 55ec62b58492..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCanceledEventData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Job output canceled event data. Schema of the data property of an - /// EventGridEvent for a Microsoft.Media.JobOutputCanceled event. - /// - public partial class MediaJobOutputCanceledEventData : MediaJobOutputStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// or is null. - internal MediaJobOutputCanceledEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData) : base(previousState, output, jobCorrelationData) - { - Argument.AssertNotNull(output, nameof(output)); - Argument.AssertNotNull(jobCorrelationData, nameof(jobCorrelationData)); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobOutputCanceledEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData, IDictionary serializedAdditionalRawData) : base(previousState, output, jobCorrelationData, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MediaJobOutputCanceledEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCancelingEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCancelingEventData.Serialization.cs deleted file mode 100644 index e1447404365e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCancelingEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobOutputCancelingEventData : 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(MediaJobOutputCancelingEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MediaJobOutputCancelingEventData 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(MediaJobOutputCancelingEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobOutputCancelingEventData(document.RootElement, options); - } - - internal static MediaJobOutputCancelingEventData DeserializeMediaJobOutputCancelingEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobState previousState = default; - MediaJobOutput output = default; - IReadOnlyDictionary jobCorrelationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("output"u8)) - { - output = MediaJobOutput.DeserializeMediaJobOutput(property.Value, options); - continue; - } - if (property.NameEquals("jobCorrelationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobCorrelationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobOutputCancelingEventData(previousState, output, jobCorrelationData, 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(MediaJobOutputCancelingEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobOutputCancelingEventData 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 DeserializeMediaJobOutputCancelingEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobOutputCancelingEventData)} 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 MediaJobOutputCancelingEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobOutputCancelingEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCancelingEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCancelingEventData.cs deleted file mode 100644 index 30e7d163aaa6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputCancelingEventData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Job output canceling event data. Schema of the data property of an - /// EventGridEvent for a Microsoft.Media.JobOutputCanceling event. - /// - public partial class MediaJobOutputCancelingEventData : MediaJobOutputStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// or is null. - internal MediaJobOutputCancelingEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData) : base(previousState, output, jobCorrelationData) - { - Argument.AssertNotNull(output, nameof(output)); - Argument.AssertNotNull(jobCorrelationData, nameof(jobCorrelationData)); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobOutputCancelingEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData, IDictionary serializedAdditionalRawData) : base(previousState, output, jobCorrelationData, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MediaJobOutputCancelingEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputErroredEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputErroredEventData.Serialization.cs deleted file mode 100644 index ee7d8c142784..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputErroredEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobOutputErroredEventData : 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(MediaJobOutputErroredEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MediaJobOutputErroredEventData 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(MediaJobOutputErroredEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobOutputErroredEventData(document.RootElement, options); - } - - internal static MediaJobOutputErroredEventData DeserializeMediaJobOutputErroredEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobState previousState = default; - MediaJobOutput output = default; - IReadOnlyDictionary jobCorrelationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("output"u8)) - { - output = MediaJobOutput.DeserializeMediaJobOutput(property.Value, options); - continue; - } - if (property.NameEquals("jobCorrelationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobCorrelationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobOutputErroredEventData(previousState, output, jobCorrelationData, 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(MediaJobOutputErroredEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobOutputErroredEventData 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 DeserializeMediaJobOutputErroredEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobOutputErroredEventData)} 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 MediaJobOutputErroredEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobOutputErroredEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputErroredEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputErroredEventData.cs deleted file mode 100644 index 22535aa75e81..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputErroredEventData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Job output error event data. Schema of the data property of an EventGridEvent - /// for a Microsoft.Media.JobOutputErrored event. - /// - public partial class MediaJobOutputErroredEventData : MediaJobOutputStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// or is null. - internal MediaJobOutputErroredEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData) : base(previousState, output, jobCorrelationData) - { - Argument.AssertNotNull(output, nameof(output)); - Argument.AssertNotNull(jobCorrelationData, nameof(jobCorrelationData)); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobOutputErroredEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData, IDictionary serializedAdditionalRawData) : base(previousState, output, jobCorrelationData, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MediaJobOutputErroredEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputFinishedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputFinishedEventData.Serialization.cs deleted file mode 100644 index 129a88fa4d80..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputFinishedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobOutputFinishedEventData : 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(MediaJobOutputFinishedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MediaJobOutputFinishedEventData 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(MediaJobOutputFinishedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobOutputFinishedEventData(document.RootElement, options); - } - - internal static MediaJobOutputFinishedEventData DeserializeMediaJobOutputFinishedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobState previousState = default; - MediaJobOutput output = default; - IReadOnlyDictionary jobCorrelationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("output"u8)) - { - output = MediaJobOutput.DeserializeMediaJobOutput(property.Value, options); - continue; - } - if (property.NameEquals("jobCorrelationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobCorrelationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobOutputFinishedEventData(previousState, output, jobCorrelationData, 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(MediaJobOutputFinishedEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobOutputFinishedEventData 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 DeserializeMediaJobOutputFinishedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobOutputFinishedEventData)} 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 MediaJobOutputFinishedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobOutputFinishedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputFinishedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputFinishedEventData.cs deleted file mode 100644 index 701290e6f1cf..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputFinishedEventData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Job output finished event data. Schema of the data property of an - /// EventGridEvent for a Microsoft.Media.JobOutputFinished event. - /// - public partial class MediaJobOutputFinishedEventData : MediaJobOutputStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// or is null. - internal MediaJobOutputFinishedEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData) : base(previousState, output, jobCorrelationData) - { - Argument.AssertNotNull(output, nameof(output)); - Argument.AssertNotNull(jobCorrelationData, nameof(jobCorrelationData)); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobOutputFinishedEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData, IDictionary serializedAdditionalRawData) : base(previousState, output, jobCorrelationData, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MediaJobOutputFinishedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProcessingEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProcessingEventData.Serialization.cs deleted file mode 100644 index c07318cc5eab..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProcessingEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobOutputProcessingEventData : 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(MediaJobOutputProcessingEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MediaJobOutputProcessingEventData 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(MediaJobOutputProcessingEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobOutputProcessingEventData(document.RootElement, options); - } - - internal static MediaJobOutputProcessingEventData DeserializeMediaJobOutputProcessingEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobState previousState = default; - MediaJobOutput output = default; - IReadOnlyDictionary jobCorrelationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("output"u8)) - { - output = MediaJobOutput.DeserializeMediaJobOutput(property.Value, options); - continue; - } - if (property.NameEquals("jobCorrelationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobCorrelationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobOutputProcessingEventData(previousState, output, jobCorrelationData, 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(MediaJobOutputProcessingEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobOutputProcessingEventData 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 DeserializeMediaJobOutputProcessingEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobOutputProcessingEventData)} 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 MediaJobOutputProcessingEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobOutputProcessingEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProcessingEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProcessingEventData.cs deleted file mode 100644 index 1d4c4de32283..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProcessingEventData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Job output processing event data. Schema of the data property of an - /// EventGridEvent for a Microsoft.Media.JobOutputProcessing event. - /// - public partial class MediaJobOutputProcessingEventData : MediaJobOutputStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// or is null. - internal MediaJobOutputProcessingEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData) : base(previousState, output, jobCorrelationData) - { - Argument.AssertNotNull(output, nameof(output)); - Argument.AssertNotNull(jobCorrelationData, nameof(jobCorrelationData)); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobOutputProcessingEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData, IDictionary serializedAdditionalRawData) : base(previousState, output, jobCorrelationData, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MediaJobOutputProcessingEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProgressEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProgressEventData.Serialization.cs deleted file mode 100644 index dce247a47310..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProgressEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobOutputProgressEventData : 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(MediaJobOutputProgressEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Label)) - { - writer.WritePropertyName("label"u8); - writer.WriteStringValue(Label); - } - if (Optional.IsDefined(Progress)) - { - writer.WritePropertyName("progress"u8); - writer.WriteNumberValue(Progress.Value); - } - writer.WritePropertyName("jobCorrelationData"u8); - writer.WriteStartObject(); - foreach (var item in JobCorrelationData) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - 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 - } - } - } - - MediaJobOutputProgressEventData 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(MediaJobOutputProgressEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobOutputProgressEventData(document.RootElement, options); - } - - internal static MediaJobOutputProgressEventData DeserializeMediaJobOutputProgressEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string label = default; - long? progress = default; - IReadOnlyDictionary jobCorrelationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("label"u8)) - { - label = property.Value.GetString(); - continue; - } - if (property.NameEquals("progress"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - progress = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("jobCorrelationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobCorrelationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobOutputProgressEventData(label, progress, jobCorrelationData, 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(MediaJobOutputProgressEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobOutputProgressEventData 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 DeserializeMediaJobOutputProgressEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobOutputProgressEventData)} 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 MediaJobOutputProgressEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobOutputProgressEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProgressEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProgressEventData.cs deleted file mode 100644 index ea1d37aa0f91..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputProgressEventData.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Job Output Progress Event Data. Schema of the Data property of an - /// EventGridEvent for a Microsoft.Media.JobOutputProgress event. - /// - public partial class MediaJobOutputProgressEventData - { - /// - /// 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 . - /// Gets the Job correlation data. - /// is null. - internal MediaJobOutputProgressEventData(IReadOnlyDictionary jobCorrelationData) - { - Argument.AssertNotNull(jobCorrelationData, nameof(jobCorrelationData)); - - JobCorrelationData = jobCorrelationData; - } - - /// Initializes a new instance of . - /// Gets the Job output label. - /// Gets the Job output progress. - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobOutputProgressEventData(string label, long? progress, IReadOnlyDictionary jobCorrelationData, IDictionary serializedAdditionalRawData) - { - Label = label; - Progress = progress; - JobCorrelationData = jobCorrelationData; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MediaJobOutputProgressEventData() - { - } - - /// Gets the Job output label. - public string Label { get; } - /// Gets the Job output progress. - public long? Progress { get; } - /// Gets the Job correlation data. - public IReadOnlyDictionary JobCorrelationData { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputScheduledEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputScheduledEventData.Serialization.cs deleted file mode 100644 index 46d2415e5d34..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputScheduledEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobOutputScheduledEventData : 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(MediaJobOutputScheduledEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MediaJobOutputScheduledEventData 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(MediaJobOutputScheduledEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobOutputScheduledEventData(document.RootElement, options); - } - - internal static MediaJobOutputScheduledEventData DeserializeMediaJobOutputScheduledEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobState previousState = default; - MediaJobOutput output = default; - IReadOnlyDictionary jobCorrelationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("output"u8)) - { - output = MediaJobOutput.DeserializeMediaJobOutput(property.Value, options); - continue; - } - if (property.NameEquals("jobCorrelationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobCorrelationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobOutputScheduledEventData(previousState, output, jobCorrelationData, 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(MediaJobOutputScheduledEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobOutputScheduledEventData 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 DeserializeMediaJobOutputScheduledEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobOutputScheduledEventData)} 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 MediaJobOutputScheduledEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobOutputScheduledEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputScheduledEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputScheduledEventData.cs deleted file mode 100644 index a11011667492..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputScheduledEventData.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Job output scheduled event data. Schema of the data property of an - /// EventGridEvent for a Microsoft.Media.JobOutputScheduled event. - /// - public partial class MediaJobOutputScheduledEventData : MediaJobOutputStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// or is null. - internal MediaJobOutputScheduledEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData) : base(previousState, output, jobCorrelationData) - { - Argument.AssertNotNull(output, nameof(output)); - Argument.AssertNotNull(jobCorrelationData, nameof(jobCorrelationData)); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobOutputScheduledEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData, IDictionary serializedAdditionalRawData) : base(previousState, output, jobCorrelationData, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MediaJobOutputScheduledEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputStateChangeEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputStateChangeEventData.Serialization.cs deleted file mode 100644 index 7cf2827360e4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputStateChangeEventData.Serialization.cs +++ /dev/null @@ -1,169 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobOutputStateChangeEventData : 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(MediaJobOutputStateChangeEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("previousState"u8); - writer.WriteStringValue(PreviousState.ToString()); - writer.WritePropertyName("output"u8); - writer.WriteObjectValue(Output, options); - writer.WritePropertyName("jobCorrelationData"u8); - writer.WriteStartObject(); - foreach (var item in JobCorrelationData) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - 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 - } - } - } - - MediaJobOutputStateChangeEventData 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(MediaJobOutputStateChangeEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobOutputStateChangeEventData(document.RootElement, options); - } - - internal static MediaJobOutputStateChangeEventData DeserializeMediaJobOutputStateChangeEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobState previousState = default; - MediaJobOutput output = default; - IReadOnlyDictionary jobCorrelationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("output"u8)) - { - output = MediaJobOutput.DeserializeMediaJobOutput(property.Value, options); - continue; - } - if (property.NameEquals("jobCorrelationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - jobCorrelationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobOutputStateChangeEventData(previousState, output, jobCorrelationData, 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(MediaJobOutputStateChangeEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobOutputStateChangeEventData 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 DeserializeMediaJobOutputStateChangeEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobOutputStateChangeEventData)} 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 MediaJobOutputStateChangeEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobOutputStateChangeEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputStateChangeEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputStateChangeEventData.cs deleted file mode 100644 index d647fa5feff2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobOutputStateChangeEventData.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Schema of the Data property of an EventGridEvent for a - /// Microsoft.Media.JobOutputStateChange event. - /// - public partial class MediaJobOutputStateChangeEventData - { - /// - /// 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 previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// or is null. - internal MediaJobOutputStateChangeEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData) - { - Argument.AssertNotNull(output, nameof(output)); - Argument.AssertNotNull(jobCorrelationData, nameof(jobCorrelationData)); - - PreviousState = previousState; - Output = output; - JobCorrelationData = jobCorrelationData; - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// - /// Gets the 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 . - /// - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobOutputStateChangeEventData(MediaJobState previousState, MediaJobOutput output, IReadOnlyDictionary jobCorrelationData, IDictionary serializedAdditionalRawData) - { - PreviousState = previousState; - Output = output; - JobCorrelationData = jobCorrelationData; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MediaJobOutputStateChangeEventData() - { - } - - /// The previous state of the Job. - public MediaJobState PreviousState { get; } - /// - /// Gets the 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 . - /// - public MediaJobOutput Output { get; } - /// Gets the Job correlation data. - public IReadOnlyDictionary JobCorrelationData { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobProcessingEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobProcessingEventData.Serialization.cs deleted file mode 100644 index 093588eafc6b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobProcessingEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobProcessingEventData : 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(MediaJobProcessingEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MediaJobProcessingEventData 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(MediaJobProcessingEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobProcessingEventData(document.RootElement, options); - } - - internal static MediaJobProcessingEventData DeserializeMediaJobProcessingEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobState previousState = default; - MediaJobState state = default; - IReadOnlyDictionary correlationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("state"u8)) - { - state = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("correlationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - correlationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobProcessingEventData(previousState, state, correlationData, 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(MediaJobProcessingEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobProcessingEventData 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 DeserializeMediaJobProcessingEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobProcessingEventData)} 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 MediaJobProcessingEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobProcessingEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobProcessingEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobProcessingEventData.cs deleted file mode 100644 index 1298b135d442..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobProcessingEventData.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.Messaging.EventGrid.SystemEvents -{ - /// - /// Job processing event data. Schema of the data property of an EventGridEvent for - /// a Microsoft.Media.JobProcessing event. - /// - public partial class MediaJobProcessingEventData : MediaJobStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// is null. - internal MediaJobProcessingEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData) : base(previousState, state, correlationData) - { - Argument.AssertNotNull(correlationData, nameof(correlationData)); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobProcessingEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData, IDictionary serializedAdditionalRawData) : base(previousState, state, correlationData, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MediaJobProcessingEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobRetry.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobRetry.cs deleted file mode 100644 index cf01dfb61c9b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobRetry.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Media Job Retry Options. - public readonly partial struct MediaJobRetry : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MediaJobRetry(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DoNotRetryValue = "DoNotRetry"; - private const string MayRetryValue = "MayRetry"; - - /// Issue needs to be investigated and then the job resubmitted with corrections or retried once the underlying issue has been corrected. - public static MediaJobRetry DoNotRetry { get; } = new MediaJobRetry(DoNotRetryValue); - /// Issue may be resolved after waiting for a period of time and resubmitting the same Job. - public static MediaJobRetry MayRetry { get; } = new MediaJobRetry(MayRetryValue); - /// Determines if two values are the same. - public static bool operator ==(MediaJobRetry left, MediaJobRetry right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MediaJobRetry left, MediaJobRetry right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator MediaJobRetry(string value) => new MediaJobRetry(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MediaJobRetry other && Equals(other); - /// - public bool Equals(MediaJobRetry 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobScheduledEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobScheduledEventData.Serialization.cs deleted file mode 100644 index 3f381fba4854..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobScheduledEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobScheduledEventData : 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(MediaJobScheduledEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MediaJobScheduledEventData 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(MediaJobScheduledEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobScheduledEventData(document.RootElement, options); - } - - internal static MediaJobScheduledEventData DeserializeMediaJobScheduledEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobState previousState = default; - MediaJobState state = default; - IReadOnlyDictionary correlationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("state"u8)) - { - state = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("correlationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - correlationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobScheduledEventData(previousState, state, correlationData, 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(MediaJobScheduledEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobScheduledEventData 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 DeserializeMediaJobScheduledEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobScheduledEventData)} 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 MediaJobScheduledEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobScheduledEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobScheduledEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobScheduledEventData.cs deleted file mode 100644 index f7f96abda48f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobScheduledEventData.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.Messaging.EventGrid.SystemEvents -{ - /// - /// Job scheduled event data. Schema of the data property of an EventGridEvent for - /// a Microsoft.Media.JobScheduled event. - /// - public partial class MediaJobScheduledEventData : MediaJobStateChangeEventData - { - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// is null. - internal MediaJobScheduledEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData) : base(previousState, state, correlationData) - { - Argument.AssertNotNull(correlationData, nameof(correlationData)); - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobScheduledEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData, IDictionary serializedAdditionalRawData) : base(previousState, state, correlationData, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal MediaJobScheduledEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobState.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobState.cs deleted file mode 100644 index dafd83fecbd1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobState.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.Messaging.EventGrid.SystemEvents -{ - /// State of a Media Job. - public readonly partial struct MediaJobState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MediaJobState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string CanceledValue = "Canceled"; - private const string CancelingValue = "Canceling"; - private const string ErrorValue = "Error"; - private const string FinishedValue = "Finished"; - private const string ProcessingValue = "Processing"; - private const string QueuedValue = "Queued"; - private const string ScheduledValue = "Scheduled"; - - /// The job was canceled. This is a final state for the job. - public static MediaJobState Canceled { get; } = new MediaJobState(CanceledValue); - /// The job is in the process of being canceled. This is a transient state for the job. - public static MediaJobState Canceling { get; } = new MediaJobState(CancelingValue); - /// The job has encountered an error. This is a final state for the job. - public static MediaJobState Error { get; } = new MediaJobState(ErrorValue); - /// The job is finished. This is a final state for the job. - public static MediaJobState Finished { get; } = new MediaJobState(FinishedValue); - /// The job is processing. This is a transient state for the job. - public static MediaJobState Processing { get; } = new MediaJobState(ProcessingValue); - /// The job is in a queued state, waiting for resources to become available. This is a transient state. - public static MediaJobState Queued { get; } = new MediaJobState(QueuedValue); - /// The job is being scheduled to run on an available resource. This is a transient state, between queued and processing states. - public static MediaJobState Scheduled { get; } = new MediaJobState(ScheduledValue); - /// Determines if two values are the same. - public static bool operator ==(MediaJobState left, MediaJobState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MediaJobState left, MediaJobState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator MediaJobState(string value) => new MediaJobState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MediaJobState other && Equals(other); - /// - public bool Equals(MediaJobState 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobStateChangeEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobStateChangeEventData.Serialization.cs deleted file mode 100644 index 65b844ceb28b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobStateChangeEventData.Serialization.cs +++ /dev/null @@ -1,169 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaJobStateChangeEventData : 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(MediaJobStateChangeEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("previousState"u8); - writer.WriteStringValue(PreviousState.ToString()); - writer.WritePropertyName("state"u8); - writer.WriteStringValue(State.ToString()); - writer.WritePropertyName("correlationData"u8); - writer.WriteStartObject(); - foreach (var item in CorrelationData) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - 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 - } - } - } - - MediaJobStateChangeEventData 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(MediaJobStateChangeEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobStateChangeEventData(document.RootElement, options); - } - - internal static MediaJobStateChangeEventData DeserializeMediaJobStateChangeEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaJobState previousState = default; - MediaJobState state = default; - IReadOnlyDictionary correlationData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("previousState"u8)) - { - previousState = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("state"u8)) - { - state = new MediaJobState(property.Value.GetString()); - continue; - } - if (property.NameEquals("correlationData"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - correlationData = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaJobStateChangeEventData(previousState, state, correlationData, 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(MediaJobStateChangeEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaJobStateChangeEventData 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 DeserializeMediaJobStateChangeEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobStateChangeEventData)} 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 MediaJobStateChangeEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaJobStateChangeEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobStateChangeEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobStateChangeEventData.cs deleted file mode 100644 index ce4898df35b8..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaJobStateChangeEventData.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Schema of the Data property of an EventGridEvent for a - /// Microsoft.Media.JobStateChange event. - /// - public partial class MediaJobStateChangeEventData - { - /// - /// 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 previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// is null. - internal MediaJobStateChangeEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData) - { - Argument.AssertNotNull(correlationData, nameof(correlationData)); - - PreviousState = previousState; - State = state; - CorrelationData = correlationData; - } - - /// Initializes a new instance of . - /// The previous state of the Job. - /// The new state of the Job. - /// Gets the Job correlation data. - /// Keeps track of any properties unknown to the library. - internal MediaJobStateChangeEventData(MediaJobState previousState, MediaJobState state, IReadOnlyDictionary correlationData, IDictionary serializedAdditionalRawData) - { - PreviousState = previousState; - State = state; - CorrelationData = correlationData; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MediaJobStateChangeEventData() - { - } - - /// The previous state of the Job. - public MediaJobState PreviousState { get; } - /// The new state of the Job. - public MediaJobState State { get; } - /// Gets the Job correlation data. - public IReadOnlyDictionary CorrelationData { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventChannelArchiveHeartbeatEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventChannelArchiveHeartbeatEventData.Serialization.cs deleted file mode 100644 index 8e6b9507b93a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventChannelArchiveHeartbeatEventData.Serialization.cs +++ /dev/null @@ -1,150 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaLiveEventChannelArchiveHeartbeatEventData : 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(MediaLiveEventChannelArchiveHeartbeatEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("channelLatencyMs"u8); - writer.WriteStringValue(ChannelLatencyMs); - writer.WritePropertyName("latencyResultCode"u8); - writer.WriteStringValue(LatencyResultCode); - 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 - } - } - } - - MediaLiveEventChannelArchiveHeartbeatEventData 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(MediaLiveEventChannelArchiveHeartbeatEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaLiveEventChannelArchiveHeartbeatEventData(document.RootElement, options); - } - - internal static MediaLiveEventChannelArchiveHeartbeatEventData DeserializeMediaLiveEventChannelArchiveHeartbeatEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string channelLatencyMs = default; - string latencyResultCode = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("channelLatencyMs"u8)) - { - channelLatencyMs = property.Value.GetString(); - continue; - } - if (property.NameEquals("latencyResultCode"u8)) - { - latencyResultCode = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaLiveEventChannelArchiveHeartbeatEventData(channelLatencyMs, latencyResultCode, 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(MediaLiveEventChannelArchiveHeartbeatEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaLiveEventChannelArchiveHeartbeatEventData 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 DeserializeMediaLiveEventChannelArchiveHeartbeatEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaLiveEventChannelArchiveHeartbeatEventData)} 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 MediaLiveEventChannelArchiveHeartbeatEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaLiveEventChannelArchiveHeartbeatEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventChannelArchiveHeartbeatEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventChannelArchiveHeartbeatEventData.cs deleted file mode 100644 index 1a2e1674b510..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventChannelArchiveHeartbeatEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Channel Archive heartbeat event data. Schema of the data property of an EventGridEvent for a Microsoft.Media.LiveEventChannelArchiveHeartbeat event. - public partial class MediaLiveEventChannelArchiveHeartbeatEventData - { - /// - /// 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 . - /// Gets the channel latency in ms. - /// Gets the latency result code. - /// or is null. - internal MediaLiveEventChannelArchiveHeartbeatEventData(string channelLatencyMs, string latencyResultCode) - { - Argument.AssertNotNull(channelLatencyMs, nameof(channelLatencyMs)); - Argument.AssertNotNull(latencyResultCode, nameof(latencyResultCode)); - - ChannelLatencyMs = channelLatencyMs; - LatencyResultCode = latencyResultCode; - } - - /// Initializes a new instance of . - /// Gets the channel latency in ms. - /// Gets the latency result code. - /// Keeps track of any properties unknown to the library. - internal MediaLiveEventChannelArchiveHeartbeatEventData(string channelLatencyMs, string latencyResultCode, IDictionary serializedAdditionalRawData) - { - ChannelLatencyMs = channelLatencyMs; - LatencyResultCode = latencyResultCode; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MediaLiveEventChannelArchiveHeartbeatEventData() - { - } - - /// Gets the channel latency in ms. - public string ChannelLatencyMs { get; } - /// Gets the latency result code. - public string LatencyResultCode { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventConnectionRejectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventConnectionRejectedEventData.Serialization.cs deleted file mode 100644 index 4fb52f66dce3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventConnectionRejectedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaLiveEventConnectionRejectedEventData : 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(MediaLiveEventConnectionRejectedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IngestUrl)) - { - writer.WritePropertyName("ingestUrl"u8); - writer.WriteStringValue(IngestUrl); - } - if (Optional.IsDefined(StreamId)) - { - writer.WritePropertyName("streamId"u8); - writer.WriteStringValue(StreamId); - } - if (Optional.IsDefined(EncoderIp)) - { - writer.WritePropertyName("encoderIp"u8); - writer.WriteStringValue(EncoderIp); - } - if (Optional.IsDefined(EncoderPort)) - { - writer.WritePropertyName("encoderPort"u8); - writer.WriteStringValue(EncoderPort); - } - if (Optional.IsDefined(ResultCode)) - { - writer.WritePropertyName("resultCode"u8); - writer.WriteStringValue(ResultCode); - } - 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 - } - } - } - - MediaLiveEventConnectionRejectedEventData 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(MediaLiveEventConnectionRejectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaLiveEventConnectionRejectedEventData(document.RootElement, options); - } - - internal static MediaLiveEventConnectionRejectedEventData DeserializeMediaLiveEventConnectionRejectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string ingestUrl = default; - string streamId = default; - string encoderIp = default; - string encoderPort = default; - string resultCode = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ingestUrl"u8)) - { - ingestUrl = property.Value.GetString(); - continue; - } - if (property.NameEquals("streamId"u8)) - { - streamId = property.Value.GetString(); - continue; - } - if (property.NameEquals("encoderIp"u8)) - { - encoderIp = property.Value.GetString(); - continue; - } - if (property.NameEquals("encoderPort"u8)) - { - encoderPort = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultCode"u8)) - { - resultCode = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaLiveEventConnectionRejectedEventData( - ingestUrl, - streamId, - encoderIp, - encoderPort, - resultCode, - 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(MediaLiveEventConnectionRejectedEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaLiveEventConnectionRejectedEventData 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 DeserializeMediaLiveEventConnectionRejectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaLiveEventConnectionRejectedEventData)} 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 MediaLiveEventConnectionRejectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaLiveEventConnectionRejectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventConnectionRejectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventConnectionRejectedEventData.cs deleted file mode 100644 index 9e86f61c5768..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventConnectionRejectedEventData.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Encoder connection rejected event data. Schema of the data property of an EventGridEvent for a Microsoft.Media.LiveEventConnectionRejected event. - public partial class MediaLiveEventConnectionRejectedEventData - { - /// - /// 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 MediaLiveEventConnectionRejectedEventData() - { - } - - /// Initializes a new instance of . - /// Gets the ingest URL provided by the live event. - /// Gets the stream Id. - /// Gets the remote IP. - /// Gets the remote port. - /// Gets the result code. - /// Keeps track of any properties unknown to the library. - internal MediaLiveEventConnectionRejectedEventData(string ingestUrl, string streamId, string encoderIp, string encoderPort, string resultCode, IDictionary serializedAdditionalRawData) - { - IngestUrl = ingestUrl; - StreamId = streamId; - EncoderIp = encoderIp; - EncoderPort = encoderPort; - ResultCode = resultCode; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the ingest URL provided by the live event. - public string IngestUrl { get; } - /// Gets the stream Id. - public string StreamId { get; } - /// Gets the remote IP. - public string EncoderIp { get; } - /// Gets the remote port. - public string EncoderPort { get; } - /// Gets the result code. - public string ResultCode { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderConnectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderConnectedEventData.Serialization.cs deleted file mode 100644 index 8caba084c648..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderConnectedEventData.Serialization.cs +++ /dev/null @@ -1,178 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaLiveEventEncoderConnectedEventData : 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(MediaLiveEventEncoderConnectedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IngestUrl)) - { - writer.WritePropertyName("ingestUrl"u8); - writer.WriteStringValue(IngestUrl); - } - if (Optional.IsDefined(StreamId)) - { - writer.WritePropertyName("streamId"u8); - writer.WriteStringValue(StreamId); - } - if (Optional.IsDefined(EncoderIp)) - { - writer.WritePropertyName("encoderIp"u8); - writer.WriteStringValue(EncoderIp); - } - if (Optional.IsDefined(EncoderPort)) - { - writer.WritePropertyName("encoderPort"u8); - writer.WriteStringValue(EncoderPort); - } - 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 - } - } - } - - MediaLiveEventEncoderConnectedEventData 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(MediaLiveEventEncoderConnectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaLiveEventEncoderConnectedEventData(document.RootElement, options); - } - - internal static MediaLiveEventEncoderConnectedEventData DeserializeMediaLiveEventEncoderConnectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string ingestUrl = default; - string streamId = default; - string encoderIp = default; - string encoderPort = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ingestUrl"u8)) - { - ingestUrl = property.Value.GetString(); - continue; - } - if (property.NameEquals("streamId"u8)) - { - streamId = property.Value.GetString(); - continue; - } - if (property.NameEquals("encoderIp"u8)) - { - encoderIp = property.Value.GetString(); - continue; - } - if (property.NameEquals("encoderPort"u8)) - { - encoderPort = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaLiveEventEncoderConnectedEventData(ingestUrl, streamId, encoderIp, encoderPort, 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(MediaLiveEventEncoderConnectedEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaLiveEventEncoderConnectedEventData 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 DeserializeMediaLiveEventEncoderConnectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaLiveEventEncoderConnectedEventData)} 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 MediaLiveEventEncoderConnectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaLiveEventEncoderConnectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderConnectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderConnectedEventData.cs deleted file mode 100644 index ae72ea53ee7d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderConnectedEventData.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Encoder connect event data. Schema of the data property of an EventGridEvent for a Microsoft.Media.LiveEventEncoderConnected event. - public partial class MediaLiveEventEncoderConnectedEventData - { - /// - /// 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 MediaLiveEventEncoderConnectedEventData() - { - } - - /// Initializes a new instance of . - /// Gets the ingest URL provided by the live event. - /// Gets the stream Id. - /// Gets the remote IP. - /// Gets the remote port. - /// Keeps track of any properties unknown to the library. - internal MediaLiveEventEncoderConnectedEventData(string ingestUrl, string streamId, string encoderIp, string encoderPort, IDictionary serializedAdditionalRawData) - { - IngestUrl = ingestUrl; - StreamId = streamId; - EncoderIp = encoderIp; - EncoderPort = encoderPort; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the ingest URL provided by the live event. - public string IngestUrl { get; } - /// Gets the stream Id. - public string StreamId { get; } - /// Gets the remote IP. - public string EncoderIp { get; } - /// Gets the remote port. - public string EncoderPort { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderDisconnectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderDisconnectedEventData.Serialization.cs deleted file mode 100644 index a568208756a4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderDisconnectedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaLiveEventEncoderDisconnectedEventData : 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(MediaLiveEventEncoderDisconnectedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IngestUrl)) - { - writer.WritePropertyName("ingestUrl"u8); - writer.WriteStringValue(IngestUrl); - } - if (Optional.IsDefined(StreamId)) - { - writer.WritePropertyName("streamId"u8); - writer.WriteStringValue(StreamId); - } - if (Optional.IsDefined(EncoderIp)) - { - writer.WritePropertyName("encoderIp"u8); - writer.WriteStringValue(EncoderIp); - } - if (Optional.IsDefined(EncoderPort)) - { - writer.WritePropertyName("encoderPort"u8); - writer.WriteStringValue(EncoderPort); - } - if (Optional.IsDefined(ResultCode)) - { - writer.WritePropertyName("resultCode"u8); - writer.WriteStringValue(ResultCode); - } - 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 - } - } - } - - MediaLiveEventEncoderDisconnectedEventData 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(MediaLiveEventEncoderDisconnectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaLiveEventEncoderDisconnectedEventData(document.RootElement, options); - } - - internal static MediaLiveEventEncoderDisconnectedEventData DeserializeMediaLiveEventEncoderDisconnectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string ingestUrl = default; - string streamId = default; - string encoderIp = default; - string encoderPort = default; - string resultCode = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ingestUrl"u8)) - { - ingestUrl = property.Value.GetString(); - continue; - } - if (property.NameEquals("streamId"u8)) - { - streamId = property.Value.GetString(); - continue; - } - if (property.NameEquals("encoderIp"u8)) - { - encoderIp = property.Value.GetString(); - continue; - } - if (property.NameEquals("encoderPort"u8)) - { - encoderPort = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultCode"u8)) - { - resultCode = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaLiveEventEncoderDisconnectedEventData( - ingestUrl, - streamId, - encoderIp, - encoderPort, - resultCode, - 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(MediaLiveEventEncoderDisconnectedEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaLiveEventEncoderDisconnectedEventData 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 DeserializeMediaLiveEventEncoderDisconnectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaLiveEventEncoderDisconnectedEventData)} 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 MediaLiveEventEncoderDisconnectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaLiveEventEncoderDisconnectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderDisconnectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderDisconnectedEventData.cs deleted file mode 100644 index 93e701277824..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventEncoderDisconnectedEventData.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Encoder disconnected event data. Schema of the Data property of an EventGridEvent for a Microsoft.Media.LiveEventEncoderDisconnected event. - public partial class MediaLiveEventEncoderDisconnectedEventData - { - /// - /// 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 MediaLiveEventEncoderDisconnectedEventData() - { - } - - /// Initializes a new instance of . - /// Gets the ingest URL provided by the live event. - /// Gets the stream Id. - /// Gets the remote IP. - /// Gets the remote port. - /// Gets the result code. - /// Keeps track of any properties unknown to the library. - internal MediaLiveEventEncoderDisconnectedEventData(string ingestUrl, string streamId, string encoderIp, string encoderPort, string resultCode, IDictionary serializedAdditionalRawData) - { - IngestUrl = ingestUrl; - StreamId = streamId; - EncoderIp = encoderIp; - EncoderPort = encoderPort; - ResultCode = resultCode; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the ingest URL provided by the live event. - public string IngestUrl { get; } - /// Gets the stream Id. - public string StreamId { get; } - /// Gets the remote IP. - public string EncoderIp { get; } - /// Gets the remote port. - public string EncoderPort { get; } - /// Gets the result code. - public string ResultCode { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingDataChunkDroppedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingDataChunkDroppedEventData.Serialization.cs deleted file mode 100644 index 4692cd59910e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingDataChunkDroppedEventData.Serialization.cs +++ /dev/null @@ -1,199 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaLiveEventIncomingDataChunkDroppedEventData : 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(MediaLiveEventIncomingDataChunkDroppedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Timestamp)) - { - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp); - } - if (Optional.IsDefined(TrackType)) - { - writer.WritePropertyName("trackType"u8); - writer.WriteStringValue(TrackType); - } - if (Optional.IsDefined(Bitrate)) - { - writer.WritePropertyName("bitrate"u8); - writer.WriteNumberValue(Bitrate.Value); - } - if (Optional.IsDefined(ResultCode)) - { - writer.WritePropertyName("resultCode"u8); - writer.WriteStringValue(ResultCode); - } - if (Optional.IsDefined(TrackName)) - { - writer.WritePropertyName("trackName"u8); - writer.WriteStringValue(TrackName); - } - 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 - } - } - } - - MediaLiveEventIncomingDataChunkDroppedEventData 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(MediaLiveEventIncomingDataChunkDroppedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaLiveEventIncomingDataChunkDroppedEventData(document.RootElement, options); - } - - internal static MediaLiveEventIncomingDataChunkDroppedEventData DeserializeMediaLiveEventIncomingDataChunkDroppedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string timestamp = default; - string trackType = default; - long? bitrate = default; - string resultCode = default; - string trackName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("trackType"u8)) - { - trackType = property.Value.GetString(); - continue; - } - if (property.NameEquals("bitrate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - bitrate = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("resultCode"u8)) - { - resultCode = property.Value.GetString(); - continue; - } - if (property.NameEquals("trackName"u8)) - { - trackName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaLiveEventIncomingDataChunkDroppedEventData( - timestamp, - trackType, - bitrate, - resultCode, - trackName, - 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(MediaLiveEventIncomingDataChunkDroppedEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaLiveEventIncomingDataChunkDroppedEventData 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 DeserializeMediaLiveEventIncomingDataChunkDroppedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaLiveEventIncomingDataChunkDroppedEventData)} 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 MediaLiveEventIncomingDataChunkDroppedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaLiveEventIncomingDataChunkDroppedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingDataChunkDroppedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingDataChunkDroppedEventData.cs deleted file mode 100644 index c12a9ad19eb9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingDataChunkDroppedEventData.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Ingest fragment dropped event data. Schema of the data property of an EventGridEvent for a Microsoft.Media.LiveEventIncomingDataChunkDropped event. - public partial class MediaLiveEventIncomingDataChunkDroppedEventData - { - /// - /// 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 MediaLiveEventIncomingDataChunkDroppedEventData() - { - } - - /// Initializes a new instance of . - /// Gets the timestamp of the data chunk dropped. - /// Gets the type of the track (Audio / Video). - /// Gets the bitrate of the track. - /// Gets the result code for fragment drop operation. - /// Gets the name of the track for which fragment is dropped. - /// Keeps track of any properties unknown to the library. - internal MediaLiveEventIncomingDataChunkDroppedEventData(string timestamp, string trackType, long? bitrate, string resultCode, string trackName, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - TrackType = trackType; - Bitrate = bitrate; - ResultCode = resultCode; - TrackName = trackName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the timestamp of the data chunk dropped. - public string Timestamp { get; } - /// Gets the type of the track (Audio / Video). - public string TrackType { get; } - /// Gets the bitrate of the track. - public long? Bitrate { get; } - /// Gets the result code for fragment drop operation. - public string ResultCode { get; } - /// Gets the name of the track for which fragment is dropped. - public string TrackName { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamReceivedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamReceivedEventData.Serialization.cs deleted file mode 100644 index be42947c0456..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamReceivedEventData.Serialization.cs +++ /dev/null @@ -1,247 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaLiveEventIncomingStreamReceivedEventData : 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(MediaLiveEventIncomingStreamReceivedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IngestUrl)) - { - writer.WritePropertyName("ingestUrl"u8); - writer.WriteStringValue(IngestUrl); - } - if (Optional.IsDefined(TrackType)) - { - writer.WritePropertyName("trackType"u8); - writer.WriteStringValue(TrackType); - } - if (Optional.IsDefined(TrackName)) - { - writer.WritePropertyName("trackName"u8); - writer.WriteStringValue(TrackName); - } - if (Optional.IsDefined(Bitrate)) - { - writer.WritePropertyName("bitrate"u8); - writer.WriteNumberValue(Bitrate.Value); - } - if (Optional.IsDefined(EncoderIp)) - { - writer.WritePropertyName("encoderIp"u8); - writer.WriteStringValue(EncoderIp); - } - if (Optional.IsDefined(EncoderPort)) - { - writer.WritePropertyName("encoderPort"u8); - writer.WriteStringValue(EncoderPort); - } - if (Optional.IsDefined(Timestamp)) - { - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp); - } - if (Optional.IsDefined(Duration)) - { - writer.WritePropertyName("duration"u8); - writer.WriteStringValue(Duration); - } - if (Optional.IsDefined(Timescale)) - { - writer.WritePropertyName("timescale"u8); - writer.WriteStringValue(Timescale); - } - 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 - } - } - } - - MediaLiveEventIncomingStreamReceivedEventData 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(MediaLiveEventIncomingStreamReceivedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaLiveEventIncomingStreamReceivedEventData(document.RootElement, options); - } - - internal static MediaLiveEventIncomingStreamReceivedEventData DeserializeMediaLiveEventIncomingStreamReceivedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string ingestUrl = default; - string trackType = default; - string trackName = default; - long? bitrate = default; - string encoderIp = default; - string encoderPort = default; - string timestamp = default; - string duration = default; - string timescale = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ingestUrl"u8)) - { - ingestUrl = property.Value.GetString(); - continue; - } - if (property.NameEquals("trackType"u8)) - { - trackType = property.Value.GetString(); - continue; - } - if (property.NameEquals("trackName"u8)) - { - trackName = property.Value.GetString(); - continue; - } - if (property.NameEquals("bitrate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - bitrate = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("encoderIp"u8)) - { - encoderIp = property.Value.GetString(); - continue; - } - if (property.NameEquals("encoderPort"u8)) - { - encoderPort = property.Value.GetString(); - continue; - } - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("duration"u8)) - { - duration = property.Value.GetString(); - continue; - } - if (property.NameEquals("timescale"u8)) - { - timescale = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaLiveEventIncomingStreamReceivedEventData( - ingestUrl, - trackType, - trackName, - bitrate, - encoderIp, - encoderPort, - timestamp, - duration, - timescale, - 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(MediaLiveEventIncomingStreamReceivedEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaLiveEventIncomingStreamReceivedEventData 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 DeserializeMediaLiveEventIncomingStreamReceivedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaLiveEventIncomingStreamReceivedEventData)} 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 MediaLiveEventIncomingStreamReceivedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaLiveEventIncomingStreamReceivedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamReceivedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamReceivedEventData.cs deleted file mode 100644 index c16535f3a93b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamReceivedEventData.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Encoder connect event data. Schema of the data property of an EventGridEvent for a Microsoft.Media.LiveEventIncomingStreamReceived event. - public partial class MediaLiveEventIncomingStreamReceivedEventData - { - /// - /// 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 MediaLiveEventIncomingStreamReceivedEventData() - { - } - - /// Initializes a new instance of . - /// Gets the ingest URL provided by the live event. - /// Gets the type of the track (Audio / Video). - /// Gets the track name. - /// Gets the bitrate of the track. - /// Gets the remote IP. - /// Gets the remote port. - /// Gets the first timestamp of the data chunk received. - /// Gets the duration of the first data chunk. - /// Gets the timescale in which timestamp is represented. - /// Keeps track of any properties unknown to the library. - internal MediaLiveEventIncomingStreamReceivedEventData(string ingestUrl, string trackType, string trackName, long? bitrate, string encoderIp, string encoderPort, string timestamp, string duration, string timescale, IDictionary serializedAdditionalRawData) - { - IngestUrl = ingestUrl; - TrackType = trackType; - TrackName = trackName; - Bitrate = bitrate; - EncoderIp = encoderIp; - EncoderPort = encoderPort; - Timestamp = timestamp; - Duration = duration; - Timescale = timescale; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the ingest URL provided by the live event. - public string IngestUrl { get; } - /// Gets the type of the track (Audio / Video). - public string TrackType { get; } - /// Gets the track name. - public string TrackName { get; } - /// Gets the bitrate of the track. - public long? Bitrate { get; } - /// Gets the remote IP. - public string EncoderIp { get; } - /// Gets the remote port. - public string EncoderPort { get; } - /// Gets the first timestamp of the data chunk received. - public string Timestamp { get; } - /// Gets the duration of the first data chunk. - public string Duration { get; } - /// Gets the timescale in which timestamp is represented. - public string Timescale { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamsOutOfSyncEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamsOutOfSyncEventData.Serialization.cs deleted file mode 100644 index dc5a7de96c8d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamsOutOfSyncEventData.Serialization.cs +++ /dev/null @@ -1,207 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaLiveEventIncomingStreamsOutOfSyncEventData : 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(MediaLiveEventIncomingStreamsOutOfSyncEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(MinLastTimestamp)) - { - writer.WritePropertyName("minLastTimestamp"u8); - writer.WriteStringValue(MinLastTimestamp); - } - if (Optional.IsDefined(TypeOfStreamWithMinLastTimestamp)) - { - writer.WritePropertyName("typeOfStreamWithMinLastTimestamp"u8); - writer.WriteStringValue(TypeOfStreamWithMinLastTimestamp); - } - if (Optional.IsDefined(MaxLastTimestamp)) - { - writer.WritePropertyName("maxLastTimestamp"u8); - writer.WriteStringValue(MaxLastTimestamp); - } - if (Optional.IsDefined(TypeOfStreamWithMaxLastTimestamp)) - { - writer.WritePropertyName("typeOfStreamWithMaxLastTimestamp"u8); - writer.WriteStringValue(TypeOfStreamWithMaxLastTimestamp); - } - if (Optional.IsDefined(TimescaleOfMinLastTimestamp)) - { - writer.WritePropertyName("timescaleOfMinLastTimestamp"u8); - writer.WriteStringValue(TimescaleOfMinLastTimestamp); - } - if (Optional.IsDefined(TimescaleOfMaxLastTimestamp)) - { - writer.WritePropertyName("timescaleOfMaxLastTimestamp"u8); - writer.WriteStringValue(TimescaleOfMaxLastTimestamp); - } - 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 - } - } - } - - MediaLiveEventIncomingStreamsOutOfSyncEventData 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(MediaLiveEventIncomingStreamsOutOfSyncEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaLiveEventIncomingStreamsOutOfSyncEventData(document.RootElement, options); - } - - internal static MediaLiveEventIncomingStreamsOutOfSyncEventData DeserializeMediaLiveEventIncomingStreamsOutOfSyncEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string minLastTimestamp = default; - string typeOfStreamWithMinLastTimestamp = default; - string maxLastTimestamp = default; - string typeOfStreamWithMaxLastTimestamp = default; - string timescaleOfMinLastTimestamp = default; - string timescaleOfMaxLastTimestamp = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("minLastTimestamp"u8)) - { - minLastTimestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("typeOfStreamWithMinLastTimestamp"u8)) - { - typeOfStreamWithMinLastTimestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("maxLastTimestamp"u8)) - { - maxLastTimestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("typeOfStreamWithMaxLastTimestamp"u8)) - { - typeOfStreamWithMaxLastTimestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("timescaleOfMinLastTimestamp"u8)) - { - timescaleOfMinLastTimestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("timescaleOfMaxLastTimestamp"u8)) - { - timescaleOfMaxLastTimestamp = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaLiveEventIncomingStreamsOutOfSyncEventData( - minLastTimestamp, - typeOfStreamWithMinLastTimestamp, - maxLastTimestamp, - typeOfStreamWithMaxLastTimestamp, - timescaleOfMinLastTimestamp, - timescaleOfMaxLastTimestamp, - 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(MediaLiveEventIncomingStreamsOutOfSyncEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaLiveEventIncomingStreamsOutOfSyncEventData 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 DeserializeMediaLiveEventIncomingStreamsOutOfSyncEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaLiveEventIncomingStreamsOutOfSyncEventData)} 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 MediaLiveEventIncomingStreamsOutOfSyncEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaLiveEventIncomingStreamsOutOfSyncEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamsOutOfSyncEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamsOutOfSyncEventData.cs deleted file mode 100644 index 48d04136a2fd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingStreamsOutOfSyncEventData.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Incoming streams out of sync event data. Schema of the data property of an EventGridEvent for a Microsoft.Media.LiveEventIncomingStreamsOutOfSync event. - public partial class MediaLiveEventIncomingStreamsOutOfSyncEventData - { - /// - /// 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 MediaLiveEventIncomingStreamsOutOfSyncEventData() - { - } - - /// Initializes a new instance of . - /// Gets the minimum last timestamp received. - /// Gets the type of stream with minimum last timestamp. - /// Gets the maximum timestamp among all the tracks (audio or video). - /// Gets the type of stream with maximum last timestamp. - /// Gets the timescale in which \"MinLastTimestamp\" is represented. - /// Gets the timescale in which \"MaxLastTimestamp\" is represented. - /// Keeps track of any properties unknown to the library. - internal MediaLiveEventIncomingStreamsOutOfSyncEventData(string minLastTimestamp, string typeOfStreamWithMinLastTimestamp, string maxLastTimestamp, string typeOfStreamWithMaxLastTimestamp, string timescaleOfMinLastTimestamp, string timescaleOfMaxLastTimestamp, IDictionary serializedAdditionalRawData) - { - MinLastTimestamp = minLastTimestamp; - TypeOfStreamWithMinLastTimestamp = typeOfStreamWithMinLastTimestamp; - MaxLastTimestamp = maxLastTimestamp; - TypeOfStreamWithMaxLastTimestamp = typeOfStreamWithMaxLastTimestamp; - TimescaleOfMinLastTimestamp = timescaleOfMinLastTimestamp; - TimescaleOfMaxLastTimestamp = timescaleOfMaxLastTimestamp; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the minimum last timestamp received. - public string MinLastTimestamp { get; } - /// Gets the type of stream with minimum last timestamp. - public string TypeOfStreamWithMinLastTimestamp { get; } - /// Gets the maximum timestamp among all the tracks (audio or video). - public string MaxLastTimestamp { get; } - /// Gets the type of stream with maximum last timestamp. - public string TypeOfStreamWithMaxLastTimestamp { get; } - /// Gets the timescale in which \"MinLastTimestamp\" is represented. - public string TimescaleOfMinLastTimestamp { get; } - /// Gets the timescale in which \"MaxLastTimestamp\" is represented. - public string TimescaleOfMaxLastTimestamp { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingVideoStreamsOutOfSyncEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingVideoStreamsOutOfSyncEventData.Serialization.cs deleted file mode 100644 index cdf63959dbb9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingVideoStreamsOutOfSyncEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaLiveEventIncomingVideoStreamsOutOfSyncEventData : 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(MediaLiveEventIncomingVideoStreamsOutOfSyncEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(FirstTimestamp)) - { - writer.WritePropertyName("firstTimestamp"u8); - writer.WriteStringValue(FirstTimestamp); - } - if (Optional.IsDefined(FirstDuration)) - { - writer.WritePropertyName("firstDuration"u8); - writer.WriteStringValue(FirstDuration); - } - if (Optional.IsDefined(SecondTimestamp)) - { - writer.WritePropertyName("secondTimestamp"u8); - writer.WriteStringValue(SecondTimestamp); - } - if (Optional.IsDefined(SecondDuration)) - { - writer.WritePropertyName("secondDuration"u8); - writer.WriteStringValue(SecondDuration); - } - if (Optional.IsDefined(Timescale)) - { - writer.WritePropertyName("timescale"u8); - writer.WriteStringValue(Timescale); - } - 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 - } - } - } - - MediaLiveEventIncomingVideoStreamsOutOfSyncEventData 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(MediaLiveEventIncomingVideoStreamsOutOfSyncEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaLiveEventIncomingVideoStreamsOutOfSyncEventData(document.RootElement, options); - } - - internal static MediaLiveEventIncomingVideoStreamsOutOfSyncEventData DeserializeMediaLiveEventIncomingVideoStreamsOutOfSyncEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string firstTimestamp = default; - string firstDuration = default; - string secondTimestamp = default; - string secondDuration = default; - string timescale = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("firstTimestamp"u8)) - { - firstTimestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("firstDuration"u8)) - { - firstDuration = property.Value.GetString(); - continue; - } - if (property.NameEquals("secondTimestamp"u8)) - { - secondTimestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("secondDuration"u8)) - { - secondDuration = property.Value.GetString(); - continue; - } - if (property.NameEquals("timescale"u8)) - { - timescale = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaLiveEventIncomingVideoStreamsOutOfSyncEventData( - firstTimestamp, - firstDuration, - secondTimestamp, - secondDuration, - timescale, - 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(MediaLiveEventIncomingVideoStreamsOutOfSyncEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaLiveEventIncomingVideoStreamsOutOfSyncEventData 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 DeserializeMediaLiveEventIncomingVideoStreamsOutOfSyncEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaLiveEventIncomingVideoStreamsOutOfSyncEventData)} 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 MediaLiveEventIncomingVideoStreamsOutOfSyncEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaLiveEventIncomingVideoStreamsOutOfSyncEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingVideoStreamsOutOfSyncEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingVideoStreamsOutOfSyncEventData.cs deleted file mode 100644 index 00316740b3de..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIncomingVideoStreamsOutOfSyncEventData.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Incoming video stream out of sync event data. Schema of the data property of an EventGridEvent for a Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync event. - public partial class MediaLiveEventIncomingVideoStreamsOutOfSyncEventData - { - /// - /// 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 MediaLiveEventIncomingVideoStreamsOutOfSyncEventData() - { - } - - /// Initializes a new instance of . - /// Gets the first timestamp received for one of the quality levels. - /// Gets the duration of the data chunk with first timestamp. - /// Gets the timestamp received for some other quality levels. - /// Gets the duration of the data chunk with second timestamp. - /// Gets the timescale in which both the timestamps and durations are represented. - /// Keeps track of any properties unknown to the library. - internal MediaLiveEventIncomingVideoStreamsOutOfSyncEventData(string firstTimestamp, string firstDuration, string secondTimestamp, string secondDuration, string timescale, IDictionary serializedAdditionalRawData) - { - FirstTimestamp = firstTimestamp; - FirstDuration = firstDuration; - SecondTimestamp = secondTimestamp; - SecondDuration = secondDuration; - Timescale = timescale; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the first timestamp received for one of the quality levels. - public string FirstTimestamp { get; } - /// Gets the duration of the data chunk with first timestamp. - public string FirstDuration { get; } - /// Gets the timestamp received for some other quality levels. - public string SecondTimestamp { get; } - /// Gets the duration of the data chunk with second timestamp. - public string SecondDuration { get; } - /// Gets the timescale in which both the timestamps and durations are represented. - public string Timescale { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIngestHeartbeatEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIngestHeartbeatEventData.Serialization.cs deleted file mode 100644 index 2e196fa43664..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIngestHeartbeatEventData.Serialization.cs +++ /dev/null @@ -1,355 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaLiveEventIngestHeartbeatEventData : 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(MediaLiveEventIngestHeartbeatEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TrackType)) - { - writer.WritePropertyName("trackType"u8); - writer.WriteStringValue(TrackType); - } - if (Optional.IsDefined(TrackName)) - { - writer.WritePropertyName("trackName"u8); - writer.WriteStringValue(TrackName); - } - if (Optional.IsDefined(TranscriptionLanguage)) - { - writer.WritePropertyName("transcriptionLanguage"u8); - writer.WriteStringValue(TranscriptionLanguage); - } - if (Optional.IsDefined(TranscriptionState)) - { - writer.WritePropertyName("transcriptionState"u8); - writer.WriteStringValue(TranscriptionState); - } - if (Optional.IsDefined(Bitrate)) - { - writer.WritePropertyName("bitrate"u8); - writer.WriteNumberValue(Bitrate.Value); - } - if (Optional.IsDefined(IncomingBitrate)) - { - writer.WritePropertyName("incomingBitrate"u8); - writer.WriteNumberValue(IncomingBitrate.Value); - } - if (Optional.IsDefined(IngestDriftValue)) - { - writer.WritePropertyName("ingestDriftValue"u8); - writer.WriteStringValue(IngestDriftValue); - } - if (Optional.IsDefined(LastFragmentArrivalTime)) - { - writer.WritePropertyName("lastFragmentArrivalTime"u8); - writer.WriteStringValue(LastFragmentArrivalTime); - } - if (Optional.IsDefined(LastTimestamp)) - { - writer.WritePropertyName("lastTimestamp"u8); - writer.WriteStringValue(LastTimestamp); - } - if (Optional.IsDefined(Timescale)) - { - writer.WritePropertyName("timescale"u8); - writer.WriteStringValue(Timescale); - } - if (Optional.IsDefined(OverlapCount)) - { - writer.WritePropertyName("overlapCount"u8); - writer.WriteNumberValue(OverlapCount.Value); - } - if (Optional.IsDefined(DiscontinuityCount)) - { - writer.WritePropertyName("discontinuityCount"u8); - writer.WriteNumberValue(DiscontinuityCount.Value); - } - if (Optional.IsDefined(NonincreasingCount)) - { - writer.WritePropertyName("nonincreasingCount"u8); - writer.WriteNumberValue(NonincreasingCount.Value); - } - if (Optional.IsDefined(UnexpectedBitrate)) - { - writer.WritePropertyName("unexpectedBitrate"u8); - writer.WriteBooleanValue(UnexpectedBitrate.Value); - } - if (Optional.IsDefined(State)) - { - writer.WritePropertyName("state"u8); - writer.WriteStringValue(State); - } - if (Optional.IsDefined(Healthy)) - { - writer.WritePropertyName("healthy"u8); - writer.WriteBooleanValue(Healthy.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MediaLiveEventIngestHeartbeatEventData 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(MediaLiveEventIngestHeartbeatEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaLiveEventIngestHeartbeatEventData(document.RootElement, options); - } - - internal static MediaLiveEventIngestHeartbeatEventData DeserializeMediaLiveEventIngestHeartbeatEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string trackType = default; - string trackName = default; - string transcriptionLanguage = default; - string transcriptionState = default; - long? bitrate = default; - long? incomingBitrate = default; - string ingestDriftValue = default; - string lastFragmentArrivalTime = default; - string lastTimestamp = default; - string timescale = default; - long? overlapCount = default; - long? discontinuityCount = default; - long? nonincreasingCount = default; - bool? unexpectedBitrate = default; - string state = default; - bool? healthy = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("trackType"u8)) - { - trackType = property.Value.GetString(); - continue; - } - if (property.NameEquals("trackName"u8)) - { - trackName = property.Value.GetString(); - continue; - } - if (property.NameEquals("transcriptionLanguage"u8)) - { - transcriptionLanguage = property.Value.GetString(); - continue; - } - if (property.NameEquals("transcriptionState"u8)) - { - transcriptionState = property.Value.GetString(); - continue; - } - if (property.NameEquals("bitrate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - bitrate = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("incomingBitrate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - incomingBitrate = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("ingestDriftValue"u8)) - { - ingestDriftValue = property.Value.GetString(); - continue; - } - if (property.NameEquals("lastFragmentArrivalTime"u8)) - { - lastFragmentArrivalTime = property.Value.GetString(); - continue; - } - if (property.NameEquals("lastTimestamp"u8)) - { - lastTimestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("timescale"u8)) - { - timescale = property.Value.GetString(); - continue; - } - if (property.NameEquals("overlapCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - overlapCount = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("discontinuityCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - discontinuityCount = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("nonincreasingCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nonincreasingCount = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("unexpectedBitrate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - unexpectedBitrate = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("state"u8)) - { - state = property.Value.GetString(); - continue; - } - if (property.NameEquals("healthy"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - healthy = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaLiveEventIngestHeartbeatEventData( - trackType, - trackName, - transcriptionLanguage, - transcriptionState, - bitrate, - incomingBitrate, - ingestDriftValue, - lastFragmentArrivalTime, - lastTimestamp, - timescale, - overlapCount, - discontinuityCount, - nonincreasingCount, - unexpectedBitrate, - state, - healthy, - 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(MediaLiveEventIngestHeartbeatEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaLiveEventIngestHeartbeatEventData 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 DeserializeMediaLiveEventIngestHeartbeatEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaLiveEventIngestHeartbeatEventData)} 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 MediaLiveEventIngestHeartbeatEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaLiveEventIngestHeartbeatEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIngestHeartbeatEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIngestHeartbeatEventData.cs deleted file mode 100644 index 0171662bcace..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventIngestHeartbeatEventData.cs +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Ingest heartbeat event data. Schema of the data property of an EventGridEvent for a Microsoft.Media.LiveEventIngestHeartbeat event. - public partial class MediaLiveEventIngestHeartbeatEventData - { - /// - /// 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 MediaLiveEventIngestHeartbeatEventData() - { - } - - /// Initializes a new instance of . - /// Gets the type of the track (Audio / Video). - /// Gets the track name. - /// Gets the Live Transcription language. - /// Gets the Live Transcription state. - /// Gets the bitrate of the track. - /// Gets the incoming bitrate. - /// Gets the track ingest drift value. - /// Gets the arrival UTC time of the last fragment. - /// Gets the last timestamp. - /// Gets the timescale of the last timestamp. - /// Gets the fragment Overlap count. - /// Gets the fragment Discontinuity count. - /// Gets Non increasing count. - /// Gets a value indicating whether unexpected bitrate is present or not. - /// Gets the state of the live event. - /// Gets a value indicating whether preview is healthy or not. - /// Keeps track of any properties unknown to the library. - internal MediaLiveEventIngestHeartbeatEventData(string trackType, string trackName, string transcriptionLanguage, string transcriptionState, long? bitrate, long? incomingBitrate, string ingestDriftValue, string lastFragmentArrivalTime, string lastTimestamp, string timescale, long? overlapCount, long? discontinuityCount, long? nonincreasingCount, bool? unexpectedBitrate, string state, bool? healthy, IDictionary serializedAdditionalRawData) - { - TrackType = trackType; - TrackName = trackName; - TranscriptionLanguage = transcriptionLanguage; - TranscriptionState = transcriptionState; - Bitrate = bitrate; - IncomingBitrate = incomingBitrate; - IngestDriftValue = ingestDriftValue; - LastFragmentArrivalTime = lastFragmentArrivalTime; - LastTimestamp = lastTimestamp; - Timescale = timescale; - OverlapCount = overlapCount; - DiscontinuityCount = discontinuityCount; - NonincreasingCount = nonincreasingCount; - UnexpectedBitrate = unexpectedBitrate; - State = state; - Healthy = healthy; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the type of the track (Audio / Video). - public string TrackType { get; } - /// Gets the track name. - public string TrackName { get; } - /// Gets the Live Transcription language. - public string TranscriptionLanguage { get; } - /// Gets the Live Transcription state. - public string TranscriptionState { get; } - /// Gets the bitrate of the track. - public long? Bitrate { get; } - /// Gets the incoming bitrate. - public long? IncomingBitrate { get; } - /// Gets the track ingest drift value. - public string IngestDriftValue { get; } - /// Gets the arrival UTC time of the last fragment. - public string LastFragmentArrivalTime { get; } - /// Gets the last timestamp. - public string LastTimestamp { get; } - /// Gets the timescale of the last timestamp. - public string Timescale { get; } - /// Gets the fragment Overlap count. - public long? OverlapCount { get; } - /// Gets the fragment Discontinuity count. - public long? DiscontinuityCount { get; } - /// Gets Non increasing count. - public long? NonincreasingCount { get; } - /// Gets a value indicating whether unexpected bitrate is present or not. - public bool? UnexpectedBitrate { get; } - /// Gets the state of the live event. - public string State { get; } - /// Gets a value indicating whether preview is healthy or not. - public bool? Healthy { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventTrackDiscontinuityDetectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventTrackDiscontinuityDetectedEventData.Serialization.cs deleted file mode 100644 index 58ca54e43916..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventTrackDiscontinuityDetectedEventData.Serialization.cs +++ /dev/null @@ -1,223 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MediaLiveEventTrackDiscontinuityDetectedEventData : 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(MediaLiveEventTrackDiscontinuityDetectedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TrackType)) - { - writer.WritePropertyName("trackType"u8); - writer.WriteStringValue(TrackType); - } - if (Optional.IsDefined(TrackName)) - { - writer.WritePropertyName("trackName"u8); - writer.WriteStringValue(TrackName); - } - if (Optional.IsDefined(Bitrate)) - { - writer.WritePropertyName("bitrate"u8); - writer.WriteNumberValue(Bitrate.Value); - } - if (Optional.IsDefined(PreviousTimestamp)) - { - writer.WritePropertyName("previousTimestamp"u8); - writer.WriteStringValue(PreviousTimestamp); - } - if (Optional.IsDefined(NewTimestamp)) - { - writer.WritePropertyName("newTimestamp"u8); - writer.WriteStringValue(NewTimestamp); - } - if (Optional.IsDefined(Timescale)) - { - writer.WritePropertyName("timescale"u8); - writer.WriteStringValue(Timescale); - } - if (Optional.IsDefined(DiscontinuityGap)) - { - writer.WritePropertyName("discontinuityGap"u8); - writer.WriteStringValue(DiscontinuityGap); - } - 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 - } - } - } - - MediaLiveEventTrackDiscontinuityDetectedEventData 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(MediaLiveEventTrackDiscontinuityDetectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaLiveEventTrackDiscontinuityDetectedEventData(document.RootElement, options); - } - - internal static MediaLiveEventTrackDiscontinuityDetectedEventData DeserializeMediaLiveEventTrackDiscontinuityDetectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string trackType = default; - string trackName = default; - long? bitrate = default; - string previousTimestamp = default; - string newTimestamp = default; - string timescale = default; - string discontinuityGap = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("trackType"u8)) - { - trackType = property.Value.GetString(); - continue; - } - if (property.NameEquals("trackName"u8)) - { - trackName = property.Value.GetString(); - continue; - } - if (property.NameEquals("bitrate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - bitrate = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("previousTimestamp"u8)) - { - previousTimestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("newTimestamp"u8)) - { - newTimestamp = property.Value.GetString(); - continue; - } - if (property.NameEquals("timescale"u8)) - { - timescale = property.Value.GetString(); - continue; - } - if (property.NameEquals("discontinuityGap"u8)) - { - discontinuityGap = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MediaLiveEventTrackDiscontinuityDetectedEventData( - trackType, - trackName, - bitrate, - previousTimestamp, - newTimestamp, - timescale, - discontinuityGap, - 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(MediaLiveEventTrackDiscontinuityDetectedEventData)} does not support writing '{options.Format}' format."); - } - } - - MediaLiveEventTrackDiscontinuityDetectedEventData 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 DeserializeMediaLiveEventTrackDiscontinuityDetectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaLiveEventTrackDiscontinuityDetectedEventData)} 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 MediaLiveEventTrackDiscontinuityDetectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMediaLiveEventTrackDiscontinuityDetectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventTrackDiscontinuityDetectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventTrackDiscontinuityDetectedEventData.cs deleted file mode 100644 index e077f783f04a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MediaLiveEventTrackDiscontinuityDetectedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Ingest track discontinuity detected event data. Schema of the data property of an EventGridEvent for a Microsoft.Media.LiveEventTrackDiscontinuityDetected event. - public partial class MediaLiveEventTrackDiscontinuityDetectedEventData - { - /// - /// 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 MediaLiveEventTrackDiscontinuityDetectedEventData() - { - } - - /// Initializes a new instance of . - /// Gets the type of the track (Audio / Video). - /// Gets the track name. - /// Gets the bitrate. - /// Gets the timestamp of the previous fragment. - /// Gets the timestamp of the current fragment. - /// Gets the timescale in which both timestamps and discontinuity gap are represented. - /// Gets the discontinuity gap between PreviousTimestamp and NewTimestamp. - /// Keeps track of any properties unknown to the library. - internal MediaLiveEventTrackDiscontinuityDetectedEventData(string trackType, string trackName, long? bitrate, string previousTimestamp, string newTimestamp, string timescale, string discontinuityGap, IDictionary serializedAdditionalRawData) - { - TrackType = trackType; - TrackName = trackName; - Bitrate = bitrate; - PreviousTimestamp = previousTimestamp; - NewTimestamp = newTimestamp; - Timescale = timescale; - DiscontinuityGap = discontinuityGap; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the type of the track (Audio / Video). - public string TrackType { get; } - /// Gets the track name. - public string TrackName { get; } - /// Gets the bitrate. - public long? Bitrate { get; } - /// Gets the timestamp of the previous fragment. - public string PreviousTimestamp { get; } - /// Gets the timestamp of the current fragment. - public string NewTimestamp { get; } - /// Gets the timescale in which both timestamps and discontinuity gap are represented. - public string Timescale { get; } - /// Gets the discontinuity gap between PreviousTimestamp and NewTimestamp. - public string DiscontinuityGap { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsAppIdentifierModel.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsAppIdentifierModel.Serialization.cs deleted file mode 100644 index 3c142425d7d9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsAppIdentifierModel.Serialization.cs +++ /dev/null @@ -1,150 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MicrosoftTeamsAppIdentifierModel : 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(MicrosoftTeamsAppIdentifierModel)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appId"u8); - writer.WriteStringValue(AppId); - writer.WritePropertyName("cloud"u8); - writer.WriteStringValue(Cloud.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MicrosoftTeamsAppIdentifierModel 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(MicrosoftTeamsAppIdentifierModel)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMicrosoftTeamsAppIdentifierModel(document.RootElement, options); - } - - internal static MicrosoftTeamsAppIdentifierModel DeserializeMicrosoftTeamsAppIdentifierModel(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string appId = default; - CommunicationCloudEnvironmentModel cloud = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appId"u8)) - { - appId = property.Value.GetString(); - continue; - } - if (property.NameEquals("cloud"u8)) - { - cloud = new CommunicationCloudEnvironmentModel(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MicrosoftTeamsAppIdentifierModel(appId, cloud, 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(MicrosoftTeamsAppIdentifierModel)} does not support writing '{options.Format}' format."); - } - } - - MicrosoftTeamsAppIdentifierModel 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 DeserializeMicrosoftTeamsAppIdentifierModel(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MicrosoftTeamsAppIdentifierModel)} 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 MicrosoftTeamsAppIdentifierModel FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMicrosoftTeamsAppIdentifierModel(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsAppIdentifierModel.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsAppIdentifierModel.cs deleted file mode 100644 index 41e1a566a23f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsAppIdentifierModel.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// A Microsoft Teams application. - public partial class MicrosoftTeamsAppIdentifierModel - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The Id of the Microsoft Teams application. - /// The cloud that the Microsoft Teams application belongs to. By default 'public' if missing. - /// is null. - internal MicrosoftTeamsAppIdentifierModel(string appId, CommunicationCloudEnvironmentModel cloud) - { - Argument.AssertNotNull(appId, nameof(appId)); - - AppId = appId; - Cloud = cloud; - } - - /// Initializes a new instance of . - /// The Id of the Microsoft Teams application. - /// The cloud that the Microsoft Teams application belongs to. By default 'public' if missing. - /// Keeps track of any properties unknown to the library. - internal MicrosoftTeamsAppIdentifierModel(string appId, CommunicationCloudEnvironmentModel cloud, IDictionary serializedAdditionalRawData) - { - AppId = appId; - Cloud = cloud; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MicrosoftTeamsAppIdentifierModel() - { - } - - /// The Id of the Microsoft Teams application. - public string AppId { get; } - /// The cloud that the Microsoft Teams application belongs to. By default 'public' if missing. - public CommunicationCloudEnvironmentModel Cloud { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsUserIdentifierModel.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsUserIdentifierModel.Serialization.cs deleted file mode 100644 index 954ae03dd03a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsUserIdentifierModel.Serialization.cs +++ /dev/null @@ -1,165 +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.Messaging.EventGrid.SystemEvents -{ - public partial class MicrosoftTeamsUserIdentifierModel : 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(MicrosoftTeamsUserIdentifierModel)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("userId"u8); - writer.WriteStringValue(UserId); - if (Optional.IsDefined(IsAnonymous)) - { - writer.WritePropertyName("isAnonymous"u8); - writer.WriteBooleanValue(IsAnonymous.Value); - } - writer.WritePropertyName("cloud"u8); - writer.WriteStringValue(Cloud.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MicrosoftTeamsUserIdentifierModel 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(MicrosoftTeamsUserIdentifierModel)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMicrosoftTeamsUserIdentifierModel(document.RootElement, options); - } - - internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserIdentifierModel(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string userId = default; - bool? isAnonymous = default; - CommunicationCloudEnvironmentModel cloud = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("userId"u8)) - { - userId = property.Value.GetString(); - continue; - } - if (property.NameEquals("isAnonymous"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isAnonymous = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("cloud"u8)) - { - cloud = new CommunicationCloudEnvironmentModel(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MicrosoftTeamsUserIdentifierModel(userId, isAnonymous, cloud, 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(MicrosoftTeamsUserIdentifierModel)} does not support writing '{options.Format}' format."); - } - } - - MicrosoftTeamsUserIdentifierModel 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 DeserializeMicrosoftTeamsUserIdentifierModel(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MicrosoftTeamsUserIdentifierModel)} 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 MicrosoftTeamsUserIdentifierModel FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMicrosoftTeamsUserIdentifierModel(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsUserIdentifierModel.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsUserIdentifierModel.cs deleted file mode 100644 index d8958e4d8035..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/MicrosoftTeamsUserIdentifierModel.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// A Microsoft Teams user. - public partial class MicrosoftTeamsUserIdentifierModel - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. - /// The cloud that the Microsoft Teams user belongs to. By default 'public' if missing. - /// is null. - internal MicrosoftTeamsUserIdentifierModel(string userId, CommunicationCloudEnvironmentModel cloud) - { - Argument.AssertNotNull(userId, nameof(userId)); - - UserId = userId; - Cloud = cloud; - } - - /// Initializes a new instance of . - /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. - /// True if the Microsoft Teams user is anonymous. By default false if missing. - /// The cloud that the Microsoft Teams user belongs to. By default 'public' if missing. - /// Keeps track of any properties unknown to the library. - internal MicrosoftTeamsUserIdentifierModel(string userId, bool? isAnonymous, CommunicationCloudEnvironmentModel cloud, IDictionary serializedAdditionalRawData) - { - UserId = userId; - IsAnonymous = isAnonymous; - Cloud = cloud; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MicrosoftTeamsUserIdentifierModel() - { - } - - /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. - public string UserId { get; } - /// True if the Microsoft Teams user is anonymous. By default false if missing. - public bool? IsAnonymous { get; } - /// The cloud that the Microsoft Teams user belongs to. By default 'public' if missing. - public CommunicationCloudEnvironmentModel Cloud { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PhoneNumberIdentifierModel.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PhoneNumberIdentifierModel.Serialization.cs deleted file mode 100644 index 9e5867b71f14..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PhoneNumberIdentifierModel.Serialization.cs +++ /dev/null @@ -1,142 +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.Messaging.EventGrid.SystemEvents -{ - public partial class PhoneNumberIdentifierModel : 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(PhoneNumberIdentifierModel)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("value"u8); - writer.WriteStringValue(Value); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - PhoneNumberIdentifierModel 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(PhoneNumberIdentifierModel)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePhoneNumberIdentifierModel(document.RootElement, options); - } - - internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string value = 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 (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PhoneNumberIdentifierModel(value, 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(PhoneNumberIdentifierModel)} does not support writing '{options.Format}' format."); - } - } - - PhoneNumberIdentifierModel 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 DeserializePhoneNumberIdentifierModel(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PhoneNumberIdentifierModel)} 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 PhoneNumberIdentifierModel FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializePhoneNumberIdentifierModel(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PhoneNumberIdentifierModel.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PhoneNumberIdentifierModel.cs deleted file mode 100644 index fab888938068..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PhoneNumberIdentifierModel.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// A phone number. - public partial class PhoneNumberIdentifierModel - { - /// - /// 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 phone number in E.164 format. - /// is null. - internal PhoneNumberIdentifierModel(string value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value; - } - - /// Initializes a new instance of . - /// The phone number in E.164 format. - /// Keeps track of any properties unknown to the library. - internal PhoneNumberIdentifierModel(string value, IDictionary serializedAdditionalRawData) - { - Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PhoneNumberIdentifierModel() - { - } - - /// The phone number in E.164 format. - public string Value { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateChangedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateChangedEventData.Serialization.cs deleted file mode 100644 index d0a89e1b3172..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateChangedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class PolicyInsightsPolicyStateChangedEventData : 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(PolicyInsightsPolicyStateChangedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(PolicyAssignmentId)) - { - writer.WritePropertyName("policyAssignmentId"u8); - writer.WriteStringValue(PolicyAssignmentId); - } - if (Optional.IsDefined(PolicyDefinitionId)) - { - writer.WritePropertyName("policyDefinitionId"u8); - writer.WriteStringValue(PolicyDefinitionId); - } - if (Optional.IsDefined(PolicyDefinitionReferenceId)) - { - writer.WritePropertyName("policyDefinitionReferenceId"u8); - writer.WriteStringValue(PolicyDefinitionReferenceId); - } - if (Optional.IsDefined(ComplianceState)) - { - writer.WritePropertyName("complianceState"u8); - writer.WriteStringValue(ComplianceState); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ComplianceReasonCode)) - { - writer.WritePropertyName("complianceReasonCode"u8); - writer.WriteStringValue(ComplianceReasonCode); - } - 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 - } - } - } - - PolicyInsightsPolicyStateChangedEventData 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(PolicyInsightsPolicyStateChangedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePolicyInsightsPolicyStateChangedEventData(document.RootElement, options); - } - - internal static PolicyInsightsPolicyStateChangedEventData DeserializePolicyInsightsPolicyStateChangedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset timestamp = default; - string policyAssignmentId = default; - string policyDefinitionId = default; - string policyDefinitionReferenceId = default; - string complianceState = default; - string subscriptionId = default; - string complianceReasonCode = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("policyAssignmentId"u8)) - { - policyAssignmentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("policyDefinitionId"u8)) - { - policyDefinitionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("policyDefinitionReferenceId"u8)) - { - policyDefinitionReferenceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("complianceState"u8)) - { - complianceState = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("complianceReasonCode"u8)) - { - complianceReasonCode = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PolicyInsightsPolicyStateChangedEventData( - timestamp, - policyAssignmentId, - policyDefinitionId, - policyDefinitionReferenceId, - complianceState, - subscriptionId, - complianceReasonCode, - 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(PolicyInsightsPolicyStateChangedEventData)} does not support writing '{options.Format}' format."); - } - } - - PolicyInsightsPolicyStateChangedEventData 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 DeserializePolicyInsightsPolicyStateChangedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PolicyInsightsPolicyStateChangedEventData)} 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 PolicyInsightsPolicyStateChangedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializePolicyInsightsPolicyStateChangedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateChangedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateChangedEventData.cs deleted file mode 100644 index 3c38df1b64d7..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateChangedEventData.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.PolicyInsights.PolicyStateChanged event. - public partial class PolicyInsightsPolicyStateChangedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - internal PolicyInsightsPolicyStateChangedEventData(DateTimeOffset timestamp) - { - Timestamp = timestamp; - } - - /// Initializes a new instance of . - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - /// The resource ID of the policy assignment. - /// The resource ID of the policy definition. - /// The reference ID for the policy definition inside the initiative definition, if the policy assignment is for an initiative. May be empty. - /// The compliance state of the resource with respect to the policy assignment. - /// The subscription ID of the resource. - /// The compliance reason code. May be empty. - /// Keeps track of any properties unknown to the library. - internal PolicyInsightsPolicyStateChangedEventData(DateTimeOffset timestamp, string policyAssignmentId, string policyDefinitionId, string policyDefinitionReferenceId, string complianceState, string subscriptionId, string complianceReasonCode, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - PolicyAssignmentId = policyAssignmentId; - PolicyDefinitionId = policyDefinitionId; - PolicyDefinitionReferenceId = policyDefinitionReferenceId; - ComplianceState = complianceState; - SubscriptionId = subscriptionId; - ComplianceReasonCode = complianceReasonCode; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PolicyInsightsPolicyStateChangedEventData() - { - } - - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - public DateTimeOffset Timestamp { get; } - /// The resource ID of the policy assignment. - public string PolicyAssignmentId { get; } - /// The resource ID of the policy definition. - public string PolicyDefinitionId { get; } - /// The reference ID for the policy definition inside the initiative definition, if the policy assignment is for an initiative. May be empty. - public string PolicyDefinitionReferenceId { get; } - /// The compliance state of the resource with respect to the policy assignment. - public string ComplianceState { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The compliance reason code. May be empty. - public string ComplianceReasonCode { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateCreatedEventData.Serialization.cs deleted file mode 100644 index 7300f5a3a9cc..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateCreatedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class PolicyInsightsPolicyStateCreatedEventData : 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(PolicyInsightsPolicyStateCreatedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(PolicyAssignmentId)) - { - writer.WritePropertyName("policyAssignmentId"u8); - writer.WriteStringValue(PolicyAssignmentId); - } - if (Optional.IsDefined(PolicyDefinitionId)) - { - writer.WritePropertyName("policyDefinitionId"u8); - writer.WriteStringValue(PolicyDefinitionId); - } - if (Optional.IsDefined(PolicyDefinitionReferenceId)) - { - writer.WritePropertyName("policyDefinitionReferenceId"u8); - writer.WriteStringValue(PolicyDefinitionReferenceId); - } - if (Optional.IsDefined(ComplianceState)) - { - writer.WritePropertyName("complianceState"u8); - writer.WriteStringValue(ComplianceState); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ComplianceReasonCode)) - { - writer.WritePropertyName("complianceReasonCode"u8); - writer.WriteStringValue(ComplianceReasonCode); - } - 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 - } - } - } - - PolicyInsightsPolicyStateCreatedEventData 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(PolicyInsightsPolicyStateCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePolicyInsightsPolicyStateCreatedEventData(document.RootElement, options); - } - - internal static PolicyInsightsPolicyStateCreatedEventData DeserializePolicyInsightsPolicyStateCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset timestamp = default; - string policyAssignmentId = default; - string policyDefinitionId = default; - string policyDefinitionReferenceId = default; - string complianceState = default; - string subscriptionId = default; - string complianceReasonCode = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("policyAssignmentId"u8)) - { - policyAssignmentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("policyDefinitionId"u8)) - { - policyDefinitionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("policyDefinitionReferenceId"u8)) - { - policyDefinitionReferenceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("complianceState"u8)) - { - complianceState = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("complianceReasonCode"u8)) - { - complianceReasonCode = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PolicyInsightsPolicyStateCreatedEventData( - timestamp, - policyAssignmentId, - policyDefinitionId, - policyDefinitionReferenceId, - complianceState, - subscriptionId, - complianceReasonCode, - 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(PolicyInsightsPolicyStateCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - PolicyInsightsPolicyStateCreatedEventData 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 DeserializePolicyInsightsPolicyStateCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PolicyInsightsPolicyStateCreatedEventData)} 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 PolicyInsightsPolicyStateCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializePolicyInsightsPolicyStateCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateCreatedEventData.cs deleted file mode 100644 index deb18f455881..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateCreatedEventData.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.PolicyInsights.PolicyStateCreated event. - public partial class PolicyInsightsPolicyStateCreatedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - internal PolicyInsightsPolicyStateCreatedEventData(DateTimeOffset timestamp) - { - Timestamp = timestamp; - } - - /// Initializes a new instance of . - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - /// The resource ID of the policy assignment. - /// The resource ID of the policy definition. - /// The reference ID for the policy definition inside the initiative definition, if the policy assignment is for an initiative. May be empty. - /// The compliance state of the resource with respect to the policy assignment. - /// The subscription ID of the resource. - /// The compliance reason code. May be empty. - /// Keeps track of any properties unknown to the library. - internal PolicyInsightsPolicyStateCreatedEventData(DateTimeOffset timestamp, string policyAssignmentId, string policyDefinitionId, string policyDefinitionReferenceId, string complianceState, string subscriptionId, string complianceReasonCode, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - PolicyAssignmentId = policyAssignmentId; - PolicyDefinitionId = policyDefinitionId; - PolicyDefinitionReferenceId = policyDefinitionReferenceId; - ComplianceState = complianceState; - SubscriptionId = subscriptionId; - ComplianceReasonCode = complianceReasonCode; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PolicyInsightsPolicyStateCreatedEventData() - { - } - - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - public DateTimeOffset Timestamp { get; } - /// The resource ID of the policy assignment. - public string PolicyAssignmentId { get; } - /// The resource ID of the policy definition. - public string PolicyDefinitionId { get; } - /// The reference ID for the policy definition inside the initiative definition, if the policy assignment is for an initiative. May be empty. - public string PolicyDefinitionReferenceId { get; } - /// The compliance state of the resource with respect to the policy assignment. - public string ComplianceState { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The compliance reason code. May be empty. - public string ComplianceReasonCode { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateDeletedEventData.Serialization.cs deleted file mode 100644 index f7b41e8af79d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateDeletedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class PolicyInsightsPolicyStateDeletedEventData : 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(PolicyInsightsPolicyStateDeletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(PolicyAssignmentId)) - { - writer.WritePropertyName("policyAssignmentId"u8); - writer.WriteStringValue(PolicyAssignmentId); - } - if (Optional.IsDefined(PolicyDefinitionId)) - { - writer.WritePropertyName("policyDefinitionId"u8); - writer.WriteStringValue(PolicyDefinitionId); - } - if (Optional.IsDefined(PolicyDefinitionReferenceId)) - { - writer.WritePropertyName("policyDefinitionReferenceId"u8); - writer.WriteStringValue(PolicyDefinitionReferenceId); - } - if (Optional.IsDefined(ComplianceState)) - { - writer.WritePropertyName("complianceState"u8); - writer.WriteStringValue(ComplianceState); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ComplianceReasonCode)) - { - writer.WritePropertyName("complianceReasonCode"u8); - writer.WriteStringValue(ComplianceReasonCode); - } - 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 - } - } - } - - PolicyInsightsPolicyStateDeletedEventData 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(PolicyInsightsPolicyStateDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePolicyInsightsPolicyStateDeletedEventData(document.RootElement, options); - } - - internal static PolicyInsightsPolicyStateDeletedEventData DeserializePolicyInsightsPolicyStateDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset timestamp = default; - string policyAssignmentId = default; - string policyDefinitionId = default; - string policyDefinitionReferenceId = default; - string complianceState = default; - string subscriptionId = default; - string complianceReasonCode = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("policyAssignmentId"u8)) - { - policyAssignmentId = property.Value.GetString(); - continue; - } - if (property.NameEquals("policyDefinitionId"u8)) - { - policyDefinitionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("policyDefinitionReferenceId"u8)) - { - policyDefinitionReferenceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("complianceState"u8)) - { - complianceState = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("complianceReasonCode"u8)) - { - complianceReasonCode = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PolicyInsightsPolicyStateDeletedEventData( - timestamp, - policyAssignmentId, - policyDefinitionId, - policyDefinitionReferenceId, - complianceState, - subscriptionId, - complianceReasonCode, - 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(PolicyInsightsPolicyStateDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - PolicyInsightsPolicyStateDeletedEventData 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 DeserializePolicyInsightsPolicyStateDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PolicyInsightsPolicyStateDeletedEventData)} 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 PolicyInsightsPolicyStateDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializePolicyInsightsPolicyStateDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateDeletedEventData.cs deleted file mode 100644 index 412c1ba32b64..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/PolicyInsightsPolicyStateDeletedEventData.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.PolicyInsights.PolicyStateDeleted event. - public partial class PolicyInsightsPolicyStateDeletedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - internal PolicyInsightsPolicyStateDeletedEventData(DateTimeOffset timestamp) - { - Timestamp = timestamp; - } - - /// Initializes a new instance of . - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - /// The resource ID of the policy assignment. - /// The resource ID of the policy definition. - /// The reference ID for the policy definition inside the initiative definition, if the policy assignment is for an initiative. May be empty. - /// The compliance state of the resource with respect to the policy assignment. - /// The subscription ID of the resource. - /// The compliance reason code. May be empty. - /// Keeps track of any properties unknown to the library. - internal PolicyInsightsPolicyStateDeletedEventData(DateTimeOffset timestamp, string policyAssignmentId, string policyDefinitionId, string policyDefinitionReferenceId, string complianceState, string subscriptionId, string complianceReasonCode, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - PolicyAssignmentId = policyAssignmentId; - PolicyDefinitionId = policyDefinitionId; - PolicyDefinitionReferenceId = policyDefinitionReferenceId; - ComplianceState = complianceState; - SubscriptionId = subscriptionId; - ComplianceReasonCode = complianceReasonCode; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PolicyInsightsPolicyStateDeletedEventData() - { - } - - /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. - public DateTimeOffset Timestamp { get; } - /// The resource ID of the policy assignment. - public string PolicyAssignmentId { get; } - /// The resource ID of the policy definition. - public string PolicyDefinitionId { get; } - /// The reference ID for the policy definition inside the initiative definition, if the policy assignment is for an initiative. May be empty. - public string PolicyDefinitionReferenceId { get; } - /// The compliance state of the resource with respect to the policy assignment. - public string ComplianceState { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The compliance reason code. May be empty. - public string ComplianceReasonCode { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RecordingChannelType.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RecordingChannelType.cs deleted file mode 100644 index 68b23c7873a2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RecordingChannelType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Recording channel type. - public readonly partial struct RecordingChannelType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RecordingChannelType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string MixedValue = "Mixed"; - private const string UnmixedValue = "Unmixed"; - - /// Mixed channel type. - public static RecordingChannelType Mixed { get; } = new RecordingChannelType(MixedValue); - /// Unmixed channel type. - public static RecordingChannelType Unmixed { get; } = new RecordingChannelType(UnmixedValue); - /// Determines if two values are the same. - public static bool operator ==(RecordingChannelType left, RecordingChannelType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RecordingChannelType left, RecordingChannelType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RecordingChannelType(string value) => new RecordingChannelType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RecordingChannelType other && Equals(other); - /// - public bool Equals(RecordingChannelType 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RecordingContentType.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RecordingContentType.cs deleted file mode 100644 index 2c4d289397cc..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RecordingContentType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Recording content type. - public readonly partial struct RecordingContentType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RecordingContentType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AudioVideoValue = "AudioVideo"; - private const string AudioValue = "Audio"; - - /// AudioVideo content type. - public static RecordingContentType AudioVideo { get; } = new RecordingContentType(AudioVideoValue); - /// Audio content type. - public static RecordingContentType Audio { get; } = new RecordingContentType(AudioValue); - /// Determines if two values are the same. - public static bool operator ==(RecordingContentType left, RecordingContentType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RecordingContentType left, RecordingContentType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RecordingContentType(string value) => new RecordingContentType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RecordingContentType other && Equals(other); - /// - public bool Equals(RecordingContentType 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RecordingFormatType.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RecordingFormatType.cs deleted file mode 100644 index 7e10a5a8f3e0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RecordingFormatType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Recording format type. - public readonly partial struct RecordingFormatType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RecordingFormatType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string WavValue = "Wav"; - private const string Mp3Value = "Mp3"; - private const string Mp4Value = "Mp4"; - - /// WAV format. - public static RecordingFormatType Wav { get; } = new RecordingFormatType(WavValue); - /// MP3 format. - public static RecordingFormatType Mp3 { get; } = new RecordingFormatType(Mp3Value); - /// MP4 format. - public static RecordingFormatType Mp4 { get; } = new RecordingFormatType(Mp4Value); - /// Determines if two values are the same. - public static bool operator ==(RecordingFormatType left, RecordingFormatType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RecordingFormatType left, RecordingFormatType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RecordingFormatType(string value) => new RecordingFormatType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RecordingFormatType other && Equals(other); - /// - public bool Equals(RecordingFormatType 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisExportRDBCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisExportRDBCompletedEventData.Serialization.cs deleted file mode 100644 index 371ef947d88d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisExportRDBCompletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class RedisExportRDBCompletedEventData : 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(RedisExportRDBCompletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - 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 - } - } - } - - RedisExportRDBCompletedEventData 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(RedisExportRDBCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisExportRDBCompletedEventData(document.RootElement, options); - } - - internal static RedisExportRDBCompletedEventData DeserializeRedisExportRDBCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset timestamp = default; - string name = default; - string status = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisExportRDBCompletedEventData(timestamp, name, status, 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(RedisExportRDBCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - RedisExportRDBCompletedEventData 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 DeserializeRedisExportRDBCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisExportRDBCompletedEventData)} 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 RedisExportRDBCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRedisExportRDBCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisExportRDBCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisExportRDBCompletedEventData.cs deleted file mode 100644 index 4d02e07eeb4c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisExportRDBCompletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Cache.ExportRDBCompleted event. - public partial class RedisExportRDBCompletedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time at which the event occurred. - internal RedisExportRDBCompletedEventData(DateTimeOffset timestamp) - { - Timestamp = timestamp; - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The name of this event. - /// The status of this event. Failed or succeeded. - /// Keeps track of any properties unknown to the library. - internal RedisExportRDBCompletedEventData(DateTimeOffset timestamp, string name, string status, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - Name = name; - Status = status; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RedisExportRDBCompletedEventData() - { - } - - /// The time at which the event occurred. - public DateTimeOffset Timestamp { get; } - /// The name of this event. - public string Name { get; } - /// The status of this event. Failed or succeeded. - public string Status { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisImportRDBCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisImportRDBCompletedEventData.Serialization.cs deleted file mode 100644 index 1e4a780d09d4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisImportRDBCompletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class RedisImportRDBCompletedEventData : 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(RedisImportRDBCompletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - 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 - } - } - } - - RedisImportRDBCompletedEventData 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(RedisImportRDBCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisImportRDBCompletedEventData(document.RootElement, options); - } - - internal static RedisImportRDBCompletedEventData DeserializeRedisImportRDBCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset timestamp = default; - string name = default; - string status = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisImportRDBCompletedEventData(timestamp, name, status, 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(RedisImportRDBCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - RedisImportRDBCompletedEventData 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 DeserializeRedisImportRDBCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisImportRDBCompletedEventData)} 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 RedisImportRDBCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRedisImportRDBCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisImportRDBCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisImportRDBCompletedEventData.cs deleted file mode 100644 index 58ca83a77ce3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisImportRDBCompletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Cache.ImportRDBCompleted event. - public partial class RedisImportRDBCompletedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time at which the event occurred. - internal RedisImportRDBCompletedEventData(DateTimeOffset timestamp) - { - Timestamp = timestamp; - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The name of this event. - /// The status of this event. Failed or succeeded. - /// Keeps track of any properties unknown to the library. - internal RedisImportRDBCompletedEventData(DateTimeOffset timestamp, string name, string status, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - Name = name; - Status = status; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RedisImportRDBCompletedEventData() - { - } - - /// The time at which the event occurred. - public DateTimeOffset Timestamp { get; } - /// The name of this event. - public string Name { get; } - /// The status of this event. Failed or succeeded. - public string Status { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisPatchingCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisPatchingCompletedEventData.Serialization.cs deleted file mode 100644 index 345b18790fea..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisPatchingCompletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class RedisPatchingCompletedEventData : 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(RedisPatchingCompletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - 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 - } - } - } - - RedisPatchingCompletedEventData 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(RedisPatchingCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisPatchingCompletedEventData(document.RootElement, options); - } - - internal static RedisPatchingCompletedEventData DeserializeRedisPatchingCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset timestamp = default; - string name = default; - string status = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisPatchingCompletedEventData(timestamp, name, status, 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(RedisPatchingCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - RedisPatchingCompletedEventData 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 DeserializeRedisPatchingCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisPatchingCompletedEventData)} 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 RedisPatchingCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRedisPatchingCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisPatchingCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisPatchingCompletedEventData.cs deleted file mode 100644 index 0497287ee8e2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisPatchingCompletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Cache.PatchingCompleted event. - public partial class RedisPatchingCompletedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time at which the event occurred. - internal RedisPatchingCompletedEventData(DateTimeOffset timestamp) - { - Timestamp = timestamp; - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The name of this event. - /// The status of this event. Failed or succeeded. - /// Keeps track of any properties unknown to the library. - internal RedisPatchingCompletedEventData(DateTimeOffset timestamp, string name, string status, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - Name = name; - Status = status; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RedisPatchingCompletedEventData() - { - } - - /// The time at which the event occurred. - public DateTimeOffset Timestamp { get; } - /// The name of this event. - public string Name { get; } - /// The status of this event. Failed or succeeded. - public string Status { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisScalingCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisScalingCompletedEventData.Serialization.cs deleted file mode 100644 index 9fd879604e0f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisScalingCompletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class RedisScalingCompletedEventData : 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(RedisScalingCompletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - 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 - } - } - } - - RedisScalingCompletedEventData 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(RedisScalingCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisScalingCompletedEventData(document.RootElement, options); - } - - internal static RedisScalingCompletedEventData DeserializeRedisScalingCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset timestamp = default; - string name = default; - string status = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisScalingCompletedEventData(timestamp, name, status, 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(RedisScalingCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - RedisScalingCompletedEventData 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 DeserializeRedisScalingCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisScalingCompletedEventData)} 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 RedisScalingCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRedisScalingCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisScalingCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisScalingCompletedEventData.cs deleted file mode 100644 index 0d7b4896c816..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/RedisScalingCompletedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Cache.ScalingCompleted event. - public partial class RedisScalingCompletedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time at which the event occurred. - internal RedisScalingCompletedEventData(DateTimeOffset timestamp) - { - Timestamp = timestamp; - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The name of this event. - /// The status of this event. Failed or succeeded. - /// Keeps track of any properties unknown to the library. - internal RedisScalingCompletedEventData(DateTimeOffset timestamp, string name, string status, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - Name = name; - Status = status; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RedisScalingCompletedEventData() - { - } - - /// The time at which the event occurred. - public DateTimeOffset Timestamp { get; } - /// The name of this event. - public string Name { get; } - /// The status of this event. Failed or succeeded. - public string Status { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionCancelEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionCancelEventData.Serialization.cs deleted file mode 100644 index 6b50c3144e5e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionCancelEventData.Serialization.cs +++ /dev/null @@ -1,269 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceActionCancelEventData : 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(ResourceActionCancelEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ResourceGroup)) - { - writer.WritePropertyName("resourceGroup"u8); - writer.WriteStringValue(ResourceGroup); - } - if (Optional.IsDefined(ResourceProvider)) - { - writer.WritePropertyName("resourceProvider"u8); - writer.WriteStringValue(ResourceProvider); - } - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - if (Optional.IsDefined(OperationName)) - { - writer.WritePropertyName("operationName"u8); - writer.WriteStringValue(OperationName); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - writer.WritePropertyName("authorization"u8); - writer.WriteObjectValue(Authorization, options); - writer.WritePropertyName("claims"u8); - writer.WriteStartObject(); - foreach (var item in Claims) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - if (Optional.IsDefined(CorrelationId)) - { - writer.WritePropertyName("correlationId"u8); - writer.WriteStringValue(CorrelationId); - } - writer.WritePropertyName("httpRequest"u8); - writer.WriteObjectValue(HttpRequest, 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 - } - } - } - - ResourceActionCancelEventData 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(ResourceActionCancelEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceActionCancelEventData(document.RootElement, options); - } - - internal static ResourceActionCancelEventData DeserializeResourceActionCancelEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string tenantId = default; - string subscriptionId = default; - string resourceGroup = default; - string resourceProvider = default; - string resourceUri = default; - string operationName = default; - string status = default; - ResourceAuthorization authorization = default; - IReadOnlyDictionary claims = default; - string correlationId = default; - ResourceHttpRequest httpRequest = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tenantId"u8)) - { - tenantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceGroup"u8)) - { - resourceGroup = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceProvider"u8)) - { - resourceProvider = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationName"u8)) - { - operationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("authorization"u8)) - { - authorization = ResourceAuthorization.DeserializeResourceAuthorization(property.Value, options); - continue; - } - if (property.NameEquals("claims"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - claims = dictionary; - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("httpRequest"u8)) - { - httpRequest = ResourceHttpRequest.DeserializeResourceHttpRequest(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceActionCancelEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - 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(ResourceActionCancelEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceActionCancelEventData 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 DeserializeResourceActionCancelEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceActionCancelEventData)} 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 ResourceActionCancelEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceActionCancelEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionCancelEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionCancelEventData.cs deleted file mode 100644 index 46f2982bb96f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionCancelEventData.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceActionCancel event. This is raised when a resource action operation is canceled. - public partial class ResourceActionCancelEventData - { - /// - /// 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 requested authorization for the operation. - /// The properties of the claims. - /// The details of the operation. - /// , or is null. - internal ResourceActionCancelEventData(ResourceAuthorization authorization, IReadOnlyDictionary claims, ResourceHttpRequest httpRequest) - { - Argument.AssertNotNull(authorization, nameof(authorization)); - Argument.AssertNotNull(claims, nameof(claims)); - Argument.AssertNotNull(httpRequest, nameof(httpRequest)); - - Authorization = authorization; - Claims = claims; - HttpRequest = httpRequest; - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// Keeps track of any properties unknown to the library. - internal ResourceActionCancelEventData(string tenantId, string subscriptionId, string resourceGroup, string resourceProvider, string resourceUri, string operationName, string status, ResourceAuthorization authorization, IReadOnlyDictionary claims, string correlationId, ResourceHttpRequest httpRequest, IDictionary serializedAdditionalRawData) - { - TenantId = tenantId; - SubscriptionId = subscriptionId; - ResourceGroup = resourceGroup; - ResourceProvider = resourceProvider; - ResourceUri = resourceUri; - OperationName = operationName; - Status = status; - Authorization = authorization; - Claims = claims; - CorrelationId = correlationId; - HttpRequest = httpRequest; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceActionCancelEventData() - { - } - - /// The tenant ID of the resource. - public string TenantId { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The resource group of the resource. - public string ResourceGroup { get; } - /// The resource provider performing the operation. - public string ResourceProvider { get; } - /// The URI of the resource in the operation. - public string ResourceUri { get; } - /// The operation that was performed. - public string OperationName { get; } - /// The status of the operation. - public string Status { get; } - /// The requested authorization for the operation. - public ResourceAuthorization Authorization { get; } - /// The properties of the claims. - public IReadOnlyDictionary Claims { get; } - /// An operation ID used for troubleshooting. - public string CorrelationId { get; } - /// The details of the operation. - public ResourceHttpRequest HttpRequest { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionFailureEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionFailureEventData.Serialization.cs deleted file mode 100644 index 4b82333449f9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionFailureEventData.Serialization.cs +++ /dev/null @@ -1,269 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceActionFailureEventData : 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(ResourceActionFailureEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ResourceGroup)) - { - writer.WritePropertyName("resourceGroup"u8); - writer.WriteStringValue(ResourceGroup); - } - if (Optional.IsDefined(ResourceProvider)) - { - writer.WritePropertyName("resourceProvider"u8); - writer.WriteStringValue(ResourceProvider); - } - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - if (Optional.IsDefined(OperationName)) - { - writer.WritePropertyName("operationName"u8); - writer.WriteStringValue(OperationName); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - writer.WritePropertyName("authorization"u8); - writer.WriteObjectValue(Authorization, options); - writer.WritePropertyName("claims"u8); - writer.WriteStartObject(); - foreach (var item in Claims) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - if (Optional.IsDefined(CorrelationId)) - { - writer.WritePropertyName("correlationId"u8); - writer.WriteStringValue(CorrelationId); - } - writer.WritePropertyName("httpRequest"u8); - writer.WriteObjectValue(HttpRequest, 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 - } - } - } - - ResourceActionFailureEventData 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(ResourceActionFailureEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceActionFailureEventData(document.RootElement, options); - } - - internal static ResourceActionFailureEventData DeserializeResourceActionFailureEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string tenantId = default; - string subscriptionId = default; - string resourceGroup = default; - string resourceProvider = default; - string resourceUri = default; - string operationName = default; - string status = default; - ResourceAuthorization authorization = default; - IReadOnlyDictionary claims = default; - string correlationId = default; - ResourceHttpRequest httpRequest = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tenantId"u8)) - { - tenantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceGroup"u8)) - { - resourceGroup = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceProvider"u8)) - { - resourceProvider = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationName"u8)) - { - operationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("authorization"u8)) - { - authorization = ResourceAuthorization.DeserializeResourceAuthorization(property.Value, options); - continue; - } - if (property.NameEquals("claims"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - claims = dictionary; - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("httpRequest"u8)) - { - httpRequest = ResourceHttpRequest.DeserializeResourceHttpRequest(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceActionFailureEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - 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(ResourceActionFailureEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceActionFailureEventData 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 DeserializeResourceActionFailureEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceActionFailureEventData)} 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 ResourceActionFailureEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceActionFailureEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionFailureEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionFailureEventData.cs deleted file mode 100644 index 5e4fa19dcbe4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionFailureEventData.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceActionFailure event. This is raised when a resource action operation fails. - public partial class ResourceActionFailureEventData - { - /// - /// 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 requested authorization for the operation. - /// The properties of the claims. - /// The details of the operation. - /// , or is null. - internal ResourceActionFailureEventData(ResourceAuthorization authorization, IReadOnlyDictionary claims, ResourceHttpRequest httpRequest) - { - Argument.AssertNotNull(authorization, nameof(authorization)); - Argument.AssertNotNull(claims, nameof(claims)); - Argument.AssertNotNull(httpRequest, nameof(httpRequest)); - - Authorization = authorization; - Claims = claims; - HttpRequest = httpRequest; - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// Keeps track of any properties unknown to the library. - internal ResourceActionFailureEventData(string tenantId, string subscriptionId, string resourceGroup, string resourceProvider, string resourceUri, string operationName, string status, ResourceAuthorization authorization, IReadOnlyDictionary claims, string correlationId, ResourceHttpRequest httpRequest, IDictionary serializedAdditionalRawData) - { - TenantId = tenantId; - SubscriptionId = subscriptionId; - ResourceGroup = resourceGroup; - ResourceProvider = resourceProvider; - ResourceUri = resourceUri; - OperationName = operationName; - Status = status; - Authorization = authorization; - Claims = claims; - CorrelationId = correlationId; - HttpRequest = httpRequest; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceActionFailureEventData() - { - } - - /// The tenant ID of the resource. - public string TenantId { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The resource group of the resource. - public string ResourceGroup { get; } - /// The resource provider performing the operation. - public string ResourceProvider { get; } - /// The URI of the resource in the operation. - public string ResourceUri { get; } - /// The operation that was performed. - public string OperationName { get; } - /// The status of the operation. - public string Status { get; } - /// The requested authorization for the operation. - public ResourceAuthorization Authorization { get; } - /// The properties of the claims. - public IReadOnlyDictionary Claims { get; } - /// An operation ID used for troubleshooting. - public string CorrelationId { get; } - /// The details of the operation. - public ResourceHttpRequest HttpRequest { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionSuccessEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionSuccessEventData.Serialization.cs deleted file mode 100644 index c0adc937d03b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionSuccessEventData.Serialization.cs +++ /dev/null @@ -1,269 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceActionSuccessEventData : 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(ResourceActionSuccessEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ResourceGroup)) - { - writer.WritePropertyName("resourceGroup"u8); - writer.WriteStringValue(ResourceGroup); - } - if (Optional.IsDefined(ResourceProvider)) - { - writer.WritePropertyName("resourceProvider"u8); - writer.WriteStringValue(ResourceProvider); - } - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - if (Optional.IsDefined(OperationName)) - { - writer.WritePropertyName("operationName"u8); - writer.WriteStringValue(OperationName); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - writer.WritePropertyName("authorization"u8); - writer.WriteObjectValue(Authorization, options); - writer.WritePropertyName("claims"u8); - writer.WriteStartObject(); - foreach (var item in Claims) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - if (Optional.IsDefined(CorrelationId)) - { - writer.WritePropertyName("correlationId"u8); - writer.WriteStringValue(CorrelationId); - } - writer.WritePropertyName("httpRequest"u8); - writer.WriteObjectValue(HttpRequest, 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 - } - } - } - - ResourceActionSuccessEventData 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(ResourceActionSuccessEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceActionSuccessEventData(document.RootElement, options); - } - - internal static ResourceActionSuccessEventData DeserializeResourceActionSuccessEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string tenantId = default; - string subscriptionId = default; - string resourceGroup = default; - string resourceProvider = default; - string resourceUri = default; - string operationName = default; - string status = default; - ResourceAuthorization authorization = default; - IReadOnlyDictionary claims = default; - string correlationId = default; - ResourceHttpRequest httpRequest = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tenantId"u8)) - { - tenantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceGroup"u8)) - { - resourceGroup = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceProvider"u8)) - { - resourceProvider = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationName"u8)) - { - operationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("authorization"u8)) - { - authorization = ResourceAuthorization.DeserializeResourceAuthorization(property.Value, options); - continue; - } - if (property.NameEquals("claims"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - claims = dictionary; - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("httpRequest"u8)) - { - httpRequest = ResourceHttpRequest.DeserializeResourceHttpRequest(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceActionSuccessEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - 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(ResourceActionSuccessEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceActionSuccessEventData 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 DeserializeResourceActionSuccessEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceActionSuccessEventData)} 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 ResourceActionSuccessEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceActionSuccessEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionSuccessEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionSuccessEventData.cs deleted file mode 100644 index 79202e2ed756..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceActionSuccessEventData.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceActionSuccess event. This is raised when a resource action operation succeeds. - public partial class ResourceActionSuccessEventData - { - /// - /// 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 requested authorization for the operation. - /// The properties of the claims. - /// The details of the operation. - /// , or is null. - internal ResourceActionSuccessEventData(ResourceAuthorization authorization, IReadOnlyDictionary claims, ResourceHttpRequest httpRequest) - { - Argument.AssertNotNull(authorization, nameof(authorization)); - Argument.AssertNotNull(claims, nameof(claims)); - Argument.AssertNotNull(httpRequest, nameof(httpRequest)); - - Authorization = authorization; - Claims = claims; - HttpRequest = httpRequest; - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// Keeps track of any properties unknown to the library. - internal ResourceActionSuccessEventData(string tenantId, string subscriptionId, string resourceGroup, string resourceProvider, string resourceUri, string operationName, string status, ResourceAuthorization authorization, IReadOnlyDictionary claims, string correlationId, ResourceHttpRequest httpRequest, IDictionary serializedAdditionalRawData) - { - TenantId = tenantId; - SubscriptionId = subscriptionId; - ResourceGroup = resourceGroup; - ResourceProvider = resourceProvider; - ResourceUri = resourceUri; - OperationName = operationName; - Status = status; - Authorization = authorization; - Claims = claims; - CorrelationId = correlationId; - HttpRequest = httpRequest; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceActionSuccessEventData() - { - } - - /// The tenant ID of the resource. - public string TenantId { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The resource group of the resource. - public string ResourceGroup { get; } - /// The resource provider performing the operation. - public string ResourceProvider { get; } - /// The URI of the resource in the operation. - public string ResourceUri { get; } - /// The operation that was performed. - public string OperationName { get; } - /// The status of the operation. - public string Status { get; } - /// The requested authorization for the operation. - public ResourceAuthorization Authorization { get; } - /// The properties of the claims. - public IReadOnlyDictionary Claims { get; } - /// An operation ID used for troubleshooting. - public string CorrelationId { get; } - /// The details of the operation. - public ResourceHttpRequest HttpRequest { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceAuthorization.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceAuthorization.Serialization.cs deleted file mode 100644 index 4efe91edbade..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceAuthorization.Serialization.cs +++ /dev/null @@ -1,175 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceAuthorization : 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(ResourceAuthorization)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Scope)) - { - writer.WritePropertyName("scope"u8); - writer.WriteStringValue(Scope); - } - if (Optional.IsDefined(Action)) - { - writer.WritePropertyName("action"u8); - writer.WriteStringValue(Action); - } - writer.WritePropertyName("evidence"u8); - writer.WriteStartObject(); - foreach (var item in Evidence) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - 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 - } - } - } - - ResourceAuthorization 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(ResourceAuthorization)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceAuthorization(document.RootElement, options); - } - - internal static ResourceAuthorization DeserializeResourceAuthorization(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string scope = default; - string action = default; - IReadOnlyDictionary evidence = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("scope"u8)) - { - scope = property.Value.GetString(); - continue; - } - if (property.NameEquals("action"u8)) - { - action = property.Value.GetString(); - continue; - } - if (property.NameEquals("evidence"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - evidence = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceAuthorization(scope, action, evidence, 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(ResourceAuthorization)} does not support writing '{options.Format}' format."); - } - } - - ResourceAuthorization 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 DeserializeResourceAuthorization(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceAuthorization)} 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 ResourceAuthorization FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceAuthorization(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceAuthorization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceAuthorization.cs deleted file mode 100644 index 07363e2f1dca..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceAuthorization.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// The details of the authorization for the resource. - public partial class ResourceAuthorization - { - /// - /// 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 evidence for the authorization. - /// is null. - internal ResourceAuthorization(IReadOnlyDictionary evidence) - { - Argument.AssertNotNull(evidence, nameof(evidence)); - - Evidence = evidence; - } - - /// Initializes a new instance of . - /// The scope of the authorization. - /// The action being requested. - /// The evidence for the authorization. - /// Keeps track of any properties unknown to the library. - internal ResourceAuthorization(string scope, string action, IReadOnlyDictionary evidence, IDictionary serializedAdditionalRawData) - { - Scope = scope; - Action = action; - Evidence = evidence; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceAuthorization() - { - } - - /// The scope of the authorization. - public string Scope { get; } - /// The action being requested. - public string Action { get; } - /// The evidence for the authorization. - public IReadOnlyDictionary Evidence { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteCancelEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteCancelEventData.Serialization.cs deleted file mode 100644 index 86538ec5f688..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteCancelEventData.Serialization.cs +++ /dev/null @@ -1,269 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceDeleteCancelEventData : 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(ResourceDeleteCancelEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ResourceGroup)) - { - writer.WritePropertyName("resourceGroup"u8); - writer.WriteStringValue(ResourceGroup); - } - if (Optional.IsDefined(ResourceProvider)) - { - writer.WritePropertyName("resourceProvider"u8); - writer.WriteStringValue(ResourceProvider); - } - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - if (Optional.IsDefined(OperationName)) - { - writer.WritePropertyName("operationName"u8); - writer.WriteStringValue(OperationName); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - writer.WritePropertyName("authorization"u8); - writer.WriteObjectValue(Authorization, options); - writer.WritePropertyName("claims"u8); - writer.WriteStartObject(); - foreach (var item in Claims) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - if (Optional.IsDefined(CorrelationId)) - { - writer.WritePropertyName("correlationId"u8); - writer.WriteStringValue(CorrelationId); - } - writer.WritePropertyName("httpRequest"u8); - writer.WriteObjectValue(HttpRequest, 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 - } - } - } - - ResourceDeleteCancelEventData 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(ResourceDeleteCancelEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceDeleteCancelEventData(document.RootElement, options); - } - - internal static ResourceDeleteCancelEventData DeserializeResourceDeleteCancelEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string tenantId = default; - string subscriptionId = default; - string resourceGroup = default; - string resourceProvider = default; - string resourceUri = default; - string operationName = default; - string status = default; - ResourceAuthorization authorization = default; - IReadOnlyDictionary claims = default; - string correlationId = default; - ResourceHttpRequest httpRequest = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tenantId"u8)) - { - tenantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceGroup"u8)) - { - resourceGroup = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceProvider"u8)) - { - resourceProvider = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationName"u8)) - { - operationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("authorization"u8)) - { - authorization = ResourceAuthorization.DeserializeResourceAuthorization(property.Value, options); - continue; - } - if (property.NameEquals("claims"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - claims = dictionary; - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("httpRequest"u8)) - { - httpRequest = ResourceHttpRequest.DeserializeResourceHttpRequest(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceDeleteCancelEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - 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(ResourceDeleteCancelEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceDeleteCancelEventData 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 DeserializeResourceDeleteCancelEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceDeleteCancelEventData)} 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 ResourceDeleteCancelEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceDeleteCancelEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteCancelEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteCancelEventData.cs deleted file mode 100644 index 8cb3102987a2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteCancelEventData.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceDeleteCancel event. This is raised when a resource delete operation is canceled. - public partial class ResourceDeleteCancelEventData - { - /// - /// 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 requested authorization for the operation. - /// The properties of the claims. - /// The details of the operation. - /// , or is null. - internal ResourceDeleteCancelEventData(ResourceAuthorization authorization, IReadOnlyDictionary claims, ResourceHttpRequest httpRequest) - { - Argument.AssertNotNull(authorization, nameof(authorization)); - Argument.AssertNotNull(claims, nameof(claims)); - Argument.AssertNotNull(httpRequest, nameof(httpRequest)); - - Authorization = authorization; - Claims = claims; - HttpRequest = httpRequest; - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// Keeps track of any properties unknown to the library. - internal ResourceDeleteCancelEventData(string tenantId, string subscriptionId, string resourceGroup, string resourceProvider, string resourceUri, string operationName, string status, ResourceAuthorization authorization, IReadOnlyDictionary claims, string correlationId, ResourceHttpRequest httpRequest, IDictionary serializedAdditionalRawData) - { - TenantId = tenantId; - SubscriptionId = subscriptionId; - ResourceGroup = resourceGroup; - ResourceProvider = resourceProvider; - ResourceUri = resourceUri; - OperationName = operationName; - Status = status; - Authorization = authorization; - Claims = claims; - CorrelationId = correlationId; - HttpRequest = httpRequest; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceDeleteCancelEventData() - { - } - - /// The tenant ID of the resource. - public string TenantId { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The resource group of the resource. - public string ResourceGroup { get; } - /// The resource provider performing the operation. - public string ResourceProvider { get; } - /// The URI of the resource in the operation. - public string ResourceUri { get; } - /// The operation that was performed. - public string OperationName { get; } - /// The status of the operation. - public string Status { get; } - /// The requested authorization for the operation. - public ResourceAuthorization Authorization { get; } - /// The properties of the claims. - public IReadOnlyDictionary Claims { get; } - /// An operation ID used for troubleshooting. - public string CorrelationId { get; } - /// The details of the operation. - public ResourceHttpRequest HttpRequest { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteFailureEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteFailureEventData.Serialization.cs deleted file mode 100644 index 802854fbfde6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteFailureEventData.Serialization.cs +++ /dev/null @@ -1,269 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceDeleteFailureEventData : 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(ResourceDeleteFailureEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ResourceGroup)) - { - writer.WritePropertyName("resourceGroup"u8); - writer.WriteStringValue(ResourceGroup); - } - if (Optional.IsDefined(ResourceProvider)) - { - writer.WritePropertyName("resourceProvider"u8); - writer.WriteStringValue(ResourceProvider); - } - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - if (Optional.IsDefined(OperationName)) - { - writer.WritePropertyName("operationName"u8); - writer.WriteStringValue(OperationName); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - writer.WritePropertyName("authorization"u8); - writer.WriteObjectValue(Authorization, options); - writer.WritePropertyName("claims"u8); - writer.WriteStartObject(); - foreach (var item in Claims) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - if (Optional.IsDefined(CorrelationId)) - { - writer.WritePropertyName("correlationId"u8); - writer.WriteStringValue(CorrelationId); - } - writer.WritePropertyName("httpRequest"u8); - writer.WriteObjectValue(HttpRequest, 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 - } - } - } - - ResourceDeleteFailureEventData 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(ResourceDeleteFailureEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceDeleteFailureEventData(document.RootElement, options); - } - - internal static ResourceDeleteFailureEventData DeserializeResourceDeleteFailureEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string tenantId = default; - string subscriptionId = default; - string resourceGroup = default; - string resourceProvider = default; - string resourceUri = default; - string operationName = default; - string status = default; - ResourceAuthorization authorization = default; - IReadOnlyDictionary claims = default; - string correlationId = default; - ResourceHttpRequest httpRequest = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tenantId"u8)) - { - tenantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceGroup"u8)) - { - resourceGroup = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceProvider"u8)) - { - resourceProvider = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationName"u8)) - { - operationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("authorization"u8)) - { - authorization = ResourceAuthorization.DeserializeResourceAuthorization(property.Value, options); - continue; - } - if (property.NameEquals("claims"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - claims = dictionary; - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("httpRequest"u8)) - { - httpRequest = ResourceHttpRequest.DeserializeResourceHttpRequest(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceDeleteFailureEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - 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(ResourceDeleteFailureEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceDeleteFailureEventData 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 DeserializeResourceDeleteFailureEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceDeleteFailureEventData)} 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 ResourceDeleteFailureEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceDeleteFailureEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteFailureEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteFailureEventData.cs deleted file mode 100644 index 310e6916852e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteFailureEventData.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceDeleteFailure event. This is raised when a resource delete operation fails. - public partial class ResourceDeleteFailureEventData - { - /// - /// 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 requested authorization for the operation. - /// The properties of the claims. - /// The details of the operation. - /// , or is null. - internal ResourceDeleteFailureEventData(ResourceAuthorization authorization, IReadOnlyDictionary claims, ResourceHttpRequest httpRequest) - { - Argument.AssertNotNull(authorization, nameof(authorization)); - Argument.AssertNotNull(claims, nameof(claims)); - Argument.AssertNotNull(httpRequest, nameof(httpRequest)); - - Authorization = authorization; - Claims = claims; - HttpRequest = httpRequest; - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// Keeps track of any properties unknown to the library. - internal ResourceDeleteFailureEventData(string tenantId, string subscriptionId, string resourceGroup, string resourceProvider, string resourceUri, string operationName, string status, ResourceAuthorization authorization, IReadOnlyDictionary claims, string correlationId, ResourceHttpRequest httpRequest, IDictionary serializedAdditionalRawData) - { - TenantId = tenantId; - SubscriptionId = subscriptionId; - ResourceGroup = resourceGroup; - ResourceProvider = resourceProvider; - ResourceUri = resourceUri; - OperationName = operationName; - Status = status; - Authorization = authorization; - Claims = claims; - CorrelationId = correlationId; - HttpRequest = httpRequest; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceDeleteFailureEventData() - { - } - - /// The tenant ID of the resource. - public string TenantId { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The resource group of the resource. - public string ResourceGroup { get; } - /// The resource provider performing the operation. - public string ResourceProvider { get; } - /// The URI of the resource in the operation. - public string ResourceUri { get; } - /// The operation that was performed. - public string OperationName { get; } - /// The status of the operation. - public string Status { get; } - /// The requested authorization for the operation. - public ResourceAuthorization Authorization { get; } - /// The properties of the claims. - public IReadOnlyDictionary Claims { get; } - /// An operation ID used for troubleshooting. - public string CorrelationId { get; } - /// The details of the operation. - public ResourceHttpRequest HttpRequest { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteSuccessEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteSuccessEventData.Serialization.cs deleted file mode 100644 index 610475ad4de2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteSuccessEventData.Serialization.cs +++ /dev/null @@ -1,269 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceDeleteSuccessEventData : 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(ResourceDeleteSuccessEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ResourceGroup)) - { - writer.WritePropertyName("resourceGroup"u8); - writer.WriteStringValue(ResourceGroup); - } - if (Optional.IsDefined(ResourceProvider)) - { - writer.WritePropertyName("resourceProvider"u8); - writer.WriteStringValue(ResourceProvider); - } - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - if (Optional.IsDefined(OperationName)) - { - writer.WritePropertyName("operationName"u8); - writer.WriteStringValue(OperationName); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - writer.WritePropertyName("authorization"u8); - writer.WriteObjectValue(Authorization, options); - writer.WritePropertyName("claims"u8); - writer.WriteStartObject(); - foreach (var item in Claims) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - if (Optional.IsDefined(CorrelationId)) - { - writer.WritePropertyName("correlationId"u8); - writer.WriteStringValue(CorrelationId); - } - writer.WritePropertyName("httpRequest"u8); - writer.WriteObjectValue(HttpRequest, 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 - } - } - } - - ResourceDeleteSuccessEventData 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(ResourceDeleteSuccessEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceDeleteSuccessEventData(document.RootElement, options); - } - - internal static ResourceDeleteSuccessEventData DeserializeResourceDeleteSuccessEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string tenantId = default; - string subscriptionId = default; - string resourceGroup = default; - string resourceProvider = default; - string resourceUri = default; - string operationName = default; - string status = default; - ResourceAuthorization authorization = default; - IReadOnlyDictionary claims = default; - string correlationId = default; - ResourceHttpRequest httpRequest = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tenantId"u8)) - { - tenantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceGroup"u8)) - { - resourceGroup = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceProvider"u8)) - { - resourceProvider = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationName"u8)) - { - operationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("authorization"u8)) - { - authorization = ResourceAuthorization.DeserializeResourceAuthorization(property.Value, options); - continue; - } - if (property.NameEquals("claims"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - claims = dictionary; - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("httpRequest"u8)) - { - httpRequest = ResourceHttpRequest.DeserializeResourceHttpRequest(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceDeleteSuccessEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - 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(ResourceDeleteSuccessEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceDeleteSuccessEventData 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 DeserializeResourceDeleteSuccessEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceDeleteSuccessEventData)} 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 ResourceDeleteSuccessEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceDeleteSuccessEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteSuccessEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteSuccessEventData.cs deleted file mode 100644 index 990f8c2c3c32..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceDeleteSuccessEventData.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceDeleteSuccess event. This is raised when a resource delete operation succeeds. - public partial class ResourceDeleteSuccessEventData - { - /// - /// 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 requested authorization for the operation. - /// The properties of the claims. - /// The details of the operation. - /// , or is null. - internal ResourceDeleteSuccessEventData(ResourceAuthorization authorization, IReadOnlyDictionary claims, ResourceHttpRequest httpRequest) - { - Argument.AssertNotNull(authorization, nameof(authorization)); - Argument.AssertNotNull(claims, nameof(claims)); - Argument.AssertNotNull(httpRequest, nameof(httpRequest)); - - Authorization = authorization; - Claims = claims; - HttpRequest = httpRequest; - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// Keeps track of any properties unknown to the library. - internal ResourceDeleteSuccessEventData(string tenantId, string subscriptionId, string resourceGroup, string resourceProvider, string resourceUri, string operationName, string status, ResourceAuthorization authorization, IReadOnlyDictionary claims, string correlationId, ResourceHttpRequest httpRequest, IDictionary serializedAdditionalRawData) - { - TenantId = tenantId; - SubscriptionId = subscriptionId; - ResourceGroup = resourceGroup; - ResourceProvider = resourceProvider; - ResourceUri = resourceUri; - OperationName = operationName; - Status = status; - Authorization = authorization; - Claims = claims; - CorrelationId = correlationId; - HttpRequest = httpRequest; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceDeleteSuccessEventData() - { - } - - /// The tenant ID of the resource. - public string TenantId { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The resource group of the resource. - public string ResourceGroup { get; } - /// The resource provider performing the operation. - public string ResourceProvider { get; } - /// The URI of the resource in the operation. - public string ResourceUri { get; } - /// The operation that was performed. - public string OperationName { get; } - /// The status of the operation. - public string Status { get; } - /// The requested authorization for the operation. - public ResourceAuthorization Authorization { get; } - /// The properties of the claims. - public IReadOnlyDictionary Claims { get; } - /// An operation ID used for troubleshooting. - public string CorrelationId { get; } - /// The details of the operation. - public ResourceHttpRequest HttpRequest { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceHttpRequest.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceHttpRequest.Serialization.cs deleted file mode 100644 index 578c595a0979..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceHttpRequest.Serialization.cs +++ /dev/null @@ -1,178 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceHttpRequest : 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(ResourceHttpRequest)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(ClientIpAddress)) - { - writer.WritePropertyName("clientIpAddress"u8); - writer.WriteStringValue(ClientIpAddress); - } - if (Optional.IsDefined(Method)) - { - writer.WritePropertyName("method"u8); - writer.WriteStringValue(Method); - } - if (Optional.IsDefined(Url)) - { - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - } - 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 - } - } - } - - ResourceHttpRequest 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(ResourceHttpRequest)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceHttpRequest(document.RootElement, options); - } - - internal static ResourceHttpRequest DeserializeResourceHttpRequest(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string clientRequestId = default; - string clientIpAddress = default; - string method = default; - string url = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientIpAddress"u8)) - { - clientIpAddress = property.Value.GetString(); - continue; - } - if (property.NameEquals("method"u8)) - { - method = property.Value.GetString(); - continue; - } - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceHttpRequest(clientRequestId, clientIpAddress, method, url, 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(ResourceHttpRequest)} does not support writing '{options.Format}' format."); - } - } - - ResourceHttpRequest 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 DeserializeResourceHttpRequest(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceHttpRequest)} 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 ResourceHttpRequest FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceHttpRequest(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceHttpRequest.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceHttpRequest.cs deleted file mode 100644 index 4b9db7b6c94b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceHttpRequest.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// The details of the HTTP request. - public partial class ResourceHttpRequest - { - /// - /// 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 ResourceHttpRequest() - { - } - - /// Initializes a new instance of . - /// The client request ID. - /// The client IP address. - /// The request method. - /// The url used in the request. - /// Keeps track of any properties unknown to the library. - internal ResourceHttpRequest(string clientRequestId, string clientIpAddress, string method, string url, IDictionary serializedAdditionalRawData) - { - ClientRequestId = clientRequestId; - ClientIpAddress = clientIpAddress; - Method = method; - Url = url; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The client request ID. - public string ClientRequestId { get; } - /// The client IP address. - public string ClientIpAddress { get; } - /// The request method. - public string Method { get; } - /// The url used in the request. - public string Url { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAnnotatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAnnotatedEventData.Serialization.cs deleted file mode 100644 index dba464b1c155..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAnnotatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceNotificationsHealthResourcesAnnotatedEventData : 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(ResourceNotificationsHealthResourcesAnnotatedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ResourceNotificationsHealthResourcesAnnotatedEventData 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(ResourceNotificationsHealthResourcesAnnotatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceNotificationsHealthResourcesAnnotatedEventData(document.RootElement, options); - } - - internal static ResourceNotificationsHealthResourcesAnnotatedEventData DeserializeResourceNotificationsHealthResourcesAnnotatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceNotificationsResourceUpdatedDetails resourceInfo = default; - ResourceNotificationsOperationalDetails operationalInfo = default; - string apiVersion = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceInfo"u8)) - { - resourceInfo = ResourceNotificationsResourceUpdatedDetails.DeserializeResourceNotificationsResourceUpdatedDetails(property.Value, options); - continue; - } - if (property.NameEquals("operationalInfo"u8)) - { - operationalInfo = ResourceNotificationsOperationalDetails.DeserializeResourceNotificationsOperationalDetails(property.Value, options); - continue; - } - if (property.NameEquals("apiVersion"u8)) - { - apiVersion = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceNotificationsHealthResourcesAnnotatedEventData(resourceInfo, operationalInfo, apiVersion, 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(ResourceNotificationsHealthResourcesAnnotatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceNotificationsHealthResourcesAnnotatedEventData 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 DeserializeResourceNotificationsHealthResourcesAnnotatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceNotificationsHealthResourcesAnnotatedEventData)} 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 ResourceNotificationsHealthResourcesAnnotatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceNotificationsHealthResourcesAnnotatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAnnotatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAnnotatedEventData.cs deleted file mode 100644 index f4b757f2f691..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAnnotatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// - /// Schema of the Data property of an EventGridEvent for a - /// Microsoft.ResourceNotifications.HealthResources.ResourceAnnotated event. - /// - public partial class ResourceNotificationsHealthResourcesAnnotatedEventData : ResourceNotificationsResourceUpdatedEventData - { - /// Initializes a new instance of . - /// resourceInfo details for update event. - /// details about operational info. - /// or is null. - internal ResourceNotificationsHealthResourcesAnnotatedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails) : base(resourceDetails, operationalDetails) - { - Argument.AssertNotNull(resourceDetails, nameof(resourceDetails)); - Argument.AssertNotNull(operationalDetails, nameof(operationalDetails)); - } - - /// Initializes a new instance of . - /// resourceInfo details for update event. - /// details about operational info. - /// api version of the resource properties bag. - /// Keeps track of any properties unknown to the library. - internal ResourceNotificationsHealthResourcesAnnotatedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails, string apiVersion, IDictionary serializedAdditionalRawData) : base(resourceDetails, operationalDetails, apiVersion, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal ResourceNotificationsHealthResourcesAnnotatedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.Serialization.cs deleted file mode 100644 index 6a60d795bdde..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData : 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(ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData 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(ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(document.RootElement, options); - } - - internal static ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData DeserializeResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceNotificationsResourceUpdatedDetails resourceInfo = default; - ResourceNotificationsOperationalDetails operationalInfo = default; - string apiVersion = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceInfo"u8)) - { - resourceInfo = ResourceNotificationsResourceUpdatedDetails.DeserializeResourceNotificationsResourceUpdatedDetails(property.Value, options); - continue; - } - if (property.NameEquals("operationalInfo"u8)) - { - operationalInfo = ResourceNotificationsOperationalDetails.DeserializeResourceNotificationsOperationalDetails(property.Value, options); - continue; - } - if (property.NameEquals("apiVersion"u8)) - { - apiVersion = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(resourceInfo, operationalInfo, apiVersion, 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(ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData 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 DeserializeResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData)} 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 ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.cs deleted file mode 100644 index 8bcffeb43c47..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Schema of the Data property of an EventGridEvent for a - /// Microsoft.ResourceNotifications.HealthResources.AvailabilityStatusChanged - /// event. - /// - public partial class ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData : ResourceNotificationsResourceUpdatedEventData - { - /// Initializes a new instance of . - /// resourceInfo details for update event. - /// details about operational info. - /// or is null. - internal ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails) : base(resourceDetails, operationalDetails) - { - Argument.AssertNotNull(resourceDetails, nameof(resourceDetails)); - Argument.AssertNotNull(operationalDetails, nameof(operationalDetails)); - } - - /// Initializes a new instance of . - /// resourceInfo details for update event. - /// details about operational info. - /// api version of the resource properties bag. - /// Keeps track of any properties unknown to the library. - internal ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails, string apiVersion, IDictionary serializedAdditionalRawData) : base(resourceDetails, operationalDetails, apiVersion, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsOperationalDetails.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsOperationalDetails.Serialization.cs deleted file mode 100644 index 3c02399992e2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsOperationalDetails.Serialization.cs +++ /dev/null @@ -1,142 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceNotificationsOperationalDetails : 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(ResourceNotificationsOperationalDetails)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("resourceEventTime"u8); - writer.WriteStringValue(ResourceEventTime, "O"); - 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 - } - } - } - - ResourceNotificationsOperationalDetails 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(ResourceNotificationsOperationalDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceNotificationsOperationalDetails(document.RootElement, options); - } - - internal static ResourceNotificationsOperationalDetails DeserializeResourceNotificationsOperationalDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset resourceEventTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceEventTime"u8)) - { - resourceEventTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceNotificationsOperationalDetails(resourceEventTime, 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(ResourceNotificationsOperationalDetails)} does not support writing '{options.Format}' format."); - } - } - - ResourceNotificationsOperationalDetails 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 DeserializeResourceNotificationsOperationalDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceNotificationsOperationalDetails)} 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 ResourceNotificationsOperationalDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceNotificationsOperationalDetails(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsOperationalDetails.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsOperationalDetails.cs deleted file mode 100644 index a55f436fa035..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsOperationalDetails.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// details of operational info. - public partial class ResourceNotificationsOperationalDetails - { - /// - /// 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 . - /// Date and Time when resource was updated. - internal ResourceNotificationsOperationalDetails(DateTimeOffset resourceEventTime) - { - ResourceEventTime = resourceEventTime; - } - - /// Initializes a new instance of . - /// Date and Time when resource was updated. - /// Keeps track of any properties unknown to the library. - internal ResourceNotificationsOperationalDetails(DateTimeOffset resourceEventTime, IDictionary serializedAdditionalRawData) - { - ResourceEventTime = resourceEventTime; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceNotificationsOperationalDetails() - { - } - - /// Date and Time when resource was updated. - public DateTimeOffset ResourceEventTime { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedDetails.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedDetails.Serialization.cs deleted file mode 100644 index f55a187c67ac..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedDetails.Serialization.cs +++ /dev/null @@ -1,167 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceNotificationsResourceDeletedDetails : 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(ResourceNotificationsResourceDeletedDetails)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Type)) - { - 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 - } - } - } - - ResourceNotificationsResourceDeletedDetails 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(ResourceNotificationsResourceDeletedDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceNotificationsResourceDeletedDetails(document.RootElement, options); - } - - internal static ResourceNotificationsResourceDeletedDetails DeserializeResourceNotificationsResourceDeletedDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string name = default; - string type = 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("name"u8)) - { - name = 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 ResourceNotificationsResourceDeletedDetails(id, name, 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(ResourceNotificationsResourceDeletedDetails)} does not support writing '{options.Format}' format."); - } - } - - ResourceNotificationsResourceDeletedDetails 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 DeserializeResourceNotificationsResourceDeletedDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceNotificationsResourceDeletedDetails)} 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 ResourceNotificationsResourceDeletedDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceNotificationsResourceDeletedDetails(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedDetails.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedDetails.cs deleted file mode 100644 index cf7a4a0ccdf0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedDetails.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Describes the schema of the properties under resource info which are common - /// across all ARN system topic delete events - /// - public partial class ResourceNotificationsResourceDeletedDetails - { - /// - /// 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 ResourceNotificationsResourceDeletedDetails() - { - } - - /// Initializes a new instance of . - /// id of the resource for which the event is being emitted. - /// name of the resource for which the event is being emitted. - /// the type of the resource for which the event is being emitted. - /// Keeps track of any properties unknown to the library. - internal ResourceNotificationsResourceDeletedDetails(string id, string name, string type, IDictionary serializedAdditionalRawData) - { - Id = id; - Name = name; - Type = type; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// id of the resource for which the event is being emitted. - public string Id { get; } - /// name of the resource for which the event is being emitted. - public string Name { get; } - /// the type of the resource for which the event is being emitted. - public string Type { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedEventData.Serialization.cs deleted file mode 100644 index 2eb550fbc8ae..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedEventData.Serialization.cs +++ /dev/null @@ -1,150 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceNotificationsResourceDeletedEventData : 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(ResourceNotificationsResourceDeletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("resourceInfo"u8); - writer.WriteObjectValue(ResourceDetails, options); - writer.WritePropertyName("operationalInfo"u8); - writer.WriteObjectValue(OperationalDetails, 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 - } - } - } - - ResourceNotificationsResourceDeletedEventData 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(ResourceNotificationsResourceDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceNotificationsResourceDeletedEventData(document.RootElement, options); - } - - internal static ResourceNotificationsResourceDeletedEventData DeserializeResourceNotificationsResourceDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceNotificationsResourceDeletedDetails resourceInfo = default; - ResourceNotificationsOperationalDetails operationalInfo = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceInfo"u8)) - { - resourceInfo = ResourceNotificationsResourceDeletedDetails.DeserializeResourceNotificationsResourceDeletedDetails(property.Value, options); - continue; - } - if (property.NameEquals("operationalInfo"u8)) - { - operationalInfo = ResourceNotificationsOperationalDetails.DeserializeResourceNotificationsOperationalDetails(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceNotificationsResourceDeletedEventData(resourceInfo, operationalInfo, 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(ResourceNotificationsResourceDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceNotificationsResourceDeletedEventData 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 DeserializeResourceNotificationsResourceDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceNotificationsResourceDeletedEventData)} 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 ResourceNotificationsResourceDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceNotificationsResourceDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedEventData.cs deleted file mode 100644 index 5dee76cd0d52..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceDeletedEventData.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Describes the schema of the common properties across all ARN system topic - /// delete events - /// - public partial class ResourceNotificationsResourceDeletedEventData - { - /// - /// 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 . - /// resourceInfo details for delete event. - /// details about operational info. - /// or is null. - internal ResourceNotificationsResourceDeletedEventData(ResourceNotificationsResourceDeletedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails) - { - Argument.AssertNotNull(resourceDetails, nameof(resourceDetails)); - Argument.AssertNotNull(operationalDetails, nameof(operationalDetails)); - - ResourceDetails = resourceDetails; - OperationalDetails = operationalDetails; - } - - /// Initializes a new instance of . - /// resourceInfo details for delete event. - /// details about operational info. - /// Keeps track of any properties unknown to the library. - internal ResourceNotificationsResourceDeletedEventData(ResourceNotificationsResourceDeletedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails, IDictionary serializedAdditionalRawData) - { - ResourceDetails = resourceDetails; - OperationalDetails = operationalDetails; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceNotificationsResourceDeletedEventData() - { - } - - /// resourceInfo details for delete event. - public ResourceNotificationsResourceDeletedDetails ResourceDetails { get; } - /// details about operational info. - public ResourceNotificationsOperationalDetails OperationalDetails { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementCreatedOrUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementCreatedOrUpdatedEventData.Serialization.cs deleted file mode 100644 index 403063ecdb2e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementCreatedOrUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceNotificationsResourceManagementCreatedOrUpdatedEventData : 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(ResourceNotificationsResourceManagementCreatedOrUpdatedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ResourceNotificationsResourceManagementCreatedOrUpdatedEventData 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(ResourceNotificationsResourceManagementCreatedOrUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceNotificationsResourceManagementCreatedOrUpdatedEventData(document.RootElement, options); - } - - internal static ResourceNotificationsResourceManagementCreatedOrUpdatedEventData DeserializeResourceNotificationsResourceManagementCreatedOrUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceNotificationsResourceUpdatedDetails resourceInfo = default; - ResourceNotificationsOperationalDetails operationalInfo = default; - string apiVersion = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceInfo"u8)) - { - resourceInfo = ResourceNotificationsResourceUpdatedDetails.DeserializeResourceNotificationsResourceUpdatedDetails(property.Value, options); - continue; - } - if (property.NameEquals("operationalInfo"u8)) - { - operationalInfo = ResourceNotificationsOperationalDetails.DeserializeResourceNotificationsOperationalDetails(property.Value, options); - continue; - } - if (property.NameEquals("apiVersion"u8)) - { - apiVersion = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceNotificationsResourceManagementCreatedOrUpdatedEventData(resourceInfo, operationalInfo, apiVersion, 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(ResourceNotificationsResourceManagementCreatedOrUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceNotificationsResourceManagementCreatedOrUpdatedEventData 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 DeserializeResourceNotificationsResourceManagementCreatedOrUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceNotificationsResourceManagementCreatedOrUpdatedEventData)} 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 ResourceNotificationsResourceManagementCreatedOrUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceNotificationsResourceManagementCreatedOrUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementCreatedOrUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementCreatedOrUpdatedEventData.cs deleted file mode 100644 index 6b62866b0201..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementCreatedOrUpdatedEventData.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.Messaging.EventGrid.SystemEvents -{ - /// - /// Schema of the Data property of an EventGridEvent for a - /// Microsoft.ResourceNotifications.Resources.CreatedOrUpdated event. - /// - public partial class ResourceNotificationsResourceManagementCreatedOrUpdatedEventData : ResourceNotificationsResourceUpdatedEventData - { - /// Initializes a new instance of . - /// resourceInfo details for update event. - /// details about operational info. - /// or is null. - internal ResourceNotificationsResourceManagementCreatedOrUpdatedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails) : base(resourceDetails, operationalDetails) - { - Argument.AssertNotNull(resourceDetails, nameof(resourceDetails)); - Argument.AssertNotNull(operationalDetails, nameof(operationalDetails)); - } - - /// Initializes a new instance of . - /// resourceInfo details for update event. - /// details about operational info. - /// api version of the resource properties bag. - /// Keeps track of any properties unknown to the library. - internal ResourceNotificationsResourceManagementCreatedOrUpdatedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails, string apiVersion, IDictionary serializedAdditionalRawData) : base(resourceDetails, operationalDetails, apiVersion, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal ResourceNotificationsResourceManagementCreatedOrUpdatedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementDeletedEventData.Serialization.cs deleted file mode 100644 index 3d3b7ae70567..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceNotificationsResourceManagementDeletedEventData : 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(ResourceNotificationsResourceManagementDeletedEventData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ResourceNotificationsResourceManagementDeletedEventData 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(ResourceNotificationsResourceManagementDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceNotificationsResourceManagementDeletedEventData(document.RootElement, options); - } - - internal static ResourceNotificationsResourceManagementDeletedEventData DeserializeResourceNotificationsResourceManagementDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceNotificationsResourceDeletedDetails resourceInfo = default; - ResourceNotificationsOperationalDetails operationalInfo = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceInfo"u8)) - { - resourceInfo = ResourceNotificationsResourceDeletedDetails.DeserializeResourceNotificationsResourceDeletedDetails(property.Value, options); - continue; - } - if (property.NameEquals("operationalInfo"u8)) - { - operationalInfo = ResourceNotificationsOperationalDetails.DeserializeResourceNotificationsOperationalDetails(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceNotificationsResourceManagementDeletedEventData(resourceInfo, operationalInfo, 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(ResourceNotificationsResourceManagementDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceNotificationsResourceManagementDeletedEventData 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 DeserializeResourceNotificationsResourceManagementDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceNotificationsResourceManagementDeletedEventData)} 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 ResourceNotificationsResourceManagementDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceNotificationsResourceManagementDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementDeletedEventData.cs deleted file mode 100644 index 78e118f95d49..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceManagementDeletedEventData.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Schema of the Data property of an EventGridEvent for a - /// Microsoft.ResourceNotifications.Resources.Deleted event. - /// - public partial class ResourceNotificationsResourceManagementDeletedEventData : ResourceNotificationsResourceDeletedEventData - { - /// Initializes a new instance of . - /// resourceInfo details for delete event. - /// details about operational info. - /// or is null. - internal ResourceNotificationsResourceManagementDeletedEventData(ResourceNotificationsResourceDeletedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails) : base(resourceDetails, operationalDetails) - { - Argument.AssertNotNull(resourceDetails, nameof(resourceDetails)); - Argument.AssertNotNull(operationalDetails, nameof(operationalDetails)); - } - - /// Initializes a new instance of . - /// resourceInfo details for delete event. - /// details about operational info. - /// Keeps track of any properties unknown to the library. - internal ResourceNotificationsResourceManagementDeletedEventData(ResourceNotificationsResourceDeletedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails, IDictionary serializedAdditionalRawData) : base(resourceDetails, operationalDetails, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal ResourceNotificationsResourceManagementDeletedEventData() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedDetails.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedDetails.Serialization.cs deleted file mode 100644 index 72e405e281d4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedDetails.Serialization.cs +++ /dev/null @@ -1,242 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceNotificationsResourceUpdatedDetails : 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(ResourceNotificationsResourceUpdatedDetails)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Type)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type); - } - if (Optional.IsDefined(Location)) - { - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - } - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - foreach (var item in Properties) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - ResourceNotificationsResourceUpdatedDetails 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(ResourceNotificationsResourceUpdatedDetails)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceNotificationsResourceUpdatedDetails(document.RootElement, options); - } - - internal static ResourceNotificationsResourceUpdatedDetails DeserializeResourceNotificationsResourceUpdatedDetails(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string name = default; - string type = default; - string location = default; - IReadOnlyDictionary tags = default; - IReadOnlyDictionary properties = 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("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("location"u8)) - { - location = property.Value.GetString(); - continue; - } - if (property.NameEquals("tags"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("properties"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - properties = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceNotificationsResourceUpdatedDetails( - id, - name, - type, - location, - tags, - properties, - 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(ResourceNotificationsResourceUpdatedDetails)} does not support writing '{options.Format}' format."); - } - } - - ResourceNotificationsResourceUpdatedDetails 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 DeserializeResourceNotificationsResourceUpdatedDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceNotificationsResourceUpdatedDetails)} 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 ResourceNotificationsResourceUpdatedDetails FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceNotificationsResourceUpdatedDetails(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedDetails.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedDetails.cs deleted file mode 100644 index 59b8832d8be3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedDetails.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Describes the schema of the properties under resource info which are common - /// across all ARN system topic events - /// - public partial class ResourceNotificationsResourceUpdatedDetails - { - /// - /// 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 tags on the resource for which the event is being emitted. - /// properties in the payload of the resource for which the event is being emitted. - /// or is null. - internal ResourceNotificationsResourceUpdatedDetails(IReadOnlyDictionary tags, IReadOnlyDictionary properties) - { - Argument.AssertNotNull(tags, nameof(tags)); - Argument.AssertNotNull(properties, nameof(properties)); - - Tags = tags; - Properties = properties; - } - - /// Initializes a new instance of . - /// id of the resource for which the event is being emitted. - /// name of the resource for which the event is being emitted. - /// the type of the resource for which the event is being emitted. - /// the location of the resource for which the event is being emitted. - /// the tags on the resource for which the event is being emitted. - /// properties in the payload of the resource for which the event is being emitted. - /// Keeps track of any properties unknown to the library. - internal ResourceNotificationsResourceUpdatedDetails(string id, string name, string type, string location, IReadOnlyDictionary tags, IReadOnlyDictionary properties, IDictionary serializedAdditionalRawData) - { - Id = id; - Name = name; - Type = type; - Location = location; - Tags = tags; - Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceNotificationsResourceUpdatedDetails() - { - } - - /// id of the resource for which the event is being emitted. - public string Id { get; } - /// name of the resource for which the event is being emitted. - public string Name { get; } - /// the type of the resource for which the event is being emitted. - public string Type { get; } - /// the location of the resource for which the event is being emitted. - public string Location { get; } - /// the tags on the resource for which the event is being emitted. - public IReadOnlyDictionary Tags { get; } - /// - /// properties in the payload of the resource for which the event is being emitted - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary Properties { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedEventData.Serialization.cs deleted file mode 100644 index bdbca4cbd7fe..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedEventData.Serialization.cs +++ /dev/null @@ -1,161 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceNotificationsResourceUpdatedEventData : 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(ResourceNotificationsResourceUpdatedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("resourceInfo"u8); - writer.WriteObjectValue(ResourceDetails, options); - writer.WritePropertyName("operationalInfo"u8); - writer.WriteObjectValue(OperationalDetails, options); - if (Optional.IsDefined(ApiVersion)) - { - writer.WritePropertyName("apiVersion"u8); - writer.WriteStringValue(ApiVersion); - } - 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 - } - } - } - - ResourceNotificationsResourceUpdatedEventData 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(ResourceNotificationsResourceUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceNotificationsResourceUpdatedEventData(document.RootElement, options); - } - - internal static ResourceNotificationsResourceUpdatedEventData DeserializeResourceNotificationsResourceUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceNotificationsResourceUpdatedDetails resourceInfo = default; - ResourceNotificationsOperationalDetails operationalInfo = default; - string apiVersion = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceInfo"u8)) - { - resourceInfo = ResourceNotificationsResourceUpdatedDetails.DeserializeResourceNotificationsResourceUpdatedDetails(property.Value, options); - continue; - } - if (property.NameEquals("operationalInfo"u8)) - { - operationalInfo = ResourceNotificationsOperationalDetails.DeserializeResourceNotificationsOperationalDetails(property.Value, options); - continue; - } - if (property.NameEquals("apiVersion"u8)) - { - apiVersion = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceNotificationsResourceUpdatedEventData(resourceInfo, operationalInfo, apiVersion, 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(ResourceNotificationsResourceUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceNotificationsResourceUpdatedEventData 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 DeserializeResourceNotificationsResourceUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceNotificationsResourceUpdatedEventData)} 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 ResourceNotificationsResourceUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceNotificationsResourceUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedEventData.cs deleted file mode 100644 index 3bb624a3b0b1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceNotificationsResourceUpdatedEventData.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Describes the schema of the common properties across all ARN system topic events. - public partial class ResourceNotificationsResourceUpdatedEventData - { - /// - /// 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 . - /// resourceInfo details for update event. - /// details about operational info. - /// or is null. - internal ResourceNotificationsResourceUpdatedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails) - { - Argument.AssertNotNull(resourceDetails, nameof(resourceDetails)); - Argument.AssertNotNull(operationalDetails, nameof(operationalDetails)); - - ResourceDetails = resourceDetails; - OperationalDetails = operationalDetails; - } - - /// Initializes a new instance of . - /// resourceInfo details for update event. - /// details about operational info. - /// api version of the resource properties bag. - /// Keeps track of any properties unknown to the library. - internal ResourceNotificationsResourceUpdatedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails, string apiVersion, IDictionary serializedAdditionalRawData) - { - ResourceDetails = resourceDetails; - OperationalDetails = operationalDetails; - ApiVersion = apiVersion; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceNotificationsResourceUpdatedEventData() - { - } - - /// resourceInfo details for update event. - public ResourceNotificationsResourceUpdatedDetails ResourceDetails { get; } - /// details about operational info. - public ResourceNotificationsOperationalDetails OperationalDetails { get; } - /// api version of the resource properties bag. - public string ApiVersion { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteCancelEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteCancelEventData.Serialization.cs deleted file mode 100644 index 9b08a63f70af..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteCancelEventData.Serialization.cs +++ /dev/null @@ -1,269 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceWriteCancelEventData : 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(ResourceWriteCancelEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ResourceGroup)) - { - writer.WritePropertyName("resourceGroup"u8); - writer.WriteStringValue(ResourceGroup); - } - if (Optional.IsDefined(ResourceProvider)) - { - writer.WritePropertyName("resourceProvider"u8); - writer.WriteStringValue(ResourceProvider); - } - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - if (Optional.IsDefined(OperationName)) - { - writer.WritePropertyName("operationName"u8); - writer.WriteStringValue(OperationName); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - writer.WritePropertyName("authorization"u8); - writer.WriteObjectValue(Authorization, options); - writer.WritePropertyName("claims"u8); - writer.WriteStartObject(); - foreach (var item in Claims) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - if (Optional.IsDefined(CorrelationId)) - { - writer.WritePropertyName("correlationId"u8); - writer.WriteStringValue(CorrelationId); - } - writer.WritePropertyName("httpRequest"u8); - writer.WriteObjectValue(HttpRequest, 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 - } - } - } - - ResourceWriteCancelEventData 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(ResourceWriteCancelEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceWriteCancelEventData(document.RootElement, options); - } - - internal static ResourceWriteCancelEventData DeserializeResourceWriteCancelEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string tenantId = default; - string subscriptionId = default; - string resourceGroup = default; - string resourceProvider = default; - string resourceUri = default; - string operationName = default; - string status = default; - ResourceAuthorization authorization = default; - IReadOnlyDictionary claims = default; - string correlationId = default; - ResourceHttpRequest httpRequest = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tenantId"u8)) - { - tenantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceGroup"u8)) - { - resourceGroup = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceProvider"u8)) - { - resourceProvider = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationName"u8)) - { - operationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("authorization"u8)) - { - authorization = ResourceAuthorization.DeserializeResourceAuthorization(property.Value, options); - continue; - } - if (property.NameEquals("claims"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - claims = dictionary; - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("httpRequest"u8)) - { - httpRequest = ResourceHttpRequest.DeserializeResourceHttpRequest(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceWriteCancelEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - 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(ResourceWriteCancelEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceWriteCancelEventData 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 DeserializeResourceWriteCancelEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceWriteCancelEventData)} 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 ResourceWriteCancelEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceWriteCancelEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteCancelEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteCancelEventData.cs deleted file mode 100644 index 35fce3f2ae9c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteCancelEventData.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteCancel event. This is raised when a resource create or update operation is canceled. - public partial class ResourceWriteCancelEventData - { - /// - /// 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 requested authorization for the operation. - /// The properties of the claims. - /// The details of the operation. - /// , or is null. - internal ResourceWriteCancelEventData(ResourceAuthorization authorization, IReadOnlyDictionary claims, ResourceHttpRequest httpRequest) - { - Argument.AssertNotNull(authorization, nameof(authorization)); - Argument.AssertNotNull(claims, nameof(claims)); - Argument.AssertNotNull(httpRequest, nameof(httpRequest)); - - Authorization = authorization; - Claims = claims; - HttpRequest = httpRequest; - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// Keeps track of any properties unknown to the library. - internal ResourceWriteCancelEventData(string tenantId, string subscriptionId, string resourceGroup, string resourceProvider, string resourceUri, string operationName, string status, ResourceAuthorization authorization, IReadOnlyDictionary claims, string correlationId, ResourceHttpRequest httpRequest, IDictionary serializedAdditionalRawData) - { - TenantId = tenantId; - SubscriptionId = subscriptionId; - ResourceGroup = resourceGroup; - ResourceProvider = resourceProvider; - ResourceUri = resourceUri; - OperationName = operationName; - Status = status; - Authorization = authorization; - Claims = claims; - CorrelationId = correlationId; - HttpRequest = httpRequest; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceWriteCancelEventData() - { - } - - /// The tenant ID of the resource. - public string TenantId { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The resource group of the resource. - public string ResourceGroup { get; } - /// The resource provider performing the operation. - public string ResourceProvider { get; } - /// The URI of the resource in the operation. - public string ResourceUri { get; } - /// The operation that was performed. - public string OperationName { get; } - /// The status of the operation. - public string Status { get; } - /// The requested authorization for the operation. - public ResourceAuthorization Authorization { get; } - /// The properties of the claims. - public IReadOnlyDictionary Claims { get; } - /// An operation ID used for troubleshooting. - public string CorrelationId { get; } - /// The details of the operation. - public ResourceHttpRequest HttpRequest { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteFailureEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteFailureEventData.Serialization.cs deleted file mode 100644 index cce0e36f154a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteFailureEventData.Serialization.cs +++ /dev/null @@ -1,269 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceWriteFailureEventData : 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(ResourceWriteFailureEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ResourceGroup)) - { - writer.WritePropertyName("resourceGroup"u8); - writer.WriteStringValue(ResourceGroup); - } - if (Optional.IsDefined(ResourceProvider)) - { - writer.WritePropertyName("resourceProvider"u8); - writer.WriteStringValue(ResourceProvider); - } - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - if (Optional.IsDefined(OperationName)) - { - writer.WritePropertyName("operationName"u8); - writer.WriteStringValue(OperationName); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - writer.WritePropertyName("authorization"u8); - writer.WriteObjectValue(Authorization, options); - writer.WritePropertyName("claims"u8); - writer.WriteStartObject(); - foreach (var item in Claims) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - if (Optional.IsDefined(CorrelationId)) - { - writer.WritePropertyName("correlationId"u8); - writer.WriteStringValue(CorrelationId); - } - writer.WritePropertyName("httpRequest"u8); - writer.WriteObjectValue(HttpRequest, 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 - } - } - } - - ResourceWriteFailureEventData 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(ResourceWriteFailureEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceWriteFailureEventData(document.RootElement, options); - } - - internal static ResourceWriteFailureEventData DeserializeResourceWriteFailureEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string tenantId = default; - string subscriptionId = default; - string resourceGroup = default; - string resourceProvider = default; - string resourceUri = default; - string operationName = default; - string status = default; - ResourceAuthorization authorization = default; - IReadOnlyDictionary claims = default; - string correlationId = default; - ResourceHttpRequest httpRequest = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tenantId"u8)) - { - tenantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceGroup"u8)) - { - resourceGroup = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceProvider"u8)) - { - resourceProvider = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationName"u8)) - { - operationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("authorization"u8)) - { - authorization = ResourceAuthorization.DeserializeResourceAuthorization(property.Value, options); - continue; - } - if (property.NameEquals("claims"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - claims = dictionary; - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("httpRequest"u8)) - { - httpRequest = ResourceHttpRequest.DeserializeResourceHttpRequest(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceWriteFailureEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - 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(ResourceWriteFailureEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceWriteFailureEventData 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 DeserializeResourceWriteFailureEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceWriteFailureEventData)} 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 ResourceWriteFailureEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceWriteFailureEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteFailureEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteFailureEventData.cs deleted file mode 100644 index 782018d8cd16..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteFailureEventData.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteFailure event. This is raised when a resource create or update operation fails. - public partial class ResourceWriteFailureEventData - { - /// - /// 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 requested authorization for the operation. - /// The properties of the claims. - /// The details of the operation. - /// , or is null. - internal ResourceWriteFailureEventData(ResourceAuthorization authorization, IReadOnlyDictionary claims, ResourceHttpRequest httpRequest) - { - Argument.AssertNotNull(authorization, nameof(authorization)); - Argument.AssertNotNull(claims, nameof(claims)); - Argument.AssertNotNull(httpRequest, nameof(httpRequest)); - - Authorization = authorization; - Claims = claims; - HttpRequest = httpRequest; - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// Keeps track of any properties unknown to the library. - internal ResourceWriteFailureEventData(string tenantId, string subscriptionId, string resourceGroup, string resourceProvider, string resourceUri, string operationName, string status, ResourceAuthorization authorization, IReadOnlyDictionary claims, string correlationId, ResourceHttpRequest httpRequest, IDictionary serializedAdditionalRawData) - { - TenantId = tenantId; - SubscriptionId = subscriptionId; - ResourceGroup = resourceGroup; - ResourceProvider = resourceProvider; - ResourceUri = resourceUri; - OperationName = operationName; - Status = status; - Authorization = authorization; - Claims = claims; - CorrelationId = correlationId; - HttpRequest = httpRequest; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceWriteFailureEventData() - { - } - - /// The tenant ID of the resource. - public string TenantId { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The resource group of the resource. - public string ResourceGroup { get; } - /// The resource provider performing the operation. - public string ResourceProvider { get; } - /// The URI of the resource in the operation. - public string ResourceUri { get; } - /// The operation that was performed. - public string OperationName { get; } - /// The status of the operation. - public string Status { get; } - /// The requested authorization for the operation. - public ResourceAuthorization Authorization { get; } - /// The properties of the claims. - public IReadOnlyDictionary Claims { get; } - /// An operation ID used for troubleshooting. - public string CorrelationId { get; } - /// The details of the operation. - public ResourceHttpRequest HttpRequest { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteSuccessEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteSuccessEventData.Serialization.cs deleted file mode 100644 index 442361ba1b4d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteSuccessEventData.Serialization.cs +++ /dev/null @@ -1,269 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ResourceWriteSuccessEventData : 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(ResourceWriteSuccessEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId); - } - if (Optional.IsDefined(SubscriptionId)) - { - writer.WritePropertyName("subscriptionId"u8); - writer.WriteStringValue(SubscriptionId); - } - if (Optional.IsDefined(ResourceGroup)) - { - writer.WritePropertyName("resourceGroup"u8); - writer.WriteStringValue(ResourceGroup); - } - if (Optional.IsDefined(ResourceProvider)) - { - writer.WritePropertyName("resourceProvider"u8); - writer.WriteStringValue(ResourceProvider); - } - if (Optional.IsDefined(ResourceUri)) - { - writer.WritePropertyName("resourceUri"u8); - writer.WriteStringValue(ResourceUri); - } - if (Optional.IsDefined(OperationName)) - { - writer.WritePropertyName("operationName"u8); - writer.WriteStringValue(OperationName); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status); - } - writer.WritePropertyName("authorization"u8); - writer.WriteObjectValue(Authorization, options); - writer.WritePropertyName("claims"u8); - writer.WriteStartObject(); - foreach (var item in Claims) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - if (Optional.IsDefined(CorrelationId)) - { - writer.WritePropertyName("correlationId"u8); - writer.WriteStringValue(CorrelationId); - } - writer.WritePropertyName("httpRequest"u8); - writer.WriteObjectValue(HttpRequest, 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 - } - } - } - - ResourceWriteSuccessEventData 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(ResourceWriteSuccessEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeResourceWriteSuccessEventData(document.RootElement, options); - } - - internal static ResourceWriteSuccessEventData DeserializeResourceWriteSuccessEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string tenantId = default; - string subscriptionId = default; - string resourceGroup = default; - string resourceProvider = default; - string resourceUri = default; - string operationName = default; - string status = default; - ResourceAuthorization authorization = default; - IReadOnlyDictionary claims = default; - string correlationId = default; - ResourceHttpRequest httpRequest = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tenantId"u8)) - { - tenantId = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionId"u8)) - { - subscriptionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceGroup"u8)) - { - resourceGroup = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceProvider"u8)) - { - resourceProvider = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceUri"u8)) - { - resourceUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationName"u8)) - { - operationName = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("authorization"u8)) - { - authorization = ResourceAuthorization.DeserializeResourceAuthorization(property.Value, options); - continue; - } - if (property.NameEquals("claims"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - claims = dictionary; - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("httpRequest"u8)) - { - httpRequest = ResourceHttpRequest.DeserializeResourceHttpRequest(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ResourceWriteSuccessEventData( - tenantId, - subscriptionId, - resourceGroup, - resourceProvider, - resourceUri, - operationName, - status, - authorization, - claims, - correlationId, - httpRequest, - 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(ResourceWriteSuccessEventData)} does not support writing '{options.Format}' format."); - } - } - - ResourceWriteSuccessEventData 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 DeserializeResourceWriteSuccessEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ResourceWriteSuccessEventData)} 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 ResourceWriteSuccessEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeResourceWriteSuccessEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteSuccessEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteSuccessEventData.cs deleted file mode 100644 index 2a1265b7404a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ResourceWriteSuccessEventData.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteSuccess event. This is raised when a resource create or update operation succeeds. - public partial class ResourceWriteSuccessEventData - { - /// - /// 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 requested authorization for the operation. - /// The properties of the claims. - /// The details of the operation. - /// , or is null. - internal ResourceWriteSuccessEventData(ResourceAuthorization authorization, IReadOnlyDictionary claims, ResourceHttpRequest httpRequest) - { - Argument.AssertNotNull(authorization, nameof(authorization)); - Argument.AssertNotNull(claims, nameof(claims)); - Argument.AssertNotNull(httpRequest, nameof(httpRequest)); - - Authorization = authorization; - Claims = claims; - HttpRequest = httpRequest; - } - - /// Initializes a new instance of . - /// The tenant ID of the resource. - /// The subscription ID of the resource. - /// The resource group of the resource. - /// The resource provider performing the operation. - /// The URI of the resource in the operation. - /// The operation that was performed. - /// The status of the operation. - /// The requested authorization for the operation. - /// The properties of the claims. - /// An operation ID used for troubleshooting. - /// The details of the operation. - /// Keeps track of any properties unknown to the library. - internal ResourceWriteSuccessEventData(string tenantId, string subscriptionId, string resourceGroup, string resourceProvider, string resourceUri, string operationName, string status, ResourceAuthorization authorization, IReadOnlyDictionary claims, string correlationId, ResourceHttpRequest httpRequest, IDictionary serializedAdditionalRawData) - { - TenantId = tenantId; - SubscriptionId = subscriptionId; - ResourceGroup = resourceGroup; - ResourceProvider = resourceProvider; - ResourceUri = resourceUri; - OperationName = operationName; - Status = status; - Authorization = authorization; - Claims = claims; - CorrelationId = correlationId; - HttpRequest = httpRequest; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ResourceWriteSuccessEventData() - { - } - - /// The tenant ID of the resource. - public string TenantId { get; } - /// The subscription ID of the resource. - public string SubscriptionId { get; } - /// The resource group of the resource. - public string ResourceGroup { get; } - /// The resource provider performing the operation. - public string ResourceProvider { get; } - /// The URI of the resource in the operation. - public string ResourceUri { get; } - /// The operation that was performed. - public string OperationName { get; } - /// The status of the operation. - public string Status { get; } - /// The requested authorization for the operation. - public ResourceAuthorization Authorization { get; } - /// The properties of the claims. - public IReadOnlyDictionary Claims { get; } - /// An operation ID used for troubleshooting. - public string CorrelationId { get; } - /// The details of the operation. - public ResourceHttpRequest HttpRequest { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData.Serialization.cs deleted file mode 100644 index 93f730db151a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData.Serialization.cs +++ /dev/null @@ -1,207 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData : 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(ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(NamespaceName)) - { - writer.WritePropertyName("namespaceName"u8); - writer.WriteStringValue(NamespaceName); - } - if (Optional.IsDefined(RequestUri)) - { - writer.WritePropertyName("requestUri"u8); - writer.WriteStringValue(RequestUri); - } - if (Optional.IsDefined(EntityType)) - { - writer.WritePropertyName("entityType"u8); - writer.WriteStringValue(EntityType); - } - if (Optional.IsDefined(QueueName)) - { - writer.WritePropertyName("queueName"u8); - writer.WriteStringValue(QueueName); - } - if (Optional.IsDefined(TopicName)) - { - writer.WritePropertyName("topicName"u8); - writer.WriteStringValue(TopicName); - } - if (Optional.IsDefined(SubscriptionName)) - { - writer.WritePropertyName("subscriptionName"u8); - writer.WriteStringValue(SubscriptionName); - } - 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 - } - } - } - - ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData 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(ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeServiceBusActiveMessagesAvailablePeriodicNotificationsEventData(document.RootElement, options); - } - - internal static ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData DeserializeServiceBusActiveMessagesAvailablePeriodicNotificationsEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string namespaceName = default; - string requestUri = default; - string entityType = default; - string queueName = default; - string topicName = default; - string subscriptionName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("namespaceName"u8)) - { - namespaceName = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestUri"u8)) - { - requestUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("entityType"u8)) - { - entityType = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueName"u8)) - { - queueName = property.Value.GetString(); - continue; - } - if (property.NameEquals("topicName"u8)) - { - topicName = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionName"u8)) - { - subscriptionName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData( - namespaceName, - requestUri, - entityType, - queueName, - topicName, - subscriptionName, - 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(ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData)} does not support writing '{options.Format}' format."); - } - } - - ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData 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 DeserializeServiceBusActiveMessagesAvailablePeriodicNotificationsEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData)} 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 ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeServiceBusActiveMessagesAvailablePeriodicNotificationsEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData.cs deleted file mode 100644 index a5b443e63add..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ServiceBus.ActiveMessagesAvailablePeriodicNotifications event. - public partial class ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData - { - /// - /// 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 ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData() - { - } - - /// Initializes a new instance of . - /// The namespace name of the Microsoft.ServiceBus resource. - /// The endpoint of the Microsoft.ServiceBus resource. - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - /// Keeps track of any properties unknown to the library. - internal ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData(string namespaceName, string requestUri, string entityType, string queueName, string topicName, string subscriptionName, IDictionary serializedAdditionalRawData) - { - NamespaceName = namespaceName; - RequestUri = requestUri; - EntityType = entityType; - QueueName = queueName; - TopicName = topicName; - SubscriptionName = subscriptionName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The namespace name of the Microsoft.ServiceBus resource. - public string NamespaceName { get; } - /// The endpoint of the Microsoft.ServiceBus resource. - public string RequestUri { get; } - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - public string EntityType { get; } - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - public string QueueName { get; } - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - public string TopicName { get; } - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - public string SubscriptionName { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailableWithNoListenersEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailableWithNoListenersEventData.Serialization.cs deleted file mode 100644 index 10f23c8c7709..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailableWithNoListenersEventData.Serialization.cs +++ /dev/null @@ -1,207 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ServiceBusActiveMessagesAvailableWithNoListenersEventData : 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(ServiceBusActiveMessagesAvailableWithNoListenersEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(NamespaceName)) - { - writer.WritePropertyName("namespaceName"u8); - writer.WriteStringValue(NamespaceName); - } - if (Optional.IsDefined(RequestUri)) - { - writer.WritePropertyName("requestUri"u8); - writer.WriteStringValue(RequestUri); - } - if (Optional.IsDefined(EntityType)) - { - writer.WritePropertyName("entityType"u8); - writer.WriteStringValue(EntityType); - } - if (Optional.IsDefined(QueueName)) - { - writer.WritePropertyName("queueName"u8); - writer.WriteStringValue(QueueName); - } - if (Optional.IsDefined(TopicName)) - { - writer.WritePropertyName("topicName"u8); - writer.WriteStringValue(TopicName); - } - if (Optional.IsDefined(SubscriptionName)) - { - writer.WritePropertyName("subscriptionName"u8); - writer.WriteStringValue(SubscriptionName); - } - 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 - } - } - } - - ServiceBusActiveMessagesAvailableWithNoListenersEventData 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(ServiceBusActiveMessagesAvailableWithNoListenersEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeServiceBusActiveMessagesAvailableWithNoListenersEventData(document.RootElement, options); - } - - internal static ServiceBusActiveMessagesAvailableWithNoListenersEventData DeserializeServiceBusActiveMessagesAvailableWithNoListenersEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string namespaceName = default; - string requestUri = default; - string entityType = default; - string queueName = default; - string topicName = default; - string subscriptionName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("namespaceName"u8)) - { - namespaceName = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestUri"u8)) - { - requestUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("entityType"u8)) - { - entityType = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueName"u8)) - { - queueName = property.Value.GetString(); - continue; - } - if (property.NameEquals("topicName"u8)) - { - topicName = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionName"u8)) - { - subscriptionName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ServiceBusActiveMessagesAvailableWithNoListenersEventData( - namespaceName, - requestUri, - entityType, - queueName, - topicName, - subscriptionName, - 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(ServiceBusActiveMessagesAvailableWithNoListenersEventData)} does not support writing '{options.Format}' format."); - } - } - - ServiceBusActiveMessagesAvailableWithNoListenersEventData 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 DeserializeServiceBusActiveMessagesAvailableWithNoListenersEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ServiceBusActiveMessagesAvailableWithNoListenersEventData)} 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 ServiceBusActiveMessagesAvailableWithNoListenersEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeServiceBusActiveMessagesAvailableWithNoListenersEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailableWithNoListenersEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailableWithNoListenersEventData.cs deleted file mode 100644 index 5b06715deecb..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusActiveMessagesAvailableWithNoListenersEventData.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners event. - public partial class ServiceBusActiveMessagesAvailableWithNoListenersEventData - { - /// - /// 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 ServiceBusActiveMessagesAvailableWithNoListenersEventData() - { - } - - /// Initializes a new instance of . - /// The namespace name of the Microsoft.ServiceBus resource. - /// The endpoint of the Microsoft.ServiceBus resource. - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - /// Keeps track of any properties unknown to the library. - internal ServiceBusActiveMessagesAvailableWithNoListenersEventData(string namespaceName, string requestUri, string entityType, string queueName, string topicName, string subscriptionName, IDictionary serializedAdditionalRawData) - { - NamespaceName = namespaceName; - RequestUri = requestUri; - EntityType = entityType; - QueueName = queueName; - TopicName = topicName; - SubscriptionName = subscriptionName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The namespace name of the Microsoft.ServiceBus resource. - public string NamespaceName { get; } - /// The endpoint of the Microsoft.ServiceBus resource. - public string RequestUri { get; } - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - public string EntityType { get; } - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - public string QueueName { get; } - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - public string TopicName { get; } - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - public string SubscriptionName { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData.Serialization.cs deleted file mode 100644 index 4db6bbbb3307..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData.Serialization.cs +++ /dev/null @@ -1,207 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData : 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(ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(NamespaceName)) - { - writer.WritePropertyName("namespaceName"u8); - writer.WriteStringValue(NamespaceName); - } - if (Optional.IsDefined(RequestUri)) - { - writer.WritePropertyName("requestUri"u8); - writer.WriteStringValue(RequestUri); - } - if (Optional.IsDefined(EntityType)) - { - writer.WritePropertyName("entityType"u8); - writer.WriteStringValue(EntityType); - } - if (Optional.IsDefined(QueueName)) - { - writer.WritePropertyName("queueName"u8); - writer.WriteStringValue(QueueName); - } - if (Optional.IsDefined(TopicName)) - { - writer.WritePropertyName("topicName"u8); - writer.WriteStringValue(TopicName); - } - if (Optional.IsDefined(SubscriptionName)) - { - writer.WritePropertyName("subscriptionName"u8); - writer.WriteStringValue(SubscriptionName); - } - 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 - } - } - } - - ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData 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(ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData(document.RootElement, options); - } - - internal static ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData DeserializeServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string namespaceName = default; - string requestUri = default; - string entityType = default; - string queueName = default; - string topicName = default; - string subscriptionName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("namespaceName"u8)) - { - namespaceName = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestUri"u8)) - { - requestUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("entityType"u8)) - { - entityType = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueName"u8)) - { - queueName = property.Value.GetString(); - continue; - } - if (property.NameEquals("topicName"u8)) - { - topicName = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionName"u8)) - { - subscriptionName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData( - namespaceName, - requestUri, - entityType, - queueName, - topicName, - subscriptionName, - 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(ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData)} does not support writing '{options.Format}' format."); - } - } - - ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData 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 DeserializeServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData)} 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 ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData.cs deleted file mode 100644 index dcbc6d7da593..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ServiceBus.DeadletterMessagesAvailablePeriodicNotifications event. - public partial class ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData - { - /// - /// 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 ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData() - { - } - - /// Initializes a new instance of . - /// The namespace name of the Microsoft.ServiceBus resource. - /// The endpoint of the Microsoft.ServiceBus resource. - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - /// Keeps track of any properties unknown to the library. - internal ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData(string namespaceName, string requestUri, string entityType, string queueName, string topicName, string subscriptionName, IDictionary serializedAdditionalRawData) - { - NamespaceName = namespaceName; - RequestUri = requestUri; - EntityType = entityType; - QueueName = queueName; - TopicName = topicName; - SubscriptionName = subscriptionName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The namespace name of the Microsoft.ServiceBus resource. - public string NamespaceName { get; } - /// The endpoint of the Microsoft.ServiceBus resource. - public string RequestUri { get; } - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - public string EntityType { get; } - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - public string QueueName { get; } - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - public string TopicName { get; } - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - public string SubscriptionName { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailableWithNoListenersEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailableWithNoListenersEventData.Serialization.cs deleted file mode 100644 index 53f8605d54c4..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailableWithNoListenersEventData.Serialization.cs +++ /dev/null @@ -1,207 +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.Messaging.EventGrid.SystemEvents -{ - public partial class ServiceBusDeadletterMessagesAvailableWithNoListenersEventData : 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(ServiceBusDeadletterMessagesAvailableWithNoListenersEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(NamespaceName)) - { - writer.WritePropertyName("namespaceName"u8); - writer.WriteStringValue(NamespaceName); - } - if (Optional.IsDefined(RequestUri)) - { - writer.WritePropertyName("requestUri"u8); - writer.WriteStringValue(RequestUri); - } - if (Optional.IsDefined(EntityType)) - { - writer.WritePropertyName("entityType"u8); - writer.WriteStringValue(EntityType); - } - if (Optional.IsDefined(QueueName)) - { - writer.WritePropertyName("queueName"u8); - writer.WriteStringValue(QueueName); - } - if (Optional.IsDefined(TopicName)) - { - writer.WritePropertyName("topicName"u8); - writer.WriteStringValue(TopicName); - } - if (Optional.IsDefined(SubscriptionName)) - { - writer.WritePropertyName("subscriptionName"u8); - writer.WriteStringValue(SubscriptionName); - } - 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 - } - } - } - - ServiceBusDeadletterMessagesAvailableWithNoListenersEventData 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(ServiceBusDeadletterMessagesAvailableWithNoListenersEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeServiceBusDeadletterMessagesAvailableWithNoListenersEventData(document.RootElement, options); - } - - internal static ServiceBusDeadletterMessagesAvailableWithNoListenersEventData DeserializeServiceBusDeadletterMessagesAvailableWithNoListenersEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string namespaceName = default; - string requestUri = default; - string entityType = default; - string queueName = default; - string topicName = default; - string subscriptionName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("namespaceName"u8)) - { - namespaceName = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestUri"u8)) - { - requestUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("entityType"u8)) - { - entityType = property.Value.GetString(); - continue; - } - if (property.NameEquals("queueName"u8)) - { - queueName = property.Value.GetString(); - continue; - } - if (property.NameEquals("topicName"u8)) - { - topicName = property.Value.GetString(); - continue; - } - if (property.NameEquals("subscriptionName"u8)) - { - subscriptionName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ServiceBusDeadletterMessagesAvailableWithNoListenersEventData( - namespaceName, - requestUri, - entityType, - queueName, - topicName, - subscriptionName, - 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(ServiceBusDeadletterMessagesAvailableWithNoListenersEventData)} does not support writing '{options.Format}' format."); - } - } - - ServiceBusDeadletterMessagesAvailableWithNoListenersEventData 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 DeserializeServiceBusDeadletterMessagesAvailableWithNoListenersEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ServiceBusDeadletterMessagesAvailableWithNoListenersEventData)} 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 ServiceBusDeadletterMessagesAvailableWithNoListenersEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeServiceBusDeadletterMessagesAvailableWithNoListenersEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailableWithNoListenersEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailableWithNoListenersEventData.cs deleted file mode 100644 index ea92138d8a82..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/ServiceBusDeadletterMessagesAvailableWithNoListenersEventData.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners event. - public partial class ServiceBusDeadletterMessagesAvailableWithNoListenersEventData - { - /// - /// 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 ServiceBusDeadletterMessagesAvailableWithNoListenersEventData() - { - } - - /// Initializes a new instance of . - /// The namespace name of the Microsoft.ServiceBus resource. - /// The endpoint of the Microsoft.ServiceBus resource. - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - /// Keeps track of any properties unknown to the library. - internal ServiceBusDeadletterMessagesAvailableWithNoListenersEventData(string namespaceName, string requestUri, string entityType, string queueName, string topicName, string subscriptionName, IDictionary serializedAdditionalRawData) - { - NamespaceName = namespaceName; - RequestUri = requestUri; - EntityType = entityType; - QueueName = queueName; - TopicName = topicName; - SubscriptionName = subscriptionName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The namespace name of the Microsoft.ServiceBus resource. - public string NamespaceName { get; } - /// The endpoint of the Microsoft.ServiceBus resource. - public string RequestUri { get; } - /// The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'. - public string EntityType { get; } - /// The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then this value will be null. - public string QueueName { get; } - /// The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this value will be null. - public string TopicName { get; } - /// The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type 'queue', then this value will be null. - public string SubscriptionName { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionConnectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionConnectedEventData.Serialization.cs deleted file mode 100644 index 13dd8294ddcd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionConnectedEventData.Serialization.cs +++ /dev/null @@ -1,175 +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.Messaging.EventGrid.SystemEvents -{ - public partial class SignalRServiceClientConnectionConnectedEventData : 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(SignalRServiceClientConnectionConnectedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(HubName)) - { - writer.WritePropertyName("hubName"u8); - writer.WriteStringValue(HubName); - } - if (Optional.IsDefined(ConnectionId)) - { - writer.WritePropertyName("connectionId"u8); - writer.WriteStringValue(ConnectionId); - } - if (Optional.IsDefined(UserId)) - { - writer.WritePropertyName("userId"u8); - writer.WriteStringValue(UserId); - } - 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 - } - } - } - - SignalRServiceClientConnectionConnectedEventData 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(SignalRServiceClientConnectionConnectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSignalRServiceClientConnectionConnectedEventData(document.RootElement, options); - } - - internal static SignalRServiceClientConnectionConnectedEventData DeserializeSignalRServiceClientConnectionConnectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset timestamp = default; - string hubName = default; - string connectionId = default; - string userId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("hubName"u8)) - { - hubName = property.Value.GetString(); - continue; - } - if (property.NameEquals("connectionId"u8)) - { - connectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("userId"u8)) - { - userId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SignalRServiceClientConnectionConnectedEventData(timestamp, hubName, connectionId, userId, 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(SignalRServiceClientConnectionConnectedEventData)} does not support writing '{options.Format}' format."); - } - } - - SignalRServiceClientConnectionConnectedEventData 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 DeserializeSignalRServiceClientConnectionConnectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SignalRServiceClientConnectionConnectedEventData)} 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 SignalRServiceClientConnectionConnectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeSignalRServiceClientConnectionConnectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionConnectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionConnectedEventData.cs deleted file mode 100644 index dcb093dd889d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionConnectedEventData.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.SignalRService.ClientConnectionConnected event. - public partial class SignalRServiceClientConnectionConnectedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time at which the event occurred. - internal SignalRServiceClientConnectionConnectedEventData(DateTimeOffset timestamp) - { - Timestamp = timestamp; - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The hub of connected client connection. - /// The connection Id of connected client connection. - /// The user Id of connected client connection. - /// Keeps track of any properties unknown to the library. - internal SignalRServiceClientConnectionConnectedEventData(DateTimeOffset timestamp, string hubName, string connectionId, string userId, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - HubName = hubName; - ConnectionId = connectionId; - UserId = userId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal SignalRServiceClientConnectionConnectedEventData() - { - } - - /// The time at which the event occurred. - public DateTimeOffset Timestamp { get; } - /// The hub of connected client connection. - public string HubName { get; } - /// The connection Id of connected client connection. - public string ConnectionId { get; } - /// The user Id of connected client connection. - public string UserId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionDisconnectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionDisconnectedEventData.Serialization.cs deleted file mode 100644 index 33279e9b4fe6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionDisconnectedEventData.Serialization.cs +++ /dev/null @@ -1,192 +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.Messaging.EventGrid.SystemEvents -{ - public partial class SignalRServiceClientConnectionDisconnectedEventData : 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(SignalRServiceClientConnectionDisconnectedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp, "O"); - if (Optional.IsDefined(HubName)) - { - writer.WritePropertyName("hubName"u8); - writer.WriteStringValue(HubName); - } - if (Optional.IsDefined(ConnectionId)) - { - writer.WritePropertyName("connectionId"u8); - writer.WriteStringValue(ConnectionId); - } - if (Optional.IsDefined(UserId)) - { - writer.WritePropertyName("userId"u8); - writer.WriteStringValue(UserId); - } - if (Optional.IsDefined(ErrorMessage)) - { - writer.WritePropertyName("errorMessage"u8); - writer.WriteStringValue(ErrorMessage); - } - 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 - } - } - } - - SignalRServiceClientConnectionDisconnectedEventData 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(SignalRServiceClientConnectionDisconnectedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSignalRServiceClientConnectionDisconnectedEventData(document.RootElement, options); - } - - internal static SignalRServiceClientConnectionDisconnectedEventData DeserializeSignalRServiceClientConnectionDisconnectedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset timestamp = default; - string hubName = default; - string connectionId = default; - string userId = default; - string errorMessage = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("hubName"u8)) - { - hubName = property.Value.GetString(); - continue; - } - if (property.NameEquals("connectionId"u8)) - { - connectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("userId"u8)) - { - userId = property.Value.GetString(); - continue; - } - if (property.NameEquals("errorMessage"u8)) - { - errorMessage = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SignalRServiceClientConnectionDisconnectedEventData( - timestamp, - hubName, - connectionId, - userId, - errorMessage, - 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(SignalRServiceClientConnectionDisconnectedEventData)} does not support writing '{options.Format}' format."); - } - } - - SignalRServiceClientConnectionDisconnectedEventData 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 DeserializeSignalRServiceClientConnectionDisconnectedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SignalRServiceClientConnectionDisconnectedEventData)} 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 SignalRServiceClientConnectionDisconnectedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeSignalRServiceClientConnectionDisconnectedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionDisconnectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionDisconnectedEventData.cs deleted file mode 100644 index 6a0f3883fc81..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SignalRServiceClientConnectionDisconnectedEventData.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.SignalRService.ClientConnectionDisconnected event. - public partial class SignalRServiceClientConnectionDisconnectedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time at which the event occurred. - internal SignalRServiceClientConnectionDisconnectedEventData(DateTimeOffset timestamp) - { - Timestamp = timestamp; - } - - /// Initializes a new instance of . - /// The time at which the event occurred. - /// The hub of connected client connection. - /// The connection Id of connected client connection. - /// The user Id of connected client connection. - /// The message of error that cause the client connection disconnected. - /// Keeps track of any properties unknown to the library. - internal SignalRServiceClientConnectionDisconnectedEventData(DateTimeOffset timestamp, string hubName, string connectionId, string userId, string errorMessage, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - HubName = hubName; - ConnectionId = connectionId; - UserId = userId; - ErrorMessage = errorMessage; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal SignalRServiceClientConnectionDisconnectedEventData() - { - } - - /// The time at which the event occurred. - public DateTimeOffset Timestamp { get; } - /// The hub of connected client connection. - public string HubName { get; } - /// The connection Id of connected client connection. - public string ConnectionId { get; } - /// The user Id of connected client connection. - public string UserId { get; } - /// The message of error that cause the client connection disconnected. - public string ErrorMessage { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StampKind.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StampKind.cs deleted file mode 100644 index e80161dd3493..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StampKind.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Kind of environment where app service plan is. - public readonly partial struct StampKind : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public StampKind(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PublicValue = "Public"; - private const string AseV1Value = "AseV1"; - private const string AseV2Value = "AseV2"; - - /// App Service Plan is running on a public stamp. - public static StampKind Public { get; } = new StampKind(PublicValue); - /// App Service Plan is running on an App Service Environment V1. - public static StampKind AseV1 { get; } = new StampKind(AseV1Value); - /// App Service Plan is running on an App Service Environment V2. - public static StampKind AseV2 { get; } = new StampKind(AseV2Value); - /// Determines if two values are the same. - public static bool operator ==(StampKind left, StampKind right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(StampKind left, StampKind right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator StampKind(string value) => new StampKind(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is StampKind other && Equals(other); - /// - public bool Equals(StampKind 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageAsyncOperationInitiatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageAsyncOperationInitiatedEventData.Serialization.cs deleted file mode 100644 index c70924f23f12..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageAsyncOperationInitiatedEventData.Serialization.cs +++ /dev/null @@ -1,286 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageAsyncOperationInitiatedEventData : 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(StorageAsyncOperationInitiatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Api)) - { - writer.WritePropertyName("api"u8); - writer.WriteStringValue(Api); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(ContentType)) - { - writer.WritePropertyName("contentType"u8); - writer.WriteStringValue(ContentType); - } - if (Optional.IsDefined(ContentLength)) - { - writer.WritePropertyName("contentLength"u8); - writer.WriteNumberValue(ContentLength.Value); - } - if (Optional.IsDefined(BlobType)) - { - writer.WritePropertyName("blobType"u8); - writer.WriteStringValue(BlobType); - } - if (Optional.IsDefined(Url)) - { - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - } - if (Optional.IsDefined(Sequencer)) - { - writer.WritePropertyName("sequencer"u8); - writer.WriteStringValue(Sequencer); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - writer.WriteStringValue(Identity); - } - writer.WritePropertyName("storageDiagnostics"u8); - writer.WriteStartObject(); - foreach (var item in StorageDiagnostics) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - StorageAsyncOperationInitiatedEventData 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(StorageAsyncOperationInitiatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageAsyncOperationInitiatedEventData(document.RootElement, options); - } - - internal static StorageAsyncOperationInitiatedEventData DeserializeStorageAsyncOperationInitiatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string api = default; - string clientRequestId = default; - string requestId = default; - string contentType = default; - long? contentLength = default; - string blobType = default; - string url = default; - string sequencer = default; - string identity = default; - IReadOnlyDictionary storageDiagnostics = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("api"u8)) - { - api = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentType"u8)) - { - contentType = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentLength"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - contentLength = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("blobType"u8)) - { - blobType = property.Value.GetString(); - continue; - } - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequencer"u8)) - { - sequencer = property.Value.GetString(); - continue; - } - if (property.NameEquals("identity"u8)) - { - identity = property.Value.GetString(); - continue; - } - if (property.NameEquals("storageDiagnostics"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - storageDiagnostics = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageAsyncOperationInitiatedEventData( - api, - clientRequestId, - requestId, - contentType, - contentLength, - blobType, - url, - sequencer, - identity, - storageDiagnostics, - 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(StorageAsyncOperationInitiatedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageAsyncOperationInitiatedEventData 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 DeserializeStorageAsyncOperationInitiatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageAsyncOperationInitiatedEventData)} 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 StorageAsyncOperationInitiatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageAsyncOperationInitiatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageAsyncOperationInitiatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageAsyncOperationInitiatedEventData.cs deleted file mode 100644 index 18206f1e5c1f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageAsyncOperationInitiatedEventData.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Storage.AsyncOperationInitiated event. - public partial class StorageAsyncOperationInitiatedEventData - { - /// - /// 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 . - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// is null. - internal StorageAsyncOperationInitiatedEventData(IReadOnlyDictionary storageDiagnostics) - { - Argument.AssertNotNull(storageDiagnostics, nameof(storageDiagnostics)); - - StorageDiagnostics = storageDiagnostics; - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - /// The size of the blob in bytes. This is the same as what would be returned in the Content-Length header from the blob. - /// The type of blob. - /// The path to the blob. - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// Keeps track of any properties unknown to the library. - internal StorageAsyncOperationInitiatedEventData(string api, string clientRequestId, string requestId, string contentType, long? contentLength, string blobType, string url, string sequencer, string identity, IReadOnlyDictionary storageDiagnostics, IDictionary serializedAdditionalRawData) - { - Api = api; - ClientRequestId = clientRequestId; - RequestId = requestId; - ContentType = contentType; - ContentLength = contentLength; - BlobType = blobType; - Url = url; - Sequencer = sequencer; - Identity = identity; - StorageDiagnostics = storageDiagnostics; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageAsyncOperationInitiatedEventData() - { - } - - /// The name of the API/operation that triggered this event. - public string Api { get; } - /// A request id provided by the client of the storage API operation that triggered this event. - public string ClientRequestId { get; } - /// The request id generated by the storage service for the storage API operation that triggered this event. - public string RequestId { get; } - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - public string ContentType { get; } - /// The size of the blob in bytes. This is the same as what would be returned in the Content-Length header from the blob. - public long? ContentLength { get; } - /// The type of blob. - public string BlobType { get; } - /// The path to the blob. - public string Url { get; } - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - public string Sequencer { get; } - /// The identity of the requester that triggered this event. - public string Identity { get; } - /// - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary StorageDiagnostics { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobCreatedEventData.Serialization.cs deleted file mode 100644 index 2612495b4542..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobCreatedEventData.Serialization.cs +++ /dev/null @@ -1,314 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageBlobCreatedEventData : 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(StorageBlobCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Api)) - { - writer.WritePropertyName("api"u8); - writer.WriteStringValue(Api); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(ETag)) - { - writer.WritePropertyName("eTag"u8); - writer.WriteStringValue(ETag); - } - if (Optional.IsDefined(ContentType)) - { - writer.WritePropertyName("contentType"u8); - writer.WriteStringValue(ContentType); - } - if (Optional.IsDefined(ContentLength)) - { - writer.WritePropertyName("contentLength"u8); - writer.WriteNumberValue(ContentLength.Value); - } - if (Optional.IsDefined(ContentOffset)) - { - writer.WritePropertyName("contentOffset"u8); - writer.WriteNumberValue(ContentOffset.Value); - } - if (Optional.IsDefined(BlobType)) - { - writer.WritePropertyName("blobType"u8); - writer.WriteStringValue(BlobType); - } - if (Optional.IsDefined(Url)) - { - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - } - if (Optional.IsDefined(Sequencer)) - { - writer.WritePropertyName("sequencer"u8); - writer.WriteStringValue(Sequencer); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - writer.WriteStringValue(Identity); - } - writer.WritePropertyName("storageDiagnostics"u8); - writer.WriteStartObject(); - foreach (var item in StorageDiagnostics) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - StorageBlobCreatedEventData 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(StorageBlobCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageBlobCreatedEventData(document.RootElement, options); - } - - internal static StorageBlobCreatedEventData DeserializeStorageBlobCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string api = default; - string clientRequestId = default; - string requestId = default; - string eTag = default; - string contentType = default; - long? contentLength = default; - long? contentOffset = default; - string blobType = default; - string url = default; - string sequencer = default; - string identity = default; - IReadOnlyDictionary storageDiagnostics = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("api"u8)) - { - api = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("eTag"u8)) - { - eTag = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentType"u8)) - { - contentType = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentLength"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - contentLength = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("contentOffset"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - contentOffset = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("blobType"u8)) - { - blobType = property.Value.GetString(); - continue; - } - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequencer"u8)) - { - sequencer = property.Value.GetString(); - continue; - } - if (property.NameEquals("identity"u8)) - { - identity = property.Value.GetString(); - continue; - } - if (property.NameEquals("storageDiagnostics"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - storageDiagnostics = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageBlobCreatedEventData( - api, - clientRequestId, - requestId, - eTag, - contentType, - contentLength, - contentOffset, - blobType, - url, - sequencer, - identity, - storageDiagnostics, - 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(StorageBlobCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageBlobCreatedEventData 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 DeserializeStorageBlobCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageBlobCreatedEventData)} 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 StorageBlobCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageBlobCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobCreatedEventData.cs deleted file mode 100644 index a1799eea345a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobCreatedEventData.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Storage.BlobCreated event. - public partial class StorageBlobCreatedEventData - { - /// - /// 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 . - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// is null. - internal StorageBlobCreatedEventData(IReadOnlyDictionary storageDiagnostics) - { - Argument.AssertNotNull(storageDiagnostics, nameof(storageDiagnostics)); - - StorageDiagnostics = storageDiagnostics; - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The etag of the blob at the time this event was triggered. - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - /// The size of the blob in bytes. This is the same as what would be returned in the Content-Length header from the blob. - /// The offset of the blob in bytes. - /// The type of blob. - /// The path to the blob. - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// Keeps track of any properties unknown to the library. - internal StorageBlobCreatedEventData(string api, string clientRequestId, string requestId, string eTag, string contentType, long? contentLength, long? contentOffset, string blobType, string url, string sequencer, string identity, IReadOnlyDictionary storageDiagnostics, IDictionary serializedAdditionalRawData) - { - Api = api; - ClientRequestId = clientRequestId; - RequestId = requestId; - ETag = eTag; - ContentType = contentType; - ContentLength = contentLength; - ContentOffset = contentOffset; - BlobType = blobType; - Url = url; - Sequencer = sequencer; - Identity = identity; - StorageDiagnostics = storageDiagnostics; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageBlobCreatedEventData() - { - } - - /// The name of the API/operation that triggered this event. - public string Api { get; } - /// A request id provided by the client of the storage API operation that triggered this event. - public string ClientRequestId { get; } - /// The request id generated by the storage service for the storage API operation that triggered this event. - public string RequestId { get; } - /// The etag of the blob at the time this event was triggered. - public string ETag { get; } - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - public string ContentType { get; } - /// The size of the blob in bytes. This is the same as what would be returned in the Content-Length header from the blob. - public long? ContentLength { get; } - /// The offset of the blob in bytes. - public long? ContentOffset { get; } - /// The type of blob. - public string BlobType { get; } - /// The path to the blob. - public string Url { get; } - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - public string Sequencer { get; } - /// The identity of the requester that triggered this event. - public string Identity { get; } - /// - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary StorageDiagnostics { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobDeletedEventData.Serialization.cs deleted file mode 100644 index f9d3b771d7a9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobDeletedEventData.Serialization.cs +++ /dev/null @@ -1,270 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageBlobDeletedEventData : 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(StorageBlobDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Api)) - { - writer.WritePropertyName("api"u8); - writer.WriteStringValue(Api); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(ContentType)) - { - writer.WritePropertyName("contentType"u8); - writer.WriteStringValue(ContentType); - } - if (Optional.IsDefined(BlobType)) - { - writer.WritePropertyName("blobType"u8); - writer.WriteStringValue(BlobType); - } - if (Optional.IsDefined(Url)) - { - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - } - if (Optional.IsDefined(Sequencer)) - { - writer.WritePropertyName("sequencer"u8); - writer.WriteStringValue(Sequencer); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - writer.WriteStringValue(Identity); - } - writer.WritePropertyName("storageDiagnostics"u8); - writer.WriteStartObject(); - foreach (var item in StorageDiagnostics) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - StorageBlobDeletedEventData 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(StorageBlobDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageBlobDeletedEventData(document.RootElement, options); - } - - internal static StorageBlobDeletedEventData DeserializeStorageBlobDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string api = default; - string clientRequestId = default; - string requestId = default; - string contentType = default; - string blobType = default; - string url = default; - string sequencer = default; - string identity = default; - IReadOnlyDictionary storageDiagnostics = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("api"u8)) - { - api = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentType"u8)) - { - contentType = property.Value.GetString(); - continue; - } - if (property.NameEquals("blobType"u8)) - { - blobType = property.Value.GetString(); - continue; - } - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequencer"u8)) - { - sequencer = property.Value.GetString(); - continue; - } - if (property.NameEquals("identity"u8)) - { - identity = property.Value.GetString(); - continue; - } - if (property.NameEquals("storageDiagnostics"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - storageDiagnostics = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageBlobDeletedEventData( - api, - clientRequestId, - requestId, - contentType, - blobType, - url, - sequencer, - identity, - storageDiagnostics, - 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(StorageBlobDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageBlobDeletedEventData 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 DeserializeStorageBlobDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageBlobDeletedEventData)} 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 StorageBlobDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageBlobDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobDeletedEventData.cs deleted file mode 100644 index c819b253bf34..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobDeletedEventData.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Storage.BlobDeleted event. - public partial class StorageBlobDeletedEventData - { - /// - /// 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 . - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// is null. - internal StorageBlobDeletedEventData(IReadOnlyDictionary storageDiagnostics) - { - Argument.AssertNotNull(storageDiagnostics, nameof(storageDiagnostics)); - - StorageDiagnostics = storageDiagnostics; - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - /// The type of blob. - /// The path to the blob. - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// Keeps track of any properties unknown to the library. - internal StorageBlobDeletedEventData(string api, string clientRequestId, string requestId, string contentType, string blobType, string url, string sequencer, string identity, IReadOnlyDictionary storageDiagnostics, IDictionary serializedAdditionalRawData) - { - Api = api; - ClientRequestId = clientRequestId; - RequestId = requestId; - ContentType = contentType; - BlobType = blobType; - Url = url; - Sequencer = sequencer; - Identity = identity; - StorageDiagnostics = storageDiagnostics; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageBlobDeletedEventData() - { - } - - /// The name of the API/operation that triggered this event. - public string Api { get; } - /// A request id provided by the client of the storage API operation that triggered this event. - public string ClientRequestId { get; } - /// The request id generated by the storage service for the storage API operation that triggered this event. - public string RequestId { get; } - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - public string ContentType { get; } - /// The type of blob. - public string BlobType { get; } - /// The path to the blob. - public string Url { get; } - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - public string Sequencer { get; } - /// The identity of the requester that triggered this event. - public string Identity { get; } - /// - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary StorageDiagnostics { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobInventoryPolicyCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobInventoryPolicyCompletedEventData.Serialization.cs deleted file mode 100644 index 6471e17fc66b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobInventoryPolicyCompletedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageBlobInventoryPolicyCompletedEventData : 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(StorageBlobInventoryPolicyCompletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("scheduleDateTime"u8); - writer.WriteStringValue(ScheduleDateTime, "O"); - if (Optional.IsDefined(AccountName)) - { - writer.WritePropertyName("accountName"u8); - writer.WriteStringValue(AccountName); - } - if (Optional.IsDefined(RuleName)) - { - writer.WritePropertyName("ruleName"u8); - writer.WriteStringValue(RuleName); - } - if (Optional.IsDefined(PolicyRunStatus)) - { - writer.WritePropertyName("policyRunStatus"u8); - writer.WriteStringValue(PolicyRunStatus); - } - if (Optional.IsDefined(PolicyRunStatusMessage)) - { - writer.WritePropertyName("policyRunStatusMessage"u8); - writer.WriteStringValue(PolicyRunStatusMessage); - } - if (Optional.IsDefined(PolicyRunId)) - { - writer.WritePropertyName("policyRunId"u8); - writer.WriteStringValue(PolicyRunId); - } - if (Optional.IsDefined(ManifestBlobUrl)) - { - writer.WritePropertyName("manifestBlobUrl"u8); - writer.WriteStringValue(ManifestBlobUrl); - } - 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 - } - } - } - - StorageBlobInventoryPolicyCompletedEventData 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(StorageBlobInventoryPolicyCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageBlobInventoryPolicyCompletedEventData(document.RootElement, options); - } - - internal static StorageBlobInventoryPolicyCompletedEventData DeserializeStorageBlobInventoryPolicyCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset scheduleDateTime = default; - string accountName = default; - string ruleName = default; - string policyRunStatus = default; - string policyRunStatusMessage = default; - string policyRunId = default; - string manifestBlobUrl = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("scheduleDateTime"u8)) - { - scheduleDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("accountName"u8)) - { - accountName = property.Value.GetString(); - continue; - } - if (property.NameEquals("ruleName"u8)) - { - ruleName = property.Value.GetString(); - continue; - } - if (property.NameEquals("policyRunStatus"u8)) - { - policyRunStatus = property.Value.GetString(); - continue; - } - if (property.NameEquals("policyRunStatusMessage"u8)) - { - policyRunStatusMessage = property.Value.GetString(); - continue; - } - if (property.NameEquals("policyRunId"u8)) - { - policyRunId = property.Value.GetString(); - continue; - } - if (property.NameEquals("manifestBlobUrl"u8)) - { - manifestBlobUrl = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageBlobInventoryPolicyCompletedEventData( - scheduleDateTime, - accountName, - ruleName, - policyRunStatus, - policyRunStatusMessage, - policyRunId, - manifestBlobUrl, - 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(StorageBlobInventoryPolicyCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageBlobInventoryPolicyCompletedEventData 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 DeserializeStorageBlobInventoryPolicyCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageBlobInventoryPolicyCompletedEventData)} 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 StorageBlobInventoryPolicyCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageBlobInventoryPolicyCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobInventoryPolicyCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobInventoryPolicyCompletedEventData.cs deleted file mode 100644 index 97097e7a9b6f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobInventoryPolicyCompletedEventData.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for an Microsoft.Storage.BlobInventoryPolicyCompleted event. - public partial class StorageBlobInventoryPolicyCompletedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time at which inventory policy was scheduled. - internal StorageBlobInventoryPolicyCompletedEventData(DateTimeOffset scheduleDateTime) - { - ScheduleDateTime = scheduleDateTime; - } - - /// Initializes a new instance of . - /// The time at which inventory policy was scheduled. - /// The account name for which inventory policy is registered. - /// The rule name for inventory policy. - /// The status of inventory run, it can be Succeeded/PartiallySucceeded/Failed. - /// The status message for inventory run. - /// The policy run id for inventory run. - /// The blob URL for manifest file for inventory run. - /// Keeps track of any properties unknown to the library. - internal StorageBlobInventoryPolicyCompletedEventData(DateTimeOffset scheduleDateTime, string accountName, string ruleName, string policyRunStatus, string policyRunStatusMessage, string policyRunId, string manifestBlobUrl, IDictionary serializedAdditionalRawData) - { - ScheduleDateTime = scheduleDateTime; - AccountName = accountName; - RuleName = ruleName; - PolicyRunStatus = policyRunStatus; - PolicyRunStatusMessage = policyRunStatusMessage; - PolicyRunId = policyRunId; - ManifestBlobUrl = manifestBlobUrl; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageBlobInventoryPolicyCompletedEventData() - { - } - - /// The time at which inventory policy was scheduled. - public DateTimeOffset ScheduleDateTime { get; } - /// The account name for which inventory policy is registered. - public string AccountName { get; } - /// The rule name for inventory policy. - public string RuleName { get; } - /// The status of inventory run, it can be Succeeded/PartiallySucceeded/Failed. - public string PolicyRunStatus { get; } - /// The status message for inventory run. - public string PolicyRunStatusMessage { get; } - /// The policy run id for inventory run. - public string PolicyRunId { get; } - /// The blob URL for manifest file for inventory run. - public string ManifestBlobUrl { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobRenamedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobRenamedEventData.Serialization.cs deleted file mode 100644 index 0cef85c3fe60..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobRenamedEventData.Serialization.cs +++ /dev/null @@ -1,258 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageBlobRenamedEventData : 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(StorageBlobRenamedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Api)) - { - writer.WritePropertyName("api"u8); - writer.WriteStringValue(Api); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(SourceUrl)) - { - writer.WritePropertyName("sourceUrl"u8); - writer.WriteStringValue(SourceUrl); - } - if (Optional.IsDefined(DestinationUrl)) - { - writer.WritePropertyName("destinationUrl"u8); - writer.WriteStringValue(DestinationUrl); - } - if (Optional.IsDefined(Sequencer)) - { - writer.WritePropertyName("sequencer"u8); - writer.WriteStringValue(Sequencer); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - writer.WriteStringValue(Identity); - } - writer.WritePropertyName("storageDiagnostics"u8); - writer.WriteStartObject(); - foreach (var item in StorageDiagnostics) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - StorageBlobRenamedEventData 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(StorageBlobRenamedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageBlobRenamedEventData(document.RootElement, options); - } - - internal static StorageBlobRenamedEventData DeserializeStorageBlobRenamedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string api = default; - string clientRequestId = default; - string requestId = default; - string sourceUrl = default; - string destinationUrl = default; - string sequencer = default; - string identity = default; - IReadOnlyDictionary storageDiagnostics = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("api"u8)) - { - api = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("sourceUrl"u8)) - { - sourceUrl = property.Value.GetString(); - continue; - } - if (property.NameEquals("destinationUrl"u8)) - { - destinationUrl = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequencer"u8)) - { - sequencer = property.Value.GetString(); - continue; - } - if (property.NameEquals("identity"u8)) - { - identity = property.Value.GetString(); - continue; - } - if (property.NameEquals("storageDiagnostics"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - storageDiagnostics = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageBlobRenamedEventData( - api, - clientRequestId, - requestId, - sourceUrl, - destinationUrl, - sequencer, - identity, - storageDiagnostics, - 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(StorageBlobRenamedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageBlobRenamedEventData 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 DeserializeStorageBlobRenamedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageBlobRenamedEventData)} 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 StorageBlobRenamedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageBlobRenamedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobRenamedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobRenamedEventData.cs deleted file mode 100644 index 04cb73986c2e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobRenamedEventData.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Storage.BlobRenamed event. - public partial class StorageBlobRenamedEventData - { - /// - /// 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 . - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// is null. - internal StorageBlobRenamedEventData(IReadOnlyDictionary storageDiagnostics) - { - Argument.AssertNotNull(storageDiagnostics, nameof(storageDiagnostics)); - - StorageDiagnostics = storageDiagnostics; - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The path to the blob that was renamed. - /// The new path to the blob after the rename operation. - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// Keeps track of any properties unknown to the library. - internal StorageBlobRenamedEventData(string api, string clientRequestId, string requestId, string sourceUrl, string destinationUrl, string sequencer, string identity, IReadOnlyDictionary storageDiagnostics, IDictionary serializedAdditionalRawData) - { - Api = api; - ClientRequestId = clientRequestId; - RequestId = requestId; - SourceUrl = sourceUrl; - DestinationUrl = destinationUrl; - Sequencer = sequencer; - Identity = identity; - StorageDiagnostics = storageDiagnostics; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageBlobRenamedEventData() - { - } - - /// The name of the API/operation that triggered this event. - public string Api { get; } - /// A request id provided by the client of the storage API operation that triggered this event. - public string ClientRequestId { get; } - /// The request id generated by the storage service for the storage API operation that triggered this event. - public string RequestId { get; } - /// The path to the blob that was renamed. - public string SourceUrl { get; } - /// The new path to the blob after the rename operation. - public string DestinationUrl { get; } - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - public string Sequencer { get; } - /// The identity of the requester that triggered this event. - public string Identity { get; } - /// - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary StorageDiagnostics { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobTierChangedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobTierChangedEventData.Serialization.cs deleted file mode 100644 index 7ecdd6aae802..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobTierChangedEventData.Serialization.cs +++ /dev/null @@ -1,286 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageBlobTierChangedEventData : 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(StorageBlobTierChangedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Api)) - { - writer.WritePropertyName("api"u8); - writer.WriteStringValue(Api); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(ContentType)) - { - writer.WritePropertyName("contentType"u8); - writer.WriteStringValue(ContentType); - } - if (Optional.IsDefined(ContentLength)) - { - writer.WritePropertyName("contentLength"u8); - writer.WriteNumberValue(ContentLength.Value); - } - if (Optional.IsDefined(BlobType)) - { - writer.WritePropertyName("blobType"u8); - writer.WriteStringValue(BlobType); - } - if (Optional.IsDefined(Url)) - { - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - } - if (Optional.IsDefined(Sequencer)) - { - writer.WritePropertyName("sequencer"u8); - writer.WriteStringValue(Sequencer); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - writer.WriteStringValue(Identity); - } - writer.WritePropertyName("storageDiagnostics"u8); - writer.WriteStartObject(); - foreach (var item in StorageDiagnostics) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - StorageBlobTierChangedEventData 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(StorageBlobTierChangedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageBlobTierChangedEventData(document.RootElement, options); - } - - internal static StorageBlobTierChangedEventData DeserializeStorageBlobTierChangedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string api = default; - string clientRequestId = default; - string requestId = default; - string contentType = default; - long? contentLength = default; - string blobType = default; - string url = default; - string sequencer = default; - string identity = default; - IReadOnlyDictionary storageDiagnostics = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("api"u8)) - { - api = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentType"u8)) - { - contentType = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentLength"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - contentLength = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("blobType"u8)) - { - blobType = property.Value.GetString(); - continue; - } - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequencer"u8)) - { - sequencer = property.Value.GetString(); - continue; - } - if (property.NameEquals("identity"u8)) - { - identity = property.Value.GetString(); - continue; - } - if (property.NameEquals("storageDiagnostics"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - storageDiagnostics = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageBlobTierChangedEventData( - api, - clientRequestId, - requestId, - contentType, - contentLength, - blobType, - url, - sequencer, - identity, - storageDiagnostics, - 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(StorageBlobTierChangedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageBlobTierChangedEventData 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 DeserializeStorageBlobTierChangedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageBlobTierChangedEventData)} 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 StorageBlobTierChangedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageBlobTierChangedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobTierChangedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobTierChangedEventData.cs deleted file mode 100644 index e1f0f18db416..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageBlobTierChangedEventData.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Storage.BlobTierChanged event. - public partial class StorageBlobTierChangedEventData - { - /// - /// 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 . - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// is null. - internal StorageBlobTierChangedEventData(IReadOnlyDictionary storageDiagnostics) - { - Argument.AssertNotNull(storageDiagnostics, nameof(storageDiagnostics)); - - StorageDiagnostics = storageDiagnostics; - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - /// The size of the blob in bytes. This is the same as what would be returned in the Content-Length header from the blob. - /// The type of blob. - /// The path to the blob. - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// Keeps track of any properties unknown to the library. - internal StorageBlobTierChangedEventData(string api, string clientRequestId, string requestId, string contentType, long? contentLength, string blobType, string url, string sequencer, string identity, IReadOnlyDictionary storageDiagnostics, IDictionary serializedAdditionalRawData) - { - Api = api; - ClientRequestId = clientRequestId; - RequestId = requestId; - ContentType = contentType; - ContentLength = contentLength; - BlobType = blobType; - Url = url; - Sequencer = sequencer; - Identity = identity; - StorageDiagnostics = storageDiagnostics; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageBlobTierChangedEventData() - { - } - - /// The name of the API/operation that triggered this event. - public string Api { get; } - /// A request id provided by the client of the storage API operation that triggered this event. - public string ClientRequestId { get; } - /// The request id generated by the storage service for the storage API operation that triggered this event. - public string RequestId { get; } - /// The content type of the blob. This is the same as what would be returned in the Content-Type header from the blob. - public string ContentType { get; } - /// The size of the blob in bytes. This is the same as what would be returned in the Content-Length header from the blob. - public long? ContentLength { get; } - /// The type of blob. - public string BlobType { get; } - /// The path to the blob. - public string Url { get; } - /// An opaque string value representing the logical sequence of events for any particular blob name. Users can use standard string comparison to understand the relative sequence of two events on the same blob name. - public string Sequencer { get; } - /// The identity of the requester that triggered this event. - public string Identity { get; } - /// - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary StorageDiagnostics { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryCreatedEventData.Serialization.cs deleted file mode 100644 index 0d0d24c1033c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryCreatedEventData.Serialization.cs +++ /dev/null @@ -1,258 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageDirectoryCreatedEventData : 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(StorageDirectoryCreatedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Api)) - { - writer.WritePropertyName("api"u8); - writer.WriteStringValue(Api); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(ETag)) - { - writer.WritePropertyName("eTag"u8); - writer.WriteStringValue(ETag); - } - if (Optional.IsDefined(Url)) - { - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - } - if (Optional.IsDefined(Sequencer)) - { - writer.WritePropertyName("sequencer"u8); - writer.WriteStringValue(Sequencer); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - writer.WriteStringValue(Identity); - } - writer.WritePropertyName("storageDiagnostics"u8); - writer.WriteStartObject(); - foreach (var item in StorageDiagnostics) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - StorageDirectoryCreatedEventData 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(StorageDirectoryCreatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageDirectoryCreatedEventData(document.RootElement, options); - } - - internal static StorageDirectoryCreatedEventData DeserializeStorageDirectoryCreatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string api = default; - string clientRequestId = default; - string requestId = default; - string eTag = default; - string url = default; - string sequencer = default; - string identity = default; - IReadOnlyDictionary storageDiagnostics = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("api"u8)) - { - api = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("eTag"u8)) - { - eTag = property.Value.GetString(); - continue; - } - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequencer"u8)) - { - sequencer = property.Value.GetString(); - continue; - } - if (property.NameEquals("identity"u8)) - { - identity = property.Value.GetString(); - continue; - } - if (property.NameEquals("storageDiagnostics"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - storageDiagnostics = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageDirectoryCreatedEventData( - api, - clientRequestId, - requestId, - eTag, - url, - sequencer, - identity, - storageDiagnostics, - 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(StorageDirectoryCreatedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageDirectoryCreatedEventData 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 DeserializeStorageDirectoryCreatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageDirectoryCreatedEventData)} 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 StorageDirectoryCreatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageDirectoryCreatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryCreatedEventData.cs deleted file mode 100644 index 334e5b3da48f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryCreatedEventData.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Storage.DirectoryCreated event. - public partial class StorageDirectoryCreatedEventData - { - /// - /// 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 . - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// is null. - internal StorageDirectoryCreatedEventData(IReadOnlyDictionary storageDiagnostics) - { - Argument.AssertNotNull(storageDiagnostics, nameof(storageDiagnostics)); - - StorageDiagnostics = storageDiagnostics; - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The etag of the directory at the time this event was triggered. - /// The path to the directory. - /// An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// Keeps track of any properties unknown to the library. - internal StorageDirectoryCreatedEventData(string api, string clientRequestId, string requestId, string eTag, string url, string sequencer, string identity, IReadOnlyDictionary storageDiagnostics, IDictionary serializedAdditionalRawData) - { - Api = api; - ClientRequestId = clientRequestId; - RequestId = requestId; - ETag = eTag; - Url = url; - Sequencer = sequencer; - Identity = identity; - StorageDiagnostics = storageDiagnostics; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageDirectoryCreatedEventData() - { - } - - /// The name of the API/operation that triggered this event. - public string Api { get; } - /// A request id provided by the client of the storage API operation that triggered this event. - public string ClientRequestId { get; } - /// The request id generated by the storage service for the storage API operation that triggered this event. - public string RequestId { get; } - /// The etag of the directory at the time this event was triggered. - public string ETag { get; } - /// The path to the directory. - public string Url { get; } - /// An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. - public string Sequencer { get; } - /// The identity of the requester that triggered this event. - public string Identity { get; } - /// - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary StorageDiagnostics { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryDeletedEventData.Serialization.cs deleted file mode 100644 index 19a1ddb4c0b2..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryDeletedEventData.Serialization.cs +++ /dev/null @@ -1,258 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageDirectoryDeletedEventData : 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(StorageDirectoryDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Api)) - { - writer.WritePropertyName("api"u8); - writer.WriteStringValue(Api); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Url)) - { - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - } - if (Optional.IsDefined(Recursive)) - { - writer.WritePropertyName("recursive"u8); - writer.WriteStringValue(Recursive); - } - if (Optional.IsDefined(Sequencer)) - { - writer.WritePropertyName("sequencer"u8); - writer.WriteStringValue(Sequencer); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - writer.WriteStringValue(Identity); - } - writer.WritePropertyName("storageDiagnostics"u8); - writer.WriteStartObject(); - foreach (var item in StorageDiagnostics) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - StorageDirectoryDeletedEventData 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(StorageDirectoryDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageDirectoryDeletedEventData(document.RootElement, options); - } - - internal static StorageDirectoryDeletedEventData DeserializeStorageDirectoryDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string api = default; - string clientRequestId = default; - string requestId = default; - string url = default; - string recursive = default; - string sequencer = default; - string identity = default; - IReadOnlyDictionary storageDiagnostics = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("api"u8)) - { - api = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("recursive"u8)) - { - recursive = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequencer"u8)) - { - sequencer = property.Value.GetString(); - continue; - } - if (property.NameEquals("identity"u8)) - { - identity = property.Value.GetString(); - continue; - } - if (property.NameEquals("storageDiagnostics"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - storageDiagnostics = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageDirectoryDeletedEventData( - api, - clientRequestId, - requestId, - url, - recursive, - sequencer, - identity, - storageDiagnostics, - 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(StorageDirectoryDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageDirectoryDeletedEventData 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 DeserializeStorageDirectoryDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageDirectoryDeletedEventData)} 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 StorageDirectoryDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageDirectoryDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryDeletedEventData.cs deleted file mode 100644 index 11e9573b8fe6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryDeletedEventData.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Storage.DirectoryDeleted event. - public partial class StorageDirectoryDeletedEventData - { - /// - /// 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 . - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// is null. - internal StorageDirectoryDeletedEventData(IReadOnlyDictionary storageDiagnostics) - { - Argument.AssertNotNull(storageDiagnostics, nameof(storageDiagnostics)); - - StorageDiagnostics = storageDiagnostics; - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The path to the deleted directory. - /// Is this event for a recursive delete operation. - /// An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// Keeps track of any properties unknown to the library. - internal StorageDirectoryDeletedEventData(string api, string clientRequestId, string requestId, string url, string recursive, string sequencer, string identity, IReadOnlyDictionary storageDiagnostics, IDictionary serializedAdditionalRawData) - { - Api = api; - ClientRequestId = clientRequestId; - RequestId = requestId; - Url = url; - Recursive = recursive; - Sequencer = sequencer; - Identity = identity; - StorageDiagnostics = storageDiagnostics; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageDirectoryDeletedEventData() - { - } - - /// The name of the API/operation that triggered this event. - public string Api { get; } - /// A request id provided by the client of the storage API operation that triggered this event. - public string ClientRequestId { get; } - /// The request id generated by the storage service for the storage API operation that triggered this event. - public string RequestId { get; } - /// The path to the deleted directory. - public string Url { get; } - /// Is this event for a recursive delete operation. - public string Recursive { get; } - /// An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. - public string Sequencer { get; } - /// The identity of the requester that triggered this event. - public string Identity { get; } - /// - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary StorageDiagnostics { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryRenamedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryRenamedEventData.Serialization.cs deleted file mode 100644 index 875bac47290a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryRenamedEventData.Serialization.cs +++ /dev/null @@ -1,258 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageDirectoryRenamedEventData : 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(StorageDirectoryRenamedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Api)) - { - writer.WritePropertyName("api"u8); - writer.WriteStringValue(Api); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(SourceUrl)) - { - writer.WritePropertyName("sourceUrl"u8); - writer.WriteStringValue(SourceUrl); - } - if (Optional.IsDefined(DestinationUrl)) - { - writer.WritePropertyName("destinationUrl"u8); - writer.WriteStringValue(DestinationUrl); - } - if (Optional.IsDefined(Sequencer)) - { - writer.WritePropertyName("sequencer"u8); - writer.WriteStringValue(Sequencer); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - writer.WriteStringValue(Identity); - } - writer.WritePropertyName("storageDiagnostics"u8); - writer.WriteStartObject(); - foreach (var item in StorageDiagnostics) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - 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 - } - } - } - - StorageDirectoryRenamedEventData 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(StorageDirectoryRenamedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageDirectoryRenamedEventData(document.RootElement, options); - } - - internal static StorageDirectoryRenamedEventData DeserializeStorageDirectoryRenamedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string api = default; - string clientRequestId = default; - string requestId = default; - string sourceUrl = default; - string destinationUrl = default; - string sequencer = default; - string identity = default; - IReadOnlyDictionary storageDiagnostics = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("api"u8)) - { - api = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("sourceUrl"u8)) - { - sourceUrl = property.Value.GetString(); - continue; - } - if (property.NameEquals("destinationUrl"u8)) - { - destinationUrl = property.Value.GetString(); - continue; - } - if (property.NameEquals("sequencer"u8)) - { - sequencer = property.Value.GetString(); - continue; - } - if (property.NameEquals("identity"u8)) - { - identity = property.Value.GetString(); - continue; - } - if (property.NameEquals("storageDiagnostics"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - storageDiagnostics = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageDirectoryRenamedEventData( - api, - clientRequestId, - requestId, - sourceUrl, - destinationUrl, - sequencer, - identity, - storageDiagnostics, - 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(StorageDirectoryRenamedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageDirectoryRenamedEventData 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 DeserializeStorageDirectoryRenamedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageDirectoryRenamedEventData)} 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 StorageDirectoryRenamedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageDirectoryRenamedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryRenamedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryRenamedEventData.cs deleted file mode 100644 index acd45cb55670..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageDirectoryRenamedEventData.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.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Storage.DirectoryRenamed event. - public partial class StorageDirectoryRenamedEventData - { - /// - /// 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 . - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// is null. - internal StorageDirectoryRenamedEventData(IReadOnlyDictionary storageDiagnostics) - { - Argument.AssertNotNull(storageDiagnostics, nameof(storageDiagnostics)); - - StorageDiagnostics = storageDiagnostics; - } - - /// Initializes a new instance of . - /// The name of the API/operation that triggered this event. - /// A request id provided by the client of the storage API operation that triggered this event. - /// The request id generated by the storage service for the storage API operation that triggered this event. - /// The path to the directory that was renamed. - /// The new path to the directory after the rename operation. - /// An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. - /// The identity of the requester that triggered this event. - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// Keeps track of any properties unknown to the library. - internal StorageDirectoryRenamedEventData(string api, string clientRequestId, string requestId, string sourceUrl, string destinationUrl, string sequencer, string identity, IReadOnlyDictionary storageDiagnostics, IDictionary serializedAdditionalRawData) - { - Api = api; - ClientRequestId = clientRequestId; - RequestId = requestId; - SourceUrl = sourceUrl; - DestinationUrl = destinationUrl; - Sequencer = sequencer; - Identity = identity; - StorageDiagnostics = storageDiagnostics; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageDirectoryRenamedEventData() - { - } - - /// The name of the API/operation that triggered this event. - public string Api { get; } - /// A request id provided by the client of the storage API operation that triggered this event. - public string ClientRequestId { get; } - /// The request id generated by the storage service for the storage API operation that triggered this event. - public string RequestId { get; } - /// The path to the directory that was renamed. - public string SourceUrl { get; } - /// The new path to the directory after the rename operation. - public string DestinationUrl { get; } - /// An opaque string value representing the logical sequence of events for any particular directory name. Users can use standard string comparison to understand the relative sequence of two events on the same directory name. - public string Sequencer { get; } - /// The identity of the requester that triggered this event. - public string Identity { get; } - /// - /// For service use only. Diagnostic data occasionally included by the Azure Storage service. This property should be ignored by event consumers. - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary StorageDiagnostics { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyActionSummaryDetail.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyActionSummaryDetail.Serialization.cs deleted file mode 100644 index 48221ea12e3a..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyActionSummaryDetail.Serialization.cs +++ /dev/null @@ -1,175 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageLifecyclePolicyActionSummaryDetail : 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(StorageLifecyclePolicyActionSummaryDetail)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TotalObjectsCount)) - { - writer.WritePropertyName("totalObjectsCount"u8); - writer.WriteNumberValue(TotalObjectsCount.Value); - } - if (Optional.IsDefined(SuccessCount)) - { - writer.WritePropertyName("successCount"u8); - writer.WriteNumberValue(SuccessCount.Value); - } - if (Optional.IsDefined(ErrorList)) - { - writer.WritePropertyName("errorList"u8); - writer.WriteStringValue(ErrorList); - } - 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 - } - } - } - - StorageLifecyclePolicyActionSummaryDetail 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(StorageLifecyclePolicyActionSummaryDetail)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageLifecyclePolicyActionSummaryDetail(document.RootElement, options); - } - - internal static StorageLifecyclePolicyActionSummaryDetail DeserializeStorageLifecyclePolicyActionSummaryDetail(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - long? totalObjectsCount = default; - long? successCount = default; - string errorList = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("totalObjectsCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - totalObjectsCount = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("successCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - successCount = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("errorList"u8)) - { - errorList = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageLifecyclePolicyActionSummaryDetail(totalObjectsCount, successCount, errorList, 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(StorageLifecyclePolicyActionSummaryDetail)} does not support writing '{options.Format}' format."); - } - } - - StorageLifecyclePolicyActionSummaryDetail 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 DeserializeStorageLifecyclePolicyActionSummaryDetail(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageLifecyclePolicyActionSummaryDetail)} 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 StorageLifecyclePolicyActionSummaryDetail FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageLifecyclePolicyActionSummaryDetail(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyActionSummaryDetail.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyActionSummaryDetail.cs deleted file mode 100644 index 7593c3cbb679..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyActionSummaryDetail.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.Messaging.EventGrid.SystemEvents -{ - /// Execution statistics of a specific policy action in a Blob Management cycle. - public partial class StorageLifecyclePolicyActionSummaryDetail - { - /// - /// 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 StorageLifecyclePolicyActionSummaryDetail() - { - } - - /// Initializes a new instance of . - /// Total number of objects to be acted on by this action. - /// Number of success operations of this action. - /// Error messages of this action if any. - /// Keeps track of any properties unknown to the library. - internal StorageLifecyclePolicyActionSummaryDetail(long? totalObjectsCount, long? successCount, string errorList, IDictionary serializedAdditionalRawData) - { - TotalObjectsCount = totalObjectsCount; - SuccessCount = successCount; - ErrorList = errorList; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Total number of objects to be acted on by this action. - public long? TotalObjectsCount { get; } - /// Number of success operations of this action. - public long? SuccessCount { get; } - /// Error messages of this action if any. - public string ErrorList { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyCompletedEventData.Serialization.cs deleted file mode 100644 index 7101b2b07c72..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyCompletedEventData.Serialization.cs +++ /dev/null @@ -1,169 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageLifecyclePolicyCompletedEventData : 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(StorageLifecyclePolicyCompletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ScheduleTime)) - { - writer.WritePropertyName("scheduleTime"u8); - writer.WriteStringValue(ScheduleTime); - } - writer.WritePropertyName("deleteSummary"u8); - writer.WriteObjectValue(DeleteSummary, options); - writer.WritePropertyName("tierToCoolSummary"u8); - writer.WriteObjectValue(TierToCoolSummary, options); - writer.WritePropertyName("tierToArchiveSummary"u8); - writer.WriteObjectValue(TierToArchiveSummary, 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 - } - } - } - - StorageLifecyclePolicyCompletedEventData 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(StorageLifecyclePolicyCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageLifecyclePolicyCompletedEventData(document.RootElement, options); - } - - internal static StorageLifecyclePolicyCompletedEventData DeserializeStorageLifecyclePolicyCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string scheduleTime = default; - StorageLifecyclePolicyActionSummaryDetail deleteSummary = default; - StorageLifecyclePolicyActionSummaryDetail tierToCoolSummary = default; - StorageLifecyclePolicyActionSummaryDetail tierToArchiveSummary = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("scheduleTime"u8)) - { - scheduleTime = property.Value.GetString(); - continue; - } - if (property.NameEquals("deleteSummary"u8)) - { - deleteSummary = StorageLifecyclePolicyActionSummaryDetail.DeserializeStorageLifecyclePolicyActionSummaryDetail(property.Value, options); - continue; - } - if (property.NameEquals("tierToCoolSummary"u8)) - { - tierToCoolSummary = StorageLifecyclePolicyActionSummaryDetail.DeserializeStorageLifecyclePolicyActionSummaryDetail(property.Value, options); - continue; - } - if (property.NameEquals("tierToArchiveSummary"u8)) - { - tierToArchiveSummary = StorageLifecyclePolicyActionSummaryDetail.DeserializeStorageLifecyclePolicyActionSummaryDetail(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageLifecyclePolicyCompletedEventData(scheduleTime, deleteSummary, tierToCoolSummary, tierToArchiveSummary, 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(StorageLifecyclePolicyCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageLifecyclePolicyCompletedEventData 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 DeserializeStorageLifecyclePolicyCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageLifecyclePolicyCompletedEventData)} 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 StorageLifecyclePolicyCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageLifecyclePolicyCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyCompletedEventData.cs deleted file mode 100644 index 392cff3c1e1e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageLifecyclePolicyCompletedEventData.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Storage.LifecyclePolicyCompleted event. - public partial class StorageLifecyclePolicyCompletedEventData - { - /// - /// 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 . - /// Execution statistics of a specific policy action in a Blob Management cycle. - /// Execution statistics of a specific policy action in a Blob Management cycle. - /// Execution statistics of a specific policy action in a Blob Management cycle. - /// , or is null. - internal StorageLifecyclePolicyCompletedEventData(StorageLifecyclePolicyActionSummaryDetail deleteSummary, StorageLifecyclePolicyActionSummaryDetail tierToCoolSummary, StorageLifecyclePolicyActionSummaryDetail tierToArchiveSummary) - { - Argument.AssertNotNull(deleteSummary, nameof(deleteSummary)); - Argument.AssertNotNull(tierToCoolSummary, nameof(tierToCoolSummary)); - Argument.AssertNotNull(tierToArchiveSummary, nameof(tierToArchiveSummary)); - - DeleteSummary = deleteSummary; - TierToCoolSummary = tierToCoolSummary; - TierToArchiveSummary = tierToArchiveSummary; - } - - /// Initializes a new instance of . - /// The time the policy task was scheduled. - /// Execution statistics of a specific policy action in a Blob Management cycle. - /// Execution statistics of a specific policy action in a Blob Management cycle. - /// Execution statistics of a specific policy action in a Blob Management cycle. - /// Keeps track of any properties unknown to the library. - internal StorageLifecyclePolicyCompletedEventData(string scheduleTime, StorageLifecyclePolicyActionSummaryDetail deleteSummary, StorageLifecyclePolicyActionSummaryDetail tierToCoolSummary, StorageLifecyclePolicyActionSummaryDetail tierToArchiveSummary, IDictionary serializedAdditionalRawData) - { - ScheduleTime = scheduleTime; - DeleteSummary = deleteSummary; - TierToCoolSummary = tierToCoolSummary; - TierToArchiveSummary = tierToArchiveSummary; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageLifecyclePolicyCompletedEventData() - { - } - - /// The time the policy task was scheduled. - public string ScheduleTime { get; } - /// Execution statistics of a specific policy action in a Blob Management cycle. - public StorageLifecyclePolicyActionSummaryDetail DeleteSummary { get; } - /// Execution statistics of a specific policy action in a Blob Management cycle. - public StorageLifecyclePolicyActionSummaryDetail TierToCoolSummary { get; } - /// Execution statistics of a specific policy action in a Blob Management cycle. - public StorageLifecyclePolicyActionSummaryDetail TierToArchiveSummary { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentCompletedEventData.Serialization.cs deleted file mode 100644 index 2cea1ef346f1..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentCompletedEventData.Serialization.cs +++ /dev/null @@ -1,186 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageTaskAssignmentCompletedEventData : 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(StorageTaskAssignmentCompletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WritePropertyName("completedDateTime"u8); - writer.WriteStringValue(CompletedOn, "O"); - if (Optional.IsDefined(TaskExecutionId)) - { - writer.WritePropertyName("taskExecutionId"u8); - writer.WriteStringValue(TaskExecutionId); - } - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("summaryReportBlobUrl"u8); - writer.WriteStringValue(SummaryReportBlobUri.AbsoluteUri); - 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 - } - } - } - - StorageTaskAssignmentCompletedEventData 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(StorageTaskAssignmentCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageTaskAssignmentCompletedEventData(document.RootElement, options); - } - - internal static StorageTaskAssignmentCompletedEventData DeserializeStorageTaskAssignmentCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - StorageTaskAssignmentCompletedStatus status = default; - DateTimeOffset completedDateTime = default; - string taskExecutionId = default; - string taskName = default; - Uri summaryReportBlobUrl = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("status"u8)) - { - status = new StorageTaskAssignmentCompletedStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("completedDateTime"u8)) - { - completedDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("taskExecutionId"u8)) - { - taskExecutionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - if (property.NameEquals("summaryReportBlobUrl"u8)) - { - summaryReportBlobUrl = new Uri(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageTaskAssignmentCompletedEventData( - status, - completedDateTime, - taskExecutionId, - taskName, - summaryReportBlobUrl, - 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(StorageTaskAssignmentCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageTaskAssignmentCompletedEventData 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 DeserializeStorageTaskAssignmentCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageTaskAssignmentCompletedEventData)} 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 StorageTaskAssignmentCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageTaskAssignmentCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentCompletedEventData.cs deleted file mode 100644 index acf2da3e348f..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentCompletedEventData.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for an Microsoft.Storage.StorageTaskAssignmentCompleted event. - public partial class StorageTaskAssignmentCompletedEventData - { - /// - /// 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 status for a storage task. - /// The time at which a storage task was completed. - /// The summary report blob url for a storage task. - /// is null. - internal StorageTaskAssignmentCompletedEventData(StorageTaskAssignmentCompletedStatus status, DateTimeOffset completedOn, Uri summaryReportBlobUri) - { - Argument.AssertNotNull(summaryReportBlobUri, nameof(summaryReportBlobUri)); - - Status = status; - CompletedOn = completedOn; - SummaryReportBlobUri = summaryReportBlobUri; - } - - /// Initializes a new instance of . - /// The status for a storage task. - /// The time at which a storage task was completed. - /// The execution id for a storage task. - /// The task name for a storage task. - /// The summary report blob url for a storage task. - /// Keeps track of any properties unknown to the library. - internal StorageTaskAssignmentCompletedEventData(StorageTaskAssignmentCompletedStatus status, DateTimeOffset completedOn, string taskExecutionId, string taskName, Uri summaryReportBlobUri, IDictionary serializedAdditionalRawData) - { - Status = status; - CompletedOn = completedOn; - TaskExecutionId = taskExecutionId; - TaskName = taskName; - SummaryReportBlobUri = summaryReportBlobUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageTaskAssignmentCompletedEventData() - { - } - - /// The status for a storage task. - public StorageTaskAssignmentCompletedStatus Status { get; } - /// The time at which a storage task was completed. - public DateTimeOffset CompletedOn { get; } - /// The execution id for a storage task. - public string TaskExecutionId { get; } - /// The task name for a storage task. - public string TaskName { get; } - /// The summary report blob url for a storage task. - public Uri SummaryReportBlobUri { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentCompletedStatus.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentCompletedStatus.cs deleted file mode 100644 index efa113f414d9..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentCompletedStatus.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// The status for a storage task. - public readonly partial struct StorageTaskAssignmentCompletedStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public StorageTaskAssignmentCompletedStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - - /// Succeeded. - public static StorageTaskAssignmentCompletedStatus Succeeded { get; } = new StorageTaskAssignmentCompletedStatus(SucceededValue); - /// Failed. - public static StorageTaskAssignmentCompletedStatus Failed { get; } = new StorageTaskAssignmentCompletedStatus(FailedValue); - /// Determines if two values are the same. - public static bool operator ==(StorageTaskAssignmentCompletedStatus left, StorageTaskAssignmentCompletedStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(StorageTaskAssignmentCompletedStatus left, StorageTaskAssignmentCompletedStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator StorageTaskAssignmentCompletedStatus(string value) => new StorageTaskAssignmentCompletedStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is StorageTaskAssignmentCompletedStatus other && Equals(other); - /// - public bool Equals(StorageTaskAssignmentCompletedStatus 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentQueuedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentQueuedEventData.Serialization.cs deleted file mode 100644 index bb9d126de7c0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentQueuedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageTaskAssignmentQueuedEventData : 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(StorageTaskAssignmentQueuedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("queuedDateTime"u8); - writer.WriteStringValue(QueuedOn, "O"); - if (Optional.IsDefined(TaskExecutionId)) - { - writer.WritePropertyName("taskExecutionId"u8); - writer.WriteStringValue(TaskExecutionId); - } - 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 - } - } - } - - StorageTaskAssignmentQueuedEventData 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(StorageTaskAssignmentQueuedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageTaskAssignmentQueuedEventData(document.RootElement, options); - } - - internal static StorageTaskAssignmentQueuedEventData DeserializeStorageTaskAssignmentQueuedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset queuedDateTime = default; - string taskExecutionId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queuedDateTime"u8)) - { - queuedDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("taskExecutionId"u8)) - { - taskExecutionId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageTaskAssignmentQueuedEventData(queuedDateTime, taskExecutionId, 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(StorageTaskAssignmentQueuedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageTaskAssignmentQueuedEventData 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 DeserializeStorageTaskAssignmentQueuedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageTaskAssignmentQueuedEventData)} 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 StorageTaskAssignmentQueuedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageTaskAssignmentQueuedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentQueuedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentQueuedEventData.cs deleted file mode 100644 index 629cae0b0418..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskAssignmentQueuedEventData.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for an Microsoft.Storage.StorageTaskAssignmentQueued event. - public partial class StorageTaskAssignmentQueuedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time at which a storage task was queued. - internal StorageTaskAssignmentQueuedEventData(DateTimeOffset queuedOn) - { - QueuedOn = queuedOn; - } - - /// Initializes a new instance of . - /// The time at which a storage task was queued. - /// The execution id for a storage task. - /// Keeps track of any properties unknown to the library. - internal StorageTaskAssignmentQueuedEventData(DateTimeOffset queuedOn, string taskExecutionId, IDictionary serializedAdditionalRawData) - { - QueuedOn = queuedOn; - TaskExecutionId = taskExecutionId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageTaskAssignmentQueuedEventData() - { - } - - /// The time at which a storage task was queued. - public DateTimeOffset QueuedOn { get; } - /// The execution id for a storage task. - public string TaskExecutionId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskCompletedEventData.Serialization.cs deleted file mode 100644 index 1e4db6040fab..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskCompletedEventData.Serialization.cs +++ /dev/null @@ -1,186 +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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageTaskCompletedEventData : 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(StorageTaskCompletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WritePropertyName("completedDateTime"u8); - writer.WriteStringValue(CompletedDateTime, "O"); - if (Optional.IsDefined(TaskExecutionId)) - { - writer.WritePropertyName("taskExecutionId"u8); - writer.WriteStringValue(TaskExecutionId); - } - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("summaryReportBlobUrl"u8); - writer.WriteStringValue(SummaryReportBlobUrl.AbsoluteUri); - 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 - } - } - } - - StorageTaskCompletedEventData 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(StorageTaskCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageTaskCompletedEventData(document.RootElement, options); - } - - internal static StorageTaskCompletedEventData DeserializeStorageTaskCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - StorageTaskCompletedStatus status = default; - DateTimeOffset completedDateTime = default; - string taskExecutionId = default; - string taskName = default; - Uri summaryReportBlobUrl = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("status"u8)) - { - status = new StorageTaskCompletedStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("completedDateTime"u8)) - { - completedDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("taskExecutionId"u8)) - { - taskExecutionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - if (property.NameEquals("summaryReportBlobUrl"u8)) - { - summaryReportBlobUrl = new Uri(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageTaskCompletedEventData( - status, - completedDateTime, - taskExecutionId, - taskName, - summaryReportBlobUrl, - 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(StorageTaskCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageTaskCompletedEventData 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 DeserializeStorageTaskCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageTaskCompletedEventData)} 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 StorageTaskCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageTaskCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskCompletedEventData.cs deleted file mode 100644 index a7e3b6af287d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskCompletedEventData.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for an Microsoft.Storage.StorageTaskCompleted event. - public partial class StorageTaskCompletedEventData - { - /// - /// 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 status for a storage task. - /// The time at which a storage task was completed. - /// The summary report blob url for a storage task. - /// is null. - internal StorageTaskCompletedEventData(StorageTaskCompletedStatus status, DateTimeOffset completedDateTime, Uri summaryReportBlobUrl) - { - Argument.AssertNotNull(summaryReportBlobUrl, nameof(summaryReportBlobUrl)); - - Status = status; - CompletedDateTime = completedDateTime; - SummaryReportBlobUrl = summaryReportBlobUrl; - } - - /// Initializes a new instance of . - /// The status for a storage task. - /// The time at which a storage task was completed. - /// The execution id for a storage task. - /// The task name for a storage task. - /// The summary report blob url for a storage task. - /// Keeps track of any properties unknown to the library. - internal StorageTaskCompletedEventData(StorageTaskCompletedStatus status, DateTimeOffset completedDateTime, string taskExecutionId, string taskName, Uri summaryReportBlobUrl, IDictionary serializedAdditionalRawData) - { - Status = status; - CompletedDateTime = completedDateTime; - TaskExecutionId = taskExecutionId; - TaskName = taskName; - SummaryReportBlobUrl = summaryReportBlobUrl; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageTaskCompletedEventData() - { - } - - /// The status for a storage task. - public StorageTaskCompletedStatus Status { get; } - /// The time at which a storage task was completed. - public DateTimeOffset CompletedDateTime { get; } - /// The execution id for a storage task. - public string TaskExecutionId { get; } - /// The task name for a storage task. - public string TaskName { get; } - /// The summary report blob url for a storage task. - public Uri SummaryReportBlobUrl { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskCompletedStatus.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskCompletedStatus.cs deleted file mode 100644 index a7df13a5681c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskCompletedStatus.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// The status for a storage task. - public readonly partial struct StorageTaskCompletedStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public StorageTaskCompletedStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - - /// Succeeded. - public static StorageTaskCompletedStatus Succeeded { get; } = new StorageTaskCompletedStatus(SucceededValue); - /// Failed. - public static StorageTaskCompletedStatus Failed { get; } = new StorageTaskCompletedStatus(FailedValue); - /// Determines if two values are the same. - public static bool operator ==(StorageTaskCompletedStatus left, StorageTaskCompletedStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(StorageTaskCompletedStatus left, StorageTaskCompletedStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator StorageTaskCompletedStatus(string value) => new StorageTaskCompletedStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is StorageTaskCompletedStatus other && Equals(other); - /// - public bool Equals(StorageTaskCompletedStatus 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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskQueuedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskQueuedEventData.Serialization.cs deleted file mode 100644 index 2b6547d43360..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskQueuedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class StorageTaskQueuedEventData : 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(StorageTaskQueuedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("queuedDateTime"u8); - writer.WriteStringValue(QueuedDateTime, "O"); - if (Optional.IsDefined(TaskExecutionId)) - { - writer.WritePropertyName("taskExecutionId"u8); - writer.WriteStringValue(TaskExecutionId); - } - 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 - } - } - } - - StorageTaskQueuedEventData 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(StorageTaskQueuedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStorageTaskQueuedEventData(document.RootElement, options); - } - - internal static StorageTaskQueuedEventData DeserializeStorageTaskQueuedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset queuedDateTime = default; - string taskExecutionId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queuedDateTime"u8)) - { - queuedDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("taskExecutionId"u8)) - { - taskExecutionId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StorageTaskQueuedEventData(queuedDateTime, taskExecutionId, 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(StorageTaskQueuedEventData)} does not support writing '{options.Format}' format."); - } - } - - StorageTaskQueuedEventData 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 DeserializeStorageTaskQueuedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StorageTaskQueuedEventData)} 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 StorageTaskQueuedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeStorageTaskQueuedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskQueuedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskQueuedEventData.cs deleted file mode 100644 index 0ad77410c7c3..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/StorageTaskQueuedEventData.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for an Microsoft.Storage.StorageTaskQueued event. - public partial class StorageTaskQueuedEventData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The time at which a storage task was queued. - internal StorageTaskQueuedEventData(DateTimeOffset queuedDateTime) - { - QueuedDateTime = queuedDateTime; - } - - /// Initializes a new instance of . - /// The time at which a storage task was queued. - /// The execution id for a storage task. - /// Keeps track of any properties unknown to the library. - internal StorageTaskQueuedEventData(DateTimeOffset queuedDateTime, string taskExecutionId, IDictionary serializedAdditionalRawData) - { - QueuedDateTime = queuedDateTime; - TaskExecutionId = taskExecutionId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StorageTaskQueuedEventData() - { - } - - /// The time at which a storage task was queued. - public DateTimeOffset QueuedDateTime { get; } - /// The execution id for a storage task. - public string TaskExecutionId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionDeletedEventData.Serialization.cs deleted file mode 100644 index 118af3e2917b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionDeletedEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class SubscriptionDeletedEventData : 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(SubscriptionDeletedEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(EventSubscriptionId)) - { - writer.WritePropertyName("eventSubscriptionId"u8); - writer.WriteStringValue(EventSubscriptionId); - } - 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 - } - } - } - - SubscriptionDeletedEventData 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(SubscriptionDeletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSubscriptionDeletedEventData(document.RootElement, options); - } - - internal static SubscriptionDeletedEventData DeserializeSubscriptionDeletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string eventSubscriptionId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("eventSubscriptionId"u8)) - { - eventSubscriptionId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SubscriptionDeletedEventData(eventSubscriptionId, 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(SubscriptionDeletedEventData)} does not support writing '{options.Format}' format."); - } - } - - SubscriptionDeletedEventData 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 DeserializeSubscriptionDeletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SubscriptionDeletedEventData)} 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 SubscriptionDeletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeSubscriptionDeletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionDeletedEventData.cs deleted file mode 100644 index 323175400bcf..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionDeletedEventData.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// Schema of the Data property of an EventGridEvent for a - /// Microsoft.EventGrid.SubscriptionDeletedEvent event. - /// - public partial class SubscriptionDeletedEventData - { - /// - /// 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 SubscriptionDeletedEventData() - { - } - - /// Initializes a new instance of . - /// The Azure resource ID of the deleted event subscription. - /// Keeps track of any properties unknown to the library. - internal SubscriptionDeletedEventData(string eventSubscriptionId, IDictionary serializedAdditionalRawData) - { - EventSubscriptionId = eventSubscriptionId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The Azure resource ID of the deleted event subscription. - public string EventSubscriptionId { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationEventData.Serialization.cs deleted file mode 100644 index 73797c8a2b8b..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationEventData.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.Messaging.EventGrid.SystemEvents -{ - public partial class SubscriptionValidationEventData : 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(SubscriptionValidationEventData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ValidationCode)) - { - writer.WritePropertyName("validationCode"u8); - writer.WriteStringValue(ValidationCode); - } - if (Optional.IsDefined(ValidationUrl)) - { - writer.WritePropertyName("validationUrl"u8); - writer.WriteStringValue(ValidationUrl); - } - 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 - } - } - } - - SubscriptionValidationEventData 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(SubscriptionValidationEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSubscriptionValidationEventData(document.RootElement, options); - } - - internal static SubscriptionValidationEventData DeserializeSubscriptionValidationEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string validationCode = default; - string validationUrl = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("validationCode"u8)) - { - validationCode = property.Value.GetString(); - continue; - } - if (property.NameEquals("validationUrl"u8)) - { - validationUrl = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SubscriptionValidationEventData(validationCode, validationUrl, 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(SubscriptionValidationEventData)} does not support writing '{options.Format}' format."); - } - } - - SubscriptionValidationEventData 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 DeserializeSubscriptionValidationEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SubscriptionValidationEventData)} 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 SubscriptionValidationEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeSubscriptionValidationEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationEventData.cs deleted file mode 100644 index 78d90aa69318..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationEventData.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.EventGrid.SubscriptionValidationEvent event. - public partial class SubscriptionValidationEventData - { - /// - /// 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 SubscriptionValidationEventData() - { - } - - /// Initializes a new instance of . - /// - /// The validation code sent by Azure Event Grid to validate an event subscription. - /// To complete the validation handshake, the subscriber must either respond with this validation code as part of the validation response, - /// or perform a GET request on the validationUrl (available starting version 2018-05-01-preview). - /// - /// - /// The validation URL sent by Azure Event Grid (available starting version 2018-05-01-preview). - /// To complete the validation handshake, the subscriber must either respond with the validationCode as part of the validation response, - /// or perform a GET request on the validationUrl (available starting version 2018-05-01-preview). - /// - /// Keeps track of any properties unknown to the library. - internal SubscriptionValidationEventData(string validationCode, string validationUrl, IDictionary serializedAdditionalRawData) - { - ValidationCode = validationCode; - ValidationUrl = validationUrl; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// - /// The validation code sent by Azure Event Grid to validate an event subscription. - /// To complete the validation handshake, the subscriber must either respond with this validation code as part of the validation response, - /// or perform a GET request on the validationUrl (available starting version 2018-05-01-preview). - /// - public string ValidationCode { get; } - /// - /// The validation URL sent by Azure Event Grid (available starting version 2018-05-01-preview). - /// To complete the validation handshake, the subscriber must either respond with the validationCode as part of the validation response, - /// or perform a GET request on the validationUrl (available starting version 2018-05-01-preview). - /// - public string ValidationUrl { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationResponse.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationResponse.Serialization.cs deleted file mode 100644 index 5b5ffbe5c353..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationResponse.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.Messaging.EventGrid.SystemEvents -{ - public partial class SubscriptionValidationResponse : 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(SubscriptionValidationResponse)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ValidationResponse)) - { - writer.WritePropertyName("validationResponse"u8); - writer.WriteStringValue(ValidationResponse); - } - 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 - } - } - } - - SubscriptionValidationResponse 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(SubscriptionValidationResponse)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSubscriptionValidationResponse(document.RootElement, options); - } - - internal static SubscriptionValidationResponse DeserializeSubscriptionValidationResponse(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string validationResponse = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("validationResponse"u8)) - { - validationResponse = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SubscriptionValidationResponse(validationResponse, 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(SubscriptionValidationResponse)} does not support writing '{options.Format}' format."); - } - } - - SubscriptionValidationResponse 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 DeserializeSubscriptionValidationResponse(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SubscriptionValidationResponse)} 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 SubscriptionValidationResponse FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeSubscriptionValidationResponse(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationResponse.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationResponse.cs deleted file mode 100644 index 7343bc21df38..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SubscriptionValidationResponse.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// - /// To complete an event subscription validation handshake, a subscriber can use - /// either the validationCode or the validationUrl received in a - /// SubscriptionValidationEvent. When the validationCode is used, the - /// SubscriptionValidationResponse can be used to build the response. - /// - public partial class SubscriptionValidationResponse - { - /// - /// 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 SubscriptionValidationResponse() - { - } - - /// Initializes a new instance of . - /// The validation response sent by the subscriber to Azure Event Grid to complete the validation of an event subscription. - /// Keeps track of any properties unknown to the library. - internal SubscriptionValidationResponse(string validationResponse, IDictionary serializedAdditionalRawData) - { - ValidationResponse = validationResponse; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The validation response sent by the subscriber to Azure Event Grid to complete the validation of an event subscription. - public string ValidationResponse { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SystemEventsClientOptions.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SystemEventsClientOptions.cs index 0d99553ffa77..17e37e2f9d4b 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SystemEventsClientOptions.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/SystemEventsClientOptions.cs @@ -13,13 +13,13 @@ namespace Azure.Messaging.EventGrid.SystemEvents /// Client options for SystemEventsClient. internal partial class SystemEventsClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2024_01_01; + private const ServiceVersion LatestVersion = ServiceVersion.V2018_01_01; /// The version of the service to use. internal enum ServiceVersion { - /// Service version "2024-01-01". - V2024_01_01 = 1, + /// Service version "2018-01-01". + V2018_01_01 = 1, } internal string Version { get; } @@ -29,7 +29,7 @@ public SystemEventsClientOptions(ServiceVersion version = LatestVersion) { Version = version switch { - ServiceVersion.V2024_01_01 => "2024-01-01", + ServiceVersion.V2018_01_01 => "2018-01-01", _ => throw new NotSupportedException() }; } diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/UnknownMediaJobOutput.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/UnknownMediaJobOutput.Serialization.cs deleted file mode 100644 index 237a41a34578..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/UnknownMediaJobOutput.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.Messaging.EventGrid.SystemEvents -{ - internal partial class UnknownMediaJobOutput : 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(MediaJobOutput)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MediaJobOutput 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(MediaJobOutput)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMediaJobOutput(document.RootElement, options); - } - - internal static UnknownMediaJobOutput DeserializeUnknownMediaJobOutput(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string odataType = "Unknown"; - MediaJobError error = default; - string label = default; - long progress = default; - MediaJobState state = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("@odata.type"u8)) - { - odataType = property.Value.GetString(); - continue; - } - if (property.NameEquals("error"u8)) - { - error = MediaJobError.DeserializeMediaJobError(property.Value, options); - continue; - } - if (property.NameEquals("label"u8)) - { - label = property.Value.GetString(); - continue; - } - if (property.NameEquals("progress"u8)) - { - progress = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("state"u8)) - { - state = new MediaJobState(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UnknownMediaJobOutput( - odataType, - error, - label, - progress, - state, - 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(MediaJobOutput)} does not support writing '{options.Format}' format."); - } - } - - MediaJobOutput 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 DeserializeMediaJobOutput(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MediaJobOutput)} 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 UnknownMediaJobOutput FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeUnknownMediaJobOutput(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/UnknownMediaJobOutput.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/UnknownMediaJobOutput.cs deleted file mode 100644 index 0bfb2f76e943..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/UnknownMediaJobOutput.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Unknown version of MediaJobOutput. - internal partial class UnknownMediaJobOutput : MediaJobOutput - { - /// Initializes a new instance of . - /// The discriminator for derived types. - /// Gets the Job output error. - /// Gets the Job output label. - /// Gets the Job output progress. - /// Gets the Job output state. - /// Keeps track of any properties unknown to the library. - internal UnknownMediaJobOutput(string odataType, MediaJobError error, string label, long progress, MediaJobState state, IDictionary serializedAdditionalRawData) : base(odataType, error, label, progress, state, serializedAdditionalRawData) - { - } - - /// Initializes a new instance of for deserialization. - internal UnknownMediaJobOutput() - { - } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventData.Serialization.cs deleted file mode 100644 index d080ac40d78d..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventData.Serialization.cs +++ /dev/null @@ -1,225 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebAppServicePlanUpdatedEventData : 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(WebAppServicePlanUpdatedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appServicePlanEventTypeDetail"u8); - writer.WriteObjectValue(AppServicePlanEventTypeDetail, options); - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebAppServicePlanUpdatedEventData 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(WebAppServicePlanUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebAppServicePlanUpdatedEventData(document.RootElement, options); - } - - internal static WebAppServicePlanUpdatedEventData DeserializeWebAppServicePlanUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppServicePlanEventTypeDetail appServicePlanEventTypeDetail = default; - WebAppServicePlanUpdatedEventDataSku sku = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appServicePlanEventTypeDetail"u8)) - { - appServicePlanEventTypeDetail = AppServicePlanEventTypeDetail.DeserializeAppServicePlanEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("sku"u8)) - { - sku = WebAppServicePlanUpdatedEventDataSku.DeserializeWebAppServicePlanUpdatedEventDataSku(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebAppServicePlanUpdatedEventData( - appServicePlanEventTypeDetail, - sku, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebAppServicePlanUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebAppServicePlanUpdatedEventData 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 DeserializeWebAppServicePlanUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebAppServicePlanUpdatedEventData)} 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 WebAppServicePlanUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebAppServicePlanUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventData.cs deleted file mode 100644 index 8b072da944e6..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventData.cs +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.AppServicePlanUpdated event. - public partial class WebAppServicePlanUpdatedEventData - { - /// - /// 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 . - /// Detail of action on the app service plan. - /// sku of app service plan. - /// or is null. - internal WebAppServicePlanUpdatedEventData(AppServicePlanEventTypeDetail appServicePlanEventTypeDetail, WebAppServicePlanUpdatedEventDataSku sku) - { - Argument.AssertNotNull(appServicePlanEventTypeDetail, nameof(appServicePlanEventTypeDetail)); - Argument.AssertNotNull(sku, nameof(sku)); - - AppServicePlanEventTypeDetail = appServicePlanEventTypeDetail; - Sku = sku; - } - - /// Initializes a new instance of . - /// Detail of action on the app service plan. - /// sku of app service plan. - /// name of the app service plan that had this event. - /// The client request id generated by the app service for the app service plan API operation that triggered this event. - /// The correlation request id generated by the app service for the app service plan API operation that triggered this event. - /// The request id generated by the app service for the app service plan API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebAppServicePlanUpdatedEventData(AppServicePlanEventTypeDetail appServicePlanEventTypeDetail, WebAppServicePlanUpdatedEventDataSku sku, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppServicePlanEventTypeDetail = appServicePlanEventTypeDetail; - Sku = sku; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebAppServicePlanUpdatedEventData() - { - } - - /// Detail of action on the app service plan. - public AppServicePlanEventTypeDetail AppServicePlanEventTypeDetail { get; } - /// sku of app service plan. - public WebAppServicePlanUpdatedEventDataSku Sku { get; } - /// name of the app service plan that had this event. - public string Name { get; } - /// The client request id generated by the app service for the app service plan API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the app service plan API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the app service plan API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventDataSku.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventDataSku.Serialization.cs deleted file mode 100644 index 6f468fc9ebf0..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventDataSku.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.Messaging.EventGrid.SystemEvents -{ - public partial class WebAppServicePlanUpdatedEventDataSku : 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(WebAppServicePlanUpdatedEventDataSku)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Tier)) - { - writer.WritePropertyName("Tier"u8); - writer.WriteStringValue(Tier); - } - if (Optional.IsDefined(Size)) - { - writer.WritePropertyName("Size"u8); - writer.WriteStringValue(Size); - } - if (Optional.IsDefined(Family)) - { - writer.WritePropertyName("Family"u8); - writer.WriteStringValue(Family); - } - if (Optional.IsDefined(Capacity)) - { - writer.WritePropertyName("Capacity"u8); - writer.WriteStringValue(Capacity); - } - 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 - } - } - } - - WebAppServicePlanUpdatedEventDataSku 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(WebAppServicePlanUpdatedEventDataSku)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebAppServicePlanUpdatedEventDataSku(document.RootElement, options); - } - - internal static WebAppServicePlanUpdatedEventDataSku DeserializeWebAppServicePlanUpdatedEventDataSku(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - string tier = default; - string size = default; - string family = default; - string capacity = 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("Tier"u8)) - { - tier = property.Value.GetString(); - continue; - } - if (property.NameEquals("Size"u8)) - { - size = property.Value.GetString(); - continue; - } - if (property.NameEquals("Family"u8)) - { - family = property.Value.GetString(); - continue; - } - if (property.NameEquals("Capacity"u8)) - { - capacity = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebAppServicePlanUpdatedEventDataSku( - name, - tier, - size, - family, - capacity, - 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(WebAppServicePlanUpdatedEventDataSku)} does not support writing '{options.Format}' format."); - } - } - - WebAppServicePlanUpdatedEventDataSku 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 DeserializeWebAppServicePlanUpdatedEventDataSku(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebAppServicePlanUpdatedEventDataSku)} 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 WebAppServicePlanUpdatedEventDataSku FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebAppServicePlanUpdatedEventDataSku(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventDataSku.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventDataSku.cs deleted file mode 100644 index 775bf2394abd..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppServicePlanUpdatedEventDataSku.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// sku of app service plan. - public partial class WebAppServicePlanUpdatedEventDataSku - { - /// - /// 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 WebAppServicePlanUpdatedEventDataSku() - { - } - - /// Initializes a new instance of . - /// name of app service plan sku. - /// tier of app service plan sku. - /// size of app service plan sku. - /// family of app service plan sku. - /// capacity of app service plan sku. - /// Keeps track of any properties unknown to the library. - internal WebAppServicePlanUpdatedEventDataSku(string name, string tier, string size, string family, string capacity, IDictionary serializedAdditionalRawData) - { - Name = name; - Tier = tier; - Size = size; - Family = family; - Capacity = capacity; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// name of app service plan sku. - public string Name { get; } - /// tier of app service plan sku. - public string Tier { get; } - /// size of app service plan sku. - public string Size { get; } - /// family of app service plan sku. - public string Family { get; } - /// capacity of app service plan sku. - public string Capacity { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppUpdatedEventData.Serialization.cs deleted file mode 100644 index 1ad3d2774328..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppUpdatedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebAppUpdatedEventData : 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(WebAppUpdatedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebAppUpdatedEventData 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(WebAppUpdatedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebAppUpdatedEventData(document.RootElement, options); - } - - internal static WebAppUpdatedEventData DeserializeWebAppUpdatedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebAppUpdatedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebAppUpdatedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebAppUpdatedEventData 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 DeserializeWebAppUpdatedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebAppUpdatedEventData)} 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 WebAppUpdatedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebAppUpdatedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppUpdatedEventData.cs deleted file mode 100644 index f2d7d0dea273..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebAppUpdatedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.AppUpdated event. - public partial class WebAppUpdatedEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebAppUpdatedEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebAppUpdatedEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebAppUpdatedEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationCompletedEventData.Serialization.cs deleted file mode 100644 index 3ba9f6644c88..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationCompletedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebBackupOperationCompletedEventData : 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(WebBackupOperationCompletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebBackupOperationCompletedEventData 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(WebBackupOperationCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebBackupOperationCompletedEventData(document.RootElement, options); - } - - internal static WebBackupOperationCompletedEventData DeserializeWebBackupOperationCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebBackupOperationCompletedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebBackupOperationCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebBackupOperationCompletedEventData 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 DeserializeWebBackupOperationCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebBackupOperationCompletedEventData)} 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 WebBackupOperationCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebBackupOperationCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationCompletedEventData.cs deleted file mode 100644 index 690319b63466..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationCompletedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.BackupOperationCompleted event. - public partial class WebBackupOperationCompletedEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebBackupOperationCompletedEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebBackupOperationCompletedEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebBackupOperationCompletedEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationFailedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationFailedEventData.Serialization.cs deleted file mode 100644 index 8747eb522d65..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationFailedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebBackupOperationFailedEventData : 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(WebBackupOperationFailedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebBackupOperationFailedEventData 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(WebBackupOperationFailedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebBackupOperationFailedEventData(document.RootElement, options); - } - - internal static WebBackupOperationFailedEventData DeserializeWebBackupOperationFailedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebBackupOperationFailedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebBackupOperationFailedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebBackupOperationFailedEventData 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 DeserializeWebBackupOperationFailedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebBackupOperationFailedEventData)} 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 WebBackupOperationFailedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebBackupOperationFailedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationFailedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationFailedEventData.cs deleted file mode 100644 index fe28f8fcac62..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationFailedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.BackupOperationFailed event. - public partial class WebBackupOperationFailedEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebBackupOperationFailedEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebBackupOperationFailedEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebBackupOperationFailedEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationStartedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationStartedEventData.Serialization.cs deleted file mode 100644 index aed7afbdc5b8..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationStartedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebBackupOperationStartedEventData : 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(WebBackupOperationStartedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebBackupOperationStartedEventData 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(WebBackupOperationStartedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebBackupOperationStartedEventData(document.RootElement, options); - } - - internal static WebBackupOperationStartedEventData DeserializeWebBackupOperationStartedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebBackupOperationStartedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebBackupOperationStartedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebBackupOperationStartedEventData 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 DeserializeWebBackupOperationStartedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebBackupOperationStartedEventData)} 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 WebBackupOperationStartedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebBackupOperationStartedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationStartedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationStartedEventData.cs deleted file mode 100644 index de39c3343f4c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebBackupOperationStartedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.BackupOperationStarted event. - public partial class WebBackupOperationStartedEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebBackupOperationStartedEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebBackupOperationStartedEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebBackupOperationStartedEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationCompletedEventData.Serialization.cs deleted file mode 100644 index f1da68ce703e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationCompletedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebRestoreOperationCompletedEventData : 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(WebRestoreOperationCompletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebRestoreOperationCompletedEventData 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(WebRestoreOperationCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebRestoreOperationCompletedEventData(document.RootElement, options); - } - - internal static WebRestoreOperationCompletedEventData DeserializeWebRestoreOperationCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebRestoreOperationCompletedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebRestoreOperationCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebRestoreOperationCompletedEventData 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 DeserializeWebRestoreOperationCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebRestoreOperationCompletedEventData)} 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 WebRestoreOperationCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebRestoreOperationCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationCompletedEventData.cs deleted file mode 100644 index 89117d07f272..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationCompletedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.RestoreOperationCompleted event. - public partial class WebRestoreOperationCompletedEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebRestoreOperationCompletedEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebRestoreOperationCompletedEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebRestoreOperationCompletedEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationFailedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationFailedEventData.Serialization.cs deleted file mode 100644 index befc7069bc90..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationFailedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebRestoreOperationFailedEventData : 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(WebRestoreOperationFailedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebRestoreOperationFailedEventData 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(WebRestoreOperationFailedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebRestoreOperationFailedEventData(document.RootElement, options); - } - - internal static WebRestoreOperationFailedEventData DeserializeWebRestoreOperationFailedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebRestoreOperationFailedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebRestoreOperationFailedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebRestoreOperationFailedEventData 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 DeserializeWebRestoreOperationFailedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebRestoreOperationFailedEventData)} 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 WebRestoreOperationFailedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebRestoreOperationFailedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationFailedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationFailedEventData.cs deleted file mode 100644 index 8e5342982adf..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationFailedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.RestoreOperationFailed event. - public partial class WebRestoreOperationFailedEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebRestoreOperationFailedEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebRestoreOperationFailedEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebRestoreOperationFailedEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationStartedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationStartedEventData.Serialization.cs deleted file mode 100644 index 736f9d2dc985..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationStartedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebRestoreOperationStartedEventData : 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(WebRestoreOperationStartedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebRestoreOperationStartedEventData 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(WebRestoreOperationStartedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebRestoreOperationStartedEventData(document.RootElement, options); - } - - internal static WebRestoreOperationStartedEventData DeserializeWebRestoreOperationStartedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebRestoreOperationStartedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebRestoreOperationStartedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebRestoreOperationStartedEventData 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 DeserializeWebRestoreOperationStartedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebRestoreOperationStartedEventData)} 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 WebRestoreOperationStartedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebRestoreOperationStartedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationStartedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationStartedEventData.cs deleted file mode 100644 index 56a269515051..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebRestoreOperationStartedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.RestoreOperationStarted event. - public partial class WebRestoreOperationStartedEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebRestoreOperationStartedEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebRestoreOperationStartedEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebRestoreOperationStartedEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapCompletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapCompletedEventData.Serialization.cs deleted file mode 100644 index 2f3fd9f03910..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapCompletedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebSlotSwapCompletedEventData : 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(WebSlotSwapCompletedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebSlotSwapCompletedEventData 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(WebSlotSwapCompletedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebSlotSwapCompletedEventData(document.RootElement, options); - } - - internal static WebSlotSwapCompletedEventData DeserializeWebSlotSwapCompletedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebSlotSwapCompletedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebSlotSwapCompletedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebSlotSwapCompletedEventData 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 DeserializeWebSlotSwapCompletedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebSlotSwapCompletedEventData)} 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 WebSlotSwapCompletedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebSlotSwapCompletedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapCompletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapCompletedEventData.cs deleted file mode 100644 index ef1a8a7802ed..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapCompletedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.SlotSwapCompleted event. - public partial class WebSlotSwapCompletedEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebSlotSwapCompletedEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebSlotSwapCompletedEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebSlotSwapCompletedEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapFailedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapFailedEventData.Serialization.cs deleted file mode 100644 index cc16e789939e..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapFailedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebSlotSwapFailedEventData : 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(WebSlotSwapFailedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebSlotSwapFailedEventData 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(WebSlotSwapFailedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebSlotSwapFailedEventData(document.RootElement, options); - } - - internal static WebSlotSwapFailedEventData DeserializeWebSlotSwapFailedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebSlotSwapFailedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebSlotSwapFailedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebSlotSwapFailedEventData 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 DeserializeWebSlotSwapFailedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebSlotSwapFailedEventData)} 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 WebSlotSwapFailedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebSlotSwapFailedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapFailedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapFailedEventData.cs deleted file mode 100644 index 0ea9b65f8e11..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapFailedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.SlotSwapFailed event. - public partial class WebSlotSwapFailedEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebSlotSwapFailedEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebSlotSwapFailedEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebSlotSwapFailedEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapStartedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapStartedEventData.Serialization.cs deleted file mode 100644 index 89e6c83484ee..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapStartedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebSlotSwapStartedEventData : 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(WebSlotSwapStartedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebSlotSwapStartedEventData 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(WebSlotSwapStartedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebSlotSwapStartedEventData(document.RootElement, options); - } - - internal static WebSlotSwapStartedEventData DeserializeWebSlotSwapStartedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebSlotSwapStartedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebSlotSwapStartedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebSlotSwapStartedEventData 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 DeserializeWebSlotSwapStartedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebSlotSwapStartedEventData)} 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 WebSlotSwapStartedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebSlotSwapStartedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapStartedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapStartedEventData.cs deleted file mode 100644 index 14651b8d467c..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapStartedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.SlotSwapStarted event. - public partial class WebSlotSwapStartedEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebSlotSwapStartedEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebSlotSwapStartedEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebSlotSwapStartedEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewCancelledEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewCancelledEventData.Serialization.cs deleted file mode 100644 index 448d307ecd32..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewCancelledEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebSlotSwapWithPreviewCancelledEventData : 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(WebSlotSwapWithPreviewCancelledEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebSlotSwapWithPreviewCancelledEventData 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(WebSlotSwapWithPreviewCancelledEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebSlotSwapWithPreviewCancelledEventData(document.RootElement, options); - } - - internal static WebSlotSwapWithPreviewCancelledEventData DeserializeWebSlotSwapWithPreviewCancelledEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebSlotSwapWithPreviewCancelledEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebSlotSwapWithPreviewCancelledEventData)} does not support writing '{options.Format}' format."); - } - } - - WebSlotSwapWithPreviewCancelledEventData 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 DeserializeWebSlotSwapWithPreviewCancelledEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebSlotSwapWithPreviewCancelledEventData)} 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 WebSlotSwapWithPreviewCancelledEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebSlotSwapWithPreviewCancelledEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewCancelledEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewCancelledEventData.cs deleted file mode 100644 index a6d365495a26..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewCancelledEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.SlotSwapWithPreviewCancelled event. - public partial class WebSlotSwapWithPreviewCancelledEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebSlotSwapWithPreviewCancelledEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebSlotSwapWithPreviewCancelledEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebSlotSwapWithPreviewCancelledEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewStartedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewStartedEventData.Serialization.cs deleted file mode 100644 index 445795c243b5..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewStartedEventData.Serialization.cs +++ /dev/null @@ -1,216 +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.Messaging.EventGrid.SystemEvents -{ - public partial class WebSlotSwapWithPreviewStartedEventData : 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(WebSlotSwapWithPreviewStartedEventData)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("appEventTypeDetail"u8); - writer.WriteObjectValue(AppEventTypeDetail, options); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ClientRequestId)) - { - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - } - if (Optional.IsDefined(CorrelationRequestId)) - { - writer.WritePropertyName("correlationRequestId"u8); - writer.WriteStringValue(CorrelationRequestId); - } - if (Optional.IsDefined(RequestId)) - { - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - } - if (Optional.IsDefined(Address)) - { - writer.WritePropertyName("address"u8); - writer.WriteStringValue(Address); - } - if (Optional.IsDefined(Verb)) - { - writer.WritePropertyName("verb"u8); - writer.WriteStringValue(Verb); - } - 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 - } - } - } - - WebSlotSwapWithPreviewStartedEventData 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(WebSlotSwapWithPreviewStartedEventData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWebSlotSwapWithPreviewStartedEventData(document.RootElement, options); - } - - internal static WebSlotSwapWithPreviewStartedEventData DeserializeWebSlotSwapWithPreviewStartedEventData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AppEventTypeDetail appEventTypeDetail = default; - string name = default; - string clientRequestId = default; - string correlationRequestId = default; - string requestId = default; - string address = default; - string verb = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("appEventTypeDetail"u8)) - { - appEventTypeDetail = AppEventTypeDetail.DeserializeAppEventTypeDetail(property.Value, options); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) - { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationRequestId"u8)) - { - correlationRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("address"u8)) - { - address = property.Value.GetString(); - continue; - } - if (property.NameEquals("verb"u8)) - { - verb = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WebSlotSwapWithPreviewStartedEventData( - appEventTypeDetail, - name, - clientRequestId, - correlationRequestId, - requestId, - address, - verb, - 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(WebSlotSwapWithPreviewStartedEventData)} does not support writing '{options.Format}' format."); - } - } - - WebSlotSwapWithPreviewStartedEventData 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 DeserializeWebSlotSwapWithPreviewStartedEventData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WebSlotSwapWithPreviewStartedEventData)} 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 WebSlotSwapWithPreviewStartedEventData FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeWebSlotSwapWithPreviewStartedEventData(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/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewStartedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewStartedEventData.cs deleted file mode 100644 index c5040a0eb438..000000000000 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/src/Generated/WebSlotSwapWithPreviewStartedEventData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Messaging.EventGrid.SystemEvents -{ - /// Schema of the Data property of an EventGridEvent for a Microsoft.Web.SlotSwapWithPreviewStarted event. - public partial class WebSlotSwapWithPreviewStartedEventData - { - /// - /// 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 . - /// Detail of action on the app. - /// is null. - internal WebSlotSwapWithPreviewStartedEventData(AppEventTypeDetail appEventTypeDetail) - { - Argument.AssertNotNull(appEventTypeDetail, nameof(appEventTypeDetail)); - - AppEventTypeDetail = appEventTypeDetail; - } - - /// Initializes a new instance of . - /// Detail of action on the app. - /// name of the web site that had this event. - /// The client request id generated by the app service for the site API operation that triggered this event. - /// The correlation request id generated by the app service for the site API operation that triggered this event. - /// The request id generated by the app service for the site API operation that triggered this event. - /// HTTP request URL of this operation. - /// HTTP verb of this operation. - /// Keeps track of any properties unknown to the library. - internal WebSlotSwapWithPreviewStartedEventData(AppEventTypeDetail appEventTypeDetail, string name, string clientRequestId, string correlationRequestId, string requestId, string address, string verb, IDictionary serializedAdditionalRawData) - { - AppEventTypeDetail = appEventTypeDetail; - Name = name; - ClientRequestId = clientRequestId; - CorrelationRequestId = correlationRequestId; - RequestId = requestId; - Address = address; - Verb = verb; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WebSlotSwapWithPreviewStartedEventData() - { - } - - /// Detail of action on the app. - public AppEventTypeDetail AppEventTypeDetail { get; } - /// name of the web site that had this event. - public string Name { get; } - /// The client request id generated by the app service for the site API operation that triggered this event. - public string ClientRequestId { get; } - /// The correlation request id generated by the app service for the site API operation that triggered this event. - public string CorrelationRequestId { get; } - /// The request id generated by the app service for the site API operation that triggered this event. - public string RequestId { get; } - /// HTTP request URL of this operation. - public string Address { get; } - /// HTTP verb of this operation. - public string Verb { get; } - } -} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/tsp-location.yaml b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/tsp-location.yaml index e59d0681c201..7a3577acd9ca 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/tsp-location.yaml +++ b/sdk/eventgrid/Azure.Messaging.EventGrid.SystemEvents/tsp-location.yaml @@ -1,3 +1,4 @@ +directory: specification/eventgrid/Azure.Messaging.EventGrid.SystemEvents +commit: 90994cf250891c93b12cd0bfcd4e237e331c6341 repo: Azure/azure-rest-api-specs -directory: "specification/eventgrid/Azure.Messaging.EventGrid.SystemEvents" -commit: 9f024124361561030653abd1e8ec6d5ad1080c1a +additionalDirectories: