Remove RestconfDataServiceConstant.PostData
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / utils / RestconfDataServiceConstant.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.restconf.nb.rfc8040.rests.utils;
9
10 import static java.util.Objects.requireNonNull;
11
12 import com.google.common.collect.Maps;
13 import java.util.Arrays;
14 import java.util.Map;
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19
20 /**
21  * Constants for RestconfDataService.
22  *
23  */
24 public final class RestconfDataServiceConstant {
25     public static final QName NETCONF_BASE_QNAME = SchemaContext.NAME;
26
27     private RestconfDataServiceConstant() {
28         throw new UnsupportedOperationException("Util class.");
29     }
30
31     /**
32      * Constants for read data.
33      *
34      */
35     public static final class ReadData {
36         // URI parameters
37         public static final String CONTENT = "content";
38         public static final String DEPTH = "depth";
39         public static final String FIELDS = "fields";
40
41         // content values
42         public static final String CONFIG = "config";
43         public static final String ALL = "all";
44         public static final String NONCONFIG = "nonconfig";
45
46         // depth values
47         public static final String UNBOUNDED = "unbounded";
48         public static final int MIN_DEPTH = 1;
49         public static final int MAX_DEPTH = 65535;
50
51         public static final String READ_TYPE_TX = "READ";
52         public static final String WITH_DEFAULTS = "with-defaults";
53         public static final String REPORT_ALL_DEFAULT_VALUE = "report-all";
54         public static final String REPORT_ALL_TAGGED_DEFAULT_VALUE = "report-all-tagged";
55
56         private ReadData() {
57             throw new UnsupportedOperationException("Util class.");
58         }
59     }
60
61     /**
62      * Common for PostData and PutData.
63      */
64     public static final class PostPutQueryParameters {
65         public static final String INSERT = "insert";
66         public static final String POINT = "point";
67
68         /**
69          * Insert values, as per <a href="https://tools.ietf.org/html/rfc8040#section-4.8.5">RFC8040 section 4.8.5</a>.
70          */
71         public enum Insert {
72             /**
73              * Insert the new data as the new first entry.
74              */
75             FIRST("first"),
76             /**
77              * Insert the new data as the new last entry.
78              */
79             LAST("last"),
80             /**
81              * Insert the new data before the insertion point, as specified by the value of the "point" parameter.
82              */
83             BEFORE("before"),
84             /**
85              * Insert the new data after the insertion point, as specified by the value of the "point" parameter.
86              */
87             AFTER("after");
88
89             private static final Map<String, Insert> VALUES = Maps.uniqueIndex(Arrays.asList(values()), Insert::value);
90
91             private @NonNull String value;
92
93             Insert(final @NonNull String value) {
94                 this.value = value;
95             }
96
97             public @NonNull String value() {
98                 return value;
99             }
100
101             public static @Nullable Insert forValue(final String value) {
102                 return VALUES.get(requireNonNull(value));
103             }
104         }
105
106         private PostPutQueryParameters() {
107             // Hidden on purpose
108         }
109     }
110
111     /**
112      * Constants for data to yang patch.
113      *
114      */
115     public static final class PatchData {
116         public static final String PATCH_TX_TYPE = "Patch";
117
118         private PatchData() {
119             throw new UnsupportedOperationException("Util class.");
120         }
121     }
122 }