コード例 #1
0
 internal ModuleIdentity(string moduleId, string managedBy, string deviceId, string generationId, string etag, ModuleConnectionState?connectionState, DateTimeOffset?connectionStateUpdatedTime, DateTimeOffset?lastActivityTime, int?cloudToDeviceMessageCount, AuthenticationMechanism authentication)
 {
     ModuleId                   = moduleId;
     ManagedBy                  = managedBy;
     DeviceId                   = deviceId;
     GenerationId               = generationId;
     Etag                       = etag;
     ConnectionState            = connectionState;
     ConnectionStateUpdatedTime = connectionStateUpdatedTime;
     LastActivityTime           = lastActivityTime;
     CloudToDeviceMessageCount  = cloudToDeviceMessageCount;
     Authentication             = authentication;
 }
コード例 #2
0
 internal DeviceIdentity(string deviceId, string generationId, string etag, DeviceConnectionState?connectionState, DeviceStatus?status, string statusReason, DateTimeOffset?connectionStateUpdatedTime, DateTimeOffset?statusUpdatedTime, DateTimeOffset?lastActivityTime, int?cloudToDeviceMessageCount, AuthenticationMechanism authentication, DeviceCapabilities capabilities, string deviceScope)
 {
     DeviceId                   = deviceId;
     GenerationId               = generationId;
     Etag                       = etag;
     ConnectionState            = connectionState;
     Status                     = status;
     StatusReason               = statusReason;
     ConnectionStateUpdatedTime = connectionStateUpdatedTime;
     StatusUpdatedTime          = statusUpdatedTime;
     LastActivityTime           = lastActivityTime;
     CloudToDeviceMessageCount  = cloudToDeviceMessageCount;
     Authentication             = authentication;
     Capabilities               = capabilities;
     DeviceScope                = deviceScope;
 }
コード例 #3
0
 internal ExportImportDevice(string id, string moduleId, string eTag, ExportImportDeviceImportMode?importMode, ExportImportDeviceStatus?status, string statusReason, AuthenticationMechanism authentication, string twinETag, IDictionary <string, object> tags, PropertyContainer properties, DeviceCapabilities capabilities, string deviceScope, IList <string> parentScopes)
 {
     Id             = id;
     ModuleId       = moduleId;
     ETag           = eTag;
     ImportMode     = importMode;
     Status         = status;
     StatusReason   = statusReason;
     Authentication = authentication;
     TwinETag       = twinETag;
     Tags           = tags;
     Properties     = properties;
     Capabilities   = capabilities;
     DeviceScope    = deviceScope;
     ParentScopes   = parentScopes;
 }
コード例 #4
0
        internal static DeviceIdentity DeserializeDeviceIdentity(JsonElement element)
        {
            Optional <string> deviceId     = default;
            Optional <string> generationId = default;
            Optional <string> etag         = default;
            Optional <DeviceConnectionState> connectionState = default;
            Optional <DeviceStatus>          status          = default;
            Optional <string>                  statusReason  = default;
            Optional <DateTimeOffset>          connectionStateUpdatedTime = default;
            Optional <DateTimeOffset>          statusUpdatedTime          = default;
            Optional <DateTimeOffset>          lastActivityTime           = default;
            Optional <int>                     cloudToDeviceMessageCount  = default;
            Optional <AuthenticationMechanism> authentication             = default;
            Optional <DeviceCapabilities>      capabilities = default;
            Optional <string>                  deviceScope  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("deviceId"))
                {
                    deviceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("generationId"))
                {
                    generationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectionState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    connectionState = new DeviceConnectionState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = new DeviceStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("statusReason"))
                {
                    statusReason = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectionStateUpdatedTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    connectionStateUpdatedTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("statusUpdatedTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    statusUpdatedTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("lastActivityTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    lastActivityTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("cloudToDeviceMessageCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    cloudToDeviceMessageCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("authentication"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    authentication = AuthenticationMechanism.DeserializeAuthenticationMechanism(property.Value);
                    continue;
                }
                if (property.NameEquals("capabilities"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    capabilities = DeviceCapabilities.DeserializeDeviceCapabilities(property.Value);
                    continue;
                }
                if (property.NameEquals("deviceScope"))
                {
                    deviceScope = property.Value.GetString();
                    continue;
                }
            }
            return(new DeviceIdentity(deviceId.Value, generationId.Value, etag.Value, Optional.ToNullable(connectionState), Optional.ToNullable(status), statusReason.Value, Optional.ToNullable(connectionStateUpdatedTime), Optional.ToNullable(statusUpdatedTime), Optional.ToNullable(lastActivityTime), Optional.ToNullable(cloudToDeviceMessageCount), authentication.Value, capabilities.Value, deviceScope.Value));
        }
コード例 #5
0
        internal static DeviceIdentity DeserializeDeviceIdentity(JsonElement element)
        {
            string deviceId     = default;
            string generationId = default;
            string etag         = default;
            DeviceConnectionState?connectionState = default;
            DeviceStatus?         status          = default;
            string                  statusReason  = default;
            DateTimeOffset?         connectionStateUpdatedTime = default;
            DateTimeOffset?         statusUpdatedTime          = default;
            DateTimeOffset?         lastActivityTime           = default;
            int?                    cloudToDeviceMessageCount  = default;
            AuthenticationMechanism authentication             = default;
            DeviceCapabilities      capabilities = default;
            string                  deviceScope  = default;
            IList <string>          parentScopes = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("deviceId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    deviceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("generationId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    generationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectionState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    connectionState = new DeviceConnectionState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    status = new DeviceStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("statusReason"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    statusReason = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectionStateUpdatedTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    connectionStateUpdatedTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("statusUpdatedTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    statusUpdatedTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("lastActivityTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    lastActivityTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("cloudToDeviceMessageCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    cloudToDeviceMessageCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("authentication"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    authentication = AuthenticationMechanism.DeserializeAuthenticationMechanism(property.Value);
                    continue;
                }
                if (property.NameEquals("capabilities"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    capabilities = DeviceCapabilities.DeserializeDeviceCapabilities(property.Value);
                    continue;
                }
                if (property.NameEquals("deviceScope"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    deviceScope = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("parentScopes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(item.GetString());
                        }
                    }
                    parentScopes = array;
                    continue;
                }
            }
            return(new DeviceIdentity(deviceId, generationId, etag, connectionState, status, statusReason, connectionStateUpdatedTime, statusUpdatedTime, lastActivityTime, cloudToDeviceMessageCount, authentication, capabilities, deviceScope, parentScopes));
        }
コード例 #6
0
        internal static ModuleIdentity DeserializeModuleIdentity(JsonElement element)
        {
            Optional <string> moduleId     = default;
            Optional <string> managedBy    = default;
            Optional <string> deviceId     = default;
            Optional <string> generationId = default;
            Optional <string> etag         = default;
            Optional <ModuleConnectionState> connectionState            = default;
            Optional <DateTimeOffset>        connectionStateUpdatedTime = default;
            Optional <DateTimeOffset>        lastActivityTime           = default;
            Optional <int> cloudToDeviceMessageCount          = default;
            Optional <AuthenticationMechanism> authentication = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("moduleId"))
                {
                    moduleId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("managedBy"))
                {
                    managedBy = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("deviceId"))
                {
                    deviceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("generationId"))
                {
                    generationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectionState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    connectionState = new ModuleConnectionState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("connectionStateUpdatedTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    connectionStateUpdatedTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("lastActivityTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    lastActivityTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("cloudToDeviceMessageCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    cloudToDeviceMessageCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("authentication"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    authentication = AuthenticationMechanism.DeserializeAuthenticationMechanism(property.Value);
                    continue;
                }
            }
            return(new ModuleIdentity(moduleId.Value, managedBy.Value, deviceId.Value, generationId.Value, etag.Value, Optional.ToNullable(connectionState), Optional.ToNullable(connectionStateUpdatedTime), Optional.ToNullable(lastActivityTime), Optional.ToNullable(cloudToDeviceMessageCount), authentication.Value));
        }
コード例 #7
0
        internal static DeviceIdentity DeserializeDeviceIdentity(JsonElement element)
        {
            Optional <string> deviceId     = default;
            Optional <string> generationId = default;
            Optional <string> etag         = default;
            Optional <DeviceConnectionState> connectionState = default;
            Optional <DeviceStatus>          status          = default;
            Optional <string>                  statusReason  = default;
            Optional <DateTimeOffset>          connectionStateUpdatedTime = default;
            Optional <DateTimeOffset>          statusUpdatedTime          = default;
            Optional <DateTimeOffset>          lastActivityTime           = default;
            Optional <int>                     cloudToDeviceMessageCount  = default;
            Optional <AuthenticationMechanism> authentication             = default;
            Optional <DeviceCapabilities>      capabilities = default;
            Optional <string>                  deviceScope  = default;
            Optional <IList <string> >         parentScopes = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("deviceId"))
                {
                    deviceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("generationId"))
                {
                    generationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectionState"))
                {
                    connectionState = new DeviceConnectionState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = new DeviceStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("statusReason"))
                {
                    statusReason = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectionStateUpdatedTime"))
                {
                    connectionStateUpdatedTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("statusUpdatedTime"))
                {
                    statusUpdatedTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("lastActivityTime"))
                {
                    lastActivityTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("cloudToDeviceMessageCount"))
                {
                    cloudToDeviceMessageCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("authentication"))
                {
                    authentication = AuthenticationMechanism.DeserializeAuthenticationMechanism(property.Value);
                    continue;
                }
                if (property.NameEquals("capabilities"))
                {
                    capabilities = DeviceCapabilities.DeserializeDeviceCapabilities(property.Value);
                    continue;
                }
                if (property.NameEquals("deviceScope"))
                {
                    deviceScope = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("parentScopes"))
                {
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    parentScopes = array;
                    continue;
                }
            }
            return(new DeviceIdentity(deviceId.Value, generationId.Value, etag.Value, Optional.ToNullable(connectionState), Optional.ToNullable(status), statusReason.Value, Optional.ToNullable(connectionStateUpdatedTime), Optional.ToNullable(statusUpdatedTime), Optional.ToNullable(lastActivityTime), Optional.ToNullable(cloudToDeviceMessageCount), authentication.Value, capabilities.Value, deviceScope.Value, Optional.ToList(parentScopes)));
        }
コード例 #8
0
        internal static ModuleIdentity DeserializeModuleIdentity(JsonElement element)
        {
            string moduleId     = default;
            string managedBy    = default;
            string deviceId     = default;
            string generationId = default;
            string etag         = default;
            ModuleConnectionState?connectionState            = default;
            DateTimeOffset?       connectionStateUpdatedTime = default;
            DateTimeOffset?       lastActivityTime           = default;
            int?cloudToDeviceMessageCount          = default;
            AuthenticationMechanism authentication = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("moduleId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    moduleId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("managedBy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    managedBy = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("deviceId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    deviceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("generationId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    generationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectionState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    connectionState = new ModuleConnectionState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("connectionStateUpdatedTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    connectionStateUpdatedTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("lastActivityTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    lastActivityTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("cloudToDeviceMessageCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    cloudToDeviceMessageCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("authentication"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    authentication = AuthenticationMechanism.DeserializeAuthenticationMechanism(property.Value);
                    continue;
                }
            }
            return(new ModuleIdentity(moduleId, managedBy, deviceId, generationId, etag, connectionState, connectionStateUpdatedTime, lastActivityTime, cloudToDeviceMessageCount, authentication));
        }