Skip to content

Commit 3849a35

Browse files
committed
Support PartialMetadataObject requests
1 parent 55022a1 commit 3849a35

File tree

9 files changed

+472
-36
lines changed

9 files changed

+472
-36
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*
2+
Copyright 2020 The Kubernetes Authors.
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
package io.kubernetes.client.common;
14+
15+
import javax.annotation.Nullable;
16+
import io.kubernetes.client.openapi.models.V1ObjectMeta;
17+
import io.kubernetes.client.openapi.models.V1Pod;
18+
19+
import java.util.Objects;
20+
21+
public class PartialObjectMetadata implements KubernetesObject {
22+
private String apiVersion;
23+
private String kind;
24+
private V1ObjectMeta metadata;
25+
26+
public PartialObjectMetadata apiVersion(String apiVersion) {
27+
this.apiVersion = apiVersion;
28+
return this;
29+
}
30+
31+
@Override
32+
@Nullable
33+
public String getApiVersion() {
34+
return apiVersion;
35+
}
36+
37+
public void setApiVersion(String apiVersion) {
38+
this.apiVersion = apiVersion;
39+
}
40+
41+
public PartialObjectMetadata kind(String kind) {
42+
this.kind = kind;
43+
return this;
44+
}
45+
46+
@Override
47+
@Nullable
48+
public String getKind() {
49+
return kind;
50+
}
51+
52+
public void setKind(String kind) {
53+
this.kind = kind;
54+
}
55+
56+
public PartialObjectMetadata metadata(V1ObjectMeta metadata) {
57+
this.metadata = metadata;
58+
return this;
59+
}
60+
61+
@Override
62+
@Nullable
63+
public V1ObjectMeta getMetadata() {
64+
return metadata;
65+
}
66+
67+
public void setMetadata(V1ObjectMeta metadata) {
68+
this.metadata = metadata;
69+
}
70+
71+
@Override
72+
public boolean equals(java.lang.Object o) {
73+
if (this == o) {
74+
return true;
75+
}
76+
if (o == null || getClass() != o.getClass()) {
77+
return false;
78+
}
79+
PartialObjectMetadata other = (PartialObjectMetadata) o;
80+
return Objects.equals(this.apiVersion, other.apiVersion)
81+
&& Objects.equals(this.kind, other.kind)
82+
&& Objects.equals(this.metadata, other.metadata);
83+
}
84+
85+
@Override
86+
public int hashCode() {
87+
return Objects.hash(apiVersion, kind, metadata);
88+
}
89+
90+
@Override
91+
public String toString() {
92+
StringBuilder sb = new StringBuilder();
93+
sb.append("class PartialObjectMetadata {\n");
94+
sb.append(" apiVersion: ").append(toIndentedString(apiVersion)).append("\n");
95+
sb.append(" kind: ").append(toIndentedString(kind)).append("\n");
96+
sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n");
97+
sb.append("}");
98+
return sb.toString();
99+
}
100+
101+
/**
102+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
103+
*/
104+
private String toIndentedString(java.lang.Object o) {
105+
if (o == null) {
106+
return "null";
107+
}
108+
return o.toString().replace("\n", "\n ");
109+
}
110+
}
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*
2+
Copyright 2020 The Kubernetes Authors.
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
package io.kubernetes.client.common;
14+
15+
import java.util.ArrayList;
16+
import java.util.List;
17+
import java.util.Objects;
18+
import javax.annotation.Nullable;
19+
import io.kubernetes.client.openapi.models.V1ListMeta;
20+
21+
22+
public class PartialObjectMetadataList implements KubernetesListObject {
23+
private String apiVersion;
24+
private String kind;
25+
private V1ListMeta metadata;
26+
private List<KubernetesObject> items;
27+
28+
29+
public PartialObjectMetadataList apiVersion(String apiVersion) {
30+
this.apiVersion = apiVersion;
31+
return this;
32+
}
33+
34+
@Override
35+
@Nullable
36+
public String getApiVersion() {
37+
return apiVersion;
38+
}
39+
40+
public void setApiVersion(String apiVersion) {
41+
this.apiVersion = apiVersion;
42+
}
43+
44+
public PartialObjectMetadataList kind(String kind) {
45+
this.kind = kind;
46+
return this;
47+
}
48+
49+
@Override
50+
@Nullable
51+
public String getKind() {
52+
return kind;
53+
}
54+
55+
public void setKind(String kind) {
56+
this.kind = kind;
57+
}
58+
59+
public PartialObjectMetadataList metadata(V1ListMeta metadata) {
60+
this.metadata = metadata;
61+
return this;
62+
}
63+
64+
@Override
65+
@Nullable
66+
public V1ListMeta getMetadata() {
67+
return metadata;
68+
}
69+
70+
public void setMetadata(V1ListMeta metadata) {
71+
this.metadata = metadata;
72+
}
73+
74+
@SuppressWarnings("unchecked")
75+
public PartialObjectMetadataList items(List<? extends KubernetesObject> items) {
76+
this.items = (List<KubernetesObject>) items;
77+
return this;
78+
}
79+
80+
public PartialObjectMetadataList addItemsItem(KubernetesObject item) {
81+
if (items == null) {
82+
items = new ArrayList<>();
83+
}
84+
items.add(item);
85+
return this;
86+
}
87+
88+
@Override
89+
@Nullable
90+
public List<? extends KubernetesObject> getItems() {
91+
return items;
92+
}
93+
94+
@SuppressWarnings("unchecked")
95+
public void setItems(List<? extends KubernetesObject> items) {
96+
this.items = (List<KubernetesObject>) items;
97+
}
98+
99+
@Override
100+
public boolean equals(java.lang.Object o) {
101+
if (this == o) {
102+
return true;
103+
}
104+
if (o == null || getClass() != o.getClass()) {
105+
return false;
106+
}
107+
PartialObjectMetadataList other = (PartialObjectMetadataList) o;
108+
return Objects.equals(this.apiVersion, other.apiVersion)
109+
&& Objects.equals(this.kind, other.kind)
110+
&& Objects.equals(this.metadata, other.metadata)
111+
&& Objects.equals(this.items, other.items);
112+
}
113+
114+
@Override
115+
public int hashCode() {
116+
return Objects.hash(apiVersion, kind, metadata, items);
117+
}
118+
119+
@Override
120+
public String toString() {
121+
StringBuilder sb = new StringBuilder();
122+
sb.append("class PartialObjectMetadataList {\n");
123+
sb.append(" apiVersion: ").append(toIndentedString(apiVersion)).append("\n");
124+
sb.append(" kind: ").append(toIndentedString(kind)).append("\n");
125+
sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n");
126+
sb.append(" items: ").append(toIndentedString(items)).append("\n");
127+
sb.append("}");
128+
return sb.toString();
129+
}
130+
131+
/**
132+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
133+
*/
134+
private String toIndentedString(java.lang.Object o) {
135+
if (o == null) {
136+
return "null";
137+
}
138+
return o.toString().replace("\n", "\n ");
139+
}
140+
}

0 commit comments

Comments
 (0)