Skip to content
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

Update nodejs SDK to use optional chaining in constructor #959

Merged
merged 3 commits into from
Jan 23, 2020
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## HEAD (Unreleased)

### Improvements

- Update nodejs SDK to use optional chaining in constructor. (https://github.com/pulumi/pulumi-kubernetes/pull/959).

## 1.4.5 (January 22, 2020)

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion pkg/gen/nodejs-templates/package.json.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build": "tsc"
},
"dependencies": {
"@pulumi/pulumi": "^1.6.0",
"@pulumi/pulumi": "^1.8.1",
"@types/js-yaml": "^3.11.2",
"js-yaml": "^3.12.0",
"shell-quote": "^1.6.1",
Expand Down
2 changes: 1 addition & 1 deletion pkg/gen/typegen.go
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ func createGroups(definitionsJSON map[string]interface{}, opts groupOpts) []*Gro
propName = strings.ReplaceAll(propName, "-", "_")

// Create a default value for the field.
defaultValue := fmt.Sprintf("args && args.%s || undefined", propName)
defaultValue := fmt.Sprintf("args?.%s", propName)
switch propName {
case "apiVersion":
defaultValue = fmt.Sprintf(`"%s"`, defaultGroupVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ import { getVersion } from "../../version";

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

props["status"] = undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.admissionregistration.v1.MutatingWebhookConfigurationList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

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

props["status"] = undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ import { getVersion } from "../../version";

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

props["status"] = undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.admissionregistration.v1.ValidatingWebhookConfigurationList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

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

props["status"] = undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ import { getVersion } from "../../version";

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

props["status"] = undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.admissionregistration.v1beta1.MutatingWebhookConfigurationList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

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

props["status"] = undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ import { getVersion } from "../../version";

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

props["status"] = undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.admissionregistration.v1beta1.ValidatingWebhookConfigurationList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

props["apiVersion"] = "admissionregistration.k8s.io/v1beta1";
props["kind"] = "ValidatingWebhookConfigurationList";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apiextensions/v1/CustomResourceDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apiextensions.v1.CustomResourceDefinition, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["spec"] = args && args.spec || undefined;
props["spec"] = args?.spec;

props["apiVersion"] = "apiextensions.k8s.io/v1";
props["kind"] = "CustomResourceDefinition";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apiextensions/v1/CustomResourceDefinitionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apiextensions.v1.CustomResourceDefinitionList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

props["apiVersion"] = "apiextensions.k8s.io/v1";
props["kind"] = "CustomResourceDefinitionList";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apiextensions/v1beta1/CustomResourceDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apiextensions.v1beta1.CustomResourceDefinition, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["spec"] = args && args.spec || undefined;
props["spec"] = args?.spec;

props["apiVersion"] = "apiextensions.k8s.io/v1beta1";
props["kind"] = "CustomResourceDefinition";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apiextensions.v1beta1.CustomResourceDefinitionList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

props["apiVersion"] = "apiextensions.k8s.io/v1beta1";
props["kind"] = "CustomResourceDefinitionList";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apiregistration/v1/APIService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ import { getVersion } from "../../version";

props["apiVersion"] = "apiregistration.k8s.io/v1";
props["kind"] = "APIService";
props["metadata"] = args && args.metadata || undefined;
props["spec"] = args && args.spec || undefined;
props["metadata"] = args?.metadata;
props["spec"] = args?.spec;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apiregistration/v1/APIServiceList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apiregistration.v1.APIServiceList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

props["apiVersion"] = "apiregistration.k8s.io/v1";
props["kind"] = "APIServiceList";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apiregistration/v1beta1/APIService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ import { getVersion } from "../../version";

props["apiVersion"] = "apiregistration.k8s.io/v1beta1";
props["kind"] = "APIService";
props["metadata"] = args && args.metadata || undefined;
props["spec"] = args && args.spec || undefined;
props["metadata"] = args?.metadata;
props["spec"] = args?.spec;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apiregistration/v1beta1/APIServiceList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apiregistration.v1beta1.APIServiceList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

props["apiVersion"] = "apiregistration.k8s.io/v1beta1";
props["kind"] = "APIServiceList";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
6 changes: 3 additions & 3 deletions sdk/nodejs/apps/v1/ControllerRevision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apps.v1.ControllerRevision, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["revision"] = args && args.revision || undefined;
props["revision"] = args?.revision;

props["apiVersion"] = "apps/v1";
props["data"] = args && args.data || undefined;
props["data"] = args?.data;
props["kind"] = "ControllerRevision";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apps/v1/ControllerRevisionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apps.v1.ControllerRevisionList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

props["apiVersion"] = "apps/v1";
props["kind"] = "ControllerRevisionList";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apps/v1/DaemonSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ import { getVersion } from "../../version";

props["apiVersion"] = "apps/v1";
props["kind"] = "DaemonSet";
props["metadata"] = args && args.metadata || undefined;
props["spec"] = args && args.spec || undefined;
props["metadata"] = args?.metadata;
props["spec"] = args?.spec;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apps/v1/DaemonSetList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apps.v1.DaemonSetList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

props["apiVersion"] = "apps/v1";
props["kind"] = "DaemonSetList";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apps/v1/Deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ import { getVersion } from "../../version";

props["apiVersion"] = "apps/v1";
props["kind"] = "Deployment";
props["metadata"] = args && args.metadata || undefined;
props["spec"] = args && args.spec || undefined;
props["metadata"] = args?.metadata;
props["spec"] = args?.spec;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apps/v1/DeploymentList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apps.v1.DeploymentList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

props["apiVersion"] = "apps/v1";
props["kind"] = "DeploymentList";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apps/v1/ReplicaSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ import { getVersion } from "../../version";

props["apiVersion"] = "apps/v1";
props["kind"] = "ReplicaSet";
props["metadata"] = args && args.metadata || undefined;
props["spec"] = args && args.spec || undefined;
props["metadata"] = args?.metadata;
props["spec"] = args?.spec;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apps/v1/ReplicaSetList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apps.v1.ReplicaSetList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

props["apiVersion"] = "apps/v1";
props["kind"] = "ReplicaSetList";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apps/v1/StatefulSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ import { getVersion } from "../../version";

props["apiVersion"] = "apps/v1";
props["kind"] = "StatefulSet";
props["metadata"] = args && args.metadata || undefined;
props["spec"] = args && args.spec || undefined;
props["metadata"] = args?.metadata;
props["spec"] = args?.spec;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apps/v1/StatefulSetList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apps.v1.StatefulSetList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

props["apiVersion"] = "apps/v1";
props["kind"] = "StatefulSetList";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
6 changes: 3 additions & 3 deletions sdk/nodejs/apps/v1beta1/ControllerRevision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apps.v1beta1.ControllerRevision, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["revision"] = args && args.revision || undefined;
props["revision"] = args?.revision;

props["apiVersion"] = "apps/v1beta1";
props["data"] = args && args.data || undefined;
props["data"] = args?.data;
props["kind"] = "ControllerRevision";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/apps/v1beta1/ControllerRevisionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ import { getVersion } from "../../version";
*/
constructor(name: string, args?: inputs.apps.v1beta1.ControllerRevisionList, opts?: pulumi.CustomResourceOptions) {
const props: pulumi.Inputs = {};
props["items"] = args && args.items || undefined;
props["items"] = args?.items;

props["apiVersion"] = "apps/v1beta1";
props["kind"] = "ControllerRevisionList";
props["metadata"] = args && args.metadata || undefined;
props["metadata"] = args?.metadata;

props["status"] = undefined;

Expand Down
Loading