Skip to content

Automated Generate from openapi release-1.25 #2478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions client-java-contrib/admissionreview/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<parent>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-parent</artifactId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>

<dependencies>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions client-java-contrib/cert-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<parent>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-parent</artifactId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<!-- the version tracks the release version of the CRDs in the upstream cert-manager project -->
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.kubernetes</groupId>
Expand Down
4 changes: 2 additions & 2 deletions client-java-contrib/prometheus-operator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<parent>
<artifactId>client-java-parent</artifactId>
<groupId>io.kubernetes</groupId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>client-java-prometheus-operator-models</artifactId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.kubernetes</groupId>
Expand Down
2 changes: 1 addition & 1 deletion e2e/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<artifactId>client-java-parent</artifactId>
<groupId>io.kubernetes</groupId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/examples-release-13/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-examples-parent</artifactId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/examples-release-14/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-examples-parent</artifactId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/examples-release-15/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-examples-parent</artifactId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<parent>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-parent</artifactId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>

<artifactId>client-java-examples-parent</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion extended/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<artifactId>client-java-parent</artifactId>
<groupId>io.kubernetes</groupId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion fluent-gen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-parent</artifactId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion fluent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-parent</artifactId>
<version>16.0.0-SNAPSHOT</version>
<version>17.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
170 changes: 63 additions & 107 deletions fluent/src/main/java/io/kubernetes/client/fluent/BaseFluent.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
/*
Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package io.kubernetes.client.fluent;

import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

public class BaseFluent<F extends Fluent<F>> implements Fluent<F>, Visitable<F> {
import java.util.Set;
import java.util.ArrayList;
import java.lang.String;
import java.util.AbstractMap;
import java.util.Objects;
import java.lang.Class;
import java.lang.Object;
import java.util.List;
import java.util.Arrays;
import java.util.Collections;
public class BaseFluent<F extends Fluent<F>> implements Fluent<F>,Visitable<F>{
public static final String VISIT = "visit";
public final VisitableMap _visitables = new VisitableMap();

public static <T> VisitableBuilder<T, ?> builderOf(T item) {
public static <T>VisitableBuilder<T,?> builderOf(T item) {
if (item instanceof Editable) {
Object editor = ((Editable) item).edit();
if (editor instanceof VisitableBuilder) {
Expand All @@ -36,122 +25,89 @@ public class BaseFluent<F extends Fluent<F>> implements Fluent<F>, Visitable<F>
}

try {
return (VisitableBuilder<T, ?>)
Class.forName(item.getClass().getName() + "Builder")
.getConstructor(item.getClass())
.newInstance(item);
return (VisitableBuilder<T, ?>) Class.forName(item.getClass().getName() + "Builder").getConstructor(item.getClass())
.newInstance(item);
} catch (Exception e) {
throw new IllegalStateException("Failed to create builder for: " + item.getClass(), e);
}
}

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()));
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()));
}

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()));
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()));
}

public static <T> List<T> aggregate(List<? extends T>... lists) {
return new ArrayList(
Arrays.stream(lists).filter(Objects::nonNull).collect(Collectors.toList()));
public static <T>List<T> aggregate(List<? extends T>... lists) {
return new ArrayList(Arrays.stream(lists).filter(Objects::nonNull).collect(Collectors.toList()));
}

public static <T> Set<T> aggregate(Set<? extends T>... sets) {
return new LinkedHashSet(
Arrays.stream(sets).filter(Objects::nonNull).collect(Collectors.toSet()));
public static <T>Set<T> aggregate(Set<? extends T>... sets) {
return new LinkedHashSet(Arrays.stream(sets).filter(Objects::nonNull).collect(Collectors.toSet()));
}

public F accept(io.kubernetes.client.fluent.Visitor... visitors) {
return accept(Collections.emptyList(), visitors);
}
public <V>F accept(Class<V> type,Visitor<V> visitor) {
return accept(Collections.emptyList(), new Visitor<V>() {
@Override
public Class<V> getType() {
return type;
}

public <V> F accept(Class<V> type, Visitor<V> visitor) {
return accept(
Collections.emptyList(),
new Visitor<V>() {
@Override
public Class<V> getType() {
return type;
}

@Override
public void visit(List<Entry<String, Object>> path, V element) {
visitor.visit(path, element);
}
@Override
public void visit(List<Entry<String, Object>> path, V element) {
visitor.visit(path, element);
}

@Override
public void visit(V element) {
visitor.visit(element);
}
});
@Override
public void visit(V element) {
visitor.visit(element);
}
});
}

public F accept(
List<Entry<String, Object>> path, io.kubernetes.client.fluent.Visitor... visitors) {
public F accept(List<Entry<String,Object>> path,io.kubernetes.client.fluent.Visitor... visitors) {
return accept(path, "", visitors);
}

public F accept(
List<Entry<String, Object>> path,
String currentKey,
io.kubernetes.client.fluent.Visitor... 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);
});
.forEach(v -> {
((Visitor) v).visit(path, this);
});

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

_visitables.forEach(
(key, visitables) -> {
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));
});
});
_visitables.forEach((key, visitables) -> {
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));
});
});
return (F) this;
}

public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + 0;
return result;
}

public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
return true;
}
}

}
20 changes: 5 additions & 15 deletions fluent/src/main/java/io/kubernetes/client/fluent/Builder.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
/*
Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package io.kubernetes.client.fluent;

@FunctionalInterface
public interface Builder<T> {
import java.lang.FunctionalInterface;
@FunctionalInterface
public interface Builder<T>{
T build();
}

}
Loading