github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/component.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 Component extends pulumi.ComponentResource {
    10      /** @internal */
    11      public static readonly __pulumiType = 'example::Component';
    12  
    13      /**
    14       * Returns true if the given object is an instance of Component.  This is designed to work even
    15       * when multiple copies of the Pulumi SDK have been loaded into the same process.
    16       */
    17      public static isInstance(obj: any): obj is Component {
    18          if (obj === undefined || obj === null) {
    19              return false;
    20          }
    21          return obj['__pulumiType'] === Component.__pulumiType;
    22      }
    23  
    24      public readonly a!: pulumi.Output<boolean>;
    25      public readonly b!: pulumi.Output<boolean | undefined>;
    26      public readonly bar!: pulumi.Output<outputs.Foo | undefined>;
    27      public readonly baz!: pulumi.Output<outputs.Foo[] | undefined>;
    28      public readonly c!: pulumi.Output<number>;
    29      public readonly d!: pulumi.Output<number | undefined>;
    30      public readonly e!: pulumi.Output<string>;
    31      public readonly f!: pulumi.Output<string | undefined>;
    32      public readonly foo!: pulumi.Output<outputs.Foo | undefined>;
    33  
    34      /**
    35       * Create a Component resource with the given unique name, arguments, and options.
    36       *
    37       * @param name The _unique_ name of the resource.
    38       * @param args The arguments to use to populate this resource's properties.
    39       * @param opts A bag of options that control this resource's behavior.
    40       */
    41      constructor(name: string, args: ComponentArgs, opts?: pulumi.ComponentResourceOptions) {
    42          let resourceInputs: pulumi.Inputs = {};
    43          opts = opts || {};
    44          if (!opts.id) {
    45              if ((!args || args.a === undefined) && !opts.urn) {
    46                  throw new Error("Missing required property 'a'");
    47              }
    48              if ((!args || args.c === undefined) && !opts.urn) {
    49                  throw new Error("Missing required property 'c'");
    50              }
    51              if ((!args || args.e === undefined) && !opts.urn) {
    52                  throw new Error("Missing required property 'e'");
    53              }
    54              resourceInputs["a"] = args ? args.a : undefined;
    55              resourceInputs["b"] = args ? args.b : undefined;
    56              resourceInputs["bar"] = args ? args.bar : undefined;
    57              resourceInputs["baz"] = args ? args.baz : undefined;
    58              resourceInputs["c"] = args ? args.c : undefined;
    59              resourceInputs["d"] = args ? args.d : undefined;
    60              resourceInputs["e"] = args ? args.e : undefined;
    61              resourceInputs["f"] = args ? args.f : undefined;
    62              resourceInputs["foo"] = args ? args.foo : undefined;
    63          } else {
    64              resourceInputs["a"] = undefined /*out*/;
    65              resourceInputs["b"] = undefined /*out*/;
    66              resourceInputs["bar"] = undefined /*out*/;
    67              resourceInputs["baz"] = undefined /*out*/;
    68              resourceInputs["c"] = undefined /*out*/;
    69              resourceInputs["d"] = undefined /*out*/;
    70              resourceInputs["e"] = undefined /*out*/;
    71              resourceInputs["f"] = undefined /*out*/;
    72              resourceInputs["foo"] = undefined /*out*/;
    73          }
    74          opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
    75          super(Component.__pulumiType, name, resourceInputs, opts, true /*remote*/);
    76      }
    77  }
    78  
    79  /**
    80   * The set of arguments for constructing a Component resource.
    81   */
    82  export interface ComponentArgs {
    83      a: boolean;
    84      b?: boolean;
    85      bar?: inputs.FooArgs;
    86      baz?: pulumi.Input<inputs.FooArgs>[];
    87      c: number;
    88      d?: number;
    89      e: string;
    90      f?: string;
    91      foo?: pulumi.Input<inputs.FooArgs>;
    92  }