Skip to content

Commit 7796d50

Browse files
committed
feat: Knative API
1 parent bced744 commit 7796d50

File tree

174 files changed

+41431
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+41431
-1
lines changed

apis/knative/build.gradle

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import com.marcnuri.yack.schema.api.ApiGeneratorTask
2+
import com.marcnuri.yack.schema.model.ModelGeneratorTask
3+
4+
apply from: rootDir.toPath().resolve('shared.gradle').toFile()
5+
6+
ext {
7+
isPublishable = true
8+
project.group = project.group + ".apis"
9+
pomName = 'Knative Model & API'
10+
pomDescription = 'Retrofit2 based Java interfaces to create a declarative REST API client and model files for Knative (Serving & Eventing).'
11+
}
12+
13+
dependencies {
14+
compile project(':kubernetes-model')
15+
compileOnly "org.projectlombok:lombok:$version_projectlombok"
16+
annotationProcessor "org.projectlombok:lombok:$version_projectlombok"
17+
}
18+
sourceSets.main.java.srcDirs = ['src/api/java', 'src/main/java', 'src/model/java']
19+
20+
21+
def templatesDirs = new File(rootProject.projectDir, "schema/templates")
22+
def schemaDir = new File(projectDir, "schema")
23+
def availableSchemaNames = Arrays.asList(
24+
"knative-0.19.0.json"
25+
)
26+
def availableSchemas = availableSchemaNames.stream()
27+
.map { s -> new File(schemaDir, s) }
28+
.toArray{ i -> new File[i]}
29+
task generateModel(type: ModelGeneratorTask) {
30+
group = 'generators'
31+
packageName = 'com.marcnuri.yakc'
32+
schemas = availableSchemas
33+
templatesDir = templatesDirs
34+
outputDirectory = projectDir
35+
skipGenerationRegexes = ['^io\\.k8s\\.apimachinery\\.pkg\\..*']
36+
}
37+
task generateApi(type: ApiGeneratorTask) {
38+
group = 'generators'
39+
packageName = 'com.marcnuri.yakc'
40+
schemas = availableSchemas
41+
templatesDir = templatesDirs
42+
outputDirectory = projectDir
43+
skipGenerationRegexes = ['^apis$', '^version$']
44+
}

apis/knative/schema/knative-0.19.0.json

+1
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/autoscalinginternalknativedev/v1alpha1/AutoscalingInternalKnativeDevV1alpha1Api.java

+1,773
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/cachinginternalknativedev/v1alpha1/CachingInternalKnativeDevV1alpha1Api.java

+903
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/eventingknativedev/v1/EventingKnativeDevV1Api.java

+1,773
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/eventingknativedev/v1beta1/EventingKnativeDevV1beta1Api.java

+2,643
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/flowsknativedev/v1/FlowsKnativeDevV1Api.java

+1,773
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/flowsknativedev/v1beta1/FlowsKnativeDevV1beta1Api.java

+1,773
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/messagingknativedev/v1/MessagingKnativeDevV1Api.java

+1,773
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/messagingknativedev/v1beta1/MessagingKnativeDevV1beta1Api.java

+1,773
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/networkinginternalknativedev/v1alpha1/NetworkingInternalKnativeDevV1alpha1Api.java

+2,643
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/servingknativedev/v1/ServingKnativeDevV1Api.java

+3,513
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/sourcesknativedev/v1/SourcesKnativeDevV1Api.java

+2,643
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/sourcesknativedev/v1alpha1/SourcesKnativeDevV1alpha1Api.java

+1,773
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/sourcesknativedev/v1alpha2/SourcesKnativeDevV1alpha2Api.java

+3,513
Large diffs are not rendered by default.

apis/knative/src/api/java/com/marcnuri/yakc/api/sourcesknativedev/v1beta1/SourcesKnativeDevV1beta1Api.java

+3,513
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright 2020 Marc Nuri
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.marcnuri.yakc.model.dev.knative.eventing.v1;
18+
19+
import com.fasterxml.jackson.annotation.JsonProperty;
20+
import com.marcnuri.yakc.model.Model;
21+
import com.marcnuri.yakc.model.io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta;
22+
import lombok.AllArgsConstructor;
23+
import lombok.Builder;
24+
import lombok.Data;
25+
import lombok.NoArgsConstructor;
26+
import lombok.ToString;
27+
28+
/**
29+
* Broker collects a pool of events that are consumable using Triggers. Brokers provide a well-known endpoint for event delivery that senders can use with minimal knowledge of the event routing strategy. Subscribers use Triggers to request delivery of events from a Broker's pool to a specific URL or Addressable endpoint.
30+
*/
31+
@SuppressWarnings({"squid:S1192", "WeakerAccess", "unused"})
32+
@Builder(toBuilder = true, builderClassName = "Builder")
33+
@AllArgsConstructor
34+
@NoArgsConstructor
35+
@Data
36+
@ToString
37+
public class Broker implements Model {
38+
39+
40+
/**
41+
* APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
42+
*/
43+
@JsonProperty("apiVersion")
44+
private String apiVersion;
45+
46+
/**
47+
* Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
48+
*/
49+
@JsonProperty("kind")
50+
private String kind;
51+
52+
@JsonProperty("metadata")
53+
private ObjectMeta metadata;
54+
55+
@JsonProperty("spec")
56+
private BrokerSpec spec;
57+
58+
@JsonProperty("status")
59+
private BrokerStatus status;
60+
61+
}
62+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright 2020 Marc Nuri
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.marcnuri.yakc.model.dev.knative.eventing.v1;
18+
19+
import com.fasterxml.jackson.annotation.JsonProperty;
20+
import com.marcnuri.yakc.model.ListModel;
21+
import com.marcnuri.yakc.model.Model;
22+
import java.util.List;
23+
import lombok.AllArgsConstructor;
24+
import lombok.Builder;
25+
import lombok.Data;
26+
import lombok.NoArgsConstructor;
27+
import lombok.NonNull;
28+
import lombok.Singular;
29+
import lombok.ToString;
30+
31+
/**
32+
* BrokerList is a list of Broker
33+
*/
34+
@SuppressWarnings({"squid:S1192", "WeakerAccess", "unused"})
35+
@Builder(toBuilder = true, builderClassName = "Builder")
36+
@AllArgsConstructor
37+
@NoArgsConstructor
38+
@Data
39+
@ToString
40+
public class BrokerList implements Model, ListModel<Broker> {
41+
42+
43+
/**
44+
* APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
45+
*/
46+
@JsonProperty("apiVersion")
47+
private String apiVersion;
48+
49+
/**
50+
* List of brokers. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md
51+
*/
52+
@NonNull
53+
@JsonProperty("items")
54+
@Singular(value = "addToItems", ignoreNullCollections = true)
55+
private List<Broker> items;
56+
57+
/**
58+
* Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
59+
*/
60+
@JsonProperty("kind")
61+
private String kind;
62+
63+
@JsonProperty("metadata")
64+
private BrokerListMetadata metadata;
65+
66+
}
67+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright 2020 Marc Nuri
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.marcnuri.yakc.model.dev.knative.eventing.v1;
18+
19+
import com.fasterxml.jackson.annotation.JsonProperty;
20+
import com.marcnuri.yakc.model.Model;
21+
import lombok.AllArgsConstructor;
22+
import lombok.Builder;
23+
import lombok.Data;
24+
import lombok.NoArgsConstructor;
25+
import lombok.ToString;
26+
27+
/**
28+
* ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.
29+
*/
30+
@SuppressWarnings({"squid:S1192", "WeakerAccess", "unused"})
31+
@Builder(toBuilder = true, builderClassName = "Builder")
32+
@AllArgsConstructor
33+
@NoArgsConstructor
34+
@Data
35+
@ToString
36+
public class BrokerListMetadata implements Model {
37+
38+
39+
/**
40+
* continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.
41+
*/
42+
@JsonProperty("continue")
43+
private String continues;
44+
45+
/**
46+
* remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is &#42;estimating&#42; the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.
47+
*/
48+
@JsonProperty("remainingItemCount")
49+
private Number remainingItemCount;
50+
51+
/**
52+
* String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
53+
*/
54+
@JsonProperty("resourceVersion")
55+
private String resourceVersion;
56+
57+
/**
58+
* selfLink is a URL representing this object. Populated by the system. Read-only.<br><p> <br><p> DEPRECATED Kubernetes will stop propagating this field in 1.20 release and the field is planned to be removed in 1.21 release.
59+
*/
60+
@JsonProperty("selfLink")
61+
private String selfLink;
62+
63+
}
64+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2020 Marc Nuri
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.marcnuri.yakc.model.dev.knative.eventing.v1;
18+
19+
import com.fasterxml.jackson.annotation.JsonProperty;
20+
import com.marcnuri.yakc.model.Model;
21+
import lombok.AllArgsConstructor;
22+
import lombok.Builder;
23+
import lombok.Data;
24+
import lombok.NoArgsConstructor;
25+
import lombok.ToString;
26+
27+
/**
28+
* Spec defines the desired state of the Broker.
29+
*/
30+
@SuppressWarnings({"squid:S1192", "WeakerAccess", "unused"})
31+
@Builder(toBuilder = true, builderClassName = "Builder")
32+
@AllArgsConstructor
33+
@NoArgsConstructor
34+
@Data
35+
@ToString
36+
public class BrokerSpec implements Model {
37+
38+
39+
@JsonProperty("config")
40+
private BrokerSpecConfig config;
41+
42+
@JsonProperty("delivery")
43+
private BrokerSpecDelivery delivery;
44+
45+
}
46+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright 2020 Marc Nuri
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.marcnuri.yakc.model.dev.knative.eventing.v1;
18+
19+
import com.fasterxml.jackson.annotation.JsonProperty;
20+
import com.marcnuri.yakc.model.Model;
21+
import lombok.AllArgsConstructor;
22+
import lombok.Builder;
23+
import lombok.Data;
24+
import lombok.NoArgsConstructor;
25+
import lombok.ToString;
26+
27+
/**
28+
* Config is a KReference to the configuration that specifies configuration options for this Broker. For example, this could be a pointer to a ConfigMap.
29+
*/
30+
@SuppressWarnings({"squid:S1192", "WeakerAccess", "unused"})
31+
@Builder(toBuilder = true, builderClassName = "Builder")
32+
@AllArgsConstructor
33+
@NoArgsConstructor
34+
@Data
35+
@ToString
36+
public class BrokerSpecConfig implements Model {
37+
38+
39+
/**
40+
* API version of the referent.
41+
*/
42+
@JsonProperty("apiVersion")
43+
private String apiVersion;
44+
45+
/**
46+
* Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
47+
*/
48+
@JsonProperty("kind")
49+
private String kind;
50+
51+
/**
52+
* Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
53+
*/
54+
@JsonProperty("name")
55+
private String name;
56+
57+
/**
58+
* Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ This is optional field, it gets defaulted to the object holding it if left out.
59+
*/
60+
@JsonProperty("namespace")
61+
private String namespace;
62+
63+
}
64+

0 commit comments

Comments
 (0)