public SubscriptionConfiguration Clone(bool deep) { return(new SubscriptionConfiguration { Id = Id, Enabled = Enabled, Comments = Comments, AwsRegion = AwsRegion, LogGroupName = LogGroupName, LogGroupPattern = LogGroupPattern, StartTimeIso = StartTimeIso, EndTimeIso = EndTimeIso, StartTimeSecondsAgo = StartTimeSecondsAgo, EndTimeSecondsAgo = EndTimeSecondsAgo, EventFilterPattern = EventFilterPattern, LogStreamNamePrefix = LogStreamNamePrefix, LogStreamNames = deep ? LogStreamNames?.ToList() : LogStreamNames, ReadMaxBatchSize = ReadMaxBatchSize, MinIntervalSeconds = MinIntervalSeconds, MaxIntervalSeconds = MaxIntervalSeconds, ClockSkewProtectionSeconds = ClockSkewProtectionSeconds, TargetUrl = TargetUrl, TargetTimeoutSeconds = TargetTimeoutSeconds, TargetMaxBatchSize = TargetMaxBatchSize, TargetSubscriptionData = TargetSubscriptionData, Children = deep ? Children?.Select(c => c?.Clone(true)).ToList() : Children }); }
public void ExtendFrom(SubscriptionConfiguration parent) { if (parent == null) { return; } if (parent.Id.HasValue()) { Id = Id.HasValue() ? parent.Id + "." + Id : parent.Id; } Enabled ??= parent.Enabled; Comments = Comments.Or(parent.Comments); AwsRegion = AwsRegion.Or(parent.AwsRegion); LogGroupName = LogGroupName.Or(parent.LogGroupName); LogGroupPattern = LogGroupPattern.Or(parent.LogGroupPattern); StartTimeIso = StartTimeIso.Or(parent.StartTimeIso); EndTimeIso = EndTimeIso.Or(parent.EndTimeIso); StartTimeSecondsAgo ??= parent.StartTimeSecondsAgo; EndTimeSecondsAgo ??= parent.EndTimeSecondsAgo; EventFilterPattern = EventFilterPattern.Or(parent.EventFilterPattern); LogStreamNamePrefix = LogStreamNamePrefix.Or(parent.LogStreamNamePrefix); if (parent.LogStreamNames.SafeAny()) { LogStreamNames = LogStreamNames.SafeUnion(parent.LogStreamNames).ToList(); } ReadMaxBatchSize ??= parent.ReadMaxBatchSize; MinIntervalSeconds ??= parent.MinIntervalSeconds; MaxIntervalSeconds ??= parent.MaxIntervalSeconds; ClockSkewProtectionSeconds ??= parent.ClockSkewProtectionSeconds; TargetUrl = TargetUrl.Or(parent.TargetUrl); TargetTimeoutSeconds ??= parent.TargetTimeoutSeconds; TargetMaxBatchSize ??= parent.TargetMaxBatchSize; TargetSubscriptionData = TargetSubscriptionData.Or(parent.TargetSubscriptionData); }