github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/different-enum/nodejs/tree/v1/rubberTree.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 enums from "../../types/enums";
     8  import * as utilities from "../../utilities";
     9  
    10  export class RubberTree extends pulumi.CustomResource {
    11      /**
    12       * Get an existing RubberTree resource's state with the given name, ID, and optional extra
    13       * properties used to qualify the lookup.
    14       *
    15       * @param name The _unique_ name of the resulting resource.
    16       * @param id The _unique_ provider ID of the resource to lookup.
    17       * @param state Any extra arguments used during the lookup.
    18       * @param opts Optional settings to control the behavior of the CustomResource.
    19       */
    20      public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: RubberTreeState, opts?: pulumi.CustomResourceOptions): RubberTree {
    21          return new RubberTree(name, <any>state, { ...opts, id: id });
    22      }
    23  
    24      /** @internal */
    25      public static readonly __pulumiType = 'plant:tree/v1:RubberTree';
    26  
    27      /**
    28       * Returns true if the given object is an instance of RubberTree.  This is designed to work even
    29       * when multiple copies of the Pulumi SDK have been loaded into the same process.
    30       */
    31      public static isInstance(obj: any): obj is RubberTree {
    32          if (obj === undefined || obj === null) {
    33              return false;
    34          }
    35          return obj['__pulumiType'] === RubberTree.__pulumiType;
    36      }
    37  
    38      public readonly container!: pulumi.Output<outputs.Container | undefined>;
    39      public readonly diameter!: pulumi.Output<enums.tree.v1.Diameter>;
    40      public readonly farm!: pulumi.Output<enums.tree.v1.Farm | string | undefined>;
    41      public readonly size!: pulumi.Output<enums.tree.v1.TreeSize | undefined>;
    42      public readonly type!: pulumi.Output<enums.tree.v1.RubberTreeVariety>;
    43  
    44      /**
    45       * Create a RubberTree resource with the given unique name, arguments, and options.
    46       *
    47       * @param name The _unique_ name of the resource.
    48       * @param args The arguments to use to populate this resource's properties.
    49       * @param opts A bag of options that control this resource's behavior.
    50       */
    51      constructor(name: string, args: RubberTreeArgs, opts?: pulumi.CustomResourceOptions)
    52      constructor(name: string, argsOrState?: RubberTreeArgs | RubberTreeState, opts?: pulumi.CustomResourceOptions) {
    53          let resourceInputs: pulumi.Inputs = {};
    54          opts = opts || {};
    55          if (opts.id) {
    56              const state = argsOrState as RubberTreeState | undefined;
    57              resourceInputs["farm"] = state ? state.farm : undefined;
    58          } else {
    59              const args = argsOrState as RubberTreeArgs | undefined;
    60              if ((!args || args.diameter === undefined) && !opts.urn) {
    61                  throw new Error("Missing required property 'diameter'");
    62              }
    63              if ((!args || args.type === undefined) && !opts.urn) {
    64                  throw new Error("Missing required property 'type'");
    65              }
    66              resourceInputs["container"] = args ? (args.container ? pulumi.output(args.container).apply(inputs.containerArgsProvideDefaults) : undefined) : undefined;
    67              resourceInputs["diameter"] = (args ? args.diameter : undefined) ?? 6;
    68              resourceInputs["farm"] = (args ? args.farm : undefined) ?? "(unknown)";
    69              resourceInputs["size"] = (args ? args.size : undefined) ?? "medium";
    70              resourceInputs["type"] = (args ? args.type : undefined) ?? "Burgundy";
    71          }
    72          opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
    73          super(RubberTree.__pulumiType, name, resourceInputs, opts);
    74      }
    75  }
    76  
    77  export interface RubberTreeState {
    78      farm?: pulumi.Input<enums.tree.v1.Farm | string>;
    79  }
    80  
    81  /**
    82   * The set of arguments for constructing a RubberTree resource.
    83   */
    84  export interface RubberTreeArgs {
    85      container?: pulumi.Input<inputs.ContainerArgs>;
    86      diameter: pulumi.Input<enums.tree.v1.Diameter>;
    87      farm?: pulumi.Input<enums.tree.v1.Farm | string>;
    88      size?: pulumi.Input<enums.tree.v1.TreeSize>;
    89      type: pulumi.Input<enums.tree.v1.RubberTreeVariety>;
    90  }