github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/provider-config-schema/dotnet/Config/Config.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.Immutable; 6 7 namespace Configstation.Pulumi.Configstation 8 { 9 public static class Config 10 { 11 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "IDE1006", Justification = 12 "Double underscore prefix used to avoid conflicts with variable names.")] 13 private sealed class __Value<T> 14 { 15 private readonly Func<T> _getter; 16 private T _value = default!; 17 private bool _set; 18 19 public __Value(Func<T> getter) 20 { 21 _getter = getter; 22 } 23 24 public T Get() => _set ? _value : _getter(); 25 26 public void Set(T value) 27 { 28 _value = value; 29 _set = true; 30 } 31 } 32 33 private static readonly global::Pulumi.Config __config = new global::Pulumi.Config("configstation"); 34 35 private static readonly __Value<ImmutableArray<string>> _favoritePlants = new __Value<ImmutableArray<string>>(() => __config.GetObject<ImmutableArray<string>>("favoritePlants")); 36 public static ImmutableArray<string> FavoritePlants 37 { 38 get => _favoritePlants.Get(); 39 set => _favoritePlants.Set(value); 40 } 41 42 private static readonly __Value<Configstation.Pulumi.Configstation.Config.Types.Sandwich?> _favoriteSandwich = new __Value<Configstation.Pulumi.Configstation.Config.Types.Sandwich?>(() => __config.GetObject<Configstation.Pulumi.Configstation.Config.Types.Sandwich>("favoriteSandwich")); 43 /// <summary> 44 /// omg my favorite sandwich 45 /// </summary> 46 public static Configstation.Pulumi.Configstation.Config.Types.Sandwich? FavoriteSandwich 47 { 48 get => _favoriteSandwich.Get(); 49 set => _favoriteSandwich.Set(value); 50 } 51 52 private static readonly __Value<bool?> _isMember = new __Value<bool?>(() => __config.GetBoolean("isMember") ?? true); 53 public static bool? IsMember 54 { 55 get => _isMember.Get(); 56 set => _isMember.Set(value); 57 } 58 59 private static readonly __Value<Types.Child?> _kids = new __Value<Types.Child?>(() => __config.GetObject<Types.Child>("kids")); 60 public static Types.Child? Kids 61 { 62 get => _kids.Get(); 63 set => _kids.Set(value); 64 } 65 66 private static readonly __Value<string?> _name = new __Value<string?>(() => __config.Get("name")); 67 public static string? Name 68 { 69 get => _name.Get(); 70 set => _name.Set(value); 71 } 72 73 private static readonly __Value<int?> _numberOfSheep = new __Value<int?>(() => __config.GetInt32("numberOfSheep")); 74 public static int? NumberOfSheep 75 { 76 get => _numberOfSheep.Get(); 77 set => _numberOfSheep.Set(value); 78 } 79 80 private static readonly __Value<string?> _secretCode = new __Value<string?>(() => __config.Get("secretCode") ?? Utilities.GetEnv("SECRET_CODE", "MY_SUPER_SECRET_CODE")); 81 /// <summary> 82 /// This is a huge secret 83 /// </summary> 84 public static string? SecretCode 85 { 86 get => _secretCode.Get(); 87 set => _secretCode.Set(value); 88 } 89 90 public static class Types 91 { 92 93 public class Sandwich 94 { 95 public string? Bread { get; set; } = null!; 96 public ImmutableArray<string> Veggies { get; set; } 97 } 98 } 99 } 100 }