diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/CHANGELOG.md b/sdk/eventgrid/Azure.Messaging.EventGrid/CHANGELOG.md index e090db7085014..801d9fed1bded 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/CHANGELOG.md +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/CHANGELOG.md @@ -1,15 +1,22 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.18.0 (2023-09-12) ### Features Added +- Added new system events for Event Grid and App Configuration. +- Added `Recipient` property to `AcsEmailEngagementTrackingReportReceivedEventData` event. + ### Breaking Changes -### Bugs Fixed +- `EventGridClient` has been removed for the stable release. It will be included in a subsequent release. + +## 4.18.0-beta.1 (2023-07-16) ### Other Changes +- Shipping the `EventGridClient` on top of the latest system events. + ## 4.17.0 (2023-06-08) ### Features Added 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 cac68b6fbd641..e69e107804931 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 @@ -60,7 +60,9 @@ public static partial class EventGridModelFactory [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.Messaging.EventGrid.SystemEvents.AcsEmailDeliveryReportReceivedEventData AcsEmailDeliveryReportReceivedEventData(string sender = null, string recipient = null, string messageId = null, Azure.Messaging.EventGrid.SystemEvents.AcsEmailDeliveryReportStatus? status = default(Azure.Messaging.EventGrid.SystemEvents.AcsEmailDeliveryReportStatus?), System.DateTimeOffset? deliveryAttemptTimestamp = default(System.DateTimeOffset?)) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.AcsEmailDeliveryReportStatusDetails AcsEmailDeliveryReportStatusDetails(string statusMessage = null) { throw null; } - public static Azure.Messaging.EventGrid.SystemEvents.AcsEmailEngagementTrackingReportReceivedEventData AcsEmailEngagementTrackingReportReceivedEventData(string sender = null, string messageId = null, System.DateTimeOffset? userActionTimestamp = default(System.DateTimeOffset?), string engagementContext = null, string userAgent = null, Azure.Messaging.EventGrid.SystemEvents.AcsUserEngagement? engagement = default(Azure.Messaging.EventGrid.SystemEvents.AcsUserEngagement?)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public static Azure.Messaging.EventGrid.SystemEvents.AcsEmailEngagementTrackingReportReceivedEventData AcsEmailEngagementTrackingReportReceivedEventData(string sender, string messageId, System.DateTimeOffset? userActionTimestamp, string engagementContext, string userAgent, Azure.Messaging.EventGrid.SystemEvents.AcsUserEngagement? engagement) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.AcsEmailEngagementTrackingReportReceivedEventData AcsEmailEngagementTrackingReportReceivedEventData(string sender = null, string recipient = null, string messageId = null, System.DateTimeOffset? userActionTimestamp = default(System.DateTimeOffset?), string engagementContext = null, string userAgent = null, Azure.Messaging.EventGrid.SystemEvents.AcsUserEngagement? engagement = default(Azure.Messaging.EventGrid.SystemEvents.AcsUserEngagement?)) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.AcsIncomingCallCustomContext AcsIncomingCallCustomContext(System.Collections.Generic.IReadOnlyDictionary sipHeaders = null, System.Collections.Generic.IReadOnlyDictionary voipHeaders = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.AcsIncomingCallEventData AcsIncomingCallEventData(Azure.Messaging.EventGrid.SystemEvents.CommunicationIdentifierModel toCommunicationIdentifier = null, Azure.Messaging.EventGrid.SystemEvents.CommunicationIdentifierModel fromCommunicationIdentifier = null, string serverCallId = null, string callerDisplayName = null, Azure.Messaging.EventGrid.SystemEvents.AcsIncomingCallCustomContext customContext = null, string incomingCallContext = null, string correlationId = null) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -111,6 +113,9 @@ public static partial class EventGridModelFactory public static Azure.Messaging.EventGrid.SystemEvents.ApiManagementUserUpdatedEventData ApiManagementUserUpdatedEventData(string resourceUri = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.AppConfigurationKeyValueDeletedEventData AppConfigurationKeyValueDeletedEventData(string key = null, string label = null, string etag = null, string syncToken = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.AppConfigurationKeyValueModifiedEventData AppConfigurationKeyValueModifiedEventData(string key = null, string label = null, string etag = null, string syncToken = null) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.AppConfigurationSnapshotCreatedEventData AppConfigurationSnapshotCreatedEventData(string name = null, string etag = null, string syncToken = null) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.AppConfigurationSnapshotEventData AppConfigurationSnapshotEventData(string name = null, string etag = null, string syncToken = null) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.AppConfigurationSnapshotModifiedEventData AppConfigurationSnapshotModifiedEventData(string name = null, string etag = null, string syncToken = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.AppEventTypeDetail AppEventTypeDetail(Azure.Messaging.EventGrid.SystemEvents.AppAction? action = default(Azure.Messaging.EventGrid.SystemEvents.AppAction?)) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.AppServicePlanEventTypeDetail AppServicePlanEventTypeDetail(Azure.Messaging.EventGrid.SystemEvents.StampKind? stampKind = default(Azure.Messaging.EventGrid.SystemEvents.StampKind?), Azure.Messaging.EventGrid.SystemEvents.AppServicePlanAction? action = default(Azure.Messaging.EventGrid.SystemEvents.AppServicePlanAction?), Azure.Messaging.EventGrid.SystemEvents.AsyncStatus? status = default(Azure.Messaging.EventGrid.SystemEvents.AsyncStatus?)) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.CommunicationIdentifierModel CommunicationIdentifierModel(string rawId = null, Azure.Messaging.EventGrid.SystemEvents.CommunicationUserIdentifierModel communicationUser = null, Azure.Messaging.EventGrid.SystemEvents.PhoneNumberIdentifierModel phoneNumber = null, Azure.Messaging.EventGrid.SystemEvents.MicrosoftTeamsUserIdentifierModel microsoftTeamsUser = null) { throw null; } @@ -151,6 +156,11 @@ public static partial class EventGridModelFactory public static Azure.Messaging.EventGrid.SystemEvents.DeviceTwinInfoX509Thumbprint DeviceTwinInfoX509Thumbprint(string primaryThumbprint = null, string secondaryThumbprint = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.DeviceTwinMetadata DeviceTwinMetadata(string lastUpdated = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.DeviceTwinProperties DeviceTwinProperties(Azure.Messaging.EventGrid.SystemEvents.DeviceTwinMetadata metadata = null, float? version = default(float?)) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientCreatedOrUpdatedEventData EventGridMqttClientCreatedOrUpdatedEventData(string clientAuthenticationName = null, string clientName = null, string namespaceName = null, Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientState? state = default(Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientState?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), System.DateTimeOffset? updatedOn = default(System.DateTimeOffset?), System.Collections.Generic.IReadOnlyDictionary attributes = null) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDeletedEventData EventGridMqttClientDeletedEventData(string clientAuthenticationName = null, string clientName = null, string namespaceName = null) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientEventData EventGridMqttClientEventData(string clientAuthenticationName = null, string clientName = null, string namespaceName = null) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientSessionConnectedEventData EventGridMqttClientSessionConnectedEventData(string clientAuthenticationName = null, string clientName = null, string namespaceName = null, string clientSessionName = null, long? sequenceNumber = default(long?)) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientSessionDisconnectedEventData EventGridMqttClientSessionDisconnectedEventData(string clientAuthenticationName = null, string clientName = null, string namespaceName = null, string clientSessionName = null, long? sequenceNumber = default(long?), Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason? disconnectionReason = default(Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason?)) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.EventHubCaptureFileCreatedEventData EventHubCaptureFileCreatedEventData(string fileurl = null, string fileType = null, string partitionId = null, int? sizeInBytes = default(int?), int? eventCount = default(int?), int? firstSequenceNumber = default(int?), int? lastSequenceNumber = default(int?), System.DateTimeOffset? firstEnqueueTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastEnqueueTime = default(System.DateTimeOffset?)) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.Messaging.EventGrid.SystemEvents.HealthcareDicomImageCreatedEventData HealthcareDicomImageCreatedEventData(string imageStudyInstanceUid = null, string imageSeriesInstanceUid = null, string imageSopInstanceUid = null, string serviceHostName = null, long? sequenceNumber = default(long?)) { throw null; } @@ -383,6 +393,8 @@ public static partial class SystemEventNames public const string ApiManagementUserUpdated = "Microsoft.ApiManagement.UserUpdated"; public const string AppConfigurationKeyValueDeleted = "Microsoft.AppConfiguration.KeyValueDeleted"; public const string AppConfigurationKeyValueModified = "Microsoft.AppConfiguration.KeyValueModified"; + public const string AppConfigurationSnapshotCreated = "Microsoft.AppConfiguration.SnapshotCreated"; + public const string AppConfigurationSnapshotModified = "Microsoft.AppConfiguration.SnapshotModified"; public const string ContainerRegistryChartDeleted = "Microsoft.ContainerRegistry.ChartDeleted"; public const string ContainerRegistryChartPushed = "Microsoft.ContainerRegistry.ChartPushed"; public const string ContainerRegistryImageDeleted = "Microsoft.ContainerRegistry.ImageDeleted"; @@ -396,6 +408,10 @@ public static partial class SystemEventNames public const string DataBoxCopyCompleted = "Microsoft.DataBox.CopyCompleted"; public const string DataBoxCopyStarted = "Microsoft.DataBox.CopyStarted"; public const string DataBoxOrderCompleted = "Microsoft.DataBox.OrderCompleted"; + public const string EventGridMqttClientCreatedOrUpdated = "Microsoft.EventGrid.MQTTClientCreatedOrUpdated"; + public const string EventGridMqttClientDeleted = "Microsoft.EventGrid.MQTTClientDeleted"; + public const string EventGridMqttClientSessionConnected = "Microsoft.EventGrid.MQTTClientSessionConnected"; + public const string EventGridMqttClientSessionDisconnected = "Microsoft.EventGrid.MQTTClientSessionDisconnected"; public const string EventGridSubscriptionDeleted = "Microsoft.EventGrid.SubscriptionDeletedEvent"; public const string EventGridSubscriptionValidation = "Microsoft.EventGrid.SubscriptionValidationEvent"; public const string EventHubCaptureFileCreated = "Microsoft.EventHub.CaptureFileCreated"; @@ -765,6 +781,7 @@ internal AcsEmailEngagementTrackingReportReceivedEventData() { } public Azure.Messaging.EventGrid.SystemEvents.AcsUserEngagement? Engagement { get { throw null; } } public string EngagementContext { get { throw null; } } public string MessageId { get { throw null; } } + public string Recipient { get { throw null; } } public string Sender { get { throw null; } } public System.DateTimeOffset? UserActionTimestamp { get { throw null; } } public string UserAgent { get { throw null; } } @@ -1093,6 +1110,21 @@ internal AppConfigurationKeyValueModifiedEventData() { } public string Label { get { throw null; } } public string SyncToken { get { throw null; } } } + public partial class AppConfigurationSnapshotCreatedEventData : Azure.Messaging.EventGrid.SystemEvents.AppConfigurationSnapshotEventData + { + internal AppConfigurationSnapshotCreatedEventData() { } + } + public partial class AppConfigurationSnapshotEventData + { + internal AppConfigurationSnapshotEventData() { } + public string Etag { get { throw null; } } + public string Name { get { throw null; } } + public string SyncToken { get { throw null; } } + } + public partial class AppConfigurationSnapshotModifiedEventData : Azure.Messaging.EventGrid.SystemEvents.AppConfigurationSnapshotEventData + { + internal AppConfigurationSnapshotModifiedEventData() { } + } public partial class AppEventTypeDetail { internal AppEventTypeDetail() { } @@ -1402,6 +1434,83 @@ internal DeviceTwinProperties() { } public Azure.Messaging.EventGrid.SystemEvents.DeviceTwinMetadata Metadata { get { throw null; } } public float? Version { get { throw null; } } } + public partial class EventGridMqttClientCreatedOrUpdatedEventData : Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientEventData + { + internal EventGridMqttClientCreatedOrUpdatedEventData() { } + public System.Collections.Generic.IReadOnlyDictionary Attributes { get { throw null; } } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientState? State { get { throw null; } } + public System.DateTimeOffset? UpdatedOn { get { throw null; } } + } + public partial class EventGridMqttClientDeletedEventData : Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientEventData + { + internal EventGridMqttClientDeletedEventData() { } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EventGridMqttClientDisconnectionReason : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EventGridMqttClientDisconnectionReason(string value) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason ClientAuthenticationError { get { throw null; } } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason ClientAuthorizationError { get { throw null; } } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason ClientError { get { throw null; } } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason ClientInitiatedDisconnect { get { throw null; } } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason ConnectionLost { get { throw null; } } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason IpForbidden { get { throw null; } } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason QuotaExceeded { get { throw null; } } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason ServerError { get { throw null; } } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason ServerInitiatedDisconnect { get { throw null; } } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason SessionOverflow { get { throw null; } } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason SessionTakenOver { get { throw null; } } + public bool Equals(Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason left, Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason right) { throw null; } + public static implicit operator Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason (string value) { throw null; } + public static bool operator !=(Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason left, Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason right) { throw null; } + public override string ToString() { throw null; } + } + public partial class EventGridMqttClientEventData + { + internal EventGridMqttClientEventData() { } + public string ClientAuthenticationName { get { throw null; } } + public string ClientName { get { throw null; } } + public string NamespaceName { get { throw null; } } + } + public partial class EventGridMqttClientSessionConnectedEventData : Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientEventData + { + internal EventGridMqttClientSessionConnectedEventData() { } + public string ClientSessionName { get { throw null; } } + public long? SequenceNumber { get { throw null; } } + } + public partial class EventGridMqttClientSessionDisconnectedEventData : Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientEventData + { + internal EventGridMqttClientSessionDisconnectedEventData() { } + public string ClientSessionName { get { throw null; } } + public Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientDisconnectionReason? DisconnectionReason { get { throw null; } } + public long? SequenceNumber { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EventGridMqttClientState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EventGridMqttClientState(string value) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientState Disabled { get { throw null; } } + public static Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientState Enabled { get { throw null; } } + public bool Equals(Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientState left, Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientState right) { throw null; } + public static implicit operator Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientState (string value) { throw null; } + public static bool operator !=(Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientState left, Azure.Messaging.EventGrid.SystemEvents.EventGridMqttClientState right) { throw null; } + public override string ToString() { throw null; } + } public partial class EventHubCaptureFileCreatedEventData { internal EventHubCaptureFileCreatedEventData() { } diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/assets.json b/sdk/eventgrid/Azure.Messaging.EventGrid/assets.json index 42da5c291ae23..8bf42accf0611 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/assets.json +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/eventgrid/Azure.Messaging.EventGrid", - "Tag": "net/eventgrid/Azure.Messaging.EventGrid_113caaf23d" + "Tag": "net/eventgrid/Azure.Messaging.EventGrid_2bad09d27c" } diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Azure.Messaging.EventGrid.csproj b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Azure.Messaging.EventGrid.csproj index 5581b4f19c08a..0c9c4024cb48c 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Azure.Messaging.EventGrid.csproj +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Azure.Messaging.EventGrid.csproj @@ -2,7 +2,7 @@ This library can be used to publish events to Azure Event Grid and to consume events delivered by EventGrid. It also defines the event schemas for the events published to EventGrid by various Azure services. Microsoft Azure.Messaging.EventGrid client library - 4.18.0-beta.1 + 4.18.0 4.17.0 Microsoft Azure EventGrid;Event Grid;Event Grid Publishing; diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Customization/EventGridModelFactory.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Customization/EventGridModelFactory.cs index 2c166af00186b..828100f2ec551 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Customization/EventGridModelFactory.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Customization/EventGridModelFactory.cs @@ -570,6 +570,20 @@ public static HealthcareDicomImageDeletedEventData HealthcareDicomImageDeletedEv { return new HealthcareDicomImageDeletedEventData(default, imageStudyInstanceUid, imageSeriesInstanceUid, imageSopInstanceUid, serviceHostName, sequenceNumber); } + + /// Initializes a new instance of AcsEmailEngagementTrackingReportReceivedEventData. + /// The Sender 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. + [EditorBrowsable(EditorBrowsableState.Never)] + public static AcsEmailEngagementTrackingReportReceivedEventData AcsEmailEngagementTrackingReportReceivedEventData(string sender, string messageId, DateTimeOffset? userActionTimestamp, string engagementContext, string userAgent, AcsUserEngagement? engagement) + { + return new AcsEmailEngagementTrackingReportReceivedEventData(sender, null, messageId, userActionTimestamp, engagementContext, userAgent, engagement); + } } #pragma warning restore CA1054 // URI-like parameters should not be strings } diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs index 949bd7a5dd8dd..c6d8be9fbfcb8 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs @@ -230,6 +230,67 @@ public static SubscriptionDeletedEventData SubscriptionDeletedEventData(string e return new SubscriptionDeletedEventData(eventSubscriptionId); } + /// Initializes a new instance of EventGridMqttClientCreatedOrUpdatedEventData. + /// 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 = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null, IReadOnlyDictionary attributes = null) + { + attributes ??= new Dictionary(); + + return new EventGridMqttClientCreatedOrUpdatedEventData(clientAuthenticationName, clientName, namespaceName, state, createdOn, updatedOn, attributes); + } + + /// Initializes a new instance of EventGridMqttClientEventData. + /// 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); + } + + /// Initializes a new instance of EventGridMqttClientDeletedEventData. + /// 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); + } + + /// Initializes a new instance of EventGridMqttClientSessionConnectedEventData. + /// 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, clientSessionName, sequenceNumber); + } + + /// Initializes a new instance of EventGridMqttClientSessionDisconnectedEventData. + /// 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 = null) + { + return new EventGridMqttClientSessionDisconnectedEventData(clientAuthenticationName, clientName, namespaceName, clientSessionName, sequenceNumber, disconnectionReason); + } + /// Initializes a new instance of DataBoxCopyStartedEventData. /// 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. @@ -1086,6 +1147,36 @@ public static AppConfigurationKeyValueDeletedEventData AppConfigurationKeyValueD return new AppConfigurationKeyValueDeletedEventData(key, label, etag, syncToken); } + /// Initializes a new instance of AppConfigurationSnapshotEventData. + /// 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); + } + + /// Initializes a new instance of AppConfigurationSnapshotCreatedEventData. + /// 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); + } + + /// Initializes a new instance of AppConfigurationSnapshotModifiedEventData. + /// 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); + } + /// Initializes a new instance of SignalRServiceClientConnectionConnectedEventData. /// The time at which the event occurred. /// The hub of connected client connection. @@ -2105,15 +2196,16 @@ public static AcsEmailDeliveryReportStatusDetails AcsEmailDeliveryReportStatusDe /// Initializes a new instance of AcsEmailEngagementTrackingReportReceivedEventData. /// 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 messageId = null, DateTimeOffset? userActionTimestamp = null, string engagementContext = null, string userAgent = null, AcsUserEngagement? engagement = null) + public static AcsEmailEngagementTrackingReportReceivedEventData AcsEmailEngagementTrackingReportReceivedEventData(string sender = null, string recipient = null, string messageId = null, DateTimeOffset? userActionTimestamp = null, string engagementContext = null, string userAgent = null, AcsUserEngagement? engagement = null) { - return new AcsEmailEngagementTrackingReportReceivedEventData(sender, messageId, userActionTimestamp, engagementContext, userAgent, engagement); + return new AcsEmailEngagementTrackingReportReceivedEventData(sender, recipient, messageId, userActionTimestamp, engagementContext, userAgent, engagement); } /// Initializes a new instance of PolicyInsightsPolicyStateCreatedEventData. diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.Serialization.cs index 755833397fc5b..16e10f202e333 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.Serialization.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.Serialization.cs @@ -22,6 +22,7 @@ internal static AcsEmailEngagementTrackingReportReceivedEventData DeserializeAcs return null; } Optional sender = default; + Optional recipient = default; Optional messageId = default; Optional userActionTimeStamp = default; Optional engagementContext = default; @@ -34,6 +35,11 @@ internal static AcsEmailEngagementTrackingReportReceivedEventData DeserializeAcs sender = property.Value.GetString(); continue; } + if (property.NameEquals("recipient"u8)) + { + recipient = property.Value.GetString(); + continue; + } if (property.NameEquals("messageId"u8)) { messageId = property.Value.GetString(); @@ -68,7 +74,7 @@ internal static AcsEmailEngagementTrackingReportReceivedEventData DeserializeAcs continue; } } - return new AcsEmailEngagementTrackingReportReceivedEventData(sender.Value, messageId.Value, Optional.ToNullable(userActionTimeStamp), engagementContext.Value, userAgent.Value, Optional.ToNullable(engagementType)); + return new AcsEmailEngagementTrackingReportReceivedEventData(sender.Value, recipient.Value, messageId.Value, Optional.ToNullable(userActionTimeStamp), engagementContext.Value, userAgent.Value, Optional.ToNullable(engagementType)); } internal partial class AcsEmailEngagementTrackingReportReceivedEventDataConverter : JsonConverter diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.cs index 5454b81325af5..864ad03c0c429 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.cs @@ -19,14 +19,16 @@ internal AcsEmailEngagementTrackingReportReceivedEventData() /// Initializes a new instance of AcsEmailEngagementTrackingReportReceivedEventData. /// 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. - internal AcsEmailEngagementTrackingReportReceivedEventData(string sender, string messageId, DateTimeOffset? userActionTimestamp, string engagementContext, string userAgent, AcsUserEngagement? engagement) + internal AcsEmailEngagementTrackingReportReceivedEventData(string sender, string recipient, string messageId, DateTimeOffset? userActionTimestamp, string engagementContext, string userAgent, AcsUserEngagement? engagement) { Sender = sender; + Recipient = recipient; MessageId = messageId; UserActionTimestamp = userActionTimestamp; EngagementContext = engagementContext; @@ -36,6 +38,8 @@ internal AcsEmailEngagementTrackingReportReceivedEventData(string sender, string /// 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. diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotCreatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotCreatedEventData.Serialization.cs new file mode 100644 index 0000000000000..fc51ea60fa5dc --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotCreatedEventData.Serialization.cs @@ -0,0 +1,61 @@ +// 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(AppConfigurationSnapshotCreatedEventDataConverter))] + public partial class AppConfigurationSnapshotCreatedEventData + { + internal static AppConfigurationSnapshotCreatedEventData DeserializeAppConfigurationSnapshotCreatedEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional etag = default; + Optional syncToken = default; + 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; + } + } + return new AppConfigurationSnapshotCreatedEventData(name.Value, etag.Value, syncToken.Value); + } + + internal partial class AppConfigurationSnapshotCreatedEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, AppConfigurationSnapshotCreatedEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override AppConfigurationSnapshotCreatedEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationSnapshotCreatedEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotCreatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotCreatedEventData.cs new file mode 100644 index 0000000000000..3c7cda555e099 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotCreatedEventData.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.AppConfiguration.SnapshotCreated event. + public partial class AppConfigurationSnapshotCreatedEventData : AppConfigurationSnapshotEventData + { + /// Initializes a new instance of AppConfigurationSnapshotCreatedEventData. + internal AppConfigurationSnapshotCreatedEventData() + { + } + + /// Initializes a new instance of AppConfigurationSnapshotCreatedEventData. + /// The name of the snapshot. + /// The etag representing the new state of the snapshot. + /// The sync token representing the server state after the event. + internal AppConfigurationSnapshotCreatedEventData(string name, string etag, string syncToken) : base(name, etag, syncToken) + { + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotEventData.Serialization.cs new file mode 100644 index 0000000000000..822ccd440d0be --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotEventData.Serialization.cs @@ -0,0 +1,61 @@ +// 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(AppConfigurationSnapshotEventDataConverter))] + public partial class AppConfigurationSnapshotEventData + { + internal static AppConfigurationSnapshotEventData DeserializeAppConfigurationSnapshotEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional etag = default; + Optional syncToken = default; + 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; + } + } + return new AppConfigurationSnapshotEventData(name.Value, etag.Value, syncToken.Value); + } + + internal partial class AppConfigurationSnapshotEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, AppConfigurationSnapshotEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override AppConfigurationSnapshotEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationSnapshotEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotEventData.cs new file mode 100644 index 0000000000000..5aaaa39d9d98a --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotEventData.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + /// Schema of common properties of snapshot events. + public partial class AppConfigurationSnapshotEventData + { + /// Initializes a new instance of AppConfigurationSnapshotEventData. + internal AppConfigurationSnapshotEventData() + { + } + + /// Initializes a new instance of AppConfigurationSnapshotEventData. + /// The name of the snapshot. + /// The etag representing the new state of the snapshot. + /// The sync token representing the server state after the event. + internal AppConfigurationSnapshotEventData(string name, string etag, string syncToken) + { + Name = name; + Etag = etag; + SyncToken = syncToken; + } + + /// 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/src/Generated/Models/AppConfigurationSnapshotModifiedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotModifiedEventData.Serialization.cs new file mode 100644 index 0000000000000..bbebcd9cde471 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotModifiedEventData.Serialization.cs @@ -0,0 +1,61 @@ +// 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(AppConfigurationSnapshotModifiedEventDataConverter))] + public partial class AppConfigurationSnapshotModifiedEventData + { + internal static AppConfigurationSnapshotModifiedEventData DeserializeAppConfigurationSnapshotModifiedEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional etag = default; + Optional syncToken = default; + 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; + } + } + return new AppConfigurationSnapshotModifiedEventData(name.Value, etag.Value, syncToken.Value); + } + + internal partial class AppConfigurationSnapshotModifiedEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, AppConfigurationSnapshotModifiedEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override AppConfigurationSnapshotModifiedEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationSnapshotModifiedEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotModifiedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotModifiedEventData.cs new file mode 100644 index 0000000000000..02a7096ba3d20 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AppConfigurationSnapshotModifiedEventData.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.AppConfiguration.SnapshotModified event. + public partial class AppConfigurationSnapshotModifiedEventData : AppConfigurationSnapshotEventData + { + /// Initializes a new instance of AppConfigurationSnapshotModifiedEventData. + internal AppConfigurationSnapshotModifiedEventData() + { + } + + /// Initializes a new instance of AppConfigurationSnapshotModifiedEventData. + /// The name of the snapshot. + /// The etag representing the new state of the snapshot. + /// The sync token representing the server state after the event. + internal AppConfigurationSnapshotModifiedEventData(string name, string etag, string syncToken) : base(name, etag, syncToken) + { + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientCreatedOrUpdatedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientCreatedOrUpdatedEventData.Serialization.cs new file mode 100644 index 0000000000000..4ae9bb791ef10 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientCreatedOrUpdatedEventData.Serialization.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Azure.Core; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + [JsonConverter(typeof(EventGridMqttClientCreatedOrUpdatedEventDataConverter))] + public partial class EventGridMqttClientCreatedOrUpdatedEventData + { + internal static EventGridMqttClientCreatedOrUpdatedEventData DeserializeEventGridMqttClientCreatedOrUpdatedEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional state = default; + Optional createdOn = default; + Optional updatedOn = default; + Optional> attributes = default; + Optional clientAuthenticationName = default; + Optional clientName = default; + Optional namespaceName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new EventGridMqttClientState(property.Value.GetString()); + continue; + } + if (property.NameEquals("createdOn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedOn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedOn = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("attributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + 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; + } + } + return new EventGridMqttClientCreatedOrUpdatedEventData(clientAuthenticationName.Value, clientName.Value, namespaceName.Value, Optional.ToNullable(state), Optional.ToNullable(createdOn), Optional.ToNullable(updatedOn), Optional.ToDictionary(attributes)); + } + + internal partial class EventGridMqttClientCreatedOrUpdatedEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, EventGridMqttClientCreatedOrUpdatedEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override EventGridMqttClientCreatedOrUpdatedEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeEventGridMqttClientCreatedOrUpdatedEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientCreatedOrUpdatedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientCreatedOrUpdatedEventData.cs new file mode 100644 index 0000000000000..8f99c8ef287d8 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientCreatedOrUpdatedEventData.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + /// Event data for Microsoft.EventGrid.MQTTClientCreatedOrUpdated event. + public partial class EventGridMqttClientCreatedOrUpdatedEventData : EventGridMqttClientEventData + { + /// Initializes a new instance of EventGridMqttClientCreatedOrUpdatedEventData. + internal EventGridMqttClientCreatedOrUpdatedEventData() + { + Attributes = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of EventGridMqttClientCreatedOrUpdatedEventData. + /// 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. + internal EventGridMqttClientCreatedOrUpdatedEventData(string clientAuthenticationName, string clientName, string namespaceName, EventGridMqttClientState? state, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, IReadOnlyDictionary attributes) : base(clientAuthenticationName, clientName, namespaceName) + { + State = state; + CreatedOn = createdOn; + UpdatedOn = updatedOn; + Attributes = attributes; + } + + /// 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/src/Generated/Models/EventGridMqttClientDeletedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientDeletedEventData.Serialization.cs new file mode 100644 index 0000000000000..698d1ea39d41b --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientDeletedEventData.Serialization.cs @@ -0,0 +1,61 @@ +// 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(EventGridMqttClientDeletedEventDataConverter))] + public partial class EventGridMqttClientDeletedEventData + { + internal static EventGridMqttClientDeletedEventData DeserializeEventGridMqttClientDeletedEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional clientAuthenticationName = default; + Optional clientName = default; + Optional namespaceName = default; + 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; + } + } + return new EventGridMqttClientDeletedEventData(clientAuthenticationName.Value, clientName.Value, namespaceName.Value); + } + + internal partial class EventGridMqttClientDeletedEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, EventGridMqttClientDeletedEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override EventGridMqttClientDeletedEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeEventGridMqttClientDeletedEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientDeletedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientDeletedEventData.cs new file mode 100644 index 0000000000000..b978530a36051 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientDeletedEventData.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + /// Event data for Microsoft.EventGrid.MQTTClientDeleted event. + public partial class EventGridMqttClientDeletedEventData : EventGridMqttClientEventData + { + /// Initializes a new instance of EventGridMqttClientDeletedEventData. + internal EventGridMqttClientDeletedEventData() + { + } + + /// Initializes a new instance of EventGridMqttClientDeletedEventData. + /// 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. + internal EventGridMqttClientDeletedEventData(string clientAuthenticationName, string clientName, string namespaceName) : base(clientAuthenticationName, clientName, namespaceName) + { + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientDisconnectionReason.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientDisconnectionReason.cs new file mode 100644 index 0000000000000..81327714b6063 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientDisconnectionReason.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + /// Reason for the disconnection of the MQTT client's session. The value could be one of the values in the disconnection reasons table. + 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 initiates 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 string 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?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientEventData.Serialization.cs new file mode 100644 index 0000000000000..5a31fec3c7657 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientEventData.Serialization.cs @@ -0,0 +1,61 @@ +// 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(EventGridMqttClientEventDataConverter))] + public partial class EventGridMqttClientEventData + { + internal static EventGridMqttClientEventData DeserializeEventGridMqttClientEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional clientAuthenticationName = default; + Optional clientName = default; + Optional namespaceName = default; + 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; + } + } + return new EventGridMqttClientEventData(clientAuthenticationName.Value, clientName.Value, namespaceName.Value); + } + + internal partial class EventGridMqttClientEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, EventGridMqttClientEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override EventGridMqttClientEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeEventGridMqttClientEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientEventData.cs new file mode 100644 index 0000000000000..7e7edc66538f0 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientEventData.cs @@ -0,0 +1,36 @@ +// 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 MQTT Client state changes. + public partial class EventGridMqttClientEventData + { + /// Initializes a new instance of EventGridMqttClientEventData. + internal EventGridMqttClientEventData() + { + } + + /// Initializes a new instance of EventGridMqttClientEventData. + /// 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. + internal EventGridMqttClientEventData(string clientAuthenticationName, string clientName, string namespaceName) + { + ClientAuthenticationName = clientAuthenticationName; + ClientName = clientName; + NamespaceName = namespaceName; + } + + /// 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/src/Generated/Models/EventGridMqttClientSessionConnectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientSessionConnectedEventData.Serialization.cs new file mode 100644 index 0000000000000..3c94611be2169 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientSessionConnectedEventData.Serialization.cs @@ -0,0 +1,77 @@ +// 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(EventGridMqttClientSessionConnectedEventDataConverter))] + public partial class EventGridMqttClientSessionConnectedEventData + { + internal static EventGridMqttClientSessionConnectedEventData DeserializeEventGridMqttClientSessionConnectedEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional clientSessionName = default; + Optional sequenceNumber = default; + Optional clientAuthenticationName = default; + Optional clientName = default; + Optional namespaceName = default; + 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; + } + } + return new EventGridMqttClientSessionConnectedEventData(clientAuthenticationName.Value, clientName.Value, namespaceName.Value, clientSessionName.Value, Optional.ToNullable(sequenceNumber)); + } + + internal partial class EventGridMqttClientSessionConnectedEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, EventGridMqttClientSessionConnectedEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override EventGridMqttClientSessionConnectedEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeEventGridMqttClientSessionConnectedEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientSessionConnectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientSessionConnectedEventData.cs new file mode 100644 index 0000000000000..fd1508d0182eb --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientSessionConnectedEventData.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + /// Event data for Microsoft.EventGrid.MQTTClientSessionConnected event. + public partial class EventGridMqttClientSessionConnectedEventData : EventGridMqttClientEventData + { + /// Initializes a new instance of EventGridMqttClientSessionConnectedEventData. + internal EventGridMqttClientSessionConnectedEventData() + { + } + + /// Initializes a new instance of EventGridMqttClientSessionConnectedEventData. + /// 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. + internal EventGridMqttClientSessionConnectedEventData(string clientAuthenticationName, string clientName, string namespaceName, string clientSessionName, long? sequenceNumber) : base(clientAuthenticationName, clientName, namespaceName) + { + 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/src/Generated/Models/EventGridMqttClientSessionDisconnectedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientSessionDisconnectedEventData.Serialization.cs new file mode 100644 index 0000000000000..3313430f4201b --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientSessionDisconnectedEventData.Serialization.cs @@ -0,0 +1,87 @@ +// 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(EventGridMqttClientSessionDisconnectedEventDataConverter))] + public partial class EventGridMqttClientSessionDisconnectedEventData + { + internal static EventGridMqttClientSessionDisconnectedEventData DeserializeEventGridMqttClientSessionDisconnectedEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional clientSessionName = default; + Optional sequenceNumber = default; + Optional disconnectionReason = default; + Optional clientAuthenticationName = default; + Optional clientName = default; + Optional namespaceName = default; + 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)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + 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; + } + } + return new EventGridMqttClientSessionDisconnectedEventData(clientAuthenticationName.Value, clientName.Value, namespaceName.Value, clientSessionName.Value, Optional.ToNullable(sequenceNumber), Optional.ToNullable(disconnectionReason)); + } + + internal partial class EventGridMqttClientSessionDisconnectedEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, EventGridMqttClientSessionDisconnectedEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override EventGridMqttClientSessionDisconnectedEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeEventGridMqttClientSessionDisconnectedEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientSessionDisconnectedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientSessionDisconnectedEventData.cs new file mode 100644 index 0000000000000..b67d8d98e8bb4 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientSessionDisconnectedEventData.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + /// Event data for Microsoft.EventGrid.MQTTClientSessionDisconnected event. + public partial class EventGridMqttClientSessionDisconnectedEventData : EventGridMqttClientEventData + { + /// Initializes a new instance of EventGridMqttClientSessionDisconnectedEventData. + internal EventGridMqttClientSessionDisconnectedEventData() + { + } + + /// Initializes a new instance of EventGridMqttClientSessionDisconnectedEventData. + /// 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. + internal EventGridMqttClientSessionDisconnectedEventData(string clientAuthenticationName, string clientName, string namespaceName, string clientSessionName, long? sequenceNumber, EventGridMqttClientDisconnectionReason? disconnectionReason) : base(clientAuthenticationName, clientName, namespaceName) + { + ClientSessionName = clientSessionName; + SequenceNumber = sequenceNumber; + DisconnectionReason = disconnectionReason; + } + + /// 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/src/Generated/Models/EventGridMqttClientState.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientState.cs new file mode 100644 index 0000000000000..abf21e396f815 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/EventGridMqttClientState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + /// Configured state of the client. The value could be Enabled or Disabled. + 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 string 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?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md b/sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md index 6de471d7d7677..d6cfbef814292 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md @@ -4,7 +4,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml title: EventGridClient -require: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/eventgrid/data-plane/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/20312e2b31df58f0ea7560e87062d62aa92f0a14/specification/eventgrid/data-plane/readme.md generation1-convenience-client: true model-factory-for-hlc: - MediaJobOutputAsset @@ -147,6 +147,14 @@ directive: $[path]["properties"]["status"]["x-namespace"] = namespace; $[path]["properties"]["summaryReportBlobUrl"]["x-ms-client-name"] = "SummaryReportBlobUri"; } + if (path.includes("EventGridMQTTClientCreatedOrUpdatedEventData")) + { + $[path]["properties"]["state"]["x-namespace"] = namespace; + } + if (path.includes("EventGridMQTTClientSessionDisconnectedEventData")) + { + $[path]["properties"]["disconnectionReason"]["x-namespace"] = namespace; + } } ``` diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/tests/ConsumeEventTests.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/tests/ConsumeEventTests.cs index b146d9d08952d..99319c4deed5b 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/tests/ConsumeEventTests.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/tests/ConsumeEventTests.cs @@ -2299,6 +2299,36 @@ public void ConsumeCloudEventAppConfigurationKeyValueModifiedEvent() var sysEvent = events[0].Data.ToObjectFromJson(); Assert.AreEqual("key1", sysEvent.Key); } + + [Test] + public void ConsumeCloudEventAppConfigurationSnapshotCreatedEvent() + { + string requestContent = "[{\"specversion\": \"1.0\", \"id\": \"56afc886-767b-d359-d59e-0da7877166b2\", \"source\": \"/SUBSCRIPTIONS/ID/RESOURCEGROUPS/rg/PROVIDERS/MICROSOFT.Maps/test1\", \"subject\": \"test1\", \"type\": \"Microsoft.AppConfiguration.SnapshotCreated\",\"time\": \"2018-01-02T19:17:44.4383997Z\", \"data\": {\"name\":\"Foo\",\"etag\":\"FnUExLaj2moIi4tJX9AXn9sakm0\",\"syncToken\":\"zAJw6V16=Njo1IzUxNjQ2NzM=;sn=5164673\"}}]"; + CloudEvent[] events = CloudEvent.ParseMany(new BinaryData(requestContent)); + + Assert.NotNull(events); + Assert.True(events[0].TryGetSystemEventData(out object eventData)); + Assert.AreEqual("Foo", (eventData as AppConfigurationSnapshotCreatedEventData).Name); + Assert.AreEqual("zAJw6V16=Njo1IzUxNjQ2NzM=;sn=5164673", (eventData as AppConfigurationSnapshotCreatedEventData).SyncToken); + + var sysEvent = events[0].Data.ToObjectFromJson(); + Assert.AreEqual("Foo", sysEvent.Name); + } + + [Test] + public void ConsumeCloudEventAppConfigurationSnapshotModifiedEvent() + { + string requestContent = "[{\"specversion\": \"1.0\", \"id\": \"56afc886-767b-d359-d59e-0da7877166b2\", \"source\": \"/SUBSCRIPTIONS/ID/RESOURCEGROUPS/rg/PROVIDERS/MICROSOFT.Maps/test1\", \"subject\": \"test1\", \"type\": \"Microsoft.AppConfiguration.SnapshotModified\",\"time\": \"2018-01-02T19:17:44.4383997Z\", \"data\": {\"name\":\"Foo\",\"etag\":\"FnUExLaj2moIi4tJX9AXn9sakm0\",\"syncToken\":\"zAJw6V16=Njo1IzUxNjQ2NzM=;sn=5164673\"}}]"; + CloudEvent[] events = CloudEvent.ParseMany(new BinaryData(requestContent)); + + Assert.NotNull(events); + Assert.True(events[0].TryGetSystemEventData(out object eventData)); + Assert.AreEqual("Foo", (eventData as AppConfigurationSnapshotModifiedEventData).Name); + Assert.AreEqual("zAJw6V16=Njo1IzUxNjQ2NzM=;sn=5164673", (eventData as AppConfigurationSnapshotModifiedEventData).SyncToken); + + var sysEvent = events[0].Data.ToObjectFromJson(); + Assert.AreEqual("Foo", sysEvent.Name); + } #endregion #region ContainerRegistry events @@ -2565,6 +2595,65 @@ public void ConsumeCloudEventEventGridSubscriptionDeletedEvent() Assert.True(events[0].TryGetSystemEventData(out object eventData)); Assert.AreEqual("/subscriptions/id/resourceGroups/rg/providers/Microsoft.EventGrid/topics/topic1/providers/Microsoft.EventGrid/eventSubscriptions/eventsubscription1", (eventData as SubscriptionDeletedEventData).EventSubscriptionId); } + + [Test] + public void ConsumeCloudEventEventGridMqttClientCreatedOrUpdatedEvent() + { + string requestContent = "[{ \"id\": \"2d1781af-3a4c-4d7c-bd0c-e34b19da4e66\", \"source\": \"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \"subject\": \"\", \"data\": { \"createdOn\": \"2023-07-29T01:14:34.2048108Z\", \"updatedOn\": \"2023-07-29T01:14:34.2048108Z\",\"namespaceName\": \"myns\",\"clientName\": \"client1\",\"clientAuthenticationName\": \"client1\",\"state\": \"Enabled\",\"attributes\": {\"attribute1\": \"value1\"} }, \"type\": \"Microsoft.EventGrid.MQTTClientCreatedOrUpdated\", \"time\": \"2018-01-25T22:12:19.4556811Z\", \"specversion\": \"1.0\"}]"; + + CloudEvent[] events = CloudEvent.ParseMany(new BinaryData(requestContent)); + + Assert.NotNull(events); + Assert.True(events[0].TryGetSystemEventData(out object eventData)); + Assert.AreEqual("client1", (eventData as EventGridMqttClientCreatedOrUpdatedEventData).ClientName); + Assert.AreEqual("myns", (eventData as EventGridMqttClientCreatedOrUpdatedEventData).NamespaceName); + Assert.AreEqual("client1", (eventData as EventGridMqttClientCreatedOrUpdatedEventData).ClientAuthenticationName); + } + + [Test] + public void ConsumeCloudEventEventGridMqttClientDeletedEvent() + { + string requestContent = "[{ \"id\": \"2d1781af-3a4c-4d7c-bd0c-e34b19da4e66\", \"source\": \"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \"subject\": \"\", \"data\": { \"namespaceName\": \"myns\",\"clientName\": \"client1\",\"clientAuthenticationName\": \"client1\" }, \"type\": \"Microsoft.EventGrid.MQTTClientDeleted\", \"time\": \"2018-01-25T22:12:19.4556811Z\", \"specversion\": \"1.0\"}]"; + + CloudEvent[] events = CloudEvent.ParseMany(new BinaryData(requestContent)); + + Assert.NotNull(events); + Assert.True(events[0].TryGetSystemEventData(out object eventData)); + Assert.AreEqual("client1", (eventData as EventGridMqttClientDeletedEventData).ClientName); + Assert.AreEqual("myns", (eventData as EventGridMqttClientDeletedEventData).NamespaceName); + Assert.AreEqual("client1", (eventData as EventGridMqttClientDeletedEventData).ClientAuthenticationName); + } + + [Test] + public void ConsumeCloudEventEventGridMqttClientSessionConnectedEvent() + { + string requestContent = "[{ \"id\": \"2d1781af-3a4c-4d7c-bd0c-e34b19da4e66\", \"source\": \"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \"subject\": \"\", \"data\": { \"namespaceName\": \"myns\",\"clientSessionName\": \"session\",\"clientAuthenticationName\": \"client1\", \"sequenceNumber\": 1 }, \"type\": \"Microsoft.EventGrid.MQTTClientSessionConnected\", \"time\": \"2018-01-25T22:12:19.4556811Z\", \"specversion\": \"1.0\"}]"; + + CloudEvent[] events = CloudEvent.ParseMany(new BinaryData(requestContent)); + + Assert.NotNull(events); + Assert.True(events[0].TryGetSystemEventData(out object eventData)); + Assert.AreEqual("session", (eventData as EventGridMqttClientSessionConnectedEventData).ClientSessionName); + Assert.AreEqual("myns", (eventData as EventGridMqttClientSessionConnectedEventData).NamespaceName); + Assert.AreEqual("client1", (eventData as EventGridMqttClientSessionConnectedEventData).ClientAuthenticationName); + Assert.AreEqual(1, (eventData as EventGridMqttClientSessionConnectedEventData).SequenceNumber); + } + + [Test] + public void ConsumeCloudEventEventGridMqttClientSessionDisconnectedEvent() + { + string requestContent = "[{ \"id\": \"2d1781af-3a4c-4d7c-bd0c-e34b19da4e66\", \"source\": \"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \"subject\": \"\", \"data\": { \"namespaceName\": \"myns\",\"clientSessionName\": \"session\",\"clientAuthenticationName\": \"client1\", \"sequenceNumber\": 1, \"disconnectionReason\": \"ClientInitiatedDisconnect\" }, \"type\": \"Microsoft.EventGrid.MQTTClientSessionDisconnected\", \"time\": \"2018-01-25T22:12:19.4556811Z\", \"specversion\": \"1.0\"}]"; + + CloudEvent[] events = CloudEvent.ParseMany(new BinaryData(requestContent)); + + Assert.NotNull(events); + Assert.True(events[0].TryGetSystemEventData(out object eventData)); + Assert.AreEqual("session", (eventData as EventGridMqttClientSessionDisconnectedEventData).ClientSessionName); + Assert.AreEqual("myns", (eventData as EventGridMqttClientSessionDisconnectedEventData).NamespaceName); + Assert.AreEqual("client1", (eventData as EventGridMqttClientSessionDisconnectedEventData).ClientAuthenticationName); + Assert.AreEqual(1, (eventData as EventGridMqttClientSessionDisconnectedEventData).SequenceNumber); + Assert.AreEqual(EventGridMqttClientDisconnectionReason.ClientInitiatedDisconnect, (eventData as EventGridMqttClientSessionDisconnectedEventData).DisconnectionReason); + } #endregion #region Event Hub Events diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/tests/SystemEventTests.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/tests/SystemEventTests.cs index e986529ef3a6e..317eeb3c768c2 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/tests/SystemEventTests.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/tests/SystemEventTests.cs @@ -24,14 +24,12 @@ public void MappingContainsAllSystemEvents() { foreach (var systemEvent in Assembly.GetAssembly(typeof(EventGridEvent)).GetTypes().Where(t => t.Name.EndsWith("EventData"))) { - // skip base types - if (systemEvent == typeof(ContainerRegistryArtifactEventData) || - systemEvent == typeof(ContainerRegistryEventData) || - systemEvent == typeof(ContainerServiceClusterSupportEventData) || - systemEvent == typeof(ContainerServiceNodePoolRollingEventData)) + // skip types that have no public constructors, e.g. base types + if (systemEvent.GetConstructors().Length == 0) { continue; } + ValidateName(systemEvent.Name); Assert.IsTrue( SystemEventExtensions.s_systemEventDeserializers.Values.Any(