pulumi/tests/testdata/codegen/secrets/dotnet/Resource.cs

165 lines
6.1 KiB
C#

// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Mypkg
{
[MypkgResourceType("mypkg::Resource")]
public partial class Resource : global::Pulumi.CustomResource
{
[Output("config")]
public Output<Outputs.Config> Config { get; private set; } = null!;
[Output("configArray")]
public Output<ImmutableArray<Outputs.Config>> ConfigArray { get; private set; } = null!;
[Output("configMap")]
public Output<ImmutableDictionary<string, Outputs.Config>> ConfigMap { get; private set; } = null!;
[Output("foo")]
public Output<string> Foo { get; private set; } = null!;
[Output("fooArray")]
public Output<ImmutableArray<string>> FooArray { get; private set; } = null!;
[Output("fooMap")]
public Output<ImmutableDictionary<string, string>> FooMap { get; private set; } = null!;
/// <summary>
/// Create a Resource resource with the given unique name, arguments, and options.
/// </summary>
///
/// <param name="name">The unique name of the resource</param>
/// <param name="args">The arguments used to populate this resource's properties</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public Resource(string name, ResourceArgs args, CustomResourceOptions? options = null)
: base("mypkg::Resource", name, args ?? new ResourceArgs(), MakeResourceOptions(options, ""))
{
}
private Resource(string name, Input<string> id, CustomResourceOptions? options = null)
: base("mypkg::Resource", name, null, MakeResourceOptions(options, id))
{
}
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
{
var defaultOptions = new CustomResourceOptions
{
Version = Utilities.Version,
AdditionalSecretOutputs =
{
"config",
"configArray",
"configMap",
"foo",
"fooArray",
"fooMap",
},
};
var merged = CustomResourceOptions.Merge(defaultOptions, options);
// Override the ID if one was specified for consistency with other language SDKs.
merged.Id = id ?? merged.Id;
return merged;
}
/// <summary>
/// Get an existing Resource resource's state with the given name, ID, and optional extra
/// properties used to qualify the lookup.
/// </summary>
///
/// <param name="name">The unique name of the resulting resource.</param>
/// <param name="id">The unique provider ID of the resource to lookup.</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public static Resource Get(string name, Input<string> id, CustomResourceOptions? options = null)
{
return new Resource(name, id, options);
}
}
public sealed class ResourceArgs : global::Pulumi.ResourceArgs
{
[Input("config", required: true)]
private Input<Inputs.ConfigArgs>? _config;
public Input<Inputs.ConfigArgs>? Config
{
get => _config;
set
{
var emptySecret = Output.CreateSecret(0);
_config = Output.Tuple<Input<Inputs.ConfigArgs>?, int>(value, emptySecret).Apply(t => t.Item1);
}
}
[Input("configArray", required: true)]
private InputList<Inputs.ConfigArgs>? _configArray;
public InputList<Inputs.ConfigArgs> ConfigArray
{
get => _configArray ?? (_configArray = new InputList<Inputs.ConfigArgs>());
set
{
var emptySecret = Output.CreateSecret(ImmutableArray.Create<Inputs.ConfigArgs>());
_configArray = Output.All(value, emptySecret).Apply(v => v[0]);
}
}
[Input("configMap", required: true)]
private InputMap<Inputs.ConfigArgs>? _configMap;
public InputMap<Inputs.ConfigArgs> ConfigMap
{
get => _configMap ?? (_configMap = new InputMap<Inputs.ConfigArgs>());
set
{
var emptySecret = Output.CreateSecret(ImmutableDictionary.Create<string, Inputs.ConfigArgs>());
_configMap = Output.All(value, emptySecret).Apply(v => v[0]);
}
}
[Input("foo", required: true)]
private Input<string>? _foo;
public Input<string>? Foo
{
get => _foo;
set
{
var emptySecret = Output.CreateSecret(0);
_foo = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
}
}
[Input("fooArray", required: true)]
private InputList<string>? _fooArray;
public InputList<string> FooArray
{
get => _fooArray ?? (_fooArray = new InputList<string>());
set
{
var emptySecret = Output.CreateSecret(ImmutableArray.Create<string>());
_fooArray = Output.All(value, emptySecret).Apply(v => v[0]);
}
}
[Input("fooMap", required: true)]
private InputMap<string>? _fooMap;
public InputMap<string> FooMap
{
get => _fooMap ?? (_fooMap = new InputMap<string>());
set
{
var emptySecret = Output.CreateSecret(ImmutableDictionary.Create<string, string>());
_fooMap = Output.All(value, emptySecret).Apply(v => v[0]);
}
}
public ResourceArgs()
{
}
public static new ResourceArgs Empty => new ResourceArgs();
}
}