diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs index cb342dde6dbf..90410f9aec86 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs @@ -255,6 +255,11 @@ public static partial class EventGridModelFactory public static Azure.Messaging.EventGrid.SystemEvents.ResourceDeleteFailureEventData ResourceDeleteFailureEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, string authorization = null, string claims = null, string correlationId = null, string httpRequest = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.ResourceDeleteSuccessEventData ResourceDeleteSuccessEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, string authorization = null, string claims = null, string correlationId = null, string httpRequest = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.ResourceHttpRequest ResourceHttpRequest(string clientRequestId = null, string clientIpAddress = null, Azure.Core.RequestMethod? method = default(Azure.Core.RequestMethod?), string url = null) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsHealthResourcesAnnotatedEventData ResourceNotificationsHealthResourcesAnnotatedEventData(Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedDetails resourceDetails = null, Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsOperationalDetails operationalDetails = null, string apiVersion = null) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedDetails resourceDetails = null, Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsOperationalDetails operationalDetails = null, string apiVersion = null) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsOperationalDetails ResourceNotificationsOperationalDetails(System.DateTimeOffset? resourceEventTime = default(System.DateTimeOffset?)) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedDetails ResourceNotificationsResourceUpdatedDetails(string id = null, string name = null, string type = null, string location = null, string tags = null, System.Collections.Generic.IReadOnlyDictionary properties = null) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedEventData ResourceNotificationsResourceUpdatedEventData(Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedDetails resourceDetails = null, Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsOperationalDetails operationalDetails = null, string apiVersion = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.ResourceWriteCancelEventData ResourceWriteCancelEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, string authorization = null, string claims = null, string correlationId = null, string httpRequest = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.ResourceWriteFailureEventData ResourceWriteFailureEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, string authorization = null, string claims = null, string correlationId = null, string httpRequest = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.ResourceWriteSuccessEventData ResourceWriteSuccessEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, string authorization = null, string claims = null, string correlationId = null, string httpRequest = null) { throw null; } @@ -482,6 +487,8 @@ public static partial class SystemEventNames public const string ResourceDeleteCancel = "Microsoft.Resources.ResourceDeleteCancel"; public const string ResourceDeleteFailure = "Microsoft.Resources.ResourceDeleteFailure"; public const string ResourceDeleteSuccess = "Microsoft.Resources.ResourceDeleteSuccess"; + public const string ResourceNotificationsHealthResourcesAnnotated = "Microsoft.ResourceNotifications.HealthResources"; + public const string ResourceNotificationsHealthResourcesAvailabilityStatusChanged = "Microsoft.ResourceNotifications.HealthResources"; public const string ResourceWriteCancel = "Microsoft.Resources.ResourceWriteCancel"; public const string ResourceWriteFailure = "Microsoft.Resources.ResourceWriteFailure"; public const string ResourceWriteSuccess = "Microsoft.Resources.ResourceWriteSuccess"; @@ -2421,6 +2428,36 @@ internal ResourceHttpRequest() { } public Azure.Core.RequestMethod Method { get { throw null; } } public string Url { get { throw null; } } } + public partial class ResourceNotificationsHealthResourcesAnnotatedEventData : Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedEventData + { + internal ResourceNotificationsHealthResourcesAnnotatedEventData() { } + } + public partial class ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData : Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedEventData + { + internal ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData() { } + } + public partial class ResourceNotificationsOperationalDetails + { + internal ResourceNotificationsOperationalDetails() { } + public System.DateTimeOffset? ResourceEventTime { get { throw null; } } + } + public partial class ResourceNotificationsResourceUpdatedDetails + { + internal ResourceNotificationsResourceUpdatedDetails() { } + public string Id { get { throw null; } } + public string Location { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Properties { get { throw null; } } + public string Tags { get { throw null; } } + public string Type { get { throw null; } } + } + public partial class ResourceNotificationsResourceUpdatedEventData + { + internal ResourceNotificationsResourceUpdatedEventData() { } + public string ApiVersion { get { throw null; } } + public Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsOperationalDetails OperationalDetails { get { throw null; } } + public Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedDetails ResourceDetails { get { throw null; } } + } public partial class ResourceWriteCancelEventData { internal ResourceWriteCancelEventData() { } diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs index 207f314f39de..61d6ded7a8f4 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs @@ -2596,5 +2596,58 @@ public static HealthcareDicomImageDeletedEventData HealthcareDicomImageDeletedEv { return new HealthcareDicomImageDeletedEventData(partitionName, imageStudyInstanceUid, imageSeriesInstanceUid, imageSopInstanceUid, serviceHostName, sequenceNumber); } + + /// Initializes a new instance of ResourceNotificationsResourceUpdatedDetails. + /// 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, string tags = null, IReadOnlyDictionary properties = null) + { + properties ??= new Dictionary(); + + return new ResourceNotificationsResourceUpdatedDetails(id, name, type, location, tags, properties); + } + + /// Initializes a new instance of ResourceNotificationsOperationalDetails. + /// Date and Time when resource was updated. + /// A new instance for mocking. + public static ResourceNotificationsOperationalDetails ResourceNotificationsOperationalDetails(DateTimeOffset? resourceEventTime = null) + { + return new ResourceNotificationsOperationalDetails(resourceEventTime); + } + + /// Initializes a new instance of ResourceNotificationsResourceUpdatedEventData. + /// 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); + } + + /// Initializes a new instance of ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData. + /// 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); + } + + /// Initializes a new instance of ResourceNotificationsHealthResourcesAnnotatedEventData. + /// 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); + } } } diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAnnotatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAnnotatedEventData.Serialization.cs new file mode 100644 index 000000000000..913413a370f4 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAnnotatedEventData.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Text.Json.Serialization; +using Azure.Core; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + [JsonConverter(typeof(ResourceNotificationsHealthResourcesAnnotatedEventDataConverter))] + public partial class ResourceNotificationsHealthResourcesAnnotatedEventData + { + internal static ResourceNotificationsHealthResourcesAnnotatedEventData DeserializeResourceNotificationsHealthResourcesAnnotatedEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional resourceInfo = default; + Optional operationalInfo = default; + Optional apiVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceInfo = ResourceNotificationsResourceUpdatedDetails.DeserializeResourceNotificationsResourceUpdatedDetails(property.Value); + continue; + } + if (property.NameEquals("operationalInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + operationalInfo = ResourceNotificationsOperationalDetails.DeserializeResourceNotificationsOperationalDetails(property.Value); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + } + return new ResourceNotificationsHealthResourcesAnnotatedEventData(resourceInfo.Value, operationalInfo.Value, apiVersion.Value); + } + + internal partial class ResourceNotificationsHealthResourcesAnnotatedEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, ResourceNotificationsHealthResourcesAnnotatedEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override ResourceNotificationsHealthResourcesAnnotatedEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceNotificationsHealthResourcesAnnotatedEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAnnotatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAnnotatedEventData.cs new file mode 100644 index 000000000000..764ee4c4923d --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAnnotatedEventData.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +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 ResourceNotificationsHealthResourcesAnnotatedEventData. + internal ResourceNotificationsHealthResourcesAnnotatedEventData() + { + } + + /// Initializes a new instance of ResourceNotificationsHealthResourcesAnnotatedEventData. + /// resourceInfo details for update event. + /// details about operational info. + /// api version of the resource properties bag. + internal ResourceNotificationsHealthResourcesAnnotatedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails, string apiVersion) : base(resourceDetails, operationalDetails, apiVersion) + { + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.Serialization.cs new file mode 100644 index 000000000000..10306793903e --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Text.Json.Serialization; +using Azure.Core; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + [JsonConverter(typeof(ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventDataConverter))] + public partial class ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData + { + internal static ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData DeserializeResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional resourceInfo = default; + Optional operationalInfo = default; + Optional apiVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceInfo = ResourceNotificationsResourceUpdatedDetails.DeserializeResourceNotificationsResourceUpdatedDetails(property.Value); + continue; + } + if (property.NameEquals("operationalInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + operationalInfo = ResourceNotificationsOperationalDetails.DeserializeResourceNotificationsOperationalDetails(property.Value); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + } + return new ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(resourceInfo.Value, operationalInfo.Value, apiVersion.Value); + } + + internal partial class ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.cs new file mode 100644 index 000000000000..d1625882da63 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +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 ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData. + internal ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData() + { + } + + /// Initializes a new instance of ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData. + /// resourceInfo details for update event. + /// details about operational info. + /// api version of the resource properties bag. + internal ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails, string apiVersion) : base(resourceDetails, operationalDetails, apiVersion) + { + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsOperationalDetails.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsOperationalDetails.Serialization.cs new file mode 100644 index 000000000000..839ccc0fdfe8 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsOperationalDetails.Serialization.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + public partial class ResourceNotificationsOperationalDetails + { + internal static ResourceNotificationsOperationalDetails DeserializeResourceNotificationsOperationalDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional resourceEventTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceEventTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceEventTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new ResourceNotificationsOperationalDetails(Optional.ToNullable(resourceEventTime)); + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsOperationalDetails.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsOperationalDetails.cs new file mode 100644 index 000000000000..097cfac13bfa --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsOperationalDetails.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + /// details of operational info. + public partial class ResourceNotificationsOperationalDetails + { + /// Initializes a new instance of ResourceNotificationsOperationalDetails. + internal ResourceNotificationsOperationalDetails() + { + } + + /// Initializes a new instance of ResourceNotificationsOperationalDetails. + /// Date and Time when resource was updated. + internal ResourceNotificationsOperationalDetails(DateTimeOffset? resourceEventTime) + { + ResourceEventTime = resourceEventTime; + } + + /// Date and Time when resource was updated. + public DateTimeOffset? ResourceEventTime { get; } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedDetails.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedDetails.Serialization.cs new file mode 100644 index 000000000000..dbb22f1a2a78 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedDetails.Serialization.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + public partial class ResourceNotificationsResourceUpdatedDetails + { + internal static ResourceNotificationsResourceUpdatedDetails DeserializeResourceNotificationsResourceUpdatedDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional tags = default; + Optional> properties = default; + 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)) + { + tags = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + 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, property0.Value.GetObject()); + } + } + properties = dictionary; + continue; + } + } + return new ResourceNotificationsResourceUpdatedDetails(id.Value, name.Value, type.Value, location.Value, tags.Value, Optional.ToDictionary(properties)); + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedDetails.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedDetails.cs new file mode 100644 index 000000000000..fb5f2be7f951 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedDetails.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +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 + { + /// Initializes a new instance of ResourceNotificationsResourceUpdatedDetails. + internal ResourceNotificationsResourceUpdatedDetails() + { + Properties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of ResourceNotificationsResourceUpdatedDetails. + /// 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. + internal ResourceNotificationsResourceUpdatedDetails(string id, string name, string type, string location, string tags, IReadOnlyDictionary properties) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + Properties = properties; + } + + /// 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 string Tags { get; } + /// properties in the payload of the resource for which the event is being emitted. + public IReadOnlyDictionary Properties { get; } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedEventData.Serialization.cs new file mode 100644 index 000000000000..70a72e8e8d5e --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedEventData.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Text.Json.Serialization; +using Azure.Core; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + [JsonConverter(typeof(ResourceNotificationsResourceUpdatedEventDataConverter))] + public partial class ResourceNotificationsResourceUpdatedEventData + { + internal static ResourceNotificationsResourceUpdatedEventData DeserializeResourceNotificationsResourceUpdatedEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional resourceInfo = default; + Optional operationalInfo = default; + Optional apiVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceInfo = ResourceNotificationsResourceUpdatedDetails.DeserializeResourceNotificationsResourceUpdatedDetails(property.Value); + continue; + } + if (property.NameEquals("operationalInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + operationalInfo = ResourceNotificationsOperationalDetails.DeserializeResourceNotificationsOperationalDetails(property.Value); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + } + return new ResourceNotificationsResourceUpdatedEventData(resourceInfo.Value, operationalInfo.Value, apiVersion.Value); + } + + internal partial class ResourceNotificationsResourceUpdatedEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, ResourceNotificationsResourceUpdatedEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override ResourceNotificationsResourceUpdatedEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceNotificationsResourceUpdatedEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedEventData.cs new file mode 100644 index 000000000000..eb1694603fc0 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/ResourceNotificationsResourceUpdatedEventData.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + /// Describes the schema of the common properties across all ARN system topic events. + public partial class ResourceNotificationsResourceUpdatedEventData + { + /// Initializes a new instance of ResourceNotificationsResourceUpdatedEventData. + internal ResourceNotificationsResourceUpdatedEventData() + { + } + + /// Initializes a new instance of ResourceNotificationsResourceUpdatedEventData. + /// resourceInfo details for update event. + /// details about operational info. + /// api version of the resource properties bag. + internal ResourceNotificationsResourceUpdatedEventData(ResourceNotificationsResourceUpdatedDetails resourceDetails, ResourceNotificationsOperationalDetails operationalDetails, string apiVersion) + { + ResourceDetails = resourceDetails; + OperationalDetails = operationalDetails; + ApiVersion = apiVersion; + } + + /// 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/src/autorest.md b/sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md index d6cfbef81429..fd9cba39e67d 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md @@ -4,7 +4,9 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml title: EventGridClient -require: https://github.com/Azure/azure-rest-api-specs/blob/20312e2b31df58f0ea7560e87062d62aa92f0a14/specification/eventgrid/data-plane/readme.md +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/eventgrid/data-plane/readme.md + generation1-convenience-client: true model-factory-for-hlc: - MediaJobOutputAsset @@ -180,3 +182,4 @@ directive: $.MediaLiveEventIngestHeartbeatEventData["properties"]["ingestDriftValue"]["x-ms-client-name"] = "IngestDriftValueInternal"; $.MediaLiveEventIngestHeartbeatEventData["properties"]["lastFragmentArrivalTime"]["format"] = "date-time"; ``` +