///GENMHASH:ABF901A96C194317F2128DAAA2AC323A:E84AFD285616868A9D7189B18889D122 private CaptureDescription CloneCurrentSettings() { if (this.currentSettings == null) { throw new ArgumentNullException("currentSettings"); } CaptureDescription clone = new CaptureDescription { SizeLimitInBytes = this.currentSettings.SizeLimitInBytes, IntervalInSeconds = this.currentSettings.IntervalInSeconds, Enabled = this.currentSettings.Enabled, Encoding = this.currentSettings.Encoding }; if (this.currentSettings.Destination != null) { clone.Destination = new Destination { ArchiveNameFormat = this.currentSettings.Destination.ArchiveNameFormat, BlobContainer = this.currentSettings.Destination.BlobContainer, Name = this.currentSettings.Destination.Name, StorageAccountResourceId = this.currentSettings.Destination.StorageAccountResourceId }; } else { clone.Destination = new Destination(); } return(clone); }
internal EventHubData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string location, IReadOnlyList <string> partitionIds, DateTimeOffset?createdAt, DateTimeOffset?updatedAt, long?messageRetentionInDays, long?partitionCount, EntityStatus?status, CaptureDescription captureDescription) : base(id, name, resourceType, systemData, location) { PartitionIds = partitionIds; CreatedAt = createdAt; UpdatedAt = updatedAt; MessageRetentionInDays = messageRetentionInDays; PartitionCount = partitionCount; Status = status; CaptureDescription = captureDescription; }
///GENMHASH:E6B603961EBB7673A4FCE2FF57FFD887:3E9D667DC332932DBD8876ED30B87263 private CaptureDescription EnsureSettings() { if (this.newSettings != null) { return(this.newSettings); } else if (this.currentSettings == null) { this.newSettings = new CaptureDescription { Destination = new Destination() }; return(this.newSettings); } else { // Clone the current settings to new settings (one time) // this.newSettings = CloneCurrentSettings(); return(this.newSettings); } }
///GENMHASH:4A2506B258DCD069BEF25E848169A42D:5FB10EA9887E2818CBB3F553DF9768CB internal CaptureSettings(EventhubInner eventhubInner, IStorageManager storageManager) { this.currentSettings = eventhubInner.CaptureDescription; this.storageManager = storageManager; this.works = new List <Func <CancellationToken, Task> >(); }
internal static EventHubData DeserializeEventHubData(JsonElement element) { Optional <SystemData> systemData = default; Optional <string> location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional <IReadOnlyList <string> > partitionIds = default; Optional <DateTimeOffset> createdAt = default; Optional <DateTimeOffset> updatedAt = default; Optional <long> messageRetentionInDays = default; Optional <long> partitionCount = default; Optional <EntityStatus> status = default; Optional <CaptureDescription> captureDescription = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("systemData")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); continue; } if (property.NameEquals("location")) { location = 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 = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("partitionIds")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(item.GetString()); } partitionIds = array; continue; } if (property0.NameEquals("createdAt")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } createdAt = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("updatedAt")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } updatedAt = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("messageRetentionInDays")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } messageRetentionInDays = property0.Value.GetInt64(); continue; } if (property0.NameEquals("partitionCount")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } partitionCount = property0.Value.GetInt64(); continue; } if (property0.NameEquals("status")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } status = property0.Value.GetString().ToEntityStatus(); continue; } if (property0.NameEquals("captureDescription")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } captureDescription = CaptureDescription.DeserializeCaptureDescription(property0.Value); continue; } } continue; } } return(new EventHubData(id, name, type, location.Value, systemData, Optional.ToList(partitionIds), Optional.ToNullable(createdAt), Optional.ToNullable(updatedAt), Optional.ToNullable(messageRetentionInDays), Optional.ToNullable(partitionCount), Optional.ToNullable(status), captureDescription.Value)); }