2 * Copyright (c) 2024 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.restconf.server.api;
10 import static java.util.Objects.requireNonNull;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.restconf.api.FormatParameters;
14 import org.opendaylight.restconf.api.query.PrettyPrintParam;
17 * Supported query parameters of {@code PATCH} HTTP operation when the request is to invoke a YANG Patch operation.
18 * There is no such thing in RFC8073, but we support pretty-printing of the resulting {@code yang-patch-status}.
20 public record DataYangPatchParams(@NonNull PrettyPrintParam prettyPrint) implements FormatParameters {
21 public static final @NonNull DataYangPatchParams COMPACT = new DataYangPatchParams(PrettyPrintParam.FALSE);
22 public static final @NonNull DataYangPatchParams PRETTY = new DataYangPatchParams(PrettyPrintParam.TRUE);
24 public DataYangPatchParams {
25 requireNonNull(prettyPrint);
29 * Return {@link DataYangPatchParams} for specified query parameters.
31 * @param params Parameters and their values
32 * @return A {@link DataYangPatchParams}
33 * @throws NullPointerException if {@code queryParameters} is {@code null}
34 * @throws IllegalArgumentException if the parameters are invalid
36 public static @NonNull DataYangPatchParams of(final QueryParams params) {
37 return FormatParametersHelper.of(params, COMPACT, PRETTY);