github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/simple-plain-schema/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["bazMap"] = args ? args.bazMap : undefined;
    59              resourceInputs["c"] = args ? args.c : undefined;
    60              resourceInputs["d"] = args ? args.d : undefined;
    61              resourceInputs["e"] = args ? args.e : undefined;
    62              resourceInputs["f"] = args ? args.f : undefined;
    63              resourceInputs["foo"] = args ? args.foo : undefined;
    64          } else {
    65              resourceInputs["a"] = undefined /*out*/;
    66              resourceInputs["b"] = undefined /*out*/;
    67              resourceInputs["bar"] = undefined /*out*/;
    68              resourceInputs["baz"] = undefined /*out*/;
    69              resourceInputs["c"] = undefined /*out*/;
    70              resourceInputs["d"] = undefined /*out*/;
    71              resourceInputs["e"] = undefined /*out*/;
    72              resourceInputs["f"] = undefined /*out*/;
    73              resourceInputs["foo"] = undefined /*out*/;
    74          }
    75          opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
    76          super(Component.__pulumiType, name, resourceInputs, opts, true /*remote*/);
    77      }
    78  }
    79  
    80  /**
    81   * The set of arguments for constructing a Component resource.
    82   */
    83  export interface ComponentArgs {
    84      a: boolean;
    85      b?: boolean;
    86      bar?: inputs.FooArgs;
    87      baz?: pulumi.Input<inputs.FooArgs>[];
    88      bazMap?: {[key: string]: pulumi.Input<inputs.FooArgs>};
    89      c: number;
    90      d?: number;
    91      e: string;
    92      f?: string;
    93      foo?: pulumi.Input<inputs.FooArgs>;
    94  }