Skip to content

Commit

Permalink
Fix typegen for apiextensionsV1
Browse files Browse the repository at this point in the history
  • Loading branch information
lblackstone committed Sep 3, 2019
1 parent 4b6af64 commit 9f570cd
Show file tree
Hide file tree
Showing 29 changed files with 4,769 additions and 2,519 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PROVIDER := pulumi-resource-${PACK}
CODEGEN := pulumi-gen-${PACK}
VERSION ?= $(shell scripts/get-version)
PYPI_VERSION := $(shell scripts/get-py-version)
KUBE_VERSION ?= v1.16.0-beta.0
KUBE_VERSION ?= v1.16.0-beta.1
SWAGGER_URL ?= https://github.com/kubernetes/kubernetes/raw/${KUBE_VERSION}/api/openapi-spec/swagger.json
OPENAPI_DIR := pkg/gen/openapi-specs
OPENAPI_FILE := ${OPENAPI_DIR}/swagger-${KUBE_VERSION}.json
Expand Down
17 changes: 13 additions & 4 deletions pkg/gen/typegen.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ func fmtComment(comment interface{}, prefix string, bareRender bool, opts groupO

const (
apiextensionsV1beta1 = "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1"
apiextensionsV1 = "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1"
quantity = "io.k8s.apimachinery.pkg.api.resource.Quantity"
intOrString = "io.k8s.apimachinery.pkg.util.intstr.IntOrString"
v1Fields = "io.k8s.apimachinery.pkg.apis.meta.v1.Fields"
Expand All @@ -315,6 +316,10 @@ const (
v1beta1JSONSchemaPropsOrArray = apiextensionsV1beta1 + ".JSONSchemaPropsOrArray"
v1beta1JSON = apiextensionsV1beta1 + ".JSON"
v1beta1CRSubresourceStatus = apiextensionsV1beta1 + ".CustomResourceSubresourceStatus"
v1JSONSchemaPropsOrBool = apiextensionsV1 + ".JSONSchemaPropsOrBool"
v1JSONSchemaPropsOrArray = apiextensionsV1 + ".JSONSchemaPropsOrArray"
v1JSON = apiextensionsV1 + ".JSON"
v1CRSubresourceStatus = apiextensionsV1 + ".CustomResourceSubresourceStatus"
)

func makeTypescriptType(resourceType, propName string, prop map[string]interface{}, opts groupOpts) string {
Expand Down Expand Up @@ -399,9 +404,13 @@ func makeTypescriptType(resourceType, propName string, prop map[string]interface
ref = tsStringT
case v1beta1JSONSchemaPropsOrBool:
ref = "apiextensions.v1beta1.JSONSchemaProps | boolean"
case v1JSONSchemaPropsOrBool:
ref = "apiextensions.v1.JSONSchemaProps | boolean"
case v1beta1JSONSchemaPropsOrArray:
ref = "apiextensions.v1beta1.JSONSchemaProps | any[]"
case v1beta1JSON, v1beta1CRSubresourceStatus:
case v1JSONSchemaPropsOrArray:
ref = "apiextensions.v1.JSONSchemaProps | any[]"
case v1beta1JSON, v1beta1CRSubresourceStatus, v1JSON, v1CRSubresourceStatus:
ref = "any"
default:
isSimpleRef = false
Expand Down Expand Up @@ -465,11 +474,11 @@ func makePythonType(resourceType, propName string, prop map[string]interface{},
case v1Time, v1MicroTime:
// TODO: Automatically deserialized with `DateConstructor`.
ref = pyStringT
case v1beta1JSONSchemaPropsOrBool:
case v1beta1JSONSchemaPropsOrBool, v1JSONSchemaPropsOrBool:
ref = fmt.Sprintf("Union[%s, %s]", pyDictT, pyBoolT)
case v1beta1JSONSchemaPropsOrArray:
case v1beta1JSONSchemaPropsOrArray, v1JSONSchemaPropsOrArray:
ref = fmt.Sprintf("Union[%s, %s]", pyDictT, pyListT)
case v1beta1JSON, v1beta1CRSubresourceStatus:
case v1beta1JSON, v1beta1CRSubresourceStatus, v1JSON, v1CRSubresourceStatus:
ref = pyAnyT
default:
ref = pyDictT
Expand Down
39 changes: 21 additions & 18 deletions sdk/nodejs/admissionregistration/v1/MutatingWebhookConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// *** Do not edit by hand unless you're certain you know what you are doing! ***

import * as pulumi from "@pulumi/pulumi";
import * as inputApi from "../../types/input";
import * as outputApi from "../../types/output";
import { core } from "../..";
import * as inputs from "../../types/input";
import * as outputs from "../../types/output";
import { getVersion } from "../../version";

/**
Expand All @@ -15,39 +16,38 @@ import { getVersion } from "../../version";
* 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/api-conventions.md#resources
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
*/
public readonly apiVersion: pulumi.Output<"admissionregistration.k8s.io/v1">;

/**
* 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/api-conventions.md#types-kinds
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
*/
public readonly kind: pulumi.Output<"MutatingWebhookConfiguration">;

/**
* Standard object metadata; More info:
* https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata.
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
*/
public readonly metadata: pulumi.Output<outputApi.meta.v1.ObjectMeta>;
public readonly metadata: pulumi.Output<outputs.meta.v1.ObjectMeta>;

/**
* Webhooks is a list of webhooks and the affected resources and operations.
*/
public readonly webhooks: pulumi.Output<outputApi.admissionregistration.v1.MutatingWebhook[]>;
public readonly webhooks: pulumi.Output<outputs.admissionregistration.v1.MutatingWebhook[]>;

/**
* Get the state of an existing `MutatingWebhookConfiguration` resource, as identified by `id`.
* Typically this ID is of the form <namespace>/<name>; if <namespace> is omitted, then (per
* Kubernetes convention) the ID becomes default/<name>.
* The ID is of the form `[namespace]/<name>`; if `namespace` is omitted, then (per
* Kubernetes convention) the ID becomes `default/<name>`.
*
* Pulumi will keep track of this resource using `name` as the Pulumi ID.
*
* @param name _Unique_ name used to register this resource with Pulumi.
* @param id An ID for the Kubernetes resource to retrieve. Takes the form
* <namespace>/<name> or <name>.
* @param id An ID for the Kubernetes resource to retrieve. Takes the form `[namespace]/<name>`.
* @param opts Uniquely specifies a CustomResource to select.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): MutatingWebhookConfiguration {
Expand Down Expand Up @@ -76,12 +76,15 @@ import { getVersion } from "../../version";
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args?: inputApi.admissionregistration.v1.MutatingWebhookConfiguration, opts?: pulumi.CustomResourceOptions) {
let inputs: pulumi.Inputs = {};
inputs["apiVersion"] = "admissionregistration.k8s.io/v1";
inputs["kind"] = "MutatingWebhookConfiguration";
inputs["metadata"] = args && args.metadata || undefined;
inputs["webhooks"] = args && args.webhooks || undefined;
constructor(name: string, args?: inputs.admissionregistration.v1.MutatingWebhookConfiguration, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};

props["apiVersion"] = "admissionregistration.k8s.io/v1";
props["kind"] = "MutatingWebhookConfiguration";
props["metadata"] = args && args.metadata || undefined;
props["webhooks"] = args && args.webhooks || undefined;

props["status"] = undefined;

if (!opts) {
opts = {};
Expand All @@ -90,6 +93,6 @@ import { getVersion } from "../../version";
if (!opts.version) {
opts.version = getVersion();
}
super(MutatingWebhookConfiguration.__pulumiType, name, inputs, opts);
super(MutatingWebhookConfiguration.__pulumiType, name, props, opts);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// *** Do not edit by hand unless you're certain you know what you are doing! ***

import * as pulumi from "@pulumi/pulumi";
import * as inputApi from "../../types/input";
import * as outputApi from "../../types/output";
import { core } from "../..";
import * as inputs from "../../types/input";
import * as outputs from "../../types/output";
import { getVersion } from "../../version";

/**
Expand All @@ -14,39 +15,38 @@ import { getVersion } from "../../version";
* 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/api-conventions.md#resources
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
*/
public readonly apiVersion: pulumi.Output<"admissionregistration.k8s.io/v1">;

/**
* List of MutatingWebhookConfiguration.
*/
public readonly items: pulumi.Output<outputApi.admissionregistration.v1.MutatingWebhookConfiguration[]>;
public readonly items: pulumi.Output<outputs.admissionregistration.v1.MutatingWebhookConfiguration[]>;

/**
* 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/api-conventions.md#types-kinds
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
*/
public readonly kind: pulumi.Output<"MutatingWebhookConfigurationList">;

/**
* Standard list metadata. More info:
* https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
*/
public readonly metadata: pulumi.Output<outputApi.meta.v1.ListMeta>;
public readonly metadata: pulumi.Output<outputs.meta.v1.ListMeta>;

/**
* Get the state of an existing `MutatingWebhookConfigurationList` resource, as identified by `id`.
* Typically this ID is of the form <namespace>/<name>; if <namespace> is omitted, then (per
* Kubernetes convention) the ID becomes default/<name>.
* The ID is of the form `[namespace]/<name>`; if `namespace` is omitted, then (per
* Kubernetes convention) the ID becomes `default/<name>`.
*
* Pulumi will keep track of this resource using `name` as the Pulumi ID.
*
* @param name _Unique_ name used to register this resource with Pulumi.
* @param id An ID for the Kubernetes resource to retrieve. Takes the form
* <namespace>/<name> or <name>.
* @param id An ID for the Kubernetes resource to retrieve. Takes the form `[namespace]/<name>`.
* @param opts Uniquely specifies a CustomResource to select.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): MutatingWebhookConfigurationList {
Expand Down Expand Up @@ -75,12 +75,15 @@ import { getVersion } from "../../version";
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args?: inputApi.admissionregistration.v1.MutatingWebhookConfigurationList, opts?: pulumi.CustomResourceOptions) {
let inputs: pulumi.Inputs = {};
inputs["apiVersion"] = "admissionregistration.k8s.io/v1";
inputs["items"] = args && args.items || undefined;
inputs["kind"] = "MutatingWebhookConfigurationList";
inputs["metadata"] = args && args.metadata || undefined;
constructor(name: string, args?: inputs.admissionregistration.v1.MutatingWebhookConfigurationList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;

props["apiVersion"] = "admissionregistration.k8s.io/v1";
props["kind"] = "MutatingWebhookConfigurationList";
props["metadata"] = args && args.metadata || undefined;

props["status"] = undefined;

if (!opts) {
opts = {};
Expand All @@ -89,6 +92,6 @@ import { getVersion } from "../../version";
if (!opts.version) {
opts.version = getVersion();
}
super(MutatingWebhookConfigurationList.__pulumiType, name, inputs, opts);
super(MutatingWebhookConfigurationList.__pulumiType, name, props, opts);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// *** Do not edit by hand unless you're certain you know what you are doing! ***

import * as pulumi from "@pulumi/pulumi";
import * as inputApi from "../../types/input";
import * as outputApi from "../../types/output";
import { core } from "../..";
import * as inputs from "../../types/input";
import * as outputs from "../../types/output";
import { getVersion } from "../../version";

/**
Expand All @@ -15,39 +16,38 @@ import { getVersion } from "../../version";
* 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/api-conventions.md#resources
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
*/
public readonly apiVersion: pulumi.Output<"admissionregistration.k8s.io/v1">;

/**
* 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/api-conventions.md#types-kinds
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
*/
public readonly kind: pulumi.Output<"ValidatingWebhookConfiguration">;

/**
* Standard object metadata; More info:
* https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata.
* https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
*/
public readonly metadata: pulumi.Output<outputApi.meta.v1.ObjectMeta>;
public readonly metadata: pulumi.Output<outputs.meta.v1.ObjectMeta>;

/**
* Webhooks is a list of webhooks and the affected resources and operations.
*/
public readonly webhooks: pulumi.Output<outputApi.admissionregistration.v1.ValidatingWebhook[]>;
public readonly webhooks: pulumi.Output<outputs.admissionregistration.v1.ValidatingWebhook[]>;

/**
* Get the state of an existing `ValidatingWebhookConfiguration` resource, as identified by `id`.
* Typically this ID is of the form <namespace>/<name>; if <namespace> is omitted, then (per
* Kubernetes convention) the ID becomes default/<name>.
* The ID is of the form `[namespace]/<name>`; if `namespace` is omitted, then (per
* Kubernetes convention) the ID becomes `default/<name>`.
*
* Pulumi will keep track of this resource using `name` as the Pulumi ID.
*
* @param name _Unique_ name used to register this resource with Pulumi.
* @param id An ID for the Kubernetes resource to retrieve. Takes the form
* <namespace>/<name> or <name>.
* @param id An ID for the Kubernetes resource to retrieve. Takes the form `[namespace]/<name>`.
* @param opts Uniquely specifies a CustomResource to select.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): ValidatingWebhookConfiguration {
Expand Down Expand Up @@ -76,12 +76,15 @@ import { getVersion } from "../../version";
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args?: inputApi.admissionregistration.v1.ValidatingWebhookConfiguration, opts?: pulumi.CustomResourceOptions) {
let inputs: pulumi.Inputs = {};
inputs["apiVersion"] = "admissionregistration.k8s.io/v1";
inputs["kind"] = "ValidatingWebhookConfiguration";
inputs["metadata"] = args && args.metadata || undefined;
inputs["webhooks"] = args && args.webhooks || undefined;
constructor(name: string, args?: inputs.admissionregistration.v1.ValidatingWebhookConfiguration, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};

props["apiVersion"] = "admissionregistration.k8s.io/v1";
props["kind"] = "ValidatingWebhookConfiguration";
props["metadata"] = args && args.metadata || undefined;
props["webhooks"] = args && args.webhooks || undefined;

props["status"] = undefined;

if (!opts) {
opts = {};
Expand All @@ -90,6 +93,6 @@ import { getVersion } from "../../version";
if (!opts.version) {
opts.version = getVersion();
}
super(ValidatingWebhookConfiguration.__pulumiType, name, inputs, opts);
super(ValidatingWebhookConfiguration.__pulumiType, name, props, opts);
}
}
Loading

0 comments on commit 9f570cd

Please sign in to comment.