github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/secrets/nodejs/resource.ts (about)

     1  // *** WARNING: this file was generated by test. ***
     2  // *** Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  import * as pulumi from "@pulumi/pulumi";
     5  import * as inputs from "./types/input";
     6  import * as outputs from "./types/output";
     7  import * as utilities from "./utilities";
     8  
     9  export class Resource extends pulumi.CustomResource {
    10      /**
    11       * Get an existing Resource resource's state with the given name, ID, and optional extra
    12       * properties used to qualify the lookup.
    13       *
    14       * @param name The _unique_ name of the resulting resource.
    15       * @param id The _unique_ provider ID of the resource to lookup.
    16       * @param opts Optional settings to control the behavior of the CustomResource.
    17       */
    18      public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Resource {
    19          return new Resource(name, undefined as any, { ...opts, id: id });
    20      }
    21  
    22      /** @internal */
    23      public static readonly __pulumiType = 'mypkg::Resource';
    24  
    25      /**
    26       * Returns true if the given object is an instance of Resource.  This is designed to work even
    27       * when multiple copies of the Pulumi SDK have been loaded into the same process.
    28       */
    29      public static isInstance(obj: any): obj is Resource {
    30          if (obj === undefined || obj === null) {
    31              return false;
    32          }
    33          return obj['__pulumiType'] === Resource.__pulumiType;
    34      }
    35  
    36      public readonly config!: pulumi.Output<outputs.Config>;
    37      public readonly configArray!: pulumi.Output<outputs.Config[]>;
    38      public readonly configMap!: pulumi.Output<{[key: string]: outputs.Config}>;
    39      public readonly foo!: pulumi.Output<string>;
    40      public readonly fooArray!: pulumi.Output<string[]>;
    41      public readonly fooMap!: pulumi.Output<{[key: string]: string}>;
    42  
    43      /**
    44       * Create a Resource resource with the given unique name, arguments, and options.
    45       *
    46       * @param name The _unique_ name of the resource.
    47       * @param args The arguments to use to populate this resource's properties.
    48       * @param opts A bag of options that control this resource's behavior.
    49       */
    50      constructor(name: string, args: ResourceArgs, opts?: pulumi.CustomResourceOptions) {
    51          let resourceInputs: pulumi.Inputs = {};
    52          opts = opts || {};
    53          if (!opts.id) {
    54              if ((!args || args.config === undefined) && !opts.urn) {
    55                  throw new Error("Missing required property 'config'");
    56              }
    57              if ((!args || args.configArray === undefined) && !opts.urn) {
    58                  throw new Error("Missing required property 'configArray'");
    59              }
    60              if ((!args || args.configMap === undefined) && !opts.urn) {
    61                  throw new Error("Missing required property 'configMap'");
    62              }
    63              if ((!args || args.foo === undefined) && !opts.urn) {
    64                  throw new Error("Missing required property 'foo'");
    65              }
    66              if ((!args || args.fooArray === undefined) && !opts.urn) {
    67                  throw new Error("Missing required property 'fooArray'");
    68              }
    69              if ((!args || args.fooMap === undefined) && !opts.urn) {
    70                  throw new Error("Missing required property 'fooMap'");
    71              }
    72              resourceInputs["config"] = args?.config ? pulumi.secret(args.config) : undefined;
    73              resourceInputs["configArray"] = args?.configArray ? pulumi.secret(args.configArray) : undefined;
    74              resourceInputs["configMap"] = args?.configMap ? pulumi.secret(args.configMap) : undefined;
    75              resourceInputs["foo"] = args?.foo ? pulumi.secret(args.foo) : undefined;
    76              resourceInputs["fooArray"] = args?.fooArray ? pulumi.secret(args.fooArray) : undefined;
    77              resourceInputs["fooMap"] = args?.fooMap ? pulumi.secret(args.fooMap) : undefined;
    78          } else {
    79              resourceInputs["config"] = undefined /*out*/;
    80              resourceInputs["configArray"] = undefined /*out*/;
    81              resourceInputs["configMap"] = undefined /*out*/;
    82              resourceInputs["foo"] = undefined /*out*/;
    83              resourceInputs["fooArray"] = undefined /*out*/;
    84              resourceInputs["fooMap"] = undefined /*out*/;
    85          }
    86          opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
    87          const secretOpts = { additionalSecretOutputs: ["config", "configArray", "configMap", "foo", "fooArray", "fooMap"] };
    88          opts = pulumi.mergeOptions(opts, secretOpts);
    89          super(Resource.__pulumiType, name, resourceInputs, opts);
    90      }
    91  }
    92  
    93  /**
    94   * The set of arguments for constructing a Resource resource.
    95   */
    96  export interface ResourceArgs {
    97      config: pulumi.Input<inputs.ConfigArgs>;
    98      configArray: pulumi.Input<pulumi.Input<inputs.ConfigArgs>[]>;
    99      configMap: pulumi.Input<{[key: string]: pulumi.Input<inputs.ConfigArgs>}>;
   100      foo: pulumi.Input<string>;
   101      fooArray: pulumi.Input<pulumi.Input<string>[]>;
   102      fooMap: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
   103  }