internal Update(UpdateId updateId, string updateType, string installedCriteria, IEnumerable <Compatibility> compatibility, string manifestVersion, DateTimeOffset importedDateTime, DateTimeOffset createdDateTime) { if (updateId == null) { throw new ArgumentNullException(nameof(updateId)); } if (updateType == null) { throw new ArgumentNullException(nameof(updateType)); } if (installedCriteria == null) { throw new ArgumentNullException(nameof(installedCriteria)); } if (compatibility == null) { throw new ArgumentNullException(nameof(compatibility)); } if (manifestVersion == null) { throw new ArgumentNullException(nameof(manifestVersion)); } UpdateId = updateId; UpdateType = updateType; InstalledCriteria = installedCriteria; Compatibility = compatibility.ToList(); ManifestVersion = manifestVersion; ImportedDateTime = importedDateTime; CreatedDateTime = createdDateTime; }
internal static PageableListOfUpdateIds DeserializePageableListOfUpdateIds(JsonElement element) { Optional <IReadOnlyList <UpdateId> > value = default; Optional <string> nextLink = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <UpdateId> array = new List <UpdateId>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(UpdateId.DeserializeUpdateId(item)); } value = array; continue; } if (property.NameEquals("nextLink")) { nextLink = property.Value.GetString(); continue; } } return(new PageableListOfUpdateIds(Optional.ToList(value), nextLink.Value)); }
public ImportManifest(UpdateId updateId, string updateType, string installedCriteria, List <ImportManifestCompatibilityInfo> compatibility, DateTime createdDateTime, Version manifestVersion, List <ImportManifestFile> files) { UpdateId = updateId; UpdateType = updateType; InstalledCriteria = installedCriteria; Compatibility = compatibility; CreatedDateTime = createdDateTime; ManifestVersion = manifestVersion; Files = files; }
internal UpdatableDevices(UpdateId updateId, int deviceCount) { if (updateId == null) { throw new ArgumentNullException(nameof(updateId)); } UpdateId = updateId; DeviceCount = deviceCount; }
internal Update(UpdateId updateId, string updateType, string installedCriteria, IReadOnlyList <Compatibility> compatibility, string manifestVersion, DateTimeOffset importedDateTime, DateTimeOffset createdDateTime, string etag) { UpdateId = updateId; UpdateType = updateType; InstalledCriteria = installedCriteria; Compatibility = compatibility; ManifestVersion = manifestVersion; ImportedDateTime = importedDateTime; CreatedDateTime = createdDateTime; Etag = etag; }
internal Operation(string operationId, OperationStatus status, UpdateId updateId, string resourceLocation, Error error, string traceId, DateTimeOffset lastActionDateTime, DateTimeOffset createdDateTime, string etag) { OperationId = operationId; Status = status; UpdateId = updateId; ResourceLocation = resourceLocation; Error = error; TraceId = traceId; LastActionDateTime = lastActionDateTime; CreatedDateTime = createdDateTime; Etag = etag; }
internal Deployment(string deploymentId, DeploymentType deploymentType, string deviceClassId, DateTimeOffset startDateTime, DeviceGroupType deviceGroupType, IList <string> deviceGroupDefinition, UpdateId updateId, bool?isCanceled, bool?isRetried, bool?isCompleted) { DeploymentId = deploymentId; DeploymentType = deploymentType; DeviceClassId = deviceClassId; StartDateTime = startDateTime; DeviceGroupType = deviceGroupType; DeviceGroupDefinition = deviceGroupDefinition; UpdateId = updateId; IsCanceled = isCanceled; IsRetried = isRetried; IsCompleted = isCompleted; }
internal Device(string deviceId, string deviceClassId, string manufacturer, string model, string groupId, UpdateId lastAttemptedUpdateId, DeviceDeploymentState?deploymentStatus, UpdateId installedUpdateId, bool onLatestUpdate, string lastDeploymentId) { DeviceId = deviceId; DeviceClassId = deviceClassId; Manufacturer = manufacturer; Model = model; GroupId = groupId; LastAttemptedUpdateId = lastAttemptedUpdateId; DeploymentStatus = deploymentStatus; InstalledUpdateId = installedUpdateId; OnLatestUpdate = onLatestUpdate; LastDeploymentId = lastDeploymentId; }
internal DeviceClass(string deviceClassId, string manufacturer, string model, UpdateId bestCompatibleUpdateId) { if (deviceClassId == null) { throw new ArgumentNullException(nameof(deviceClassId)); } if (manufacturer == null) { throw new ArgumentNullException(nameof(manufacturer)); } if (model == null) { throw new ArgumentNullException(nameof(model)); } DeviceClassId = deviceClassId; Manufacturer = manufacturer; Model = model; BestCompatibleUpdateId = bestCompatibleUpdateId; }
internal static UpdatableDevices DeserializeUpdatableDevices(JsonElement element) { UpdateId updateId = default; int deviceCount = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("updateId")) { updateId = UpdateId.DeserializeUpdateId(property.Value); continue; } if (property.NameEquals("deviceCount")) { deviceCount = property.Value.GetInt32(); continue; } } return(new UpdatableDevices(updateId, deviceCount)); }
public Deployment(string deploymentId, DeploymentType deploymentType, DateTimeOffset startDateTime, DeviceGroupType deviceGroupType, IEnumerable <string> deviceGroupDefinition, UpdateId updateId) { if (deploymentId == null) { throw new ArgumentNullException(nameof(deploymentId)); } if (deviceGroupDefinition == null) { throw new ArgumentNullException(nameof(deviceGroupDefinition)); } if (updateId == null) { throw new ArgumentNullException(nameof(updateId)); } DeploymentId = deploymentId; DeploymentType = deploymentType; StartDateTime = startDateTime; DeviceGroupType = deviceGroupType; DeviceGroupDefinition = deviceGroupDefinition.ToList(); UpdateId = updateId; }
internal static DeviceClass DeserializeDeviceClass(JsonElement element) { string deviceClassId = default; string manufacturer = default; string model = default; UpdateId bestCompatibleUpdateId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("deviceClassId")) { deviceClassId = property.Value.GetString(); continue; } if (property.NameEquals("manufacturer")) { manufacturer = property.Value.GetString(); continue; } if (property.NameEquals("model")) { model = property.Value.GetString(); continue; } if (property.NameEquals("bestCompatibleUpdateId")) { if (property.Value.ValueKind == JsonValueKind.Null) { bestCompatibleUpdateId = null; continue; } bestCompatibleUpdateId = UpdateId.DeserializeUpdateId(property.Value); continue; } } return(new DeviceClass(deviceClassId, manufacturer, model, bestCompatibleUpdateId)); }
public static DeviceClass DeviceClass(string deviceClassId = null, string manufacturer = null, string model = null, UpdateId bestCompatibleUpdateId = null) { return(new DeviceClass(deviceClassId, manufacturer, model, bestCompatibleUpdateId)); }
public static UpdatableDevices UpdatableDevices(UpdateId updateId = null, int deviceCount = default) { return(new UpdatableDevices(updateId, deviceCount)); }
internal static Deployment DeserializeDeployment(JsonElement element) { string deploymentId = default; DeploymentType deploymentType = default; Optional <string> deviceClassId = default; DateTimeOffset startDateTime = default; DeviceGroupType deviceGroupType = default; IList <string> deviceGroupDefinition = default; UpdateId updateId = default; Optional <bool> isCanceled = default; Optional <bool> isRetried = default; Optional <bool> isCompleted = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("deploymentId")) { deploymentId = property.Value.GetString(); continue; } if (property.NameEquals("deploymentType")) { deploymentType = new DeploymentType(property.Value.GetString()); continue; } if (property.NameEquals("deviceClassId")) { deviceClassId = property.Value.GetString(); continue; } if (property.NameEquals("startDateTime")) { startDateTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("deviceGroupType")) { deviceGroupType = new DeviceGroupType(property.Value.GetString()); continue; } if (property.NameEquals("deviceGroupDefinition")) { List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } deviceGroupDefinition = array; continue; } if (property.NameEquals("updateId")) { updateId = UpdateId.DeserializeUpdateId(property.Value); continue; } if (property.NameEquals("isCanceled")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } isCanceled = property.Value.GetBoolean(); continue; } if (property.NameEquals("isRetried")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } isRetried = property.Value.GetBoolean(); continue; } if (property.NameEquals("isCompleted")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } isCompleted = property.Value.GetBoolean(); continue; } } return(new Deployment(deploymentId, deploymentType, deviceClassId.Value, startDateTime, deviceGroupType, deviceGroupDefinition, updateId, Optional.ToNullable(isCanceled), Optional.ToNullable(isRetried), Optional.ToNullable(isCompleted))); }
internal static Device DeserializeDevice(JsonElement element) { string deviceId = default; string deviceClassId = default; string manufacturer = default; string model = default; Optional <string> groupId = default; Optional <UpdateId> lastAttemptedUpdateId = default; Optional <DeviceDeploymentState> deploymentStatus = default; Optional <UpdateId> installedUpdateId = default; bool onLatestUpdate = default; Optional <string> lastDeploymentId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("deviceId")) { deviceId = property.Value.GetString(); continue; } if (property.NameEquals("deviceClassId")) { deviceClassId = property.Value.GetString(); continue; } if (property.NameEquals("manufacturer")) { manufacturer = property.Value.GetString(); continue; } if (property.NameEquals("model")) { model = property.Value.GetString(); continue; } if (property.NameEquals("groupId")) { groupId = property.Value.GetString(); continue; } if (property.NameEquals("lastAttemptedUpdateId")) { if (property.Value.ValueKind == JsonValueKind.Null) { lastAttemptedUpdateId = null; continue; } lastAttemptedUpdateId = UpdateId.DeserializeUpdateId(property.Value); continue; } if (property.NameEquals("deploymentStatus")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } deploymentStatus = new DeviceDeploymentState(property.Value.GetString()); continue; } if (property.NameEquals("installedUpdateId")) { if (property.Value.ValueKind == JsonValueKind.Null) { installedUpdateId = null; continue; } installedUpdateId = UpdateId.DeserializeUpdateId(property.Value); continue; } if (property.NameEquals("onLatestUpdate")) { onLatestUpdate = property.Value.GetBoolean(); continue; } if (property.NameEquals("lastDeploymentId")) { lastDeploymentId = property.Value.GetString(); continue; } } return(new Device(deviceId, deviceClassId, manufacturer, model, groupId.Value, lastAttemptedUpdateId.Value, Optional.ToNullable(deploymentStatus), installedUpdateId.Value, onLatestUpdate, lastDeploymentId.Value)); }
internal static Update DeserializeUpdate(JsonElement element) { UpdateId updateId = default; string updateType = default; string installedCriteria = default; IReadOnlyList <Compatibility> compatibility = default; string manifestVersion = default; DateTimeOffset importedDateTime = default; DateTimeOffset createdDateTime = default; Optional <string> etag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("updateId")) { updateId = UpdateId.DeserializeUpdateId(property.Value); continue; } if (property.NameEquals("updateType")) { updateType = property.Value.GetString(); continue; } if (property.NameEquals("installedCriteria")) { installedCriteria = property.Value.GetString(); continue; } if (property.NameEquals("compatibility")) { List <Compatibility> array = new List <Compatibility>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(Models.Compatibility.DeserializeCompatibility(item)); } compatibility = array; continue; } if (property.NameEquals("manifestVersion")) { manifestVersion = property.Value.GetString(); continue; } if (property.NameEquals("importedDateTime")) { importedDateTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("createdDateTime")) { createdDateTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } } return(new Update(updateId, updateType, installedCriteria, compatibility, manifestVersion, importedDateTime, createdDateTime, etag.Value)); }
public static Update Update(UpdateId updateId = null, string updateType = null, string installedCriteria = null, IEnumerable <Compatibility> compatibility = null, string manifestVersion = null, DateTimeOffset importedDateTime = default, DateTimeOffset createdDateTime = default, string etag = null) { compatibility ??= new List <Compatibility>(); return(new Update(updateId, updateType, installedCriteria, compatibility?.ToList(), manifestVersion, importedDateTime, createdDateTime, etag)); }
public static Operation Operation(string operationId = null, OperationStatus status = default, UpdateId updateId = null, string resourceLocation = null, Error error = null, string traceId = null, DateTimeOffset lastActionDateTime = default, DateTimeOffset createdDateTime = default, string etag = null) { return(new Operation(operationId, status, updateId, resourceLocation, error, traceId, lastActionDateTime, createdDateTime, etag)); }
public static Device Device(string deviceId = null, string deviceClassId = null, string manufacturer = null, string model = null, string groupId = null, UpdateId lastAttemptedUpdateId = null, DeviceDeploymentState?deploymentStatus = null, UpdateId installedUpdateId = null, bool onLatestUpdate = default, string lastDeploymentId = null) { return(new Device(deviceId, deviceClassId, manufacturer, model, groupId, lastAttemptedUpdateId, deploymentStatus, installedUpdateId, onLatestUpdate, lastDeploymentId)); }
internal static Operation DeserializeOperation(JsonElement element) { string operationId = default; OperationStatus status = default; Optional <UpdateId> updateId = default; Optional <string> resourceLocation = default; Optional <Error> error = default; Optional <string> traceId = default; DateTimeOffset lastActionDateTime = default; DateTimeOffset createdDateTime = default; Optional <string> etag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationId")) { operationId = property.Value.GetString(); continue; } if (property.NameEquals("status")) { status = new OperationStatus(property.Value.GetString()); continue; } if (property.NameEquals("updateId")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } updateId = UpdateId.DeserializeUpdateId(property.Value); continue; } if (property.NameEquals("resourceLocation")) { resourceLocation = property.Value.GetString(); continue; } if (property.NameEquals("error")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } error = Error.DeserializeError(property.Value); continue; } if (property.NameEquals("traceId")) { traceId = property.Value.GetString(); continue; } if (property.NameEquals("lastActionDateTime")) { lastActionDateTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("createdDateTime")) { createdDateTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } } return(new Operation(operationId, status, updateId.Value, resourceLocation.Value, error.Value, traceId.Value, lastActionDateTime, createdDateTime, etag.Value)); }