1 /*
2 * Copyright (c) 2023. Roland T. Lichti, Kaiserpfalz EDV-Service.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18 package de.kaiserpfalzedv.commons.api.resources;
19
20 import com.fasterxml.jackson.annotation.JsonIgnore;
21
22 import java.io.Serializable;
23 import java.util.UUID;
24
25 /**
26 * Resource --
27 *
28 * @author klenkes74 {@literal <rlichti@kaiserpfalz-edv.de>}
29 * @since 2.0.0 2023-01-07
30 */
31 public interface Resource<D extends Serializable> extends Pointer, HasMetadata {
32 /**
33 * @return Generated pointer for this resource.
34 */
35 @JsonIgnore
36 Pointer toPointer();
37
38 @JsonIgnore
39 @Override
40 default String getKind() {
41 return getMetadata().getKind();
42 }
43
44 @JsonIgnore
45 @Override
46 default String getApiVersion() {
47 return getMetadata().getApiVersion();
48 }
49
50 @JsonIgnore
51 @Override
52 default String getNameSpace() {
53 return getMetadata().getNameSpace();
54 }
55
56 @JsonIgnore
57 @Override
58 default String getName() {
59 return getMetadata().getName();
60 }
61
62 @JsonIgnore
63 default UUID getUid() {
64 return getMetadata().getUid();
65 }
66
67 @JsonIgnore
68 default Integer getGeneration() {
69 return getMetadata().getGeneration();
70 }
71
72 @JsonIgnore
73 String getSelfLink();
74
75 Resource<D> increaseGeneration();
76
77 D getSpec();
78
79 Status getStatus();
80 }