pulumi/tests/testdata/codegen/secrets/nodejs/resource.ts

104 lines
4.9 KiB
TypeScript

// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
import * as utilities from "./utilities";
export class Resource extends pulumi.CustomResource {
/**
* Get an existing Resource 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): Resource {
return new Resource(name, undefined as any, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'mypkg::Resource';
/**
* Returns true if the given object is an instance of Resource. 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 Resource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Resource.__pulumiType;
}
public readonly config!: pulumi.Output<outputs.Config>;
public readonly configArray!: pulumi.Output<outputs.Config[]>;
public readonly configMap!: pulumi.Output<{[key: string]: outputs.Config}>;
public readonly foo!: pulumi.Output<string>;
public readonly fooArray!: pulumi.Output<string[]>;
public readonly fooMap!: pulumi.Output<{[key: string]: string}>;
/**
* Create a Resource 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: ResourceArgs, opts?: pulumi.CustomResourceOptions) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (!opts.id) {
if ((!args || args.config === undefined) && !opts.urn) {
throw new Error("Missing required property 'config'");
}
if ((!args || args.configArray === undefined) && !opts.urn) {
throw new Error("Missing required property 'configArray'");
}
if ((!args || args.configMap === undefined) && !opts.urn) {
throw new Error("Missing required property 'configMap'");
}
if ((!args || args.foo === undefined) && !opts.urn) {
throw new Error("Missing required property 'foo'");
}
if ((!args || args.fooArray === undefined) && !opts.urn) {
throw new Error("Missing required property 'fooArray'");
}
if ((!args || args.fooMap === undefined) && !opts.urn) {
throw new Error("Missing required property 'fooMap'");
}
resourceInputs["config"] = args?.config ? pulumi.secret(args.config) : undefined;
resourceInputs["configArray"] = args?.configArray ? pulumi.secret(args.configArray) : undefined;
resourceInputs["configMap"] = args?.configMap ? pulumi.secret(args.configMap) : undefined;
resourceInputs["foo"] = args?.foo ? pulumi.secret(args.foo) : undefined;
resourceInputs["fooArray"] = args?.fooArray ? pulumi.secret(args.fooArray) : undefined;
resourceInputs["fooMap"] = args?.fooMap ? pulumi.secret(args.fooMap) : undefined;
} else {
resourceInputs["config"] = undefined /*out*/;
resourceInputs["configArray"] = undefined /*out*/;
resourceInputs["configMap"] = undefined /*out*/;
resourceInputs["foo"] = undefined /*out*/;
resourceInputs["fooArray"] = undefined /*out*/;
resourceInputs["fooMap"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["config", "configArray", "configMap", "foo", "fooArray", "fooMap"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Resource.__pulumiType, name, resourceInputs, opts);
}
}
/**
* The set of arguments for constructing a Resource resource.
*/
export interface ResourceArgs {
config: pulumi.Input<inputs.ConfigArgs>;
configArray: pulumi.Input<pulumi.Input<inputs.ConfigArgs>[]>;
configMap: pulumi.Input<{[key: string]: pulumi.Input<inputs.ConfigArgs>}>;
foo: pulumi.Input<string>;
fooArray: pulumi.Input<pulumi.Input<string>[]>;
fooMap: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
}