Exemplo n.º 1
0
        internal static DeviceUpdateInstanceData DeserializeDeviceUpdateInstanceData(JsonElement element)
        {
            IDictionary <string, string> tags = default;
            AzureLocation                          location                    = default;
            ResourceIdentifier                     id                          = default;
            string                                 name                        = default;
            ResourceType                           type                        = default;
            SystemData                             systemData                  = default;
            Optional <ProvisioningState>           provisioningState           = default;
            Optional <string>                      accountName                 = default;
            Optional <IList <IotHubSettings> >     iotHubs                     = default;
            Optional <bool>                        enableDiagnostics           = default;
            Optional <DiagnosticStorageProperties> diagnosticStorageProperties = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("accountName"))
                        {
                            accountName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("iotHubs"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <IotHubSettings> array = new List <IotHubSettings>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(IotHubSettings.DeserializeIotHubSettings(item));
                            }
                            iotHubs = array;
                            continue;
                        }
                        if (property0.NameEquals("enableDiagnostics"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableDiagnostics = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("diagnosticStorageProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            diagnosticStorageProperties = DiagnosticStorageProperties.DeserializeDiagnosticStorageProperties(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new DeviceUpdateInstanceData(id, name, type, systemData, tags, location, Optional.ToNullable(provisioningState), accountName.Value, Optional.ToList(iotHubs), Optional.ToNullable(enableDiagnostics), diagnosticStorageProperties.Value));
        }
Exemplo n.º 2
0
 public IotHub(IotHubSettings settings)
 {
     _settings = settings;
 }
 public MessageReaderService(ILogger <MessageReaderService> logger, IotHubSettings iotHubSettings, IActorSystemService actorSystem)
 {
     _logger         = logger;
     _iotHubSettings = iotHubSettings;
     _actorSystem    = actorSystem;
 }