diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid.Tests/Tests/ConsumeEventTests.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid.Tests/Tests/ConsumeEventTests.cs index 3d6e3f6e5b1e..ab0bcf2dcf80 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid.Tests/Tests/ConsumeEventTests.cs +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid.Tests/Tests/ConsumeEventTests.cs @@ -241,7 +241,7 @@ public void ConsumeContainerRegistryImageDeletedEvent() [Fact] public void ConsumeIoTHubDeviceCreatedEvent() { - string requestContent = "[{ \"id\": \"56afc886-767b-d359-d59e-0da7877166b2\", \"topic\": \"/SUBSCRIPTIONS/ID/RESOURCEGROUPS/rg/PROVIDERS/MICROSOFT.DEVICES/IOTHUBS/hub1\", \"subject\": \"devices/LogicAppTestDevice\", \"eventType\": \"Microsoft.Devices.DeviceCreated\", \"eventTime\": \"2018-01-02T19:17:44.4383997Z\", \"data\": { \"twin\": { \"deviceId\": \"LogicAppTestDevice\", \"etag\": \"AAAAAAAAAAE=\", \"status\": \"enabled\", \"statusUpdateTime\": \"0001-01-01T00:00:00\", \"connectionState\": \"Disconnected\", \"lastActivityTime\": \"0001-01-01T00:00:00\", \"cloudToDeviceMessageCount\": 0, \"authenticationType\": \"sas\", \"x509Thumbprint\": { \"primaryThumbprint\": null, \"secondaryThumbprint\": null }, \"version\": 2, \"properties\": { \"desired\": { \"$metadata\": { \"$lastUpdated\": \"2018-01-02T19:17:44.4383997Z\" }, \"$version\": 1 }, \"reported\": { \"$metadata\": { \"$lastUpdated\": \"2018-01-02T19:17:44.4383997Z\" }, \"$version\": 1 } } }, \"hubName\": \"egtesthub1\", \"deviceId\": \"LogicAppTestDevice\", \"operationTimestamp\": \"2018-01-02T19:17:44.4383997Z\", \"opType\": \"DeviceCreated\" }, \"dataVersion\": \"\", \"metadataVersion\": \"1\"}]"; + string requestContent = "[{ \"id\": \"2da5e9b4-4e38-04c1-cc58-9da0b37230c0\", \"topic\": \"/SUBSCRIPTIONS/BDF55CDD-8DAB-4CF4-9B2F-C21E8A780472/RESOURCEGROUPS/EGTESTRG/PROVIDERS/MICROSOFT.DEVICES/IOTHUBS/EGTESTHUB1\", \"subject\": \"devices/48e44e11-1437-4907-83b1-4a8d7e89859e\", \"eventType\": \"Microsoft.Devices.DeviceCreated\", \"eventTime\": \"2018-07-03T23:20:07.6532054Z\", \"data\": { \"twin\": { \"deviceId\": \"48e44e11-1437-4907-83b1-4a8d7e89859e\", \"etag\": \"AAAAAAAAAAE=\", \"deviceEtag\": null, \"status\": \"enabled\", \"statusUpdateTime\": \"0001-01-01T00:00:00\", \"connectionState\": \"Disconnected\", \"lastActivityTime\": \"0001-01-01T00:00:00\", \"cloudToDeviceMessageCount\": 0, \"authenticationType\": \"sas\", \"x509Thumbprint\": { \"primaryThumbprint\": null, \"secondaryThumbprint\": null }, \"version\": 2, \"properties\": { \"desired\": { \"$metadata\": { \"$lastUpdated\": \"2018-07-03T23:20:07.6532054Z\" }, \"$version\": 1 }, \"reported\": { \"$metadata\": { \"$lastUpdated\": \"2018-07-03T23:20:07.6532054Z\" }, \"$version\": 1 } } }, \"hubName\": \"EGTESTHUB1\", \"deviceId\": \"48e44e11-1437-4907-83b1-4a8d7e89859e\" }, \"dataVersion\": \"\", \"metadataVersion\": \"1\" }]"; var events = this.eventGridSubscriber.DeserializeEventGridEvents(requestContent); @@ -254,14 +254,40 @@ public void ConsumeIoTHubDeviceCreatedEvent() [Fact] public void ConsumeIoTHubDeviceDeletedEvent() { - string requestContent = "[{ \"id\": \"56afc886-767b-d359-d59e-0da7877166b2\", \"topic\": \"/SUBSCRIPTIONS/id/RESOURCEGROUPS/rg/PROVIDERS/MICROSOFT.DEVICES/IOTHUBS/hub1\", \"subject\": \"devices/LogicAppTestDevice\", \"eventType\": \"Microsoft.Devices.DeviceDeleted\", \"eventTime\": \"2018-01-02T19:17:44.4383997Z\", \"data\": { \"twin\": { \"deviceId\": \"LogicAppTestDevice\", \"etag\": \"AAAAAAAAAAE=\", \"status\": \"enabled\", \"statusUpdateTime\": \"0001-01-01T00:00:00\", \"connectionState\": \"Disconnected\", \"lastActivityTime\": \"0001-01-01T00:00:00\", \"cloudToDeviceMessageCount\": 0, \"authenticationType\": \"sas\", \"x509Thumbprint\": { \"primaryThumbprint\": null, \"secondaryThumbprint\": null }, \"version\": 2, \"properties\": { \"desired\": { \"$metadata\": { \"$lastUpdated\": \"2018-01-02T19:17:44.4383997Z\" }, \"$version\": 1 }, \"reported\": { \"$metadata\": { \"$lastUpdated\": \"2018-01-02T19:17:44.4383997Z\" }, \"$version\": 1 } } }, \"hubName\": \"egtesthub1\", \"deviceId\": \"LogicAppTestDevice\", \"operationTimestamp\": \"2018-01-02T19:17:44.4383997Z\", \"opType\": \"DeviceCreated\" }, \"dataVersion\": \"\", \"metadataVersion\": \"1\"}]"; + string requestContent = "[ { \"id\": \"aaaf95c6-ed99-b307-e321-81d8e4f731a6\", \"topic\": \"/SUBSCRIPTIONS/BDF55CDD-8DAB-4CF4-9B2F-C21E8A780472/RESOURCEGROUPS/EGTESTRG/PROVIDERS/MICROSOFT.DEVICES/IOTHUBS/EGTESTHUB1\", \"subject\": \"devices/48e44e11-1437-4907-83b1-4a8d7e89859e\", \"eventType\": \"Microsoft.Devices.DeviceDeleted\", \"eventTime\": \"2018-07-03T23:21:33.2753956Z\", \"data\": { \"twin\": { \"deviceId\": \"48e44e11-1437-4907-83b1-4a8d7e89859e\", \"etag\": \"AAAAAAAAAAI=\", \"deviceEtag\": null, \"status\": \"enabled\", \"statusUpdateTime\": \"0001-01-01T00:00:00\", \"connectionState\": \"Disconnected\", \"lastActivityTime\": \"0001-01-01T00:00:00\", \"cloudToDeviceMessageCount\": 0, \"authenticationType\": \"sas\", \"x509Thumbprint\": { \"primaryThumbprint\": null, \"secondaryThumbprint\": null }, \"version\": 3, \"tags\": { \"testKey\": \"testValue\" }, \"properties\": { \"desired\": { \"$metadata\": { \"$lastUpdated\": \"2018-07-03T23:20:07.6532054Z\" }, \"$version\": 1 }, \"reported\": { \"$metadata\": { \"$lastUpdated\": \"2018-07-03T23:20:07.6532054Z\" }, \"$version\": 1 } } }, \"hubName\": \"EGTESTHUB1\", \"deviceId\": \"48e44e11-1437-4907-83b1-4a8d7e89859e\" }, \"dataVersion\": \"\", \"metadataVersion\": \"1\" }]"; var events = this.eventGridSubscriber.DeserializeEventGridEvents(requestContent); Assert.NotNull(events); Assert.True(events[0].Data is IotHubDeviceDeletedEventData); IotHubDeviceDeletedEventData eventData = (IotHubDeviceDeletedEventData)events[0].Data; - Assert.Equal("AAAAAAAAAAE=", eventData.Twin.Etag); + Assert.Equal("AAAAAAAAAAI=", eventData.Twin.Etag); + } + + [Fact] + public void ConsumeIoTHubDeviceConnectedEvent() + { + string requestContent = "[ { \"id\": \"fbfd8ee1-cf78-74c6-dbcf-e1c58638ccbd\", \"topic\": \"/SUBSCRIPTIONS/BDF55CDD-8DAB-4CF4-9B2F-C21E8A780472/RESOURCEGROUPS/EGTESTRG/PROVIDERS/MICROSOFT.DEVICES/IOTHUBS/EGTESTHUB1\", \"subject\": \"devices/48e44e11-1437-4907-83b1-4a8d7e89859e\", \"eventType\": \"Microsoft.Devices.DeviceConnected\", \"eventTime\": \"2018-07-03T23:20:11.6921933+00:00\", \"data\": { \"deviceConnectionStateEventInfo\": { \"sequenceNumber\": \"000000000000000001D4132452F67CE200000002000000000000000000000001\" }, \"hubName\": \"EGTESTHUB1\", \"deviceId\": \"48e44e11-1437-4907-83b1-4a8d7e89859e\", \"moduleId\": \"\" }, \"dataVersion\": \"\", \"metadataVersion\": \"1\" }]"; + + var events = this.eventGridSubscriber.DeserializeEventGridEvents(requestContent); + + Assert.NotNull(events); + Assert.True(events[0].Data is IotHubDeviceConnectedEventData); + IotHubDeviceConnectedEventData eventData = (IotHubDeviceConnectedEventData)events[0].Data; + Assert.Equal("EGTESTHUB1", eventData.HubName); + } + + [Fact] + public void ConsumeIoTHubDeviceDisconnectedEvent() + { + string requestContent = "[ { \"id\": \"877f0b10-a086-98ec-27b8-6ae2dfbf5f67\", \"topic\": \"/SUBSCRIPTIONS/BDF55CDD-8DAB-4CF4-9B2F-C21E8A780472/RESOURCEGROUPS/EGTESTRG/PROVIDERS/MICROSOFT.DEVICES/IOTHUBS/EGTESTHUB1\", \"subject\": \"devices/48e44e11-1437-4907-83b1-4a8d7e89859e\", \"eventType\": \"Microsoft.Devices.DeviceDisconnected\", \"eventTime\": \"2018-07-03T23:20:52.646434+00:00\", \"data\": { \"deviceConnectionStateEventInfo\": { \"sequenceNumber\": \"000000000000000001D4132452F67CE200000002000000000000000000000002\" }, \"hubName\": \"EGTESTHUB1\", \"deviceId\": \"48e44e11-1437-4907-83b1-4a8d7e89859e\", \"moduleId\": \"\" }, \"dataVersion\": \"\", \"metadataVersion\": \"1\" }]"; + + var events = this.eventGridSubscriber.DeserializeEventGridEvents(requestContent); + + Assert.NotNull(events); + Assert.True(events[0].Data is IotHubDeviceDisconnectedEventData); + IotHubDeviceDisconnectedEventData eventData = (IotHubDeviceDisconnectedEventData)events[0].Data; + Assert.Equal("000000000000000001D4132452F67CE200000002000000000000000000000002", eventData.DeviceConnectionStateEventInfo.SequenceNumber); } // EventGrid events @@ -316,7 +342,7 @@ public void ConsumeMediaServicesJobStateChangedEvent() Assert.NotNull(events); Assert.True(events[0].Data is MediaJobStateChangeEventData); MediaJobStateChangeEventData eventData = (MediaJobStateChangeEventData)events[0].Data; - Assert.Equal("Finished", eventData.State); + Assert.Equal(JobState.Finished, eventData.State); } // Resource Manager (Azure Subscription/Resource Group) events @@ -398,6 +424,46 @@ public void ConsumeResourceDeleteCancelEvent() Assert.Equal("72f988bf-86f1-41af-91ab-2d7cd011db47", eventData.TenantId); } + [Fact] + public void ConsumeResourceActionSuccessEvent() + { + string requestContent = "[ { \"topic\":\"/subscriptions/{subscription-id}\", \"subject\":\"/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.EventGrid/eventSubscriptions/LogicAppdd584bdf-8347-49c9-b9a9-d1f980783501\", \"eventType\":\"Microsoft.Resources.ResourceActionSuccess\", \"eventTime\":\"2017-08-16T03:54:38.2696833Z\", \"id\":\"25b3b0d0-d79b-44d5-9963-440d4e6a9bba\", \"data\": { \"authorization\":\"{azure_resource_manager_authorizations}\", \"claims\":\"{azure_resource_manager_claims}\", \"correlationId\":\"54ef1e39-6a82-44b3-abc1-bdeb6ce4d3c6\", \"httpRequest\":\"{request-operation}\", \"resourceProvider\":\"Microsoft.EventGrid\", \"resourceUri\":\"/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.EventGrid/eventSubscriptions/LogicAppdd584bdf-8347-49c9-b9a9-d1f980783501\", \"operationName\":\"Microsoft.EventGrid/eventSubscriptions/write\", \"status\":\"Succeeded\", \"subscriptionId\":\"{subscription-id}\", \"tenantId\":\"72f988bf-86f1-41af-91ab-2d7cd011db47\" }, \"dataVersion\": \"\", \"metadataVersion\": \"1\" }]"; + + var events = this.eventGridSubscriber.DeserializeEventGridEvents(requestContent); + + Assert.NotNull(events); + Assert.True(events[0].Data is ResourceActionSuccessData); + ResourceActionSuccessData eventData = (ResourceActionSuccessData)events[0].Data; + Assert.Equal("72f988bf-86f1-41af-91ab-2d7cd011db47", eventData.TenantId); + } + + [Fact] + public void ConsumeResourceActionFailureEvent() + { + string requestContent = "[ { \"topic\":\"/subscriptions/{subscription-id}\", \"subject\":\"/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.EventGrid/eventSubscriptions/LogicAppdd584bdf-8347-49c9-b9a9-d1f980783501\", \"eventType\":\"Microsoft.Resources.ResourceActionFailure\", \"eventTime\":\"2017-08-16T03:54:38.2696833Z\", \"id\":\"25b3b0d0-d79b-44d5-9963-440d4e6a9bba\", \"data\": { \"authorization\":\"{azure_resource_manager_authorizations}\", \"claims\":\"{azure_resource_manager_claims}\", \"correlationId\":\"54ef1e39-6a82-44b3-abc1-bdeb6ce4d3c6\", \"httpRequest\":\"{request-operation}\", \"resourceProvider\":\"Microsoft.EventGrid\", \"resourceUri\":\"/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.EventGrid/eventSubscriptions/LogicAppdd584bdf-8347-49c9-b9a9-d1f980783501\", \"operationName\":\"Microsoft.EventGrid/eventSubscriptions/write\", \"status\":\"Succeeded\", \"subscriptionId\":\"{subscription-id}\", \"tenantId\":\"72f988bf-86f1-41af-91ab-2d7cd011db47\" }, \"dataVersion\": \"\", \"metadataVersion\": \"1\" }]"; + + var events = this.eventGridSubscriber.DeserializeEventGridEvents(requestContent); + + Assert.NotNull(events); + Assert.True(events[0].Data is ResourceActionFailureData); + ResourceActionFailureData eventData = (ResourceActionFailureData)events[0].Data; + Assert.Equal("72f988bf-86f1-41af-91ab-2d7cd011db47", eventData.TenantId); + } + + [Fact] + public void ConsumeResourceActionCancelEvent() + { + string requestContent = "[ { \"topic\":\"/subscriptions/{subscription-id}\", \"subject\":\"/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.EventGrid/eventSubscriptions/LogicAppdd584bdf-8347-49c9-b9a9-d1f980783501\", \"eventType\":\"Microsoft.Resources.ResourceActionCancel\", \"eventTime\":\"2017-08-16T03:54:38.2696833Z\", \"id\":\"25b3b0d0-d79b-44d5-9963-440d4e6a9bba\", \"data\": { \"authorization\":\"{azure_resource_manager_authorizations}\", \"claims\":\"{azure_resource_manager_claims}\", \"correlationId\":\"54ef1e39-6a82-44b3-abc1-bdeb6ce4d3c6\", \"httpRequest\":\"{request-operation}\", \"resourceProvider\":\"Microsoft.EventGrid\", \"resourceUri\":\"/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.EventGrid/eventSubscriptions/LogicAppdd584bdf-8347-49c9-b9a9-d1f980783501\", \"operationName\":\"Microsoft.EventGrid/eventSubscriptions/write\", \"status\":\"Succeeded\", \"subscriptionId\":\"{subscription-id}\", \"tenantId\":\"72f988bf-86f1-41af-91ab-2d7cd011db47\" }, \"dataVersion\": \"\", \"metadataVersion\": \"1\" }]"; + + var events = this.eventGridSubscriber.DeserializeEventGridEvents(requestContent); + + Assert.NotNull(events); + Assert.True(events[0].Data is ResourceActionCancelData); + ResourceActionCancelData eventData = (ResourceActionCancelData)events[0].Data; + Assert.Equal("72f988bf-86f1-41af-91ab-2d7cd011db47", eventData.TenantId); + } + + // ServiceBus events [Fact] public void ConsumeServiceBusActiveMessagesAvailableWithNoListenersEvent() diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Customization/EventTypes.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Customization/EventTypes.cs index 64ab3d75c5b1..dabe82eafd2a 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Customization/EventTypes.cs +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Customization/EventTypes.cs @@ -19,6 +19,8 @@ public class EventTypes // Device events public const string IoTHubDeviceCreatedEvent = "Microsoft.Devices.DeviceCreated"; public const string IoTHubDeviceDeletedEvent = "Microsoft.Devices.DeviceDeleted"; + public const string IoTHubDeviceConnectedEvent = "Microsoft.Devices.DeviceConnected"; + public const string IoTHubDeviceDisconnectedEvent = "Microsoft.Devices.DeviceDisconnected"; // EventGrid events public const string EventGridSubscriptionValidationEvent = "Microsoft.EventGrid.SubscriptionValidationEvent"; @@ -37,6 +39,9 @@ public class EventTypes public const string ResourceDeleteSuccessEvent = "Microsoft.Resources.ResourceDeleteSuccess"; public const string ResourceDeleteFailureEvent = "Microsoft.Resources.ResourceDeleteFailure"; public const string ResourceDeleteCancelEvent = "Microsoft.Resources.ResourceDeleteCancel"; + public const string ResourceActionSuccessEvent = "Microsoft.Resources.ResourceActionSuccess"; + public const string ResourceActionFailureEvent = "Microsoft.Resources.ResourceActionFailure"; + public const string ResourceActionCancelEvent = "Microsoft.Resources.ResourceActionCancel"; // ServiceBus events public const string ServiceBusActiveMessagesAvailableWithNoListenersEvent = "Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners"; diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Customization/SystemEventTypeMappings.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Customization/SystemEventTypeMappings.cs index b276ebd259ee..79e9bfe52462 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Customization/SystemEventTypeMappings.cs +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Customization/SystemEventTypeMappings.cs @@ -25,6 +25,8 @@ internal static class SystemEventTypeMappings // IoTHub Device events { EventTypes.IoTHubDeviceCreatedEvent, typeof(IotHubDeviceCreatedEventData) }, { EventTypes.IoTHubDeviceDeletedEvent, typeof(IotHubDeviceDeletedEventData) }, + { EventTypes.IoTHubDeviceConnectedEvent, typeof(IotHubDeviceConnectedEventData) }, + { EventTypes.IoTHubDeviceDisconnectedEvent, typeof(IotHubDeviceDisconnectedEventData) }, // EventGrid events { EventTypes.EventGridSubscriptionValidationEvent, typeof(SubscriptionValidationEventData) }, @@ -43,6 +45,9 @@ internal static class SystemEventTypeMappings { EventTypes.ResourceDeleteSuccessEvent, typeof(ResourceDeleteSuccessData) }, { EventTypes.ResourceDeleteFailureEvent, typeof(ResourceDeleteFailureData) }, { EventTypes.ResourceDeleteCancelEvent, typeof(ResourceDeleteCancelData) }, + { EventTypes.ResourceActionSuccessEvent, typeof(ResourceActionSuccessData) }, + { EventTypes.ResourceActionFailureEvent, typeof(ResourceActionFailureData) }, + { EventTypes.ResourceActionCancelEvent, typeof(ResourceActionCancelData) }, // ServiceBus events { EventTypes.ServiceBusActiveMessagesAvailableWithNoListenersEvent, typeof(ServiceBusActiveMessagesAvailableWithNoListenersEventData) }, diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/EventGridClient.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/EventGridClient.cs index 66dea58858b9..9d382531835a 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/EventGridClient.cs +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/EventGridClient.cs @@ -54,22 +54,36 @@ public partial class EventGridClient : ServiceClient, IEventGri public string ApiVersion { get; private set; } /// - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// public string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running Operations. - /// Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. /// public int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated and - /// included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. /// public bool? GenerateClientRequestId { get; set; } + /// + /// Initializes a new instance of the EventGridClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling EventGridClient.Dispose(). False: will not dispose provided httpClient + protected EventGridClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + /// /// Initializes a new instance of the EventGridClient class. /// @@ -120,6 +134,33 @@ public EventGridClient(ServiceClientCredentials credentials, params DelegatingHa } } + /// + /// Initializes a new instance of the EventGridClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling EventGridClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public EventGridClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + /// /// Initializes a new instance of the EventGridClient class. /// diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/IEventGridClient.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/IEventGridClient.cs index 104384e98f1d..e5b30846e268 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/IEventGridClient.cs +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/IEventGridClient.cs @@ -49,19 +49,20 @@ public partial interface IEventGridClient : System.IDisposable string ApiVersion { get; } /// - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running - /// Operations. Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. /// int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated - /// and included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceConnectionStateEventInfo.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceConnectionStateEventInfo.cs new file mode 100644 index 000000000000..d53a2dae834d --- /dev/null +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceConnectionStateEventInfo.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.EventGrid.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about the device connection state event. + /// + public partial class DeviceConnectionStateEventInfo + { + /// + /// Initializes a new instance of the DeviceConnectionStateEventInfo + /// class. + /// + public DeviceConnectionStateEventInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeviceConnectionStateEventInfo + /// class. + /// + /// Sequence number is string + /// representation of a hexadecimal number. string compare can be used + /// to identify the larger number because both in ASCII and HEX numbers + /// come after alphabets. If you are converting the string to hex, then + /// the number is a 256 bit number. + public DeviceConnectionStateEventInfo(string sequenceNumber = default(string)) + { + SequenceNumber = sequenceNumber; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets sequence number is string representation of a + /// hexadecimal number. string compare can be used to identify the + /// larger number because both in ASCII and HEX numbers come after + /// alphabets. If you are converting the string to hex, then the number + /// is a 256 bit number. + /// + [JsonProperty(PropertyName = "sequenceNumber")] + public string SequenceNumber { get; set; } + + } +} diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceConnectionStateEventProperties.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceConnectionStateEventProperties.cs new file mode 100644 index 000000000000..01c02b1be92f --- /dev/null +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceConnectionStateEventProperties.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.EventGrid.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Schema of the Data property of an EventGridEvent for a device + /// connection state event (DeviceConnected, DeviceDisconnected). + /// + public partial class DeviceConnectionStateEventProperties + { + /// + /// Initializes a new instance of the + /// DeviceConnectionStateEventProperties class. + /// + public DeviceConnectionStateEventProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DeviceConnectionStateEventProperties class. + /// + /// The unique identifier of the device. This + /// case-sensitive string can be up to 128 characters long, and + /// supports ASCII 7-bit alphanumeric characters plus the following + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. + /// The unique identifier of the module. This + /// case-sensitive string can be up to 128 characters long, and + /// supports ASCII 7-bit alphanumeric characters plus the following + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. + /// Name of the IoT Hub where the device was + /// created or deleted. + /// Information about the + /// device connection state event. + public DeviceConnectionStateEventProperties(string deviceId = default(string), string moduleId = default(string), string hubName = default(string), DeviceConnectionStateEventInfo deviceConnectionStateEventInfo = default(DeviceConnectionStateEventInfo)) + { + DeviceId = deviceId; + ModuleId = moduleId; + HubName = hubName; + DeviceConnectionStateEventInfo = deviceConnectionStateEventInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the unique identifier of the device. This + /// case-sensitive string can be up to 128 characters long, and + /// supports ASCII 7-bit alphanumeric characters plus the following + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. + /// + [JsonProperty(PropertyName = "deviceId")] + public string DeviceId { get; set; } + + /// + /// Gets or sets the unique identifier of the module. This + /// case-sensitive string can be up to 128 characters long, and + /// supports ASCII 7-bit alphanumeric characters plus the following + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. + /// + [JsonProperty(PropertyName = "moduleId")] + public string ModuleId { get; set; } + + /// + /// Gets or sets name of the IoT Hub where the device was created or + /// deleted. + /// + [JsonProperty(PropertyName = "hubName")] + public string HubName { get; set; } + + /// + /// Gets or sets information about the device connection state event. + /// + [JsonProperty(PropertyName = "deviceConnectionStateEventInfo")] + public DeviceConnectionStateEventInfo DeviceConnectionStateEventInfo { get; set; } + + } +} diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceLifeCycleEventProperties.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceLifeCycleEventProperties.cs index 9afbef9acb3b..0f2b90d79b24 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceLifeCycleEventProperties.cs +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceLifeCycleEventProperties.cs @@ -35,21 +35,16 @@ public DeviceLifeCycleEventProperties() /// The unique identifier of the device. This /// case-sensitive string can be up to 128 characters long, and /// supports ASCII 7-bit alphanumeric characters plus the following - /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '. + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. /// Name of the IoT Hub where the device was /// created or deleted. - /// The event type specified for this operation by - /// the IoT Hub. - /// The ISO8601 timestamp of the - /// operation. /// Information about the device twin, which is the - /// cloud represenation of application device metadata. - public DeviceLifeCycleEventProperties(string deviceId = default(string), string hubName = default(string), string opType = default(string), string operationTimestamp = default(string), DeviceTwinInfo twin = default(DeviceTwinInfo)) + /// cloud representation of application device metadata. + public DeviceLifeCycleEventProperties(string deviceId = default(string), string hubName = default(string), DeviceTwinInfo twin = default(DeviceTwinInfo)) { DeviceId = deviceId; HubName = hubName; - OpType = opType; - OperationTimestamp = operationTimestamp; Twin = twin; CustomInit(); } @@ -63,7 +58,8 @@ public DeviceLifeCycleEventProperties() /// Gets or sets the unique identifier of the device. This /// case-sensitive string can be up to 128 characters long, and /// supports ASCII 7-bit alphanumeric characters plus the following - /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '. + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. /// [JsonProperty(PropertyName = "deviceId")] public string DeviceId { get; set; } @@ -75,22 +71,9 @@ public DeviceLifeCycleEventProperties() [JsonProperty(PropertyName = "hubName")] public string HubName { get; set; } - /// - /// Gets or sets the event type specified for this operation by the IoT - /// Hub. - /// - [JsonProperty(PropertyName = "opType")] - public string OpType { get; set; } - - /// - /// Gets or sets the ISO8601 timestamp of the operation. - /// - [JsonProperty(PropertyName = "operationTimestamp")] - public string OperationTimestamp { get; set; } - /// /// Gets or sets information about the device twin, which is the cloud - /// represenation of application device metadata. + /// representation of application device metadata. /// [JsonProperty(PropertyName = "twin")] public DeviceTwinInfo Twin { get; set; } diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceTwinInfo.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceTwinInfo.cs index 974f0fe65584..3859e4e56b39 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceTwinInfo.cs +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/DeviceTwinInfo.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.EventGrid.Models using System.Linq; /// - /// Information about the device twin, which is the cloud represenation of + /// Information about the device twin, which is the cloud representation of /// application device metadata. /// public partial class DeviceTwinInfo diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceConnectedEventData.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceConnectedEventData.cs new file mode 100644 index 000000000000..16baef61df0e --- /dev/null +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceConnectedEventData.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.EventGrid.Models +{ + using System.Linq; + + /// + /// Event data for Microsoft.Devices.DeviceConnected event. + /// + public partial class IotHubDeviceConnectedEventData : DeviceConnectionStateEventProperties + { + /// + /// Initializes a new instance of the IotHubDeviceConnectedEventData + /// class. + /// + public IotHubDeviceConnectedEventData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotHubDeviceConnectedEventData + /// class. + /// + /// The unique identifier of the device. This + /// case-sensitive string can be up to 128 characters long, and + /// supports ASCII 7-bit alphanumeric characters plus the following + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. + /// The unique identifier of the module. This + /// case-sensitive string can be up to 128 characters long, and + /// supports ASCII 7-bit alphanumeric characters plus the following + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. + /// Name of the IoT Hub where the device was + /// created or deleted. + /// Information about the + /// device connection state event. + public IotHubDeviceConnectedEventData(string deviceId = default(string), string moduleId = default(string), string hubName = default(string), DeviceConnectionStateEventInfo deviceConnectionStateEventInfo = default(DeviceConnectionStateEventInfo)) + : base(deviceId, moduleId, hubName, deviceConnectionStateEventInfo) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceCreatedEventData.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceCreatedEventData.cs index 4b0621eeb42d..71afffde5456 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceCreatedEventData.cs +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceCreatedEventData.cs @@ -33,17 +33,14 @@ public IotHubDeviceCreatedEventData() /// The unique identifier of the device. This /// case-sensitive string can be up to 128 characters long, and /// supports ASCII 7-bit alphanumeric characters plus the following - /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '. + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. /// Name of the IoT Hub where the device was /// created or deleted. - /// The event type specified for this operation by - /// the IoT Hub. - /// The ISO8601 timestamp of the - /// operation. /// Information about the device twin, which is the - /// cloud represenation of application device metadata. - public IotHubDeviceCreatedEventData(string deviceId = default(string), string hubName = default(string), string opType = default(string), string operationTimestamp = default(string), DeviceTwinInfo twin = default(DeviceTwinInfo)) - : base(deviceId, hubName, opType, operationTimestamp, twin) + /// cloud representation of application device metadata. + public IotHubDeviceCreatedEventData(string deviceId = default(string), string hubName = default(string), DeviceTwinInfo twin = default(DeviceTwinInfo)) + : base(deviceId, hubName, twin) { CustomInit(); } diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceDeletedEventData.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceDeletedEventData.cs index d7bec51cef11..b4025ab80e1b 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceDeletedEventData.cs +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceDeletedEventData.cs @@ -33,17 +33,14 @@ public IotHubDeviceDeletedEventData() /// The unique identifier of the device. This /// case-sensitive string can be up to 128 characters long, and /// supports ASCII 7-bit alphanumeric characters plus the following - /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '. + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. /// Name of the IoT Hub where the device was /// created or deleted. - /// The event type specified for this operation by - /// the IoT Hub. - /// The ISO8601 timestamp of the - /// operation. /// Information about the device twin, which is the - /// cloud represenation of application device metadata. - public IotHubDeviceDeletedEventData(string deviceId = default(string), string hubName = default(string), string opType = default(string), string operationTimestamp = default(string), DeviceTwinInfo twin = default(DeviceTwinInfo)) - : base(deviceId, hubName, opType, operationTimestamp, twin) + /// cloud representation of application device metadata. + public IotHubDeviceDeletedEventData(string deviceId = default(string), string hubName = default(string), DeviceTwinInfo twin = default(DeviceTwinInfo)) + : base(deviceId, hubName, twin) { CustomInit(); } diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceDisconnectedEventData.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceDisconnectedEventData.cs new file mode 100644 index 000000000000..261b8c8cae4c --- /dev/null +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/IotHubDeviceDisconnectedEventData.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.EventGrid.Models +{ + using System.Linq; + + /// + /// Event data for Microsoft.Devices.DeviceDisconnected event. + /// + public partial class IotHubDeviceDisconnectedEventData : DeviceConnectionStateEventProperties + { + /// + /// Initializes a new instance of the IotHubDeviceDisconnectedEventData + /// class. + /// + public IotHubDeviceDisconnectedEventData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotHubDeviceDisconnectedEventData + /// class. + /// + /// The unique identifier of the device. This + /// case-sensitive string can be up to 128 characters long, and + /// supports ASCII 7-bit alphanumeric characters plus the following + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. + /// The unique identifier of the module. This + /// case-sensitive string can be up to 128 characters long, and + /// supports ASCII 7-bit alphanumeric characters plus the following + /// special characters: - : . + % _ # * ? ! ( ) , = @ ; $ + /// '. + /// Name of the IoT Hub where the device was + /// created or deleted. + /// Information about the + /// device connection state event. + public IotHubDeviceDisconnectedEventData(string deviceId = default(string), string moduleId = default(string), string hubName = default(string), DeviceConnectionStateEventInfo deviceConnectionStateEventInfo = default(DeviceConnectionStateEventInfo)) + : base(deviceId, moduleId, hubName, deviceConnectionStateEventInfo) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/JobState.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/JobState.cs index c62fcf55be61..564356476e34 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/JobState.cs +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/JobState.cs @@ -11,130 +11,105 @@ namespace Microsoft.Azure.EventGrid.Models { using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; /// /// Defines values for JobState. /// - /// - /// Determine base value for a given allowed value if exists, else return - /// the value itself - /// - [JsonConverter(typeof(JobStateConverter))] - public struct JobState : System.IEquatable + [JsonConverter(typeof(StringEnumConverter))] + public enum JobState { - private JobState(string underlyingValue) - { - UnderlyingValue=underlyingValue; - } - /// /// The job was canceled. This is a final state for the job. /// - public static readonly JobState Canceled = "Canceled"; - + [EnumMember(Value = "Canceled")] + Canceled, /// /// The job is in the process of being canceled. This is a transient /// state for the job. /// - public static readonly JobState Canceling = "Canceling"; - + [EnumMember(Value = "Canceling")] + Canceling, /// /// The job has encountered an error. This is a final state for the /// job. /// - public static readonly JobState Error = "Error"; - + [EnumMember(Value = "Error")] + Error, /// /// The job is finished. This is a final state for the job. /// - public static readonly JobState Finished = "Finished"; - + [EnumMember(Value = "Finished")] + Finished, /// /// The job is processing. This is a transient state for the job. /// - public static readonly JobState Processing = "Processing"; - + [EnumMember(Value = "Processing")] + Processing, /// /// The job is in a queued state, waiting for resources to become /// available. This is a transient state. /// - public static readonly JobState Queued = "Queued"; - + [EnumMember(Value = "Queued")] + Queued, /// /// The job is being scheduled to run on an available resource. This is /// a transient state, between queued and processing states. /// - public static readonly JobState Scheduled = "Scheduled"; - - - /// - /// Underlying value of enum JobState - /// - private readonly string UnderlyingValue; - - /// - /// Returns string representation for JobState - /// - public override string ToString() - { - return UnderlyingValue.ToString(); - } - - /// - /// Compares enums of type JobState - /// - public bool Equals(JobState e) - { - return UnderlyingValue.Equals(e.UnderlyingValue); - } - - /// - /// Implicit operator to convert string to JobState - /// - public static implicit operator JobState(string value) - { - return new JobState(value); - } - - /// - /// Implicit operator to convert JobState to string - /// - public static implicit operator string(JobState e) - { - return e.UnderlyingValue; - } - - /// - /// Overriding == operator for enum JobState - /// - public static bool operator == (JobState e1, JobState e2) - { - return e2.Equals(e1); - } - - /// - /// Overriding != operator for enum JobState - /// - public static bool operator != (JobState e1, JobState e2) + [EnumMember(Value = "Scheduled")] + Scheduled + } + internal static class JobStateEnumExtension + { + internal static string ToSerializedValue(this JobState? value) { - return !e2.Equals(e1); + return value == null ? null : ((JobState)value).ToSerializedValue(); } - /// - /// Overrides Equals operator for JobState - /// - public override bool Equals(object obj) + internal static string ToSerializedValue(this JobState value) { - return obj is JobState && Equals((JobState)obj); + switch( value ) + { + case JobState.Canceled: + return "Canceled"; + case JobState.Canceling: + return "Canceling"; + case JobState.Error: + return "Error"; + case JobState.Finished: + return "Finished"; + case JobState.Processing: + return "Processing"; + case JobState.Queued: + return "Queued"; + case JobState.Scheduled: + return "Scheduled"; + } + return null; } - /// - /// Returns for hashCode JobState - /// - public override int GetHashCode() + internal static JobState? ParseJobState(this string value) { - return UnderlyingValue.GetHashCode(); + switch( value ) + { + case "Canceled": + return JobState.Canceled; + case "Canceling": + return JobState.Canceling; + case "Error": + return JobState.Error; + case "Finished": + return JobState.Finished; + case "Processing": + return JobState.Processing; + case "Queued": + return JobState.Queued; + case "Scheduled": + return JobState.Scheduled; + } + return null; } - } } diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/JobStateConverter.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/JobStateConverter.cs deleted file mode 100644 index 2543fb9ba5fe..000000000000 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/JobStateConverter.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.EventGrid.Models -{ - using Newtonsoft.Json; - - using System.Reflection; - - /// - /// Defines values for JobState. - /// - public sealed class JobStateConverter : JsonConverter - { - - /// - /// Returns if objectType can be converted to JobState by the - /// converter. - /// - public override bool CanConvert(System.Type objectType) - { - return typeof(JobState).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); - } - - /// - /// Overrides ReadJson and converts token to JobState. - /// - public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType == Newtonsoft.Json.JsonToken.Null) - { - return null; - } - return (JobState)serializer.Deserialize(reader); - } - - /// - /// Overriding WriteJson for JobState for serialization. - /// - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - writer.WriteValue(value.ToString()); - } - - } -} diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/ResourceActionCancelData.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/ResourceActionCancelData.cs new file mode 100644 index 000000000000..e1550c0b21c7 --- /dev/null +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/ResourceActionCancelData.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.EventGrid.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Schema of the Data property of an EventGridEvent for an + /// Microsoft.Resources.ResourceActionCancel event. This is raised when a + /// resource action operation is canceled. + /// + public partial class ResourceActionCancelData + { + /// + /// Initializes a new instance of the ResourceActionCancelData class. + /// + public ResourceActionCancelData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceActionCancelData class. + /// + /// The tenant ID of the resource. + /// The subscription ID of the + /// resource. + /// The resource group of the + /// resource. + /// The resource provider performing the + /// operation. + /// The URI of the resource in the + /// operation. + /// The operation that was + /// performed. + /// The status of the operation. + /// The requested authorization for the + /// operation. + /// The properties of the claims. + /// An operation ID used for + /// troubleshooting. + /// The details of the operation. + public ResourceActionCancelData(string tenantId = default(string), string subscriptionId = default(string), string resourceGroup = default(string), string resourceProvider = default(string), string resourceUri = default(string), string operationName = default(string), string status = default(string), string authorization = default(string), string claims = default(string), string correlationId = default(string), string httpRequest = default(string)) + { + TenantId = tenantId; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + ResourceProvider = resourceProvider; + ResourceUri = resourceUri; + OperationName = operationName; + Status = status; + Authorization = authorization; + Claims = claims; + CorrelationId = correlationId; + HttpRequest = httpRequest; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant ID of the resource. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the subscription ID of the resource. + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Gets or sets the resource group of the resource. + /// + [JsonProperty(PropertyName = "resourceGroup")] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the resource provider performing the operation. + /// + [JsonProperty(PropertyName = "resourceProvider")] + public string ResourceProvider { get; set; } + + /// + /// Gets or sets the URI of the resource in the operation. + /// + [JsonProperty(PropertyName = "resourceUri")] + public string ResourceUri { get; set; } + + /// + /// Gets or sets the operation that was performed. + /// + [JsonProperty(PropertyName = "operationName")] + public string OperationName { get; set; } + + /// + /// Gets or sets the status of the operation. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the requested authorization for the operation. + /// + [JsonProperty(PropertyName = "authorization")] + public string Authorization { get; set; } + + /// + /// Gets or sets the properties of the claims. + /// + [JsonProperty(PropertyName = "claims")] + public string Claims { get; set; } + + /// + /// Gets or sets an operation ID used for troubleshooting. + /// + [JsonProperty(PropertyName = "correlationId")] + public string CorrelationId { get; set; } + + /// + /// Gets or sets the details of the operation. + /// + [JsonProperty(PropertyName = "httpRequest")] + public string HttpRequest { get; set; } + + } +} diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/ResourceActionFailureData.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/ResourceActionFailureData.cs new file mode 100644 index 000000000000..230f7f24dcc1 --- /dev/null +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/ResourceActionFailureData.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.EventGrid.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Schema of the Data property of an EventGridEvent for a + /// Microsoft.Resources.ResourceActionFailure event. This is raised when a + /// resource action operation fails. + /// + public partial class ResourceActionFailureData + { + /// + /// Initializes a new instance of the ResourceActionFailureData class. + /// + public ResourceActionFailureData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceActionFailureData class. + /// + /// The tenant ID of the resource. + /// The subscription ID of the + /// resource. + /// The resource group of the + /// resource. + /// The resource provider performing the + /// operation. + /// The URI of the resource in the + /// operation. + /// The operation that was + /// performed. + /// The status of the operation. + /// The requested authorization for the + /// operation. + /// The properties of the claims. + /// An operation ID used for + /// troubleshooting. + /// The details of the operation. + public ResourceActionFailureData(string tenantId = default(string), string subscriptionId = default(string), string resourceGroup = default(string), string resourceProvider = default(string), string resourceUri = default(string), string operationName = default(string), string status = default(string), string authorization = default(string), string claims = default(string), string correlationId = default(string), string httpRequest = default(string)) + { + TenantId = tenantId; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + ResourceProvider = resourceProvider; + ResourceUri = resourceUri; + OperationName = operationName; + Status = status; + Authorization = authorization; + Claims = claims; + CorrelationId = correlationId; + HttpRequest = httpRequest; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant ID of the resource. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the subscription ID of the resource. + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Gets or sets the resource group of the resource. + /// + [JsonProperty(PropertyName = "resourceGroup")] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the resource provider performing the operation. + /// + [JsonProperty(PropertyName = "resourceProvider")] + public string ResourceProvider { get; set; } + + /// + /// Gets or sets the URI of the resource in the operation. + /// + [JsonProperty(PropertyName = "resourceUri")] + public string ResourceUri { get; set; } + + /// + /// Gets or sets the operation that was performed. + /// + [JsonProperty(PropertyName = "operationName")] + public string OperationName { get; set; } + + /// + /// Gets or sets the status of the operation. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the requested authorization for the operation. + /// + [JsonProperty(PropertyName = "authorization")] + public string Authorization { get; set; } + + /// + /// Gets or sets the properties of the claims. + /// + [JsonProperty(PropertyName = "claims")] + public string Claims { get; set; } + + /// + /// Gets or sets an operation ID used for troubleshooting. + /// + [JsonProperty(PropertyName = "correlationId")] + public string CorrelationId { get; set; } + + /// + /// Gets or sets the details of the operation. + /// + [JsonProperty(PropertyName = "httpRequest")] + public string HttpRequest { get; set; } + + } +} diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/ResourceActionSuccessData.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/ResourceActionSuccessData.cs new file mode 100644 index 000000000000..f98497e0a88a --- /dev/null +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Generated/Models/ResourceActionSuccessData.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.EventGrid.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Schema of the Data property of an EventGridEvent for a + /// Microsoft.Resources.ResourceActionSuccess event. This is raised when a + /// resource action operation succeeds. + /// + public partial class ResourceActionSuccessData + { + /// + /// Initializes a new instance of the ResourceActionSuccessData class. + /// + public ResourceActionSuccessData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceActionSuccessData class. + /// + /// The tenant ID of the resource. + /// The subscription ID of the + /// resource. + /// The resource group of the + /// resource. + /// The resource provider performing the + /// operation. + /// The URI of the resource in the + /// operation. + /// The operation that was + /// performed. + /// The status of the operation. + /// The requested authorization for the + /// operation. + /// The properties of the claims. + /// An operation ID used for + /// troubleshooting. + /// The details of the operation. + public ResourceActionSuccessData(string tenantId = default(string), string subscriptionId = default(string), string resourceGroup = default(string), string resourceProvider = default(string), string resourceUri = default(string), string operationName = default(string), string status = default(string), string authorization = default(string), string claims = default(string), string correlationId = default(string), string httpRequest = default(string)) + { + TenantId = tenantId; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + ResourceProvider = resourceProvider; + ResourceUri = resourceUri; + OperationName = operationName; + Status = status; + Authorization = authorization; + Claims = claims; + CorrelationId = correlationId; + HttpRequest = httpRequest; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant ID of the resource. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the subscription ID of the resource. + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Gets or sets the resource group of the resource. + /// + [JsonProperty(PropertyName = "resourceGroup")] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the resource provider performing the operation. + /// + [JsonProperty(PropertyName = "resourceProvider")] + public string ResourceProvider { get; set; } + + /// + /// Gets or sets the URI of the resource in the operation. + /// + [JsonProperty(PropertyName = "resourceUri")] + public string ResourceUri { get; set; } + + /// + /// Gets or sets the operation that was performed. + /// + [JsonProperty(PropertyName = "operationName")] + public string OperationName { get; set; } + + /// + /// Gets or sets the status of the operation. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the requested authorization for the operation. + /// + [JsonProperty(PropertyName = "authorization")] + public string Authorization { get; set; } + + /// + /// Gets or sets the properties of the claims. + /// + [JsonProperty(PropertyName = "claims")] + public string Claims { get; set; } + + /// + /// Gets or sets an operation ID used for troubleshooting. + /// + [JsonProperty(PropertyName = "correlationId")] + public string CorrelationId { get; set; } + + /// + /// Gets or sets the details of the operation. + /// + [JsonProperty(PropertyName = "httpRequest")] + public string HttpRequest { get; set; } + + } +} diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Microsoft.Azure.EventGrid.csproj b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Microsoft.Azure.EventGrid.csproj index 4c9ff925885e..a5bceb70712f 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Microsoft.Azure.EventGrid.csproj +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Microsoft.Azure.EventGrid.csproj @@ -6,10 +6,10 @@ Microsoft.Azure.EventGrid 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. - 1.4.0 + 2.0.0 Microsoft.Azure.EventGrid Microsoft Azure EventGrid;Event Grid;Event Grid Publishing; - Added EventGridSubscriber class which provides functionality for consuming EventGrid events. + Added models for new IoT event types (IoTDeviceConnected, IoTDeviceDisconnected), and new resource event types (ResourceActionSuccess, ResourceActionFailure, ResourceActionCancel) . net452;netstandard1.4 diff --git a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Properties/AssemblyInfo.cs b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Properties/AssemblyInfo.cs index 99c82b4f629b..d552cc431042 100644 --- a/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Properties/AssemblyInfo.cs +++ b/src/SDKs/EventGrid/DataPlane/Microsoft.Azure.EventGrid/Properties/AssemblyInfo.cs @@ -6,10 +6,10 @@ using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Microsoft Azure EventGrid Library")] -[assembly: AssemblyDescription("Provides developers with a library to publish events to Azure EventGrid.")] +[assembly: AssemblyDescription("Provides developers with a library to publish events to Azure EventGrid and to consume events delivered by EventGrid.")] -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.4.0.0")] +[assembly: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] diff --git a/src/SDKs/_metadata/eventgrid_data-plane.txt b/src/SDKs/_metadata/eventgrid_data-plane.txt index 759132ee868b..9b8ff024efd7 100644 --- a/src/SDKs/_metadata/eventgrid_data-plane.txt +++ b/src/SDKs/_metadata/eventgrid_data-plane.txt @@ -1,11 +1,11 @@ -2018-05-22 18:06:27 UTC +2018-08-21 21:58:50 UTC 1) azure-rest-api-specs repository information GitHub user: Azure Branch: master -Commit: 7a6afb0f255ea0cdbcb100b9f17ff670fda64c54 +Commit: c93c4ed1f9eb24ff0b10f63c23ec89310ed89c3f 2) AutoRest information Requested version: latest -Bootstrapper version: C:\Users\kalyanaj\AppData\Roaming\npm `-- autorest@2.0.4262 +Bootstrapper version: C:\Users\kalyanaj\AppData\Roaming\npm `-- autorest@2.0.4283 Latest installed version: