Skip to content

Commit

Permalink
Shorten function signature for watch APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
danopia committed Sep 18, 2024
1 parent 4d82974 commit bc56120
Show file tree
Hide file tree
Showing 33 changed files with 125 additions and 121 deletions.
2 changes: 1 addition & 1 deletion generation/codegen-mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export function generateModuleTypescript(surface: SurfaceMap, api: SurfaceApi):
returnSig += ` | MetaV1.Status`;
}
if (isWatch) {
returnSig = `ReadableStream<c.WatchEvent<${returnSig.slice(0, -4)} & c.ApiKind, MetaV1.Status & c.ApiKind>>`;
returnSig = `c.WatchEventStream<${returnSig.slice(0, -4)}>`;
}
}

Expand Down
12 changes: 6 additions & 6 deletions lib/argo-cd/argoproj.io@v1alpha1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class ArgoprojIoV1alpha1Api {

async watchApplicationListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<ArgoprojIoV1alpha1.Application & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<ArgoprojIoV1alpha1.Application>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}applications`,
Expand All @@ -63,7 +63,7 @@ export class ArgoprojIoV1alpha1Api {

async watchApplicationSetListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<ArgoprojIoV1alpha1.ApplicationSet & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<ArgoprojIoV1alpha1.ApplicationSet>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}applicationsets`,
Expand All @@ -90,7 +90,7 @@ export class ArgoprojIoV1alpha1Api {

async watchAppProjectListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<ArgoprojIoV1alpha1.AppProject & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<ArgoprojIoV1alpha1.AppProject>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}appprojects`,
Expand Down Expand Up @@ -127,7 +127,7 @@ export class ArgoprojIoV1alpha1NamespacedApi {

async watchApplicationList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<ArgoprojIoV1alpha1.Application & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<ArgoprojIoV1alpha1.Application>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}applications`,
Expand Down Expand Up @@ -244,7 +244,7 @@ export class ArgoprojIoV1alpha1NamespacedApi {

async watchApplicationSetList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<ArgoprojIoV1alpha1.ApplicationSet & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<ArgoprojIoV1alpha1.ApplicationSet>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}applicationsets`,
Expand Down Expand Up @@ -408,7 +408,7 @@ export class ArgoprojIoV1alpha1NamespacedApi {

async watchAppProjectList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<ArgoprojIoV1alpha1.AppProject & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<ArgoprojIoV1alpha1.AppProject>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}appprojects`,
Expand Down
4 changes: 2 additions & 2 deletions lib/builtin/admissionregistration.k8s.io@v1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class AdmissionregistrationV1Api {

async watchMutatingWebhookConfigurationList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AdmissionregistrationV1.MutatingWebhookConfiguration & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AdmissionregistrationV1.MutatingWebhookConfiguration>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}mutatingwebhookconfigurations`,
Expand Down Expand Up @@ -145,7 +145,7 @@ export class AdmissionregistrationV1Api {

async watchValidatingWebhookConfigurationList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AdmissionregistrationV1.ValidatingWebhookConfiguration & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AdmissionregistrationV1.ValidatingWebhookConfiguration>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingwebhookconfigurations`,
Expand Down
4 changes: 2 additions & 2 deletions lib/builtin/admissionregistration.k8s.io@v1alpha1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class AdmissionregistrationV1alpha1Api {

async watchValidatingAdmissionPolicyList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AdmissionregistrationV1alpha1.ValidatingAdmissionPolicy & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AdmissionregistrationV1alpha1.ValidatingAdmissionPolicy>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingadmissionpolicies`,
Expand Down Expand Up @@ -192,7 +192,7 @@ export class AdmissionregistrationV1alpha1Api {

async watchValidatingAdmissionPolicyBindingList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AdmissionregistrationV1alpha1.ValidatingAdmissionPolicyBinding & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AdmissionregistrationV1alpha1.ValidatingAdmissionPolicyBinding>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingadmissionpolicybindings`,
Expand Down
4 changes: 2 additions & 2 deletions lib/builtin/admissionregistration.k8s.io@v1beta1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class AdmissionregistrationV1beta1Api {

async watchValidatingAdmissionPolicyList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AdmissionregistrationV1beta1.ValidatingAdmissionPolicy & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AdmissionregistrationV1beta1.ValidatingAdmissionPolicy>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingadmissionpolicies`,
Expand Down Expand Up @@ -192,7 +192,7 @@ export class AdmissionregistrationV1beta1Api {

async watchValidatingAdmissionPolicyBindingList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AdmissionregistrationV1beta1.ValidatingAdmissionPolicyBinding & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AdmissionregistrationV1beta1.ValidatingAdmissionPolicyBinding>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingadmissionpolicybindings`,
Expand Down
2 changes: 1 addition & 1 deletion lib/builtin/apiextensions.k8s.io@v1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ApiextensionsV1Api {

async watchCustomResourceDefinitionList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<ApiextensionsV1.CustomResourceDefinition & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<ApiextensionsV1.CustomResourceDefinition>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}customresourcedefinitions`,
Expand Down
2 changes: 1 addition & 1 deletion lib/builtin/apiregistration.k8s.io@v1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ApiregistrationV1Api {

async watchAPIServiceList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<ApiregistrationV1.APIService & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<ApiregistrationV1.APIService>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}apiservices`,
Expand Down
20 changes: 10 additions & 10 deletions lib/builtin/apps@v1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class AppsV1Api {

async watchControllerRevisionListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AppsV1.ControllerRevision & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AppsV1.ControllerRevision>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}controllerrevisions`,
Expand All @@ -64,7 +64,7 @@ export class AppsV1Api {

async watchDaemonSetListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AppsV1.DaemonSet & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AppsV1.DaemonSet>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}daemonsets`,
Expand All @@ -91,7 +91,7 @@ export class AppsV1Api {

async watchDeploymentListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AppsV1.Deployment & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AppsV1.Deployment>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}deployments`,
Expand All @@ -118,7 +118,7 @@ export class AppsV1Api {

async watchReplicaSetListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AppsV1.ReplicaSet & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AppsV1.ReplicaSet>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}replicasets`,
Expand All @@ -145,7 +145,7 @@ export class AppsV1Api {

async watchStatefulSetListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AppsV1.StatefulSet & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AppsV1.StatefulSet>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}statefulsets`,
Expand Down Expand Up @@ -182,7 +182,7 @@ export class AppsV1NamespacedApi {

async watchControllerRevisionList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AppsV1.ControllerRevision & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AppsV1.ControllerRevision>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}controllerrevisions`,
Expand Down Expand Up @@ -299,7 +299,7 @@ export class AppsV1NamespacedApi {

async watchDaemonSetList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AppsV1.DaemonSet & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AppsV1.DaemonSet>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}daemonsets`,
Expand Down Expand Up @@ -463,7 +463,7 @@ export class AppsV1NamespacedApi {

async watchDeploymentList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AppsV1.Deployment & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AppsV1.Deployment>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}deployments`,
Expand Down Expand Up @@ -674,7 +674,7 @@ export class AppsV1NamespacedApi {

async watchReplicaSetList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AppsV1.ReplicaSet & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AppsV1.ReplicaSet>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}replicasets`,
Expand Down Expand Up @@ -885,7 +885,7 @@ export class AppsV1NamespacedApi {

async watchStatefulSetList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AppsV1.StatefulSet & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AppsV1.StatefulSet>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}statefulsets`,
Expand Down
4 changes: 2 additions & 2 deletions lib/builtin/autoscaling@v1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class AutoscalingV1Api {

async watchHorizontalPodAutoscalerListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AutoscalingV1.HorizontalPodAutoscaler & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AutoscalingV1.HorizontalPodAutoscaler>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}horizontalpodautoscalers`,
Expand Down Expand Up @@ -73,7 +73,7 @@ export class AutoscalingV1NamespacedApi {

async watchHorizontalPodAutoscalerList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AutoscalingV1.HorizontalPodAutoscaler & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AutoscalingV1.HorizontalPodAutoscaler>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}horizontalpodautoscalers`,
Expand Down
4 changes: 2 additions & 2 deletions lib/builtin/autoscaling@v2/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class AutoscalingV2Api {

async watchHorizontalPodAutoscalerListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AutoscalingV2.HorizontalPodAutoscaler & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AutoscalingV2.HorizontalPodAutoscaler>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}horizontalpodautoscalers`,
Expand Down Expand Up @@ -73,7 +73,7 @@ export class AutoscalingV2NamespacedApi {

async watchHorizontalPodAutoscalerList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<AutoscalingV2.HorizontalPodAutoscaler & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<AutoscalingV2.HorizontalPodAutoscaler>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}horizontalpodautoscalers`,
Expand Down
8 changes: 4 additions & 4 deletions lib/builtin/batch@v1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class BatchV1Api {

async watchCronJobListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<BatchV1.CronJob & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<BatchV1.CronJob>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}cronjobs`,
Expand All @@ -63,7 +63,7 @@ export class BatchV1Api {

async watchJobListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<BatchV1.Job & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<BatchV1.Job>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}jobs`,
Expand Down Expand Up @@ -100,7 +100,7 @@ export class BatchV1NamespacedApi {

async watchCronJobList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<BatchV1.CronJob & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<BatchV1.CronJob>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}cronjobs`,
Expand Down Expand Up @@ -264,7 +264,7 @@ export class BatchV1NamespacedApi {

async watchJobList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<BatchV1.Job & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<BatchV1.Job>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}jobs`,
Expand Down
2 changes: 1 addition & 1 deletion lib/builtin/certificates.k8s.io@v1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class CertificatesV1Api {

async watchCertificateSigningRequestList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<CertificatesV1.CertificateSigningRequest & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<CertificatesV1.CertificateSigningRequest>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}certificatesigningrequests`,
Expand Down
2 changes: 1 addition & 1 deletion lib/builtin/certificates.k8s.io@v1alpha1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class CertificatesV1alpha1Api {

async watchClusterTrustBundleList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<CertificatesV1alpha1.ClusterTrustBundle & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<CertificatesV1alpha1.ClusterTrustBundle>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}clustertrustbundles`,
Expand Down
4 changes: 2 additions & 2 deletions lib/builtin/coordination.k8s.io@v1/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class CoordinationV1Api {

async watchLeaseListForAllNamespaces(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<CoordinationV1.Lease & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<CoordinationV1.Lease>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}leases`,
Expand Down Expand Up @@ -73,7 +73,7 @@ export class CoordinationV1NamespacedApi {

async watchLeaseList(
opts: operations.WatchListOpts = {},
): Promise<ReadableStream<c.WatchEvent<CoordinationV1.Lease & c.ApiKind, MetaV1.Status & c.ApiKind>>> {
): Promise<c.WatchEventStream<CoordinationV1.Lease>> {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}leases`,
Expand Down
Loading

0 comments on commit bc56120

Please sign in to comment.