github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/simple-resource-schema/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 utilities from "./utilities";
     6  
     7  export class Resource extends pulumi.CustomResource {
     8      /**
     9       * Get an existing Resource resource's state with the given name, ID, and optional extra
    10       * properties used to qualify the lookup.
    11       *
    12       * @param name The _unique_ name of the resulting resource.
    13       * @param id The _unique_ provider ID of the resource to lookup.
    14       * @param opts Optional settings to control the behavior of the CustomResource.
    15       */
    16      public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Resource {
    17          return new Resource(name, undefined as any, { ...opts, id: id });
    18      }
    19  
    20      /** @internal */
    21      public static readonly __pulumiType = 'example::Resource';
    22  
    23      /**
    24       * Returns true if the given object is an instance of Resource.  This is designed to work even
    25       * when multiple copies of the Pulumi SDK have been loaded into the same process.
    26       */
    27      public static isInstance(obj: any): obj is Resource {
    28          if (obj === undefined || obj === null) {
    29              return false;
    30          }
    31          return obj['__pulumiType'] === Resource.__pulumiType;
    32      }
    33  
    34      public readonly bar!: pulumi.Output<string | undefined>;
    35      public /*out*/ readonly baz!: pulumi.Output<string | undefined>;
    36  
    37      /**
    38       * Create a Resource resource with the given unique name, arguments, and options.
    39       *
    40       * @param name The _unique_ name of the resource.
    41       * @param args The arguments to use to populate this resource's properties.
    42       * @param opts A bag of options that control this resource's behavior.
    43       */
    44      constructor(name: string, args?: ResourceArgs, opts?: pulumi.CustomResourceOptions) {
    45          let resourceInputs: pulumi.Inputs = {};
    46          opts = opts || {};
    47          if (!opts.id) {
    48              resourceInputs["bar"] = args?.bar ? pulumi.secret(args.bar) : undefined;
    49              resourceInputs["baz"] = undefined /*out*/;
    50          } else {
    51              resourceInputs["bar"] = undefined /*out*/;
    52              resourceInputs["baz"] = undefined /*out*/;
    53          }
    54          opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
    55          const secretOpts = { additionalSecretOutputs: ["bar", "baz"] };
    56          opts = pulumi.mergeOptions(opts, secretOpts);
    57          super(Resource.__pulumiType, name, resourceInputs, opts);
    58      }
    59  }
    60  
    61  /**
    62   * The set of arguments for constructing a Resource resource.
    63   */
    64  export interface ResourceArgs {
    65      bar?: pulumi.Input<string>;
    66  }