2 * Copyright (c) 2021 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 POST} HTTP operation when the request is to invoke a YANG operation, be it
18 * {@code rpc} or {@code action}. There is no such thing in RFC8040, but we support pretty-printing of the resulting
19 * {@code output} container.
21 public record InvokeParams(@NonNull PrettyPrintParam prettyPrint) implements FormatParameters {
22 public static final @NonNull InvokeParams COMPACT = new InvokeParams(PrettyPrintParam.FALSE);
23 public static final @NonNull InvokeParams PRETTY = new InvokeParams(PrettyPrintParam.TRUE);
26 requireNonNull(prettyPrint);
30 * Return {@link InvokeParams} for specified query parameters.
32 * @param params Parameters and their values
33 * @return A {@link InvokeParams}
34 * @throws NullPointerException if {@code queryParameters} is {@code null}
35 * @throws IllegalArgumentException if the parameters are invalid
37 public static @NonNull InvokeParams of(final QueryParams params) {
38 return FormatParametersHelper.of(params, COMPACT, PRETTY);