Source:
<code>private MaybeAdjustedRequest preResolveDNS(MaybeAdjustedRequest nonServiceChangeRequest) { if (!nonServiceChangeRequest.request.getRequest().getLoadBalancerService().isPreResolveUpstreamDNS()) { return nonServiceChangeRequest; } BaragonRequest originalRequest = nonServiceChangeRequest.request.getRequest(); List<UpstreamInfo> maybeResolvedAddUpstreams = resolveDNSForAllUpstreams(nonServiceChangeRequest.request.getRequest().getAddUpstreams()); List<UpstreamInfo> maybeResolvedRemoveUpstreams = resolveDNSForAllUpstreams(nonServiceChangeRequest.request.getRequest().getRemoveUpstreams()); List<UpstreamInfo> maybeResolvedReplaceUpstreams = resolveDNSForAllUpstreams(nonServiceChangeRequest.request.getRequest().getReplaceUpstreams()); if (allUpstreamsAreResolved(maybeResolvedAddUpstreams) && allUpstreamsAreResolved(maybeResolvedRemoveUpstreams) && allUpstreamsAreResolved(maybeResolvedReplaceUpstreams)) { LOG.trace("Request does not change a BaragonService and all upstreams were pre-resolved. Setting noValidate.", nonServiceChangeRequest.request.getQueuedRequestId().getRequestId()); <START> BaragonRequest requestWithResolvedUpstreams = new BaragonRequestBuilder() <END> .setAddUpstreams(maybeResolvedAddUpstreams) .setLoadBalancerRequestId(originalRequest.getLoadBalancerRequestId()) .setLoadBalancerService(originalRequest.getLoadBalancerService()) .setRemoveUpstreams(maybeResolvedRemoveUpstreams) .setAction(originalRequest.getAction()) .setNoReload(originalRequest.isNoReload()) .setNoValidate(true) .setReplaceUpstreams(maybeResolvedReplaceUpstreams) .setUpstreamUpdateOnly(originalRequest.isUpstreamUpdateOnly()) .setNoDuplicateUpstreams(originalRequest.isNoDuplicateUpstreams()) .build(); return new MaybeAdjustedRequest(new QueuedRequestWithState( nonServiceChangeRequest.request.getQueuedRequestId(), requestWithResolvedUpstreams, nonServiceChangeRequest.request.getCurrentState() ), true); } return nonServiceChangeRequest; }</code><technical_language>is worth making a toBuilder BaragonRequest</technical_language>

Target:
private MaybeAdjustedRequest preResolveDNS(MaybeAdjustedRequest nonServiceChangeRequest) { if (!nonServiceChangeRequest.request.getRequest().getLoadBalancerService().isPreResolveUpstreamDNS()) { return nonServiceChangeRequest; } BaragonRequest originalRequest = nonServiceChangeRequest.request.getRequest(); List<UpstreamInfo> maybeResolvedAddUpstreams = resolveDNSForAllUpstreams(nonServiceChangeRequest.request.getRequest().getAddUpstreams()); List<UpstreamInfo> maybeResolvedRemoveUpstreams = resolveDNSForAllUpstreams(nonServiceChangeRequest.request.getRequest().getRemoveUpstreams()); List<UpstreamInfo> maybeResolvedReplaceUpstreams = resolveDNSForAllUpstreams(nonServiceChangeRequest.request.getRequest().getReplaceUpstreams()); if (allUpstreamsAreResolved(maybeResolvedAddUpstreams) && allUpstreamsAreResolved(maybeResolvedRemoveUpstreams) && allUpstreamsAreResolved(maybeResolvedReplaceUpstreams)) { LOG.trace("Request does not change a BaragonService and all upstreams were pre-resolved. Setting noValidate.", nonServiceChangeRequest.request.getQueuedRequestId().getRequestId()); BaragonRequest requestWithResolvedUpstreams = originalRequest.toBuilder() .setAddUpstreams(maybeResolvedAddUpstreams) .setRemoveUpstreams(maybeResolvedRemoveUpstreams) .setReplaceUpstreams(maybeResolvedReplaceUpstreams) .setNoValidate(true) .build(); return new MaybeAdjustedRequest(new QueuedRequestWithState( nonServiceChangeRequest.request.getQueuedRequestId(), requestWithResolvedUpstreams, nonServiceChangeRequest.request.getCurrentState() ), true); } return nonServiceChangeRequest; }