Initial commit

This commit is contained in:
Bryce Lampe
2024-03-07 11:17:15 -08:00
committed by GitHub
commit 0d9ce7c53c
70 changed files with 4168 additions and 0 deletions

0
sdk/nodejs/README.md Normal file
View File

39
sdk/nodejs/index.ts Normal file
View File

@@ -0,0 +1,39 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as utilities from "./utilities";
// Export members:
export { ProviderArgs } from "./provider";
export type Provider = import("./provider").Provider;
export const Provider: typeof import("./provider").Provider = null as any;
utilities.lazyLoad(exports, ["Provider"], () => require("./provider"));
export { RandomArgs } from "./random";
export type Random = import("./random").Random;
export const Random: typeof import("./random").Random = null as any;
utilities.lazyLoad(exports, ["Random"], () => require("./random"));
const _module = {
version: utilities.getVersion(),
construct: (name: string, type: string, urn: string): pulumi.Resource => {
switch (type) {
case "xyz:index:Random":
return new Random(name, <any>undefined, { urn })
default:
throw new Error(`unknown resource type ${type}`);
}
},
};
pulumi.runtime.registerResourceModule("xyz", "index", _module)
pulumi.runtime.registerResourcePackage("xyz", {
version: utilities.getVersion(),
constructProvider: (name: string, type: string, urn: string): pulumi.ProviderResource => {
if (type !== "pulumi:providers:xyz") {
throw new Error(`unknown provider type ${type}`);
}
return new Provider(name, <any>undefined, { urn });
},
});

18
sdk/nodejs/package.json Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "@pulumi/xyz",
"version": "${VERSION}",
"scripts": {
"build": "tsc"
},
"dependencies": {
"@pulumi/pulumi": "^3.42.0"
},
"devDependencies": {
"@types/node": "^14",
"typescript": "^4.3.5"
},
"pulumi": {
"resource": true,
"name": "xyz"
}
}

44
sdk/nodejs/provider.ts Normal file
View File

@@ -0,0 +1,44 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as utilities from "./utilities";
export class Provider extends pulumi.ProviderResource {
/** @internal */
public static readonly __pulumiType = 'xyz';
/**
* Returns true if the given object is an instance of Provider. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is Provider {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}
/**
* Create a Provider resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @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?: ProviderArgs, opts?: pulumi.ResourceOptions) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
{
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Provider.__pulumiType, name, resourceInputs, opts);
}
}
/**
* The set of arguments for constructing a Provider resource.
*/
export interface ProviderArgs {
}

67
sdk/nodejs/random.ts Normal file
View File

@@ -0,0 +1,67 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as utilities from "./utilities";
export class Random extends pulumi.CustomResource {
/**
* Get an existing Random resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Random {
return new Random(name, undefined as any, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'xyz:index:Random';
/**
* Returns true if the given object is an instance of Random. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is Random {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Random.__pulumiType;
}
public readonly length!: pulumi.Output<number>;
public /*out*/ readonly result!: pulumi.Output<string>;
/**
* Create a Random resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @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: RandomArgs, opts?: pulumi.CustomResourceOptions) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (!opts.id) {
if ((!args || args.length === undefined) && !opts.urn) {
throw new Error("Missing required property 'length'");
}
resourceInputs["length"] = args ? args.length : undefined;
resourceInputs["result"] = undefined /*out*/;
} else {
resourceInputs["length"] = undefined /*out*/;
resourceInputs["result"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Random.__pulumiType, name, resourceInputs, opts);
}
}
/**
* The set of arguments for constructing a Random resource.
*/
export interface RandomArgs {
length: pulumi.Input<number>;
}

21
sdk/nodejs/tsconfig.json Normal file
View File

@@ -0,0 +1,21 @@
{
"compilerOptions": {
"outDir": "bin",
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"stripInternal": true,
"experimentalDecorators": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"strict": true
},
"files": [
"index.ts",
"provider.ts",
"random.ts",
"utilities.ts"
]
}

66
sdk/nodejs/utilities.ts Normal file
View File

@@ -0,0 +1,66 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
export function getEnv(...vars: string[]): string | undefined {
for (const v of vars) {
const value = process.env[v];
if (value) {
return value;
}
}
return undefined;
}
export function getEnvBoolean(...vars: string[]): boolean | undefined {
const s = getEnv(...vars);
if (s !== undefined) {
// NOTE: these values are taken from https://golang.org/src/strconv/atob.go?s=351:391#L1, which is what
// Terraform uses internally when parsing boolean values.
if (["1", "t", "T", "true", "TRUE", "True"].find(v => v === s) !== undefined) {
return true;
}
if (["0", "f", "F", "false", "FALSE", "False"].find(v => v === s) !== undefined) {
return false;
}
}
return undefined;
}
export function getEnvNumber(...vars: string[]): number | undefined {
const s = getEnv(...vars);
if (s !== undefined) {
const f = parseFloat(s);
if (!isNaN(f)) {
return f;
}
}
return undefined;
}
export function getVersion(): string {
let version = require('./package.json').version;
// Node allows for the version to be prefixed by a "v", while semver doesn't.
// If there is a v, strip it off.
if (version.indexOf('v') === 0) {
version = version.slice(1);
}
return version;
}
/** @internal */
export function resourceOptsDefaults(): any {
return { version: getVersion() };
}
/** @internal */
export function lazyLoad(exports: any, props: string[], loadModule: any) {
for (let property of props) {
Object.defineProperty(exports, property, {
enumerable: true,
get: function() {
return loadModule()[property];
},
});
}
}