github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/simple-yaml-schema/dotnet/Resource.cs (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 using System; 5 using System.Collections.Generic; 6 using System.Collections.Immutable; 7 using System.Threading.Tasks; 8 using Pulumi.Serialization; 9 10 namespace Pulumi.Example 11 { 12 [ExampleResourceType("example::Resource")] 13 public partial class Resource : global::Pulumi.CustomResource 14 { 15 [Output("bar")] 16 public Output<string?> Bar { get; private set; } = null!; 17 18 19 /// <summary> 20 /// Create a Resource resource with the given unique name, arguments, and options. 21 /// </summary> 22 /// 23 /// <param name="name">The unique name of the resource</param> 24 /// <param name="args">The arguments used to populate this resource's properties</param> 25 /// <param name="options">A bag of options that control this resource's behavior</param> 26 public Resource(string name, ResourceArgs? args = null, CustomResourceOptions? options = null) 27 : base("example::Resource", name, args ?? new ResourceArgs(), MakeResourceOptions(options, "")) 28 { 29 } 30 31 private Resource(string name, Input<string> id, CustomResourceOptions? options = null) 32 : base("example::Resource", name, null, MakeResourceOptions(options, id)) 33 { 34 } 35 36 private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id) 37 { 38 var defaultOptions = new CustomResourceOptions 39 { 40 Version = Utilities.Version, 41 AdditionalSecretOutputs = 42 { 43 "bar", 44 }, 45 }; 46 var merged = CustomResourceOptions.Merge(defaultOptions, options); 47 // Override the ID if one was specified for consistency with other language SDKs. 48 merged.Id = id ?? merged.Id; 49 return merged; 50 } 51 /// <summary> 52 /// Get an existing Resource resource's state with the given name, ID, and optional extra 53 /// properties used to qualify the lookup. 54 /// </summary> 55 /// 56 /// <param name="name">The unique name of the resulting resource.</param> 57 /// <param name="id">The unique provider ID of the resource to lookup.</param> 58 /// <param name="options">A bag of options that control this resource's behavior</param> 59 public static Resource Get(string name, Input<string> id, CustomResourceOptions? options = null) 60 { 61 return new Resource(name, id, options); 62 } 63 } 64 65 public sealed class ResourceArgs : global::Pulumi.ResourceArgs 66 { 67 [Input("bar")] 68 private Input<string>? _bar; 69 public Input<string>? Bar 70 { 71 get => _bar; 72 set 73 { 74 var emptySecret = Output.CreateSecret(0); 75 _bar = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1); 76 } 77 } 78 79 public ResourceArgs() 80 { 81 } 82 public static new ResourceArgs Empty => new ResourceArgs(); 83 } 84 }