-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
MyStack.cs
74 lines (65 loc) 路 2.03 KB
/
MyStack.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using Pulumi;
class MyStack : Stack
{
public MyStack()
{
// Create an AWS resource (S3 Bucket)
var r = new Random(
"default", 10, new ComponentResourceOptions{
PluginDownloadURL = "get.example.test",
});
var provider = new Provider("explicit", new CustomResourceOptions{
PluginDownloadURL = "get.pulumi.test/providers",
});
var e = new Random("explicit", 8, new ComponentResourceOptions{
Provider = provider,
});
}
}
class TestProviderResourceTypeAttribute : Pulumi.ResourceTypeAttribute
{
public TestProviderResourceTypeAttribute(string type) : base(type, "1.2.3")
{
}
}
[TestProviderResourceTypeAttribute("testprovider:index:Random")]
class Random : ComponentResource
{
public Random(string name, int length, ComponentResourceOptions? opts = null)
: base("testprovider:index:Random", name, new RandomResourceArgs {Length = length}, opts, remote: false)
{
}
public sealed class RandomResourceArgs : ResourceArgs
{
[Input("length")]
public Input<int>? Length { get; set; }
public RandomResourceArgs()
{
}
}
[Output("result")]
public Output<string> Result {get; private set;} = null!;
}
class Provider : ProviderResource
{
public Provider(string name, CustomResourceOptions? opts = null)
:base("testprovider", name, new ProviderArgs(), MakeResourceOptions(opts, ""))
{
}
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
{
var defaultOptions = new CustomResourceOptions
{
};
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;
}
public sealed class ProviderArgs : Pulumi.ResourceArgs
{
public ProviderArgs()
{
}
}
}