Skip to content

Commit

Permalink
Regenerate from latest Kubernetes: 1.28.0
Browse files Browse the repository at this point in the history
  • Loading branch information
danopia committed Aug 17, 2023
1 parent 064e308 commit f671940
Show file tree
Hide file tree
Showing 14 changed files with 782 additions and 81 deletions.
2 changes: 1 addition & 1 deletion generation/generate-all.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh -eux

# https://github.com/kubernetes/kubernetes/releases
./generation/sources/builtin.sh v1.27.4
./generation/sources/builtin.sh v1.28.0

# https://github.com/argoproj/argo-cd/releases
./generation/sources/argo-cd.sh v2.8.0
Expand Down
32 changes: 30 additions & 2 deletions lib/builtin/admissionregistration.k8s.io@v1alpha1/structs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,25 @@ export function fromParamKind(input: ParamKind): c.JSONValue {
...input,
}}

/** ParamRef references a parameter resource */
/** ParamRef describes how to locate the params to be used as input to expressions of rules applied by a policy binding. */
export interface ParamRef {
name?: string | null;
namespace?: string | null;
parameterNotFoundAction?: string | null;
selector?: MetaV1.LabelSelector | null;
}
export function toParamRef(input: c.JSONValue): ParamRef {
const obj = c.checkObj(input);
return {
name: c.readOpt(obj["name"], c.checkStr),
namespace: c.readOpt(obj["namespace"], c.checkStr),
parameterNotFoundAction: c.readOpt(obj["parameterNotFoundAction"], c.checkStr),
selector: c.readOpt(obj["selector"], MetaV1.toLabelSelector),
}}
export function fromParamRef(input: ParamRef): c.JSONValue {
return {
...input,
selector: input.selector != null ? MetaV1.fromLabelSelector(input.selector) : undefined,
}}

/** TypeChecking contains results of type checking the expressions in the ValidatingAdmissionPolicy */
Expand Down Expand Up @@ -184,6 +189,7 @@ export interface ValidatingAdmissionPolicySpec {
matchConstraints?: MatchResources | null;
paramKind?: ParamKind | null;
validations?: Array<Validation> | null;
variables?: Array<Variable> | null;
}
export function toValidatingAdmissionPolicySpec(input: c.JSONValue): ValidatingAdmissionPolicySpec {
const obj = c.checkObj(input);
Expand All @@ -194,6 +200,7 @@ export function toValidatingAdmissionPolicySpec(input: c.JSONValue): ValidatingA
matchConstraints: c.readOpt(obj["matchConstraints"], toMatchResources),
paramKind: c.readOpt(obj["paramKind"], toParamKind),
validations: c.readOpt(obj["validations"], x => c.readList(x, toValidation)),
variables: c.readOpt(obj["variables"], x => c.readList(x, toVariable)),
}}
export function fromValidatingAdmissionPolicySpec(input: ValidatingAdmissionPolicySpec): c.JSONValue {
return {
Expand All @@ -203,6 +210,7 @@ export function fromValidatingAdmissionPolicySpec(input: ValidatingAdmissionPoli
matchConstraints: input.matchConstraints != null ? fromMatchResources(input.matchConstraints) : undefined,
paramKind: input.paramKind != null ? fromParamKind(input.paramKind) : undefined,
validations: input.validations?.map(fromValidation),
variables: input.variables?.map(fromVariable),
}}

/** Validation specifies the CEL expression which is used to apply the validation. */
Expand All @@ -225,6 +233,22 @@ export function fromValidation(input: Validation): c.JSONValue {
...input,
}}

/** Variable is the definition of a variable that is used for composition. */
export interface Variable {
expression: string;
name: string;
}
export function toVariable(input: c.JSONValue): Variable {
const obj = c.checkObj(input);
return {
expression: c.checkStr(obj["expression"]),
name: c.checkStr(obj["name"]),
}}
export function fromVariable(input: Variable): c.JSONValue {
return {
...input,
}}

/** ValidatingAdmissionPolicyStatus represents the status of a ValidatingAdmissionPolicy. */
export interface ValidatingAdmissionPolicyStatus {
conditions?: Array<MetaV1.Condition> | null;
Expand All @@ -245,7 +269,11 @@ export function fromValidatingAdmissionPolicyStatus(input: ValidatingAdmissionPo
typeChecking: input.typeChecking != null ? fromTypeChecking(input.typeChecking) : undefined,
}}

/** ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters. */
/** ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters.
For a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding.
The CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget. */
export interface ValidatingAdmissionPolicyBinding {
apiVersion?: "admissionregistration.k8s.io/v1alpha1";
kind?: "ValidatingAdmissionPolicyBinding";
Expand Down
237 changes: 237 additions & 0 deletions lib/builtin/admissionregistration.k8s.io@v1beta1/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
export * from "./structs.ts";

// Autogenerated API file for AdmissionregistrationV1beta1
import * as c from "../../common.ts";
import * as operations from "../../operations.ts";
import * as MetaV1 from "../meta@v1/structs.ts";
import * as AdmissionregistrationV1beta1 from "./structs.ts";

export class AdmissionregistrationV1beta1Api {
#client: c.RestClient;
#root = "/apis/admissionregistration.k8s.io/v1beta1/";
constructor(client: c.RestClient) {
this.#client = client;
}

async getValidatingAdmissionPolicyList(opts: operations.GetListOpts = {}) {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingadmissionpolicies`,
expectJson: true,
querystring: operations.formatGetListOpts(opts),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicyList(resp);
}

async watchValidatingAdmissionPolicyList(opts: operations.WatchListOpts = {}) {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingadmissionpolicies`,
expectJson: true,
expectStream: true,
querystring: operations.formatWatchListOpts(opts),
abortSignal: opts.abortSignal,
});
return resp.pipeThrough(new c.WatchEventTransformer(AdmissionregistrationV1beta1.toValidatingAdmissionPolicy, MetaV1.toStatus));
}

async createValidatingAdmissionPolicy(body: AdmissionregistrationV1beta1.ValidatingAdmissionPolicy, opts: operations.PutOpts = {}) {
const resp = await this.#client.performRequest({
method: "POST",
path: `${this.#root}validatingadmissionpolicies`,
expectJson: true,
querystring: operations.formatPutOpts(opts),
bodyJson: AdmissionregistrationV1beta1.fromValidatingAdmissionPolicy(body),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicy(resp);
}

async deleteValidatingAdmissionPolicyList(opts: operations.DeleteListOpts = {}) {
const resp = await this.#client.performRequest({
method: "DELETE",
path: `${this.#root}validatingadmissionpolicies`,
expectJson: true,
querystring: operations.formatDeleteListOpts(opts),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicyList(resp);
}

async getValidatingAdmissionPolicy(name: string, opts: operations.NoOpts = {}) {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingadmissionpolicies/${name}`,
expectJson: true,
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicy(resp);
}

async deleteValidatingAdmissionPolicy(name: string, opts: operations.DeleteOpts = {}) {
const resp = await this.#client.performRequest({
method: "DELETE",
path: `${this.#root}validatingadmissionpolicies/${name}`,
expectJson: true,
querystring: operations.formatDeleteOpts(opts),
abortSignal: opts.abortSignal,
});
if (c.isStatusKind(resp)) return MetaV1.toStatus(resp);
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicy(resp);
}

async replaceValidatingAdmissionPolicy(name: string, body: AdmissionregistrationV1beta1.ValidatingAdmissionPolicy, opts: operations.PutOpts = {}) {
const resp = await this.#client.performRequest({
method: "PUT",
path: `${this.#root}validatingadmissionpolicies/${name}`,
expectJson: true,
querystring: operations.formatPutOpts(opts),
bodyJson: AdmissionregistrationV1beta1.fromValidatingAdmissionPolicy(body),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicy(resp);
}

async patchValidatingAdmissionPolicy(name: string, type: c.PatchType, body: AdmissionregistrationV1beta1.ValidatingAdmissionPolicy | c.JsonPatch, opts: operations.PatchOpts = {}) {
const resp = await this.#client.performRequest({
method: "PATCH",
path: `${this.#root}validatingadmissionpolicies/${name}`,
expectJson: true,
querystring: operations.formatPatchOpts(opts),
contentType: c.getPatchContentType(type),
bodyJson: Array.isArray(body) ? body : AdmissionregistrationV1beta1.fromValidatingAdmissionPolicy(body),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicy(resp);
}

async getValidatingAdmissionPolicyStatus(name: string, opts: operations.NoOpts = {}) {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingadmissionpolicies/${name}/status`,
expectJson: true,
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicy(resp);
}

async replaceValidatingAdmissionPolicyStatus(name: string, body: AdmissionregistrationV1beta1.ValidatingAdmissionPolicy, opts: operations.PutOpts = {}) {
const resp = await this.#client.performRequest({
method: "PUT",
path: `${this.#root}validatingadmissionpolicies/${name}/status`,
expectJson: true,
querystring: operations.formatPutOpts(opts),
bodyJson: AdmissionregistrationV1beta1.fromValidatingAdmissionPolicy(body),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicy(resp);
}

async patchValidatingAdmissionPolicyStatus(name: string, type: c.PatchType, body: AdmissionregistrationV1beta1.ValidatingAdmissionPolicy | c.JsonPatch, opts: operations.PatchOpts = {}) {
const resp = await this.#client.performRequest({
method: "PATCH",
path: `${this.#root}validatingadmissionpolicies/${name}/status`,
expectJson: true,
querystring: operations.formatPatchOpts(opts),
contentType: c.getPatchContentType(type),
bodyJson: Array.isArray(body) ? body : AdmissionregistrationV1beta1.fromValidatingAdmissionPolicy(body),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicy(resp);
}

async getValidatingAdmissionPolicyBindingList(opts: operations.GetListOpts = {}) {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingadmissionpolicybindings`,
expectJson: true,
querystring: operations.formatGetListOpts(opts),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicyBindingList(resp);
}

async watchValidatingAdmissionPolicyBindingList(opts: operations.WatchListOpts = {}) {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingadmissionpolicybindings`,
expectJson: true,
expectStream: true,
querystring: operations.formatWatchListOpts(opts),
abortSignal: opts.abortSignal,
});
return resp.pipeThrough(new c.WatchEventTransformer(AdmissionregistrationV1beta1.toValidatingAdmissionPolicyBinding, MetaV1.toStatus));
}

async createValidatingAdmissionPolicyBinding(body: AdmissionregistrationV1beta1.ValidatingAdmissionPolicyBinding, opts: operations.PutOpts = {}) {
const resp = await this.#client.performRequest({
method: "POST",
path: `${this.#root}validatingadmissionpolicybindings`,
expectJson: true,
querystring: operations.formatPutOpts(opts),
bodyJson: AdmissionregistrationV1beta1.fromValidatingAdmissionPolicyBinding(body),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicyBinding(resp);
}

async deleteValidatingAdmissionPolicyBindingList(opts: operations.DeleteListOpts = {}) {
const resp = await this.#client.performRequest({
method: "DELETE",
path: `${this.#root}validatingadmissionpolicybindings`,
expectJson: true,
querystring: operations.formatDeleteListOpts(opts),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicyBindingList(resp);
}

async getValidatingAdmissionPolicyBinding(name: string, opts: operations.NoOpts = {}) {
const resp = await this.#client.performRequest({
method: "GET",
path: `${this.#root}validatingadmissionpolicybindings/${name}`,
expectJson: true,
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicyBinding(resp);
}

async deleteValidatingAdmissionPolicyBinding(name: string, opts: operations.DeleteOpts = {}) {
const resp = await this.#client.performRequest({
method: "DELETE",
path: `${this.#root}validatingadmissionpolicybindings/${name}`,
expectJson: true,
querystring: operations.formatDeleteOpts(opts),
abortSignal: opts.abortSignal,
});
if (c.isStatusKind(resp)) return MetaV1.toStatus(resp);
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicyBinding(resp);
}

async replaceValidatingAdmissionPolicyBinding(name: string, body: AdmissionregistrationV1beta1.ValidatingAdmissionPolicyBinding, opts: operations.PutOpts = {}) {
const resp = await this.#client.performRequest({
method: "PUT",
path: `${this.#root}validatingadmissionpolicybindings/${name}`,
expectJson: true,
querystring: operations.formatPutOpts(opts),
bodyJson: AdmissionregistrationV1beta1.fromValidatingAdmissionPolicyBinding(body),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicyBinding(resp);
}

async patchValidatingAdmissionPolicyBinding(name: string, type: c.PatchType, body: AdmissionregistrationV1beta1.ValidatingAdmissionPolicyBinding | c.JsonPatch, opts: operations.PatchOpts = {}) {
const resp = await this.#client.performRequest({
method: "PATCH",
path: `${this.#root}validatingadmissionpolicybindings/${name}`,
expectJson: true,
querystring: operations.formatPatchOpts(opts),
contentType: c.getPatchContentType(type),
bodyJson: Array.isArray(body) ? body : AdmissionregistrationV1beta1.fromValidatingAdmissionPolicyBinding(body),
abortSignal: opts.abortSignal,
});
return AdmissionregistrationV1beta1.toValidatingAdmissionPolicyBinding(resp);
}

}
Loading

0 comments on commit f671940

Please sign in to comment.