Skip to content

Commit

Permalink
Merge pull request kubernetes-client#2709 from kubernetes-client/auto…
Browse files Browse the repository at this point in the history
…mated-generate-994bf264

Automated Generate from openapi release-1.27
  • Loading branch information
brendandburns committed Jun 22, 2023
2 parents 5e3d515 + f2119d0 commit c692d81
Show file tree
Hide file tree
Showing 2,622 changed files with 259,755 additions and 307,641 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public static void main(String[] args) throws IOException {
null,
null,
params.resourceVersion,
null,
null,
params.timeoutSeconds,
params.watch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static void main(String[] args) throws IOException, ApiException {

CoreV1Api api = new CoreV1Api();
V1PodList list =
api.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null, null);
api.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null, null, null);
for (V1Pod item : list.getItems()) {
System.out.println(item.getMetadata().getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static void main(String[] args) {
public static List<String> getAllNameSpaces() throws ApiException {
V1NamespaceList listNamespace =
COREV1_API.listNamespace(
"true", null, null, null, null, 0, null, null, Integer.MAX_VALUE, Boolean.FALSE);
null, null, null, null, null, null, null, null, null, null, null);
List<String> list =
listNamespace.getItems().stream()
.map(v1Namespace -> v1Namespace.getMetadata().getName())
Expand All @@ -119,7 +119,7 @@ public static List<String> getAllNameSpaces() throws ApiException {
public static List<String> getPods() throws ApiException {
V1PodList v1podList =
COREV1_API.listPodForAllNamespaces(
null, null, null, null, null, null, null, null, null, null);
null, null, null, null, null, null, null, null, null, null, null);
List<String> podList =
v1podList.getItems().stream()
.map(v1Pod -> v1Pod.getMetadata().getName())
Expand Down Expand Up @@ -165,7 +165,8 @@ public static List<String> getNamespacedPod(String namespace, String label) thro
null,
null,
label,
Integer.MAX_VALUE,
null,
null,
null,
null,
TIME_OUT_VALUE,
Expand All @@ -192,7 +193,8 @@ public static List<String> getServices() throws ApiException {
null,
null,
null,
Integer.MAX_VALUE,
null,
null,
null,
null,
TIME_OUT_VALUE,
Expand Down Expand Up @@ -225,6 +227,7 @@ public static void scaleDeployment(String deploymentName, int numberOfReplicas)
null,
null,
null,
null,
Boolean.FALSE);

List<V1Deployment> appsV1DeploymentItems = listNamespacedDeployment.getItems();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void main(String[] args) throws IOException, ApiException {

V1PodList list =
api.listNamespacedPod(
"default", null, null, null, null, null, null, null, null, null, null);
"default", null, null, null, null, null, null, null, null, null, null, null);
for (V1Pod item : list.getItems()) {
System.out.println(item.getMetadata().getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void main(String[] args) throws IOException, ApiException {

// invokes the CoreV1Api client
V1PodList list =
api.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null, null);
api.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null, null, null);
for (V1Pod item : list.getItems()) {
System.out.println(item.getMetadata().getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public static void main(String[] args) throws Exception {
null,
params.resourceVersion,
null,
null,
params.timeoutSeconds,
params.watch,
null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void main(String[] args) throws IOException, ApiException {

// invokes the CoreV1Api client
V1PodList list =
api.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null, null);
api.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null, null, null);
for (V1Pod item : list.getItems()) {
System.out.println(item.getMetadata().getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void main(String[] args) throws IOException, ApiException, Interru
V1Pod pod =
coreApi
.listNamespacedPod(
"default", "false", null, null, null, null, null, null, null, null, null)
"default", "false", null, null, null, null, null, null, null, null, null, null)
.getItems()
.get(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static void main(String[] args) throws IOException {
param.getLimit(),
null,
null,
null,
1,
null,
null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static void main(String[] args) throws IOException, ApiException {
while (true) {
// A request that should return 200
V1PodList list =
api.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null, null);
api.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null, null, null);
// A request that should return 404
try {
V1Pod pod = api.readNamespacedPod("foo", "bar", null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static void main(String[] args) throws IOException, ApiException {
Watch.createWatch(
client,
api.listNamespaceCall(
null, null, null, null, null, 5, null, null, null, Boolean.TRUE, null),
null, null, null, null, null, null, null, null, null, null, Boolean.TRUE, null),
new TypeToken<Watch.Response<V1Namespace>>() {}.getType());

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ private V1Node doDrain() throws KubectlException, ApiException, IOException {
null,
null,
null,
null,
null);

validatePods(allPods.getItems());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private List<V1ControllerRevision> controlledHistory(
List<V1ControllerRevision> result = new ArrayList<>();
V1ControllerRevisionList historyList =
api.listNamespacedControllerRevision(
namespace, null, null, null, null, selector.toString(), null, null, null, null, null);
namespace, null, null, null, null, selector.toString(), null, null, null, null, null, null);
for (V1ControllerRevision history : historyList.getItems()) {
if (isControlledBy(history, accessor)) {
result.add(history);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static double findNodePercentage(V1Node node, Quantity value, String metric) {
private List<Pair<ApiType, MetricsType>> topNodes(
CoreV1Api api, ApiClient apiClient, String metricName)
throws KubectlException, ApiException, IOException {
V1NodeList nodes = api.listNode(null, null, null, null, null, null, null, null, null, null);
V1NodeList nodes = api.listNode(null, null, null, null, null, null, null, null, null, null, null);
NodeMetricsList metrics = new Metrics(apiClient).getNodeMetrics();
List<V1Node> items = nodes.getItems();
Collections.sort(
Expand Down Expand Up @@ -152,7 +152,7 @@ private List<Pair<ApiType, MetricsType>> topPods(
throws KubectlException, ApiException, IOException {
V1PodList pods =
api.listNamespacedPod(
namespace, null, null, null, null, null, null, null, null, null, null);
namespace, null, null, null, null, null, null, null, null, null, null, null);
PodMetricsList metrics = new Metrics(apiClient).getPodMetrics(namespace);
List<V1Pod> items = pods.getItems();
Collections.sort(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static List<V1ReplicaSet> rsListFromClient(
String namespace, String selector, AppsV1Api api) throws ApiException {
V1ReplicaSetList rsList =
api.listNamespacedReplicaSet(
namespace, null, null, null, null, selector, null, null, null, null, null);
namespace, null, null, null, null, selector, null, null, null, null, null, null);
return rsList.getItems();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public void testBuildWatchShouldWorkIfInformerPresent() {
null,
params.resourceVersion,
null,
null,
params.timeoutSeconds,
params.watch,
null);
Expand Down Expand Up @@ -156,6 +157,7 @@ public void testBuildWatchEventNotificationShouldWork() throws InterruptedExcept
null,
params.resourceVersion,
null,
null,
params.timeoutSeconds,
params.watch,
null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void testIteratorForEmptyList() throws IOException {
(Pager.PagerParams param) -> {
try {
return api.listNamespaceCall(
null, null, null, null, null, null, null, null, null, null, null);
null, null, null, null, null, null, null, null, null, null, null, null);
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -141,6 +141,7 @@ public void testPaginationForNamespaceListWithSuccessThreadSafely() throws IOExc
null,
null,
null,
null,
null);
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down Expand Up @@ -203,6 +204,7 @@ public void testPaginationForNamespaceListWithBadTokenFailure() throws IOExcepti
null,
null,
null,
null,
null);
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down Expand Up @@ -255,6 +257,7 @@ public void testPaginationForNamespaceListWithFieldSelectorFailure() throws IOEx
null,
null,
null,
null,
null);
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down
59 changes: 37 additions & 22 deletions fluent/src/main/java/io/kubernetes/client/fluent/BaseFluent.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ public static <T>VisitableBuilder<T,?> builderOf(T item) {
}

try {
return (VisitableBuilder<T, ?>) Class.forName(item.getClass().getName() + "Builder").getConstructor(item.getClass())
return (VisitableBuilder<T, ?>) Class.forName(item.getClass().getName() + "Builder", true, item.getClass().getClassLoader()).getConstructor(item.getClass())
.newInstance(item);
} catch (Exception e) {
throw new IllegalStateException("Failed to create builder for: " + item.getClass(), e);
try {
return (VisitableBuilder<T, ?>) Class.forName(item.getClass().getName() + "Builder").getConstructor(item.getClass())
.newInstance(item);
} catch (Exception e1) {
throw new IllegalStateException("Failed to create builder for: " + item.getClass(), e1);
}
}
}
public static <T>List<T> build(List<? extends io.kubernetes.client.fluent.Builder<? extends T>> list) {
return list == null ? null : new ArrayList<T>(list.stream().map(Builder::build).collect(Collectors.toList()));
return list == null ? null : list.stream().map(Builder::build).collect(Collectors.toList());
}
public static <T>Set<T> build(Set<? extends io.kubernetes.client.fluent.Builder<? extends T>> set) {
return set == null ? null : new LinkedHashSet<T>(set.stream().map(Builder::build).collect(Collectors.toSet()));
Expand Down Expand Up @@ -68,30 +73,40 @@ public F accept(List<Entry<String,Object>> path,io.kubernetes.client.fluent.Visi
return accept(path, "", visitors);
}
public F accept(List<Entry<String,Object>> path,String currentKey,io.kubernetes.client.fluent.Visitor... visitors) {
Arrays.stream(visitors)
.map(v -> VisitorListener.wrap(v))
.filter(v -> ((Visitor) v).canVisit(path, this))
.sorted((l, r) -> ((Visitor) r).order() - ((Visitor) l).order())
.forEach(v -> {
((Visitor) v).visit(path, this);
});
List<Visitor> sortedVisitor = new ArrayList<>();
for (Visitor visitor : visitors) {
visitor = VisitorListener.wrap(visitor);
if (!visitor.canVisit(path, this)) {
continue;
}
sortedVisitor.add(visitor);
}
sortedVisitor.sort((l, r) -> ((Visitor) r).order() - ((Visitor) l).order());
for (Visitor visitor : sortedVisitor) {
visitor.visit(path, this);
}

List<Entry<String, Object>> copyOfPath = path != null ? new ArrayList(path) : new ArrayList<>();
copyOfPath.add(new AbstractMap.SimpleEntry<String, Object>(currentKey, this));
copyOfPath.add(new AbstractMap.SimpleEntry<>(currentKey, this));

_visitables.forEach((key, visitables) -> {
for (Entry<String, ?> entry : _visitables.entrySet()) {
List<Entry<String, Object>> newPath = Collections.unmodifiableList(copyOfPath);
// Copy visitables to avoid ConcurrrentModificationException when Visitors add/remove Visitables
new ArrayList<>(visitables).forEach(visitable -> {
Arrays.stream(visitors)
.filter(v -> v.getType() != null && v.getType().isAssignableFrom(visitable.getClass()))
.forEach(v -> visitable.accept(newPath, key, v));

Arrays.stream(visitors)
.filter(v -> v.getType() == null || !v.getType().isAssignableFrom(visitable.getClass()))
.forEach(v -> visitable.accept(newPath, key, v));
});
});
// Copy visitables to avoid ConcurrentModificationException when Visitors add/remove Visitables
for (Visitable<F> visitable : new ArrayList<>((List<Visitable<F>>) entry.getValue())) {
for (Visitor visitor : visitors) {
if (visitor.getType() != null && visitor.getType().isAssignableFrom(visitable.getClass())) {
visitable.accept(newPath, entry.getKey(), visitor);
}
}

for (Visitor visitor : visitors) {
if (visitor.getType() == null || !visitor.getType().isAssignableFrom(visitable.getClass())) {
visitable.accept(newPath, entry.getKey(), visitor);
}
}
}
}
return (F) this;
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,32 @@ public Class<T> getType() {
return delegate.getType();
}
public void visit(T target) {
listeners.forEach(l -> l.beforeVisit(delegate, Collections.emptyList(), target));
for (VisitorListener l : listeners) {
l.beforeVisit(delegate, Collections.emptyList(), target);
}
delegate.visit(target);
listeners.forEach(l -> l.afterVisit(delegate, Collections.emptyList(), target));
for (VisitorListener l : listeners) {
l.afterVisit(delegate, Collections.emptyList(), target);
}
}
public int order() {
return delegate.order();
}
public void visit(List<Entry<String,Object>> path,T target) {
listeners.forEach(l -> l.beforeVisit(delegate, path, target));
for (VisitorListener l : listeners) {
l.beforeVisit(delegate, path, target);
}
delegate.visit(path, target);
listeners.forEach(l -> l.afterVisit(delegate, path, target));
for (VisitorListener l : listeners) {
l.afterVisit(delegate, path, target);
}
}
public <F>Boolean canVisit(List<Entry<String,Object>> path,F target) {
boolean canVisit = delegate.canVisit(path, target);
listeners.forEach(l -> l.onCheck(delegate, canVisit, target));
for (VisitorListener l : listeners) {
l.onCheck(delegate, canVisit, target);
}

return canVisit;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,25 @@ public AdmissionregistrationV1ServiceReferenceBuilder(AdmissionregistrationV1Ser
}
public AdmissionregistrationV1ServiceReferenceBuilder(AdmissionregistrationV1ServiceReferenceFluent<?> fluent,AdmissionregistrationV1ServiceReference instance,Boolean validationEnabled) {
this.fluent = fluent;
fluent.withName(instance.getName());

fluent.withNamespace(instance.getNamespace());

fluent.withPath(instance.getPath());

fluent.withPort(instance.getPort());

if (instance != null) {
fluent.withName(instance.getName());
fluent.withNamespace(instance.getNamespace());
fluent.withPath(instance.getPath());
fluent.withPort(instance.getPort());
}
this.validationEnabled = validationEnabled;
}
public AdmissionregistrationV1ServiceReferenceBuilder(AdmissionregistrationV1ServiceReference instance) {
this(instance,false);
}
public AdmissionregistrationV1ServiceReferenceBuilder(AdmissionregistrationV1ServiceReference instance,Boolean validationEnabled) {
this.fluent = this;
this.withName(instance.getName());

this.withNamespace(instance.getNamespace());

this.withPath(instance.getPath());

this.withPort(instance.getPort());

if (instance != null) {
this.withName(instance.getName());
this.withNamespace(instance.getNamespace());
this.withPath(instance.getPath());
this.withPort(instance.getPort());
}
this.validationEnabled = validationEnabled;
}
AdmissionregistrationV1ServiceReferenceFluent<?> fluent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.kubernetes.client.openapi.models;

import java.lang.Integer;
import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.fluent.Fluent;
import java.lang.String;
import java.lang.Boolean;
Expand Down
Loading

0 comments on commit c692d81

Please sign in to comment.