diff --git a/.editorconfig b/.editorconfig index f1a0398..2235796 100644 --- a/.editorconfig +++ b/.editorconfig @@ -581,6 +581,7 @@ dotnet_diagnostic.SA1402.severity = none # dotnet_diagnostic.SA1615.severity = none # dotnet_diagnostic.CA1002.severity = none # +dotnet_diagnostic.CA1308.severity = none # Normalize strings to uppercase https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1308 dotnet_diagnostic.CA2007.severity = none # Consider calling ConfigureAwait on the awaited task dotnet_diagnostic.MA0004.severity = none # Use Task.ConfigureAwait(false) as the current SynchronizationContext is not needed diff --git a/sample/src/IoTEdgeModules/modules/opcpublishernodemanagermodule/OpcPublisherNodeManagerModuleServiceLoggerMessages.cs b/sample/src/IoTEdgeModules/modules/opcpublishernodemanagermodule/OpcPublisherNodeManagerModuleServiceLoggerMessages.cs index 6bd34d7..bfba11d 100644 --- a/sample/src/IoTEdgeModules/modules/opcpublishernodemanagermodule/OpcPublisherNodeManagerModuleServiceLoggerMessages.cs +++ b/sample/src/IoTEdgeModules/modules/opcpublishernodemanagermodule/OpcPublisherNodeManagerModuleServiceLoggerMessages.cs @@ -10,7 +10,7 @@ public sealed partial class OpcPublisherNodeManagerModuleService [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ModuleStarted, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Successfully started module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully started module '{ModuleName}'.")] private partial void LogModuleStarted( string moduleName, [CallerMemberName] string callerMethodName = "", @@ -19,7 +19,7 @@ private partial void LogModuleStarted( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ModuleStopping, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Stopping module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Stopping module '{ModuleName}'.")] private partial void LogModuleStopping( string moduleName, [CallerMemberName] string callerMethodName = "", @@ -28,7 +28,7 @@ private partial void LogModuleStopping( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ModuleStopped, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Successfully stopped module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully stopped module '{ModuleName}'.")] private partial void LogModuleStopped( string moduleName, [CallerMemberName] string callerMethodName = "", @@ -37,7 +37,7 @@ private partial void LogModuleStopped( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ModuleClientStarted, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Successfully started moduleClient for module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully started moduleClient for module '{ModuleName}'.")] private partial void LogModuleClientStarted( string moduleName, [CallerMemberName] string callerMethodName = "", @@ -46,7 +46,7 @@ private partial void LogModuleClientStarted( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ModuleClientStopped, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Successfully stopped moduleClient for module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully stopped moduleClient for module '{ModuleName}'.")] private partial void LogModuleClientStopped( string moduleName, [CallerMemberName] string callerMethodName = "", @@ -55,7 +55,7 @@ private partial void LogModuleClientStopped( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ConnectionStatusChange, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Connection changed - status: '{status}', reason: '{reason}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Connection changed - status: '{Status}', reason: '{Reason}'.")] private partial void LogConnectionStatusChange( ConnectionStatus status, ConnectionStatusChangeReason reason, @@ -65,7 +65,7 @@ private partial void LogConnectionStatusChange( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodCalled, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Method '{methodName}' was called on module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Method '{MethodName}' was called on module '{ModuleName}'.")] private partial void LogMethodCalled( string methodName, string moduleName, @@ -75,7 +75,7 @@ private partial void LogMethodCalled( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodCallCompleted, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Method '{methodName}' completed on module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Method '{MethodName}' completed on module '{ModuleName}'.")] private partial void LogMethodCallCompleted( string methodName, string moduleName, @@ -85,7 +85,7 @@ private partial void LogMethodCallCompleted( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodRequestEmpty, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - No data in request when method '{methodName}' was called on module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - No data in request when method '{MethodName}' was called on module '{ModuleName}'.")] private partial void LogMethodRequestEmpty( string methodName, string moduleName, @@ -95,7 +95,7 @@ private partial void LogMethodRequestEmpty( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodRequestDeserializationError, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Could not deserialize request when method '{methodName}' was called on module '{moduleName}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not deserialize request when method '{MethodName}' was called on module '{ModuleName}': '{ErrorMessage}'.")] private partial void LogMethodRequestDeserializationError( string methodName, string moduleName, @@ -106,7 +106,7 @@ private partial void LogMethodRequestDeserializationError( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodRequestUriParsingError, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Could not parse url '{url}' from request when method '{methodName}' was called on module '{moduleName}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not parse url '{Url}' from request when method '{MethodName}' was called on module '{ModuleName}': '{ErrorMessage}'.")] private partial void LogMethodRequestUriParsingError( string url, string methodName, @@ -118,7 +118,7 @@ private partial void LogMethodRequestUriParsingError( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodRequestUriFormatExceptionError, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Exception while parsing endpointUrl '{endpointUrl}': '{errorMessage}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Exception while parsing endpointUrl '{EndpointUrl}': '{ErrorMessage}'")] private partial void LogMethodRequestUriFormatExceptionError( string endpointUrl, string errorMessage, @@ -128,7 +128,7 @@ private partial void LogMethodRequestUriFormatExceptionError( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodRequestError, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Could not process request when method '{methodName}' was called on module '{moduleName}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not process request when method '{MethodName}' was called on module '{ModuleName}': '{ErrorMessage}'.")] private partial void LogMethodRequestError( string methodName, string moduleName, @@ -139,7 +139,7 @@ private partial void LogMethodRequestError( [LoggerMessage( EventId = LoggingEventIdConstants.ConfigurationFileMissing, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - The node configuration file '{publisherNodeConfigurationFilename}' does not exist.")] + Message = "{CallerMethodName}({CallerLineNumber}) - The node configuration file '{PublisherNodeConfigurationFilename}' does not exist.")] private partial void LogConfigurationFileNotFound( string publisherNodeConfigurationFilename, [CallerMemberName] string callerMethodName = "", @@ -148,7 +148,7 @@ private partial void LogConfigurationFileNotFound( [LoggerMessage( EventId = LoggingEventIdConstants.ConfigurationFileLoadError, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Loading of the node configuration file failed. Check the file exist and have correct syntax: '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Loading of the node configuration file failed. Check the file exist and have correct syntax: '{ErrorMessage}'.")] private partial void LogConfigurationFileLoadError( string errorMessage, [CallerMemberName] string callerMethodName = "", @@ -157,7 +157,7 @@ private partial void LogConfigurationFileLoadError( [LoggerMessage( EventId = LoggingEventIdConstants.ConfigurationFileWriteError, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Writing to the node configuration file failed. Check the file exist and have correct syntax: '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Writing to the node configuration file failed. Check the file exist and have correct syntax: '{ErrorMessage}'.")] private partial void LogConfigurationFileWriteError( string errorMessage, [CallerMemberName] string callerMethodName = "", diff --git a/sample/src/IoTEdgeModules/modules/simulationmodule/Jobs/PulsJobLoggerMessages.cs b/sample/src/IoTEdgeModules/modules/simulationmodule/Jobs/PulsJobLoggerMessages.cs index 33295c6..8368c10 100644 --- a/sample/src/IoTEdgeModules/modules/simulationmodule/Jobs/PulsJobLoggerMessages.cs +++ b/sample/src/IoTEdgeModules/modules/simulationmodule/Jobs/PulsJobLoggerMessages.cs @@ -11,7 +11,7 @@ public sealed partial class PulsJob [LoggerMessage( EventId = LoggingEventIdConstants.JobStarted, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - '{jobName}' started.")] + Message = "{CallerMethodName}({CallerLineNumber}) - '{JobName}' started.")] private partial void LogJobStarted( string jobName, [CallerMemberName] string callerMethodName = "", @@ -20,7 +20,7 @@ private partial void LogJobStarted( [LoggerMessage( EventId = LoggingEventIdConstants.JobEnded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - '{jobName}' ended.")] + Message = "{CallerMethodName}({CallerLineNumber}) - '{JobName}' ended.")] private partial void LogJobEnded( string jobName, [CallerMemberName] string callerMethodName = "", @@ -29,7 +29,7 @@ private partial void LogJobEnded( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.FailedToAcquireModuleClient, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to acquire ModuleClient for the job '{jobName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to acquire ModuleClient for the job '{JobName}'.")] private partial void LogFailedToAcquireModuleClient( string jobName, [CallerMemberName] string callerMethodName = "", @@ -38,7 +38,7 @@ private partial void LogFailedToAcquireModuleClient( [LoggerMessage( EventId = LoggingEventIdConstants.UnhandledExceptionInJob, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Unhandled exception occurred in job '{jobName}' - '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Unhandled exception occurred in job '{JobName}' - '{ErrorMessage}'.")] private partial void LogUnhandledExceptionInJob( string jobName, string? errorMessage, diff --git a/sample/src/IoTEdgeModules/modules/simulationmodule/SimulationModuleServiceLoggerMessages.cs b/sample/src/IoTEdgeModules/modules/simulationmodule/SimulationModuleServiceLoggerMessages.cs index 223e386..05890e2 100644 --- a/sample/src/IoTEdgeModules/modules/simulationmodule/SimulationModuleServiceLoggerMessages.cs +++ b/sample/src/IoTEdgeModules/modules/simulationmodule/SimulationModuleServiceLoggerMessages.cs @@ -10,7 +10,7 @@ public sealed partial class SimulationModuleService [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ModuleStarted, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Successfully started module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully started module '{ModuleName}'.")] private partial void LogModuleStarted( string moduleName, [CallerMemberName] string callerMethodName = "", @@ -19,7 +19,7 @@ private partial void LogModuleStarted( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ModuleStopping, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Stopping module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Stopping module '{ModuleName}'.")] private partial void LogModuleStopping( string moduleName, [CallerMemberName] string callerMethodName = "", @@ -28,7 +28,7 @@ private partial void LogModuleStopping( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ModuleStopped, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Successfully stopped module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully stopped module '{ModuleName}'.")] private partial void LogModuleStopped( string moduleName, [CallerMemberName] string callerMethodName = "", @@ -37,7 +37,7 @@ private partial void LogModuleStopped( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ModuleClientStarted, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Successfully started moduleClient for module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully started moduleClient for module '{ModuleName}'.")] private partial void LogModuleClientStarted( string moduleName, [CallerMemberName] string callerMethodName = "", @@ -46,7 +46,7 @@ private partial void LogModuleClientStarted( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ModuleClientStopped, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Successfully stopped moduleClient for module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully stopped moduleClient for module '{ModuleName}'.")] private partial void LogModuleClientStopped( string moduleName, [CallerMemberName] string callerMethodName = "", @@ -55,7 +55,7 @@ private partial void LogModuleClientStopped( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.ConnectionStatusChange, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Connection changed - status: '{status}', reason: '{reason}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Connection changed - status: '{Status}', reason: '{Reason}'.")] private partial void LogConnectionStatusChange( ConnectionStatus status, ConnectionStatusChangeReason reason, @@ -65,7 +65,7 @@ private partial void LogConnectionStatusChange( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodCalled, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Method '{methodName}' was called on module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Method '{MethodName}' was called on module '{ModuleName}'.")] private partial void LogMethodCalled( string methodName, string moduleName, @@ -75,7 +75,7 @@ private partial void LogMethodCalled( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodCallCompleted, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Method '{methodName}' completed on module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Method '{MethodName}' completed on module '{ModuleName}'.")] private partial void LogMethodCallCompleted( string methodName, string moduleName, @@ -85,7 +85,7 @@ private partial void LogMethodCallCompleted( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodRequestEmpty, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - No data in request when method '{methodName}' was called on module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - No data in request when method '{MethodName}' was called on module '{ModuleName}'.")] private partial void LogMethodRequestEmpty( string methodName, string moduleName, @@ -95,7 +95,7 @@ private partial void LogMethodRequestEmpty( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodRequestDeserializationError, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Could not deserialize request when method '{methodName}' was called on module '{moduleName}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not deserialize request when method '{MethodName}' was called on module '{ModuleName}': '{ErrorMessage}'.")] private partial void LogMethodRequestDeserializationError( string methodName, string moduleName, @@ -106,7 +106,7 @@ private partial void LogMethodRequestDeserializationError( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodRequestUriParsingError, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Could not parse url '{url}' from request when method '{methodName}' was called on module '{moduleName}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not parse url '{url}' from request when method '{MethodName}' was called on module '{ModuleName}': '{ErrorMessage}'.")] private partial void LogMethodRequestUriParsingError( string url, string methodName, @@ -118,7 +118,7 @@ private partial void LogMethodRequestUriParsingError( [LoggerMessage( EventId = Atc.Azure.IoTEdge.LoggingEventIdConstants.MethodRequestError, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Could not process request when method '{methodName}' was called on module '{moduleName}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not process request when method '{MethodName}' was called on module '{ModuleName}': '{ErrorMessage}'.")] private partial void LogMethodRequestError( string methodName, string moduleName, diff --git a/src/Atc.Azure.IoT/Converters/EdgeHubRouteConverter.cs b/src/Atc.Azure.IoT/Converters/EdgeHubRouteConverter.cs new file mode 100644 index 0000000..8be5e7c --- /dev/null +++ b/src/Atc.Azure.IoT/Converters/EdgeHubRouteConverter.cs @@ -0,0 +1,34 @@ +namespace Atc.Azure.IoT.Converters; + +public sealed class EdgeHubRouteConverter : Newtonsoft.Json.JsonConverter +{ + public override bool CanWrite => false; + + public override EdgeHubRoute? ReadJson( + Newtonsoft.Json.JsonReader reader, + Type objectType, + EdgeHubRoute? existingValue, + bool hasExistingValue, + Newtonsoft.Json.JsonSerializer serializer) + { + if (reader.TokenType == Newtonsoft.Json.JsonToken.String) + { + var expr = (string)reader.Value!; + return new EdgeHubRoute(expr, null, null); + } + + var jObject = Newtonsoft.Json.Linq.JObject.Load(reader); + + var routeExpr = jObject[PropertyNames.Manifest.Route]?.ToString() ?? string.Empty; + var priority = jObject[PropertyNames.Manifest.Priority]?.ToObject(); + var ttlSecs = jObject[PropertyNames.Manifest.TimeToLiveSecs]?.ToObject(); + + return new EdgeHubRoute(routeExpr, priority, ttlSecs); + } + + public override void WriteJson( + Newtonsoft.Json.JsonWriter writer, + EdgeHubRoute? value, + Newtonsoft.Json.JsonSerializer serializer) + => throw new NotSupportedException(); +} \ No newline at end of file diff --git a/src/Atc.Azure.IoT/DeviceTwinPropertyNames.cs b/src/Atc.Azure.IoT/DeviceTwinPropertyNames.cs deleted file mode 100644 index fbbb7bf..0000000 --- a/src/Atc.Azure.IoT/DeviceTwinPropertyNames.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace Atc.Azure.IoT; - -public static class DeviceTwinPropertyNames -{ - public const string Runtime = "runtime"; - - public const string Platform = "platform"; - public const string PlatformOs = "os"; - public const string PlatformArchitecture = "architecture"; - - public const string LastDesiredStatus = "lastDesiredStatus"; - public const string LastDesiredStatusCode = "code"; - public const string LastDesiredStatusDescription = "description"; - - public const string SystemModules = "systemModules"; - public const string Modules = "modules"; - public const string ModuleExitCode = "exitCode"; - public const string ModuleStatusDescription = "statusDescription"; - public const string ModuleRuntimeStatus = "runtimeStatus"; - public const string ModuleLastExitTimeUtc = "lastExitTimeUtc"; - public const string ModuleLastStartTimeUtc = "lastStartTimeUtc"; - public const string ModuleLastRestartTimeUtc = "lastRestartTimeUtc"; - public const string ModuleRestartCount = "restartCount"; - public const string ModuleStartupOrder = "startupOrder"; - public const string ModuleSettings = "settings"; - public const string ModuleSettingsImage = "image"; - public const string ModuleEnvironment = "env"; - public const string ModuleEnvironmentUpstreamProtocol = "upstreamProtocol"; - public const string ModuleEnvironmentUpstreamProtocolValue = "value"; -} \ No newline at end of file diff --git a/src/Atc.Azure.IoT/EdgeHubConstants.cs b/src/Atc.Azure.IoT/EdgeHubConstants.cs new file mode 100644 index 0000000..aa14229 --- /dev/null +++ b/src/Atc.Azure.IoT/EdgeHubConstants.cs @@ -0,0 +1,16 @@ +namespace Atc.Azure.IoT; + +/// +/// The EdgeHubConstants class contains constant string values +/// which are used within the context of the Iot Edge Hub System Module. +/// +public static class EdgeHubConstants +{ + /// + /// The ModuleId constant represents the unique identifier for the Edge Hub module. + /// + /// + /// The value "$edgeHub" is a special reserved keyword used internally to refer to the Iot Edge Hub itself. + /// + public const string ModuleId = "$edgeHub"; +} \ No newline at end of file diff --git a/src/Atc.Azure.IoT/Extensions/ConfigurationContentExtensions.cs b/src/Atc.Azure.IoT/Extensions/ConfigurationContentExtensions.cs new file mode 100644 index 0000000..b47620b --- /dev/null +++ b/src/Atc.Azure.IoT/Extensions/ConfigurationContentExtensions.cs @@ -0,0 +1,233 @@ +namespace Atc.Azure.IoT.Extensions; + +/// +/// Convenience helpers for composing IoT Edge objects. +/// All methods return the same instance to allow fluent chaining. +/// +public static class ConfigurationContentExtensions +{ + /// + /// Adds the edgeAgent desired-properties section to . + /// + /// The configuration being built. + /// The desired properties for the edgeAgent. + /// The same instance. + public static ConfigurationContent SetEdgeAgent( + this ConfigurationContent configurationContent, + EdgeAgentDesiredProperties edgeAgentDesiredProperties) + { + configurationContent.ModulesContent ??= new Dictionary>(StringComparer.Ordinal); + configurationContent.ModulesContent.Add(EdgeAgentConstants.ModuleId, new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.PropertiesDesired] = GetEdgeAgentConfiguration(edgeAgentDesiredProperties), + }); + + return configurationContent; + } + + /// + /// Adds the edgeHub desired-properties section to . + /// + /// The configuration being built. + /// The desired properties for the edgeHub. + /// The same instance. + public static ConfigurationContent SetEdgeHub( + this ConfigurationContent configurationContent, + EdgeHubDesiredProperties edgeHubDesiredProperties) + { + var routes = new Dictionary(StringComparer.Ordinal); + edgeHubDesiredProperties.Routes?.ForEach(x => + { + if (!x.Priority.HasValue && !x.TimeToLiveSecs.HasValue) + { + // Shorthand format + routes[x.Name] = x.Value; + return; + } + + var dict = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.Route] = x.Value, + }; + + if (x.Priority.HasValue) + { + dict[PropertyNames.Manifest.Priority] = x.Priority.Value; + } + + if (x.TimeToLiveSecs.HasValue) + { + dict[PropertyNames.Manifest.TimeToLiveSecs] = x.TimeToLiveSecs.Value; + } + + routes[x.Name] = dict; + }); + + configurationContent.ModulesContent ??= new Dictionary>(StringComparer.Ordinal); + configurationContent.ModulesContent.Add(EdgeHubConstants.ModuleId, new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.PropertiesDesired] = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.SchemaVersion] = edgeHubDesiredProperties.SchemaVersion, + [PropertyNames.Manifest.Routes] = routes, + [PropertyNames.Manifest.StoreAndForwardConfiguration] = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.TimeToLiveSecs] = edgeHubDesiredProperties.StoreAndForwardTimeToLiveSecs, + }, + }, + }); + + return configurationContent; + } + + /// + /// Adds a regular module’s desired properties to . + /// + /// The configuration being built. + /// The module specification. + /// The same instance. + public static ConfigurationContent SetModuleDesiredProperty( + this ConfigurationContent configurationContent, + ModuleSpecificationDesiredProperties moduleSpecificationDesiredProperties) + { + configurationContent.ModulesContent ??= new Dictionary>(StringComparer.Ordinal); + configurationContent.ModulesContent.Add(moduleSpecificationDesiredProperties.Name, new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.PropertiesDesired] = moduleSpecificationDesiredProperties.DesiredProperties, + }); + + return configurationContent; + } + + private static Dictionary GetEdgeAgentConfiguration( + EdgeAgentDesiredProperties edgeAgentDesiredProperties) + { + var manifestRegistryCredentials = edgeAgentDesiredProperties.RegistryCredentials.ToDictionary( + x => x.Name, + x => new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.Address] = x.Address, + [PropertyNames.Manifest.Username] = x.UserName, + [PropertyNames.Manifest.Password] = x.Password, + }, + StringComparer.Ordinal); + + var modules = edgeAgentDesiredProperties.EdgeModuleSpecifications.ToDictionary( + x => x.Name, + BuildDockerModule, + StringComparer.Ordinal); + + var config = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.SchemaVersion] = edgeAgentDesiredProperties.SchemaVersion, + [PropertyNames.Runtime] = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.Type] = PropertyNames.Manifest.Docker, + [PropertyNames.ModuleSettings] = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.LoggingOptions] = string.Empty, + [PropertyNames.Manifest.MinDockerVersion] = edgeAgentDesiredProperties.MinDockerVersion, + [PropertyNames.Manifest.RegistryCredentials] = manifestRegistryCredentials, + }, + }, + [PropertyNames.SystemModules] = GetSystemModuleSpecification(edgeAgentDesiredProperties), + }; + + if (modules.Count > 0) + { + config[PropertyNames.Modules] = modules; + } + + return config; + } + + private static Dictionary GetSystemModuleSpecification( + EdgeAgentDesiredProperties edgeAgentDesiredProperties) + { + if (edgeAgentDesiredProperties.EdgeSystemModuleSpecifications.Count == 0) + { + // No custom system-module specs → compose defaults and return + return new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.EdgeAgent] = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.Type] = PropertyNames.Manifest.Docker, + [PropertyNames.ModuleSettings] = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.Image] = $"mcr.microsoft.com/azureiotedge-agent:{edgeAgentDesiredProperties.SystemModuleVersion}", + [PropertyNames.Manifest.CreateOptions] = edgeAgentDesiredProperties.EdgeAgentCreateOptions, + }, + }, + [PropertyNames.Manifest.EdgeHub] = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.Type] = PropertyNames.Manifest.Docker, + [PropertyNames.Manifest.Status] = ModuleStatus.Running.ToStringLowerCase(), + [PropertyNames.Manifest.RestartPolicy] = RestartPolicy.Always.ToStringLowerCase(), + [PropertyNames.ModuleSettings] = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.Image] = $"mcr.microsoft.com/azureiotedge-hub:{edgeAgentDesiredProperties.SystemModuleVersion}", + [PropertyNames.Manifest.CreateOptions] = edgeAgentDesiredProperties.EdgeHubCreateOptions, + }, + }, + }; + } + + return edgeAgentDesiredProperties.EdgeSystemModuleSpecifications.ToDictionary( + x => x.Name, + BuildDockerModule, + StringComparer.Ordinal); + } + + private static Dictionary BuildDockerModule( + EdgeModuleSpecification edgeModuleSpecification) + { + var module = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.Version] = edgeModuleSpecification.Version, + [PropertyNames.Manifest.Type] = PropertyNames.Manifest.Docker, + [PropertyNames.Manifest.Status] = edgeModuleSpecification.Status.ToString().ToLowerInvariant(), + [PropertyNames.Manifest.RestartPolicy] = edgeModuleSpecification.RestartPolicy.ToString().ToLowerInvariant(), + }; + + var settings = new Dictionary(StringComparer.Ordinal) + { + [PropertyNames.Manifest.Image] = edgeModuleSpecification.Image, + }; + + if (!string.IsNullOrWhiteSpace(edgeModuleSpecification.CreateOptions)) + { + try + { + // Try to parse; use JToken so the serializer keeps it as JSON + settings[PropertyNames.Manifest.CreateOptions] = Newtonsoft.Json.Linq.JToken.Parse(edgeModuleSpecification.CreateOptions); + } + catch + { + // not valid JSON → keep the raw string + settings[PropertyNames.Manifest.CreateOptions] = edgeModuleSpecification.CreateOptions; + } + } + + module[PropertyNames.ModuleSettings] = settings; + + if (edgeModuleSpecification.StartupOrder.HasValue) + { + module[PropertyNames.ModuleStartupOrder] = edgeModuleSpecification.StartupOrder.Value; + } + + var env = BuildEnvironmentVariables(edgeModuleSpecification.EnvironmentVariables); + if (env.Count > 0) + { + module[PropertyNames.ModuleEnvironment] = env; + } + + return module; + } + + private static Dictionary BuildEnvironmentVariables( + IReadOnlyCollection variables) + => variables.ToDictionary( + x => x.Name, + object (x) => new { value = x.Value }, + StringComparer.Ordinal); +} \ No newline at end of file diff --git a/src/Atc.Azure.IoT/GlobalUsings.cs b/src/Atc.Azure.IoT/GlobalUsings.cs index 32d56c7..e86dcfd 100644 --- a/src/Atc.Azure.IoT/GlobalUsings.cs +++ b/src/Atc.Azure.IoT/GlobalUsings.cs @@ -3,6 +3,7 @@ global using System.Runtime.CompilerServices; global using System.Text.Json; global using System.Text.Json.Serialization; +global using Atc.Azure.IoT.Converters; global using Atc.Azure.IoT.Exceptions; global using Atc.Azure.IoT.Extensions; global using Atc.Azure.IoT.Extractors; diff --git a/src/Atc.Azure.IoT/Models/EdgeAgentDeviceTwinModels.cs b/src/Atc.Azure.IoT/Models/EdgeAgentDeviceTwinModels.cs index 9fb3c81..ed007b7 100644 --- a/src/Atc.Azure.IoT/Models/EdgeAgentDeviceTwinModels.cs +++ b/src/Atc.Azure.IoT/Models/EdgeAgentDeviceTwinModels.cs @@ -1,45 +1,43 @@ // ReSharper disable UnusedMember.Global namespace Atc.Azure.IoT.Models; -public record EdgeAgentDesiredProperties(); - public record LastDesiredStatus( - [property: JsonPropertyName(DeviceTwinPropertyNames.LastDesiredStatusCode)] int RuntimeStatusCode, - [property: JsonPropertyName(DeviceTwinPropertyNames.LastDesiredStatusDescription)] string RuntimeStatusDescription = ""); + [property: JsonPropertyName(PropertyNames.DeviceTwin.LastDesiredStatusCode)] int RuntimeStatusCode, + [property: JsonPropertyName(PropertyNames.DeviceTwin.LastDesiredStatusDescription)] string RuntimeStatusDescription = ""); [SuppressMessage("Naming", "CA1716:Identifiers should not match keywords", Justification = "OK - No Keyword.")] public record Module( [property: JsonIgnore] string Name, - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleExitCode)] int ExitCode, - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleStatusDescription)] string StatusDescription, - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleRuntimeStatus)] string RuntimeStatus, - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleLastExitTimeUtc)] DateTimeOffset? LastExitTimeUtc, - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleLastStartTimeUtc)] DateTimeOffset? LastStartTimeUtc, - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleLastRestartTimeUtc)] DateTimeOffset? LastRestartTimeUtc, - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleRestartCount)] int RestartCount, - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleStartupOrder)] int StartupOrder, - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleSettings)] ModuleSettings Settings, - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleEnvironment)] ModuleEnvironment? Environment); + [property: JsonPropertyName(PropertyNames.DeviceTwin.ModuleExitCode)] int ExitCode, + [property: JsonPropertyName(PropertyNames.DeviceTwin.ModuleStatusDescription)] string StatusDescription, + [property: JsonPropertyName(PropertyNames.DeviceTwin.ModuleRuntimeStatus)] string RuntimeStatus, + [property: JsonPropertyName(PropertyNames.DeviceTwin.ModuleLastExitTimeUtc)] DateTimeOffset? LastExitTimeUtc, + [property: JsonPropertyName(PropertyNames.DeviceTwin.ModuleLastStartTimeUtc)] DateTimeOffset? LastStartTimeUtc, + [property: JsonPropertyName(PropertyNames.DeviceTwin.ModuleLastRestartTimeUtc)] DateTimeOffset? LastRestartTimeUtc, + [property: JsonPropertyName(PropertyNames.DeviceTwin.ModuleRestartCount)] int RestartCount, + [property: JsonPropertyName(PropertyNames.ModuleStartupOrder)] int StartupOrder, + [property: JsonPropertyName(PropertyNames.ModuleSettings)] ModuleSettings Settings, + [property: JsonPropertyName(PropertyNames.ModuleEnvironment)] ModuleEnvironment? Environment); public record ModuleEnvironment( - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleEnvironmentUpstreamProtocol)] UpstreamProtocol? UpstreamProtocol); + [property: JsonPropertyName(PropertyNames.DeviceTwin.ModuleEnvironmentUpstreamProtocol)] UpstreamProtocol? UpstreamProtocol); public record ModuleSettings( - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleSettingsImage)] string Image); + [property: JsonPropertyName(PropertyNames.ModuleSettingsImage)] string Image); public record Platform( - [property: JsonPropertyName(DeviceTwinPropertyNames.PlatformOs)] string OperatingSystem, - [property: JsonPropertyName(DeviceTwinPropertyNames.PlatformArchitecture)] string OperatingSystemArchitecture); + [property: JsonPropertyName(PropertyNames.DeviceTwin.PlatformOs)] string OperatingSystem, + [property: JsonPropertyName(PropertyNames.DeviceTwin.PlatformArchitecture)] string OperatingSystemArchitecture); public record EdgeAgentReportedProperties( - [property: JsonPropertyName(DeviceTwinPropertyNames.Runtime)] Runtime? Runtime, - [property: JsonPropertyName(DeviceTwinPropertyNames.LastDesiredStatus)] LastDesiredStatus? LastDesiredStatus, - [property: JsonPropertyName(DeviceTwinPropertyNames.SystemModules), JsonConverter(typeof(JsonModulesConverter))] List? SystemModules, - [property: JsonPropertyName(DeviceTwinPropertyNames.Modules), JsonConverter(typeof(JsonModulesConverter))] List? Modules); + [property: JsonPropertyName(PropertyNames.Runtime)] Runtime? Runtime, + [property: JsonPropertyName(PropertyNames.DeviceTwin.LastDesiredStatus)] LastDesiredStatus? LastDesiredStatus, + [property: JsonPropertyName(PropertyNames.SystemModules), JsonConverter(typeof(JsonModulesConverter))] List? SystemModules, + [property: JsonPropertyName(PropertyNames.Modules), JsonConverter(typeof(JsonModulesConverter))] List? Modules); [SuppressMessage("Naming", "CA1724:Type Names Should Not Match Namespaces", Justification = "OK - No Keyword.")] public record Runtime( - [property: JsonPropertyName(DeviceTwinPropertyNames.Platform)] Platform Platform); + [property: JsonPropertyName(PropertyNames.DeviceTwin.Platform)] Platform Platform); public record UpstreamProtocol( - [property: JsonPropertyName(DeviceTwinPropertyNames.ModuleEnvironmentUpstreamProtocolValue)] string Value); \ No newline at end of file + [property: JsonPropertyName(PropertyNames.DeviceTwin.ModuleEnvironmentUpstreamProtocolValue)] string Value); \ No newline at end of file diff --git a/src/Atc.Azure.IoT/Models/EdgeAgentManifestModels.cs b/src/Atc.Azure.IoT/Models/EdgeAgentManifestModels.cs new file mode 100644 index 0000000..0d76a9f --- /dev/null +++ b/src/Atc.Azure.IoT/Models/EdgeAgentManifestModels.cs @@ -0,0 +1,63 @@ +namespace Atc.Azure.IoT.Models; + +public record DeploymentManifest( + [property: JsonPropertyName(PropertyNames.Manifest.ModulesContent)] ModulesContentDefinition ModulesContent); + +public record ModulesContentDefinition( + [property: JsonPropertyName(EdgeAgentConstants.ModuleId)] EdgeAgent EdgeAgent, + [property: JsonPropertyName(EdgeHubConstants.ModuleId)] EdgeHub EdgeHub); + +public record EdgeAgent( + [property: JsonPropertyName(PropertyNames.Manifest.PropertiesDesired)] PropertiesDesiredEdgeAgent PropertiesDesired); + +public record PropertiesDesiredEdgeAgent( + [property: JsonPropertyName(PropertyNames.Manifest.SchemaVersion)] string SchemaVersion, + [property: JsonPropertyName(PropertyNames.Runtime)] EdgeAgentRuntime Runtime, + [property: JsonPropertyName(PropertyNames.SystemModules)] Dictionary SystemModules, + [property: JsonPropertyName(PropertyNames.Modules)] Dictionary Modules); + +public record EdgeAgentRuntime( + [property: JsonPropertyName(PropertyNames.Manifest.Type)] string Type, + [property: JsonPropertyName(PropertyNames.ModuleSettings)] Settings Settings); + +public record Settings( + [property: JsonPropertyName(PropertyNames.Manifest.MinDockerVersion)] string MinDockerVersion, + [property: JsonPropertyName(PropertyNames.Manifest.LoggingOptions)] string LoggingOptions, + [property: JsonPropertyName(PropertyNames.Manifest.RegistryCredentials)] Dictionary RegistryCredentials); + +public record Store( + [property: JsonPropertyName(PropertyNames.Manifest.Address)] string Address, + [property: JsonPropertyName(PropertyNames.Manifest.Password)] string Password, + [property: JsonPropertyName(PropertyNames.Manifest.Username)] string Username); + +public record SystemModuleSpecification( + [property: JsonPropertyName(PropertyNames.Manifest.Type)] string Type, + [property: JsonPropertyName(PropertyNames.Manifest.Status)] string Status, + [property: JsonPropertyName(PropertyNames.Manifest.RestartPolicy)] string RestartPolicy, + [property: JsonPropertyName(PropertyNames.ModuleSettings)] SettingsSpecification Settings, + [property: JsonPropertyName(PropertyNames.ModuleEnvironment)] Dictionary Env, + [property: JsonPropertyName(PropertyNames.ModuleStartupOrder)] int? StartupOrder); + +public record SettingsSpecification( + [property: JsonPropertyName(PropertyNames.Manifest.Image)] string Image, + [property: JsonPropertyName(PropertyNames.Manifest.CreateOptions)] string CreateOptions); + +public record EnvSpecification( + [property: JsonPropertyName(PropertyNames.Manifest.Value)] string Value); + +public record EdgeHub( + [property: JsonPropertyName(PropertyNames.Manifest.PropertiesDesired)] PropertiesDesiredEdgeHub PropertiesDesired); + +public record PropertiesDesiredEdgeHub( + [property: JsonPropertyName(PropertyNames.Manifest.SchemaVersion)] string SchemaVersion, + [property: JsonPropertyName(PropertyNames.Manifest.Routes)] Dictionary? Routes, + [property: JsonPropertyName(PropertyNames.Manifest.StoreAndForwardConfiguration)] StoreAndForwardConfiguration StoreAndForwardConfiguration); + +[Newtonsoft.Json.JsonConverter(typeof(EdgeHubRouteConverter))] +public record EdgeHubRoute( + [property: JsonPropertyName(PropertyNames.Manifest.Route)] string Route, + [property: JsonPropertyName(PropertyNames.Manifest.Priority)] int? Priority, + [property: JsonPropertyName(PropertyNames.Manifest.TimeToLiveSecs)] int? TimeToLiveSecs); + +public record StoreAndForwardConfiguration( + [property: JsonPropertyName(PropertyNames.Manifest.TimeToLiveSecs)] int TimeToLiveSecs); \ No newline at end of file diff --git a/src/Atc.Azure.IoT/Models/ManifestModels.cs b/src/Atc.Azure.IoT/Models/ManifestModels.cs new file mode 100644 index 0000000..7b4c794 --- /dev/null +++ b/src/Atc.Azure.IoT/Models/ManifestModels.cs @@ -0,0 +1,46 @@ +namespace Atc.Azure.IoT.Models; + +public record Route( + string Name, + string Value, + int? Priority, + int? TimeToLiveSecs); + +public record RegistryCredential( + string Name, + string Address, + string UserName, + string Password); + +public record EnvironmentVariable( + string Name, + string Value); + +public record ModuleSpecificationDesiredProperties( + string Name, + object DesiredProperties); + +public record EdgeModuleSpecification( + string Name, + string Image, + int? StartupOrder, + List EnvironmentVariables, + string Version = "1.0", + RestartPolicy RestartPolicy = RestartPolicy.Always, + string CreateOptions = "", + ModuleStatus Status = ModuleStatus.Running); + +public record EdgeHubDesiredProperties( + List? Routes = null, + string SchemaVersion = "1.1", + int StoreAndForwardTimeToLiveSecs = 7200); + +public record EdgeAgentDesiredProperties( + List RegistryCredentials, + List EdgeSystemModuleSpecifications, + List EdgeModuleSpecifications, + string SchemaVersion = "1.1", + string SystemModuleVersion = "1.5", + string MinDockerVersion = "v1.25", + string EdgeAgentCreateOptions = "", + string EdgeHubCreateOptions = "{\"HostConfig\":{\"PortBindings\":{\"443/tcp\":[{\"HostPort\":\"443\"}],\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}]}}}"); \ No newline at end of file diff --git a/src/Atc.Azure.IoT/Models/_Enums/ModuleStatus.cs b/src/Atc.Azure.IoT/Models/_Enums/ModuleStatus.cs new file mode 100644 index 0000000..cc9040b --- /dev/null +++ b/src/Atc.Azure.IoT/Models/_Enums/ModuleStatus.cs @@ -0,0 +1,9 @@ +// ReSharper disable CheckNamespace +namespace Atc.Azure.IoT.Models; + +public enum ModuleStatus +{ + Unknown, + Running, + Stopped, +} \ No newline at end of file diff --git a/src/Atc.Azure.IoT/Models/_Enums/RestartPolicy.cs b/src/Atc.Azure.IoT/Models/_Enums/RestartPolicy.cs new file mode 100644 index 0000000..3fea49d --- /dev/null +++ b/src/Atc.Azure.IoT/Models/_Enums/RestartPolicy.cs @@ -0,0 +1,9 @@ +// ReSharper disable CheckNamespace +namespace Atc.Azure.IoT.Models; + +public enum RestartPolicy +{ + Unknown, + Always, + Never, +} \ No newline at end of file diff --git a/src/Atc.Azure.IoT/PropertyNames.cs b/src/Atc.Azure.IoT/PropertyNames.cs new file mode 100644 index 0000000..f0287c0 --- /dev/null +++ b/src/Atc.Azure.IoT/PropertyNames.cs @@ -0,0 +1,63 @@ +namespace Atc.Azure.IoT; + +public static class PropertyNames +{ + public const string ModuleEnvironment = "env"; + public const string Modules = "modules"; + public const string ModuleSettings = "settings"; + public const string ModuleSettingsImage = "image"; + public const string ModuleStartupOrder = "startupOrder"; + public const string Runtime = "runtime"; + public const string SystemModules = "systemModules"; + + public static class Manifest + { + public const string Address = "address"; + public const string CreateOptions = "createOptions"; + public const string Docker = "docker"; + public const string EdgeAgent = "edgeAgent"; + public const string EdgeHub = "edgeHub"; + public const string Image = "image"; + public const string LoggingOptions = "loggingOptions"; + public const string MinDockerVersion = "minDockerVersion"; + public const string ModulesContent = "modulesContent"; + public const string Password = "password"; + public const string Priority = "priority"; + public const string PropertiesDesired = "properties.desired"; + public const string PropertiesDesiredModules = "properties.desired.modules"; + public const string PropertiesDesiredRoutes = "properties.desired.routes"; + public const string RegistryCredentials = "registryCredentials"; + public const string RestartPolicy = "restartPolicy"; + public const string Route = "route"; + public const string Routes = "routes"; + public const string SchemaVersion = "schemaVersion"; + public const string Status = "status"; + public const string StoreAndForwardConfiguration = "storeAndForwardConfiguration"; + public const string TimeToLiveSecs = "timeToLiveSecs"; + public const string Username = "username"; + public const string Type = "type"; + public const string Value = "value"; + public const string Version = "version"; + } + + public static class DeviceTwin + { + public const string Platform = "platform"; + public const string PlatformOs = "os"; + public const string PlatformArchitecture = "architecture"; + + public const string LastDesiredStatus = "lastDesiredStatus"; + public const string LastDesiredStatusCode = "code"; + public const string LastDesiredStatusDescription = "description"; + + public const string ModuleExitCode = "exitCode"; + public const string ModuleStatusDescription = "statusDescription"; + public const string ModuleRuntimeStatus = "runtimeStatus"; + public const string ModuleLastExitTimeUtc = "lastExitTimeUtc"; + public const string ModuleLastStartTimeUtc = "lastStartTimeUtc"; + public const string ModuleLastRestartTimeUtc = "lastRestartTimeUtc"; + public const string ModuleRestartCount = "restartCount"; + public const string ModuleEnvironmentUpstreamProtocol = "upstreamProtocol"; + public const string ModuleEnvironmentUpstreamProtocolValue = "value"; + } +} \ No newline at end of file diff --git a/src/Atc.Azure.IoT/Services/DeviceProvisioning/DeviceProvisioningServiceLoggerMessages.cs b/src/Atc.Azure.IoT/Services/DeviceProvisioning/DeviceProvisioningServiceLoggerMessages.cs index 1e9e626..9e71b91 100644 --- a/src/Atc.Azure.IoT/Services/DeviceProvisioning/DeviceProvisioningServiceLoggerMessages.cs +++ b/src/Atc.Azure.IoT/Services/DeviceProvisioning/DeviceProvisioningServiceLoggerMessages.cs @@ -11,7 +11,7 @@ public sealed partial class DeviceProvisioningService [LoggerMessage( EventId = LoggingEventIdConstants.DeviceProvisioningManager.IndividualTpmEnrollmentFailed, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to create individual TPM enrollment for registrationId '{registrationId}': {errorMessage}")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to create individual TPM enrollment for registrationId '{RegistrationId}': {ErrorMessage}")] private partial void LogIndividualTpmEnrollmentFailed( string registrationId, string? errorMessage, @@ -21,7 +21,7 @@ private partial void LogIndividualTpmEnrollmentFailed( [LoggerMessage( EventId = LoggingEventIdConstants.DeviceProvisioningManager.IndividualTpmEnrollmentBadRequest, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to create individual TPM enrollment for registrationId '{registrationId}'. Error: {errorCode} # {errorMessage}")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to create individual TPM enrollment for registrationId '{RegistrationId}'. Error: {ErrorCode} # {ErrorMessage}")] private partial void LogIndividualTpmEnrollmentBadRequest( string registrationId, int? errorCode, @@ -32,7 +32,7 @@ private partial void LogIndividualTpmEnrollmentBadRequest( [LoggerMessage( EventId = LoggingEventIdConstants.DeviceProvisioningManager.IndividualTpmEnrollmentConflict, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to create individual TPM enrollment for registrationId '{registrationId}'. Error: {errorCode} # {errorMessage}")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to create individual TPM enrollment for registrationId '{RegistrationId}'. Error: {ErrorCode} # {ErrorMessage}")] private partial void LogIndividualTpmEnrollmentConflict( string registrationId, int? errorCode, @@ -43,7 +43,7 @@ private partial void LogIndividualTpmEnrollmentConflict( [LoggerMessage( EventId = LoggingEventIdConstants.DeviceProvisioningManager.IndividualEnrollmentNotFound, Level = LogLevel.Warning, - Message = "{callerMethodName}({callerLineNumber}) - Individual enrollment with registrationId '{registrationId}' not found. Error: {errorCode} # {errorMessage}")] + Message = "{CallerMethodName}({CallerLineNumber}) - Individual enrollment with registrationId '{RegistrationId}' not found. Error: {ErrorCode} # {ErrorMessage}")] private partial void LogIndividualEnrollmentNotFound( string registrationId, int? errorCode, @@ -54,7 +54,7 @@ private partial void LogIndividualEnrollmentNotFound( [LoggerMessage( EventId = LoggingEventIdConstants.DeviceProvisioningManager.DeleteIndividualEnrollmentNotFound, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to delete individual enrollment with registrationId '{registrationId}'. Error: {errorCode} # {errorMessage}")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to delete individual enrollment with registrationId '{RegistrationId}'. Error: {ErrorCode} # {ErrorMessage}")] private partial void LogDeleteIndividualEnrollmentNotFound( string registrationId, int? errorCode, diff --git a/src/Atc.Azure.IoT/Services/IoTHub/IoTHubServiceLoggerMessages.cs b/src/Atc.Azure.IoT/Services/IoTHub/IoTHubServiceLoggerMessages.cs index cf06722..43c10af 100644 --- a/src/Atc.Azure.IoT/Services/IoTHub/IoTHubServiceLoggerMessages.cs +++ b/src/Atc.Azure.IoT/Services/IoTHub/IoTHubServiceLoggerMessages.cs @@ -11,7 +11,7 @@ public sealed partial class IoTHubService [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.Failure, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - An unexpected exception of type '{exceptionType}' occurred when executing call against iot hub '{iotHubHostName}': {errorMessage}")] + Message = "{CallerMethodName}({CallerLineNumber}) - An unexpected exception of type '{exceptionType}' occurred when executing call against iot hub '{IotHubHostName}': {errorMessage}")] private partial void LogFailure( string iotHubHostName, string exceptionType, @@ -22,7 +22,7 @@ private partial void LogFailure( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrievingRegistryStatistics, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Retrieving registry statistics on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Retrieving registry statistics on iot hub '{IotHubHostName}'")] private partial void LogRetrievingRegistryStatistics( string iotHubHostName, [CallerMemberName] string callerMethodName = "", @@ -31,7 +31,7 @@ private partial void LogRetrievingRegistryStatistics( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrievingIotDevice, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Starting to retrieve iot edge device for deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Starting to retrieve iot edge device for deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogRetrievingDevice( string iotHubHostName, string deviceId, @@ -41,7 +41,7 @@ private partial void LogRetrievingDevice( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.IotDeviceNotFound, Level = LogLevel.Warning, - Message = "{callerMethodName}({callerLineNumber}) - Could not find iot edge device by deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not find iot edge device by deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogIotEdgeDeviceNotFound( string iotHubHostName, string deviceId, @@ -51,7 +51,7 @@ private partial void LogIotEdgeDeviceNotFound( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrieveIotDeviceSucceeded, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Retrieved iot edge device for deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Retrieved iot edge device for deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogRetrieveIotDeviceSucceeded( string iotHubHostName, string deviceId, @@ -61,7 +61,7 @@ private partial void LogRetrieveIotDeviceSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrievingDeviceConnectionString, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Starting to retrieve iot edge device connection-string for deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Starting to retrieve iot edge device connection-string for deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogRetrievingDeviceConnectionString( string iotHubHostName, string deviceId, @@ -71,7 +71,7 @@ private partial void LogRetrievingDeviceConnectionString( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrieveIotEdgeDeviceConnectionStringSucceeded, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Retrieved iot edge device connection-string for deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Retrieved iot edge device connection-string for deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogRetrieveIotEdgeDeviceConnectionStringSucceeded( string iotHubHostName, string deviceId, @@ -81,7 +81,7 @@ private partial void LogRetrieveIotEdgeDeviceConnectionStringSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrievingIotDeviceTwins, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Starting to retrieve iot device twins on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Starting to retrieve iot device twins on iot hub '{IotHubHostName}'")] private partial void LogRetrievingIotDeviceTwins( string iotHubHostName, [CallerMemberName] string callerMethodName = "", @@ -90,7 +90,7 @@ private partial void LogRetrievingIotDeviceTwins( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrieveIotDeviceTwinsSucceeded, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Retrieved '{deviceCount}' iot device twins from iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Retrieved '{deviceCount}' iot device twins from iot hub '{IotHubHostName}'")] private partial void LogRetrieveIotDeviceTwinsSucceeded( string iotHubHostName, int deviceCount, @@ -100,7 +100,7 @@ private partial void LogRetrieveIotDeviceTwinsSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrievingIotDeviceTwin, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Starting to retrieve iot device twin for deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Starting to retrieve iot device twin for deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogRetrievingDeviceTwin( string iotHubHostName, string deviceId, @@ -110,7 +110,7 @@ private partial void LogRetrievingDeviceTwin( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.IotDeviceTwinNotFound, Level = LogLevel.Warning, - Message = "{callerMethodName}({callerLineNumber}) - Could not find iot device twin by deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not find iot device twin by deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogIotDeviceTwinNotFound( string iotHubHostName, string deviceId, @@ -120,7 +120,7 @@ private partial void LogIotDeviceTwinNotFound( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrieveIotDeviceTwinSucceeded, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Retrieved iot device twin for deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Retrieved iot device twin for deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogRetrieveIotDeviceTwinSucceeded( string iotHubHostName, string deviceId, @@ -130,7 +130,7 @@ private partial void LogRetrieveIotDeviceTwinSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.UpdatingIotDeviceTwin, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Starting to update device twin for deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Starting to update device twin for deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogUpdatingDeviceTwin( string iotHubHostName, string deviceId, @@ -140,7 +140,7 @@ private partial void LogUpdatingDeviceTwin( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.IotDeviceTwinNotUpdated, Level = LogLevel.Warning, - Message = "{callerMethodName}({callerLineNumber}) - Could not update iot device twin by deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not update iot device twin by deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogIotDeviceTwinNotUpdated( string iotHubHostName, string deviceId, @@ -150,7 +150,7 @@ private partial void LogIotDeviceTwinNotUpdated( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.UpdateIotDeviceTwinSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Updated iot device twin for deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Updated iot device twin for deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogUpdateIotDeviceTwinSucceeded( string iotHubHostName, string deviceId, @@ -160,7 +160,7 @@ private partial void LogUpdateIotDeviceTwinSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.UpdatingModuleTwinDesiredProperties, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Starting to update module twin desired properties for deviceId '{deviceId}' and moduleId '{moduleId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Starting to update module twin desired properties for deviceId '{DeviceId}' and moduleId '{ModuleId}' on iot hub '{IotHubHostName}'")] private partial void LogUpdatingDeviceTwinDesiredProperties( string iotHubHostName, string deviceId, @@ -171,7 +171,7 @@ private partial void LogUpdatingDeviceTwinDesiredProperties( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.UpdateModuleTwinDesiredPropertiesSucceeded, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Updated module twin desired properties for deviceId '{deviceId}' and moduleId '{moduleId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Updated module twin desired properties for deviceId '{DeviceId}' and moduleId '{ModuleId}' on iot hub '{IotHubHostName}'")] private partial void LogUpdateModuleTwinDesiredPropertiesSucceeded( string iotHubHostName, string deviceId, @@ -182,7 +182,7 @@ private partial void LogUpdateModuleTwinDesiredPropertiesSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.ModuleTwinDesiredPropertiesNotUpdated, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Could not update module twin desired properties for deviceId '{deviceId}' and moduleId '{moduleId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not update module twin desired properties for deviceId '{DeviceId}' and moduleId '{ModuleId}' on iot hub '{IotHubHostName}'")] private partial void LogModuleTwinDesiredPropertiesNotUpdated( string iotHubHostName, string deviceId, @@ -193,7 +193,7 @@ private partial void LogModuleTwinDesiredPropertiesNotUpdated( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrievingIotEdgeDeviceModules, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Starting to retrieve iot edge device modules for deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Starting to retrieve iot edge device modules for deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogRetrievingIotEdgeDeviceModules( string iotHubHostName, string deviceId, @@ -203,7 +203,7 @@ private partial void LogRetrievingIotEdgeDeviceModules( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.IotEdgeDeviceModulesNotFound, Level = LogLevel.Warning, - Message = "{callerMethodName}({callerLineNumber}) - Could not find iot edge device modules for deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not find iot edge device modules for deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogIotEdgeDeviceModulesNotFound( string iotHubHostName, string deviceId, @@ -213,7 +213,7 @@ private partial void LogIotEdgeDeviceModulesNotFound( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrieveIotEdgeDeviceModulesSucceeded, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Retrieved iot edge device modules for deviceId '{deviceId}' from iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Retrieved iot edge device modules for deviceId '{DeviceId}' from iot hub '{IotHubHostName}'")] private partial void LogRetrieveIotEdgeDeviceModulesSucceeded( string iotHubHostName, string deviceId, @@ -223,7 +223,7 @@ private partial void LogRetrieveIotEdgeDeviceModulesSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrievingIotEdgeDeviceTwinModule, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Starting to retrieve iot edge device twin modules for deviceId '{deviceId}' and moduleId '{moduleId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Starting to retrieve iot edge device twin modules for deviceId '{DeviceId}' and moduleId '{ModuleId}' on iot hub '{IotHubHostName}'")] private partial void LogRetrievingIotEdgeDeviceTwinModule( string iotHubHostName, string deviceId, @@ -234,7 +234,7 @@ private partial void LogRetrievingIotEdgeDeviceTwinModule( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.IotEdgeDeviceTwinModuleNotFound, Level = LogLevel.Warning, - Message = "{callerMethodName}({callerLineNumber}) - Could not find iot edge device twin module for deviceId '{deviceId}' and moduleId '{moduleId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Could not find iot edge device twin module for deviceId '{DeviceId}' and moduleId '{ModuleId}' on iot hub '{IotHubHostName}'")] private partial void LogIotEdgeDeviceTwinModuleNotFound( string iotHubHostName, string deviceId, @@ -245,7 +245,7 @@ private partial void LogIotEdgeDeviceTwinModuleNotFound( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.RetrieveIotEdgeDeviceTwinModuleSucceeded, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Retrieved iot edge device twin modules for deviceId '{deviceId}' and moduleId '{moduleId}' from iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Retrieved iot edge device twin modules for deviceId '{DeviceId}' and moduleId '{ModuleId}' from iot hub '{IotHubHostName}'")] private partial void LogRetrieveIotEdgeDeviceTwinModuleSucceeded( string iotHubHostName, string deviceId, @@ -256,7 +256,7 @@ private partial void LogRetrieveIotEdgeDeviceTwinModuleSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.IotDeviceModuleRemoved, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully removed module '{moduleId}' from iot device '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully removed module '{ModuleId}' from iot device '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogIotDeviceModuleRemoved( string iotHubHostName, string deviceId, @@ -267,7 +267,7 @@ private partial void LogIotDeviceModuleRemoved( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.AddedModulesToIotEdgeDevice, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully added new modules to deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully added new modules to deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogAddedModulesToIotEdgeDevice( string iotHubHostName, string deviceId, @@ -277,7 +277,7 @@ private partial void LogAddedModulesToIotEdgeDevice( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.AppliedConfigurationContent, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully added configuration content for deviceId '{deviceId}' on iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully added configuration content for deviceId '{DeviceId}' on iot hub '{IotHubHostName}'")] private partial void LogAppliedConfigurationContent( string iotHubHostName, string deviceId, @@ -287,7 +287,7 @@ private partial void LogAppliedConfigurationContent( [LoggerMessage( EventId = LoggingEventIdConstants.IoTHubService.IotDeviceDeleted, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully deleted iot device '{deviceId}' from iot hub '{iotHubHostName}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully deleted iot device '{DeviceId}' from iot hub '{IotHubHostName}'")] private partial void LogIotDeviceDeleted( string iotHubHostName, string deviceId, diff --git a/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/AzureIoTHubService.cs b/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/AzureIoTHubService.cs index bb2dc74..2fc517b 100644 --- a/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/AzureIoTHubService.cs +++ b/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/AzureIoTHubService.cs @@ -30,13 +30,13 @@ public AzureIoTHubService( { rootNode = JsonNode.Parse(templateContent); - var modulesContent = rootNode!["modulesContent"]; - var edgeAgentDesired = modulesContent![EdgeAgentConstants.ModuleId]!["properties.desired"]; - var edgeAgentModulesSection = edgeAgentDesired!["modules"]; + var modulesContent = rootNode![PropertyNames.Manifest.ModulesContent]; + var edgeAgentDesired = modulesContent![EdgeAgentConstants.ModuleId]![PropertyNames.Manifest.ModulesContent]; + var edgeAgentModulesSection = edgeAgentDesired![PropertyNames.Modules]; foreach (var customModule in edgeAgentModulesSection!.AsObject().AsEnumerable()) { - var settings = customModule.Value!["settings"]; + var settings = customModule.Value![PropertyNames.ModuleSettings]; settings!["image"] = "wardsco/sleep:latest"; } diff --git a/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/AzureIoTHubServiceLoggerMessages.cs b/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/AzureIoTHubServiceLoggerMessages.cs index 54f6580..8612c79 100644 --- a/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/AzureIoTHubServiceLoggerMessages.cs +++ b/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/AzureIoTHubServiceLoggerMessages.cs @@ -11,7 +11,7 @@ public partial class AzureIoTHubService [LoggerMessage( EventId = LoggingEventIdConstants.IotHubProvisionIotEdgeDeviceSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully provisioned IoT Edge Device '{deviceId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully provisioned IoT Edge Device '{DeviceId}'.")] private partial void LogIotHubProvisionIotEdgeDeviceSucceeded( string deviceId, [CallerMemberName] string callerMethodName = "", @@ -20,7 +20,7 @@ private partial void LogIotHubProvisionIotEdgeDeviceSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IotHubProvisionIotEdgeDeviceFailed, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to provision IoT Edge Device '{deviceId}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to provision IoT Edge Device '{DeviceId}': '{ErrorMessage}'.")] private partial void LogIotHubProvisionIotEdgeDeviceFailed( string deviceId, string errorMessage, @@ -30,7 +30,7 @@ private partial void LogIotHubProvisionIotEdgeDeviceFailed( [LoggerMessage( EventId = LoggingEventIdConstants.IotHubProvisionIotEdgeDeviceInvalidManifest, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - {message}.")] // TODO: Improve + Message = "{CallerMethodName}({CallerLineNumber}) - {Message}.")] private partial void LogIotHubProvisionIotEdgeDeviceInvalidManifest( string message, [CallerMemberName] string callerMethodName = "", @@ -39,7 +39,7 @@ private partial void LogIotHubProvisionIotEdgeDeviceInvalidManifest( [LoggerMessage( EventId = LoggingEventIdConstants.IotHubTransformTemplateToManifestSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully transformed template to manifest.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully transformed template to manifest.")] private partial void LogIotHubTransformTemplateToManifestSucceeded( [CallerMemberName] string callerMethodName = "", [CallerLineNumber] int callerLineNumber = 0); @@ -47,7 +47,7 @@ private partial void LogIotHubTransformTemplateToManifestSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IotHubTransformTemplateToManifestFailed, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to transform template to manifest: '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to transform template to manifest: '{ErrorMessage}'.")] private partial void LogIotHubTransformTemplateToManifestFailed( string errorMessage, [CallerMemberName] string callerMethodName = "", @@ -56,7 +56,7 @@ private partial void LogIotHubTransformTemplateToManifestFailed( [LoggerMessage( EventId = LoggingEventIdConstants.IotHubAddModulesToIotEdgeDeviceSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully added new modules to IoT Edge Device '{deviceId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully added new modules to IoT Edge Device '{DeviceId}'.")] private partial void LogIotHubAddModulesToIotEdgeDeviceSucceeded( string deviceId, [CallerMemberName] string callerMethodName = "", @@ -65,7 +65,7 @@ private partial void LogIotHubAddModulesToIotEdgeDeviceSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IotHubAddModulesToIotEdgeDeviceFailed, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to add new modules to IoT Edge Device '{deviceId}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to add new modules to IoT Edge Device '{DeviceId}': '{ErrorMessage}'.")] private partial void LogIotHubAddModulesToIotEdgeDeviceFailed( string deviceId, string errorMessage, @@ -75,7 +75,7 @@ private partial void LogIotHubAddModulesToIotEdgeDeviceFailed( [LoggerMessage( EventId = LoggingEventIdConstants.IotHubApplyConfigurationContentToIotEdgeDeviceSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully added configuration content to IoT Edge Device '{deviceId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully added configuration content to IoT Edge Device '{DeviceId}'.")] private partial void LogIotHubApplyConfigurationContentToIotEdgeDeviceSucceeded( string deviceId, [CallerMemberName] string callerMethodName = "", @@ -84,7 +84,7 @@ private partial void LogIotHubApplyConfigurationContentToIotEdgeDeviceSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IotHubApplyConfigurationContentToIotEdgeDeviceFailed, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to add configuration content to IoT Edge Device '{deviceId}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to add configuration content to IoT Edge Device '{DeviceId}': '{ErrorMessage}'.")] private partial void LogIotHubApplyConfigurationContentToIotEdgeDeviceFailed( string deviceId, string errorMessage, @@ -94,7 +94,7 @@ private partial void LogIotHubApplyConfigurationContentToIotEdgeDeviceFailed( [LoggerMessage( EventId = LoggingEventIdConstants.IotHubRemoveModulesFromIotEdgeDeviceSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully removed old modules from IoT Edge Device '{deviceId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully removed old modules from IoT Edge Device '{DeviceId}'.")] private partial void LogIotHubRemoveModulesFromIotEdgeDeviceSucceeded( string deviceId, [CallerMemberName] string callerMethodName = "", @@ -103,7 +103,7 @@ private partial void LogIotHubRemoveModulesFromIotEdgeDeviceSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IotHubRemoveModulesFromIotEdgeDeviceFailed, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to remove old modules from IoT Edge Device '{deviceId}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to remove old modules from IoT Edge Device '{DeviceId}': '{ErrorMessage}'.")] private partial void LogIotHubRemoveModulesFromIotEdgeDeviceFailed( string deviceId, string errorMessage, diff --git a/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/Docker/DockerServiceLoggerMessages.cs b/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/Docker/DockerServiceLoggerMessages.cs index 0142313..f3e679b 100644 --- a/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/Docker/DockerServiceLoggerMessages.cs +++ b/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/Docker/DockerServiceLoggerMessages.cs @@ -11,7 +11,7 @@ public partial class DockerService [LoggerMessage( EventId = LoggingEventIdConstants.DockerClientCreated, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully created docker client.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully created docker client.")] private partial void LogDockerClientCreated( [CallerMemberName] string callerMethodName = "", [CallerLineNumber] int callerLineNumber = 0); @@ -19,7 +19,7 @@ private partial void LogDockerClientCreated( [LoggerMessage( EventId = LoggingEventIdConstants.DockerImageDownloadStarted, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Started downloading docker image '{imageName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Started downloading docker image '{ImageName}'.")] private partial void LogDockerImageDownloadStarted( string imageName, [CallerMemberName] string callerMethodName = "", @@ -28,7 +28,7 @@ private partial void LogDockerImageDownloadStarted( [LoggerMessage( EventId = LoggingEventIdConstants.DockerImageDownloadSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully downloaded docker image '{imageName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully downloaded docker image '{ImageName}'.")] private partial void LogDockerImageDownloadSucceeded( string imageName, [CallerMemberName] string callerMethodName = "", @@ -37,7 +37,7 @@ private partial void LogDockerImageDownloadSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.DockerImageDownloadStatus, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - -> {message}")] + Message = "{CallerMethodName}({CallerLineNumber}) - -> {Message}")] private partial void LogDockerImageDownloadStatus( string message, [CallerMemberName] string callerMethodName = "", @@ -46,7 +46,7 @@ private partial void LogDockerImageDownloadStatus( [LoggerMessage( EventId = LoggingEventIdConstants.DockerImageDownloadFailed, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to download docker image '{imageName}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to download docker image '{ImageName}': '{ErrorMessage}'.")] private partial void LogDockerImageDownloadFailed( string imageName, string errorMessage, @@ -56,7 +56,7 @@ private partial void LogDockerImageDownloadFailed( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerCreationStarted, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Started creating container '{containerName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Started creating container '{ContainerName}'.")] private partial void LogContainerCreationStarted( string containerName, [CallerMemberName] string callerMethodName = "", @@ -65,7 +65,7 @@ private partial void LogContainerCreationStarted( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerCreationSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully created container '{containerName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully created container '{ContainerName}'.")] private partial void LogContainerCreationSucceeded( string containerName, [CallerMemberName] string callerMethodName = "", @@ -74,7 +74,7 @@ private partial void LogContainerCreationSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerCreationFailed, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to create container '{containerName}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to create container '{ContainerName}': '{errorMessage}'.")] private partial void LogContainerCreationFailed( string containerName, string errorMessage, @@ -84,7 +84,7 @@ private partial void LogContainerCreationFailed( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerStarting, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Starting container '{containerName}' with containerId '{containerId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Starting container '{ContainerName}' with containerId '{ContainerId}'.")] private partial void LogContainerStarting( string containerName, string containerId, @@ -94,7 +94,7 @@ private partial void LogContainerStarting( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerStartSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully started container '{containerName}' with containerId '{containerId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully started container '{ContainerName}' with containerId '{ContainerId}'.")] private partial void LogContainerStartSucceeded( string containerName, string containerId, @@ -104,7 +104,7 @@ private partial void LogContainerStartSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerStartFailed, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to start container '{containerName}' with containerId '{containerId}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to start container '{ContainerName}' with containerId '{ContainerId}': '{ErrorMessage}'.")] private partial void LogContainerStartFailed( string containerName, string containerId, @@ -115,7 +115,7 @@ private partial void LogContainerStartFailed( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerStopMissingContainerId, Level = LogLevel.Warning, - Message = "{callerMethodName}({callerLineNumber}) - Can not stop container '{containerName}' due to missing containerId.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Can not stop container '{ContainerName}' due to missing ContainerId.")] private partial void LogContainerStopMissingContainerId( string containerName, [CallerMemberName] string callerMethodName = "", @@ -124,7 +124,7 @@ private partial void LogContainerStopMissingContainerId( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerStopping, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Stopping container '{containerName}' with containerId '{containerId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Stopping container '{ContainerName}' with containerId '{ContainerId}'.")] private partial void LogContainerStopping( string containerName, string containerId, @@ -134,7 +134,7 @@ private partial void LogContainerStopping( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerStopSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully stopped container '{containerName}' with containerId '{containerId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully stopped container '{ContainerName}' with containerId '{ContainerId}'.")] private partial void LogContainerStopSucceeded( string containerName, string containerId, @@ -144,7 +144,7 @@ private partial void LogContainerStopSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerRemovalStarting, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Removing container '{containerName}' with containerId '{containerId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Removing container '{ContainerName}' with containerId '{ContainerId}'.")] private partial void LogContainerRemovalStarting( string containerName, string containerId, @@ -154,7 +154,7 @@ private partial void LogContainerRemovalStarting( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerRemovalSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully removed container '{containerName}' with containerId '{containerId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully removed container '{ContainerName}' with containerId '{ContainerId}'.")] private partial void LogContainerRemovalSucceeded( string containerName, string containerId, @@ -164,7 +164,7 @@ private partial void LogContainerRemovalSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.DockerContainerStopOrRemovalFailed, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to stop/remove container '{containerName}' with containerId '{containerId}': '{errorMessage}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to stop/remove container '{ContainerName}' with containerId '{ContainerId}': '{ErrorMessage}'.")] private partial void LogContainerStopOrRemovalFailed( string containerName, string containerId, @@ -175,7 +175,7 @@ private partial void LogContainerStopOrRemovalFailed( [LoggerMessage( EventId = LoggingEventIdConstants.IotEdgeEmulatorCheck, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Starting check if IoTEdge module '{moduleName}' is running in container '{containerName}' with containerId '{containerId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Starting check if IoTEdge module '{ModuleName}' is running in container '{ContainerName}' with containerId '{ContainerId}'.")] private partial void LogIotEdgeEmulatorCheck( string moduleName, string containerName, @@ -186,7 +186,7 @@ private partial void LogIotEdgeEmulatorCheck( [LoggerMessage( EventId = LoggingEventIdConstants.IotEdgeEmulatorWaiting, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Waiting {secondsBetweenRetries} seconds for IoTEdge module '{moduleName}' to become available in container '{containerName}' with containerId '{containerId}' - retry ({currentIteration}/{numberOfRetries}).")] + Message = "{CallerMethodName}({CallerLineNumber}) - Waiting {SecondsBetweenRetries} seconds for IoTEdge module '{ModuleName}' to become available in container '{ContainerName}' with containerId '{ContainerId}' - retry ({CurrentIteration}/{NumberOfRetries}).")] private partial void LogIotEdgeEmulatorWaiting( string moduleName, string containerName, @@ -200,7 +200,7 @@ private partial void LogIotEdgeEmulatorWaiting( [LoggerMessage( EventId = LoggingEventIdConstants.IotEdgeEmulatorReady, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - IoTEdge module '{moduleName}' is now running in container '{containerName}' with containerId '{containerId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - IoTEdge module '{ModuleName}' is now running in container '{ContainerName}' with containerId '{ContainerId}'.")] private partial void LogIotEdgeEmulatorReady( string moduleName, string containerName, @@ -211,7 +211,7 @@ private partial void LogIotEdgeEmulatorReady( [LoggerMessage( EventId = LoggingEventIdConstants.IotEdgeEmulatorFetchingVariables, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Fetching IoT Edge environment variables from module '{moduleName}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Fetching IoT Edge environment variables from module '{ModuleName}'.")] private partial void LogIotEdgeEmulatorFetchingVariables( string moduleName, [CallerMemberName] string callerMethodName = "", @@ -220,7 +220,7 @@ private partial void LogIotEdgeEmulatorFetchingVariables( [LoggerMessage( EventId = LoggingEventIdConstants.DockerProcessCommandFailure, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failure running docker command - error: '{message}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failure running docker command - error: '{Message}'.")] private partial void LogDockerProcessCommandFailure( string message, [CallerMemberName] string callerMethodName = "", diff --git a/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/Environment/SystemEnvironmentServiceLoggerMessages.cs b/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/Environment/SystemEnvironmentServiceLoggerMessages.cs index 872feae..a26584c 100644 --- a/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/Environment/SystemEnvironmentServiceLoggerMessages.cs +++ b/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/Environment/SystemEnvironmentServiceLoggerMessages.cs @@ -11,7 +11,7 @@ public partial class SystemEnvironmentService [LoggerMessage( EventId = LoggingEventIdConstants.EnvironmentInjectedVariable, Level = LogLevel.Trace, - Message = "{callerMethodName}({callerLineNumber}) - Injected variable: {key}={value}.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Injected variable: {Key}={Value}.")] private partial void LogEnvironmentInjectedVariable( string key, string value, @@ -21,7 +21,7 @@ private partial void LogEnvironmentInjectedVariable( [LoggerMessage( EventId = LoggingEventIdConstants.EnvironmentPlatformNotSupported, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - {message}")] + Message = "{CallerMethodName}({CallerLineNumber}) - {Message}")] private partial void LogEnvironmentPlatformNotSupported( string message, [CallerMemberName] string callerMethodName = "", diff --git a/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/IoTEdgeEmulationServiceLoggerMessages.cs b/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/IoTEdgeEmulationServiceLoggerMessages.cs index e4ca6b3..0bfc802 100644 --- a/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/IoTEdgeEmulationServiceLoggerMessages.cs +++ b/src/Atc.Azure.IoTEdge.DeviceEmulator/Services/IoTEdgeEmulationServiceLoggerMessages.cs @@ -11,7 +11,7 @@ public partial class IoTEdgeEmulationService [LoggerMessage( EventId = LoggingEventIdConstants.IotEdgeEmulatorStarting, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - IoT Edge Emulator is starting for device '{deviceId}'.")] + Message = "{CallerMethodName}({CallerLineNumber}) - IoT Edge Emulator is starting for device '{DeviceId}'.")] private partial void LogIotEdgeEmulatorStarting( string deviceId, [CallerMemberName] string callerMethodName = "", @@ -20,7 +20,7 @@ private partial void LogIotEdgeEmulatorStarting( [LoggerMessage( EventId = LoggingEventIdConstants.IotEdgeEmulatorGetTemplateContentSucceeded, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Successfully retrieved template content.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Successfully retrieved template content.")] private partial void LogIotEdgeEmulatorGetTemplateContentSucceeded( [CallerMemberName] string callerMethodName = "", [CallerLineNumber] int callerLineNumber = 0); @@ -28,7 +28,7 @@ private partial void LogIotEdgeEmulatorGetTemplateContentSucceeded( [LoggerMessage( EventId = LoggingEventIdConstants.IotEdgeEmulatorGetTemplateContentFailed, Level = LogLevel.Error, - Message = "{callerMethodName}({callerLineNumber}) - Failed to retrieve template content: '{errorMessage}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - Failed to retrieve template content: '{ErrorMessage}'")] private partial void LogIotEdgeEmulatorGetTemplateContentFailed( string errorMessage, [CallerMemberName] string callerMethodName = "", @@ -37,7 +37,7 @@ private partial void LogIotEdgeEmulatorGetTemplateContentFailed( [LoggerMessage( EventId = LoggingEventIdConstants.IotEdgeEmulatorEnsuringProperVariables, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - Ensuring proper IoT Edge variables are set locally for emulator.")] + Message = "{CallerMethodName}({CallerLineNumber}) - Ensuring proper IoT Edge variables are set locally for emulator.")] private partial void LogIotEdgeEmulatorEnsuringProperVariables( [CallerMemberName] string callerMethodName = "", [CallerLineNumber] int callerLineNumber = 0); @@ -45,7 +45,7 @@ private partial void LogIotEdgeEmulatorEnsuringProperVariables( [LoggerMessage( EventId = LoggingEventIdConstants.IotEdgeEmulatorStopping, Level = LogLevel.Information, - Message = "{callerMethodName}({callerLineNumber}) - IoT Edge Emulator is stopping for device '{deviceId}'")] + Message = "{CallerMethodName}({CallerLineNumber}) - IoT Edge Emulator is stopping for device '{DeviceId}'")] private partial void LogIotEdgeEmulatorStopping( string deviceId, [CallerMemberName] string callerMethodName = "",