Add replaceOnChange to schema (#7874)
* Add replaceOnChange to schema * replaceOnChange at generate time for resources * ReplaceOnChanges sees through optional types * Correctly deal with map,array,object,resource type This is responding to PR clarifications from @justinvp and @lblackstone. * Update CHANGELOG_PENDING.md * Detect recursively defined objects * Display recursion warning * Check which recursive structures fail * Add internal logic tests for replaceOnChanges * Add tests
This commit is contained in:
parent
2f0b370a67
commit
08b428ae96
|
@ -10,6 +10,9 @@
|
|||
making it easier to compose functions/datasources with Pulumi
|
||||
resources. [#7784](https://github.com/pulumi/pulumi/pull/7784)
|
||||
|
||||
- [codegen] - Add `replaceOnChange` to schema.
|
||||
[#7874](https://github.com/pulumi/pulumi/pull/7874)
|
||||
|
||||
- [cli/about] - Add command for debug information
|
||||
[#7817](https://github.com/pulumi/pulumi/pull/7817)
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
"github.com/pulumi/pulumi/pkg/v3/codegen"
|
||||
"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/diag"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
|
||||
)
|
||||
|
||||
|
@ -1017,6 +1019,21 @@ func (mod *modContext) genResource(w io.Writer, r *schema.Resource) error {
|
|||
fmt.Fprintf(w, " },\n")
|
||||
}
|
||||
|
||||
replaceOnChangesProps, errList := r.ReplaceOnChanges()
|
||||
for _, err := range errList {
|
||||
cmdutil.Diag().Warningf(&diag.Diag{Message: err.Error()})
|
||||
}
|
||||
if len(replaceOnChangesProps) > 0 {
|
||||
fmt.Fprint(w, " ReplaceOnChanges =\n")
|
||||
fmt.Fprintf(w, " {\n")
|
||||
for _, n := range schema.PropertyListJoinToString(replaceOnChangesProps,
|
||||
func(s string) string { return s }) {
|
||||
fmt.Fprintf(w, " ")
|
||||
fmt.Fprintf(w, "%q,\n", n)
|
||||
}
|
||||
fmt.Fprintf(w, " },\n")
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, " };\n")
|
||||
fmt.Fprintf(w, " var merged = %s.Merge(defaultOptions, options);\n", optionsType)
|
||||
fmt.Fprintf(w, " // Override the ID if one was specified for consistency with other language SDKs.\n")
|
||||
|
|
|
@ -35,6 +35,8 @@ import (
|
|||
|
||||
"github.com/pulumi/pulumi/pkg/v3/codegen"
|
||||
"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/diag"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
|
||||
)
|
||||
|
||||
|
@ -1317,6 +1319,7 @@ func (pkg *pkgContext) genResource(w io.Writer, r *schema.Resource, generateReso
|
|||
}
|
||||
|
||||
var secretProps []*schema.Property
|
||||
|
||||
for _, p := range r.Properties {
|
||||
printCommentWithDeprecationMessage(w, p.Comment, p.DeprecationMessage, true)
|
||||
fmt.Fprintf(w, "\t%s %s `pulumi:\"%s\"`\n", Title(p.Name), pkg.outputType(p.Type), p.Name)
|
||||
|
@ -1417,6 +1420,8 @@ func (pkg *pkgContext) genResource(w io.Writer, r *schema.Resource, generateReso
|
|||
fmt.Fprintf(w, "\t})\n")
|
||||
fmt.Fprintf(w, "\topts = append(opts, aliases)\n")
|
||||
}
|
||||
|
||||
// Setup secrets
|
||||
if len(secretProps) > 0 {
|
||||
for _, p := range secretProps {
|
||||
fmt.Fprintf(w, "\tif args.%s != nil {\n", Title(p.Name))
|
||||
|
@ -1431,6 +1436,22 @@ func (pkg *pkgContext) genResource(w io.Writer, r *schema.Resource, generateReso
|
|||
fmt.Fprintf(w, "\topts = append(opts, secrets)\n")
|
||||
}
|
||||
|
||||
// Setup replaceOnChange
|
||||
replaceOnChangesProps, errList := r.ReplaceOnChanges()
|
||||
for _, err := range errList {
|
||||
cmdutil.Diag().Warningf(&diag.Diag{Message: err.Error()})
|
||||
}
|
||||
replaceOnChangesStrings := schema.PropertyListJoinToString(replaceOnChangesProps,
|
||||
func(x string) string { return x })
|
||||
if len(replaceOnChangesProps) > 0 {
|
||||
fmt.Fprint(w, "\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n")
|
||||
for _, p := range replaceOnChangesStrings {
|
||||
fmt.Fprintf(w, "\t\t%q,\n", p)
|
||||
}
|
||||
fmt.Fprint(w, "\t})\n")
|
||||
fmt.Fprint(w, "\topts = append(opts, replaceOnChanges)\n")
|
||||
}
|
||||
|
||||
// Finally make the call to registration.
|
||||
fmt.Fprintf(w, "\tvar resource %s\n", name)
|
||||
if r.IsComponent {
|
||||
|
|
|
@ -118,6 +118,7 @@ func ValidateFileEquality(t *testing.T, actual, expected map[string][]byte) bool
|
|||
ok := true
|
||||
for name, file := range expected {
|
||||
if !assert.Contains(t, actual, name) || !assert.Equal(t, string(file), string(actual[name]), name) {
|
||||
t.Logf("%s did not agree", name)
|
||||
ok = false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,6 +92,10 @@ var sdkTests = []sdkTest{
|
|||
Directory: "provider-config-schema",
|
||||
Description: "Simple provider config schema",
|
||||
},
|
||||
{
|
||||
Directory: "replace-on-change",
|
||||
Description: "Simple use of replaceOnChange in schema",
|
||||
},
|
||||
}
|
||||
|
||||
// TestSDKCodegen runs the complete set of SDK code generation tests against a particular language's code generator.
|
||||
|
|
33
pkg/codegen/internal/test/testdata/replace-on-change/docs/_index.md
vendored
Normal file
33
pkg/codegen/internal/test/testdata/replace-on-change/docs/_index.md
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
title: "example"
|
||||
title_tag: "example.example"
|
||||
meta_desc: ""
|
||||
menu:
|
||||
reference:
|
||||
parent: API Reference
|
||||
---
|
||||
|
||||
<!-- WARNING: this file was generated by test. -->
|
||||
<!-- Do not edit by hand unless you're certain you know what you are doing! -->
|
||||
|
||||
|
||||
|
||||
<h2 id="resources">Resources</h2>
|
||||
<ul class="api">
|
||||
<li><a href="cat" title="Cat"><span class="symbol resource"></span>Cat</a></li>
|
||||
<li><a href="dog" title="Dog"><span class="symbol resource"></span>Dog</a></li>
|
||||
<li><a href="god" title="God"><span class="symbol resource"></span>God</a></li>
|
||||
<li><a href="provider" title="Provider"><span class="symbol resource"></span>Provider</a></li>
|
||||
<li><a href="toystore" title="ToyStore"><span class="symbol resource"></span>ToyStore</a></li>
|
||||
</ul>
|
||||
|
||||
<h2 id="package-details">Package Details</h2>
|
||||
<dl class="package-details">
|
||||
<dt>Repository</dt>
|
||||
<dd><a href=""></a></dd>
|
||||
<dt>License</dt>
|
||||
<dd></dd>
|
||||
<dt>Version</dt>
|
||||
<dd>0.0.1</dd>
|
||||
</dl>
|
||||
|
517
pkg/codegen/internal/test/testdata/replace-on-change/docs/cat/_index.md
vendored
Normal file
517
pkg/codegen/internal/test/testdata/replace-on-change/docs/cat/_index.md
vendored
Normal file
|
@ -0,0 +1,517 @@
|
|||
|
||||
---
|
||||
title: "Cat"
|
||||
title_tag: "example.Cat"
|
||||
meta_desc: "Documentation for the example.Cat resource with examples, input properties, output properties, lookup functions, and supporting types."
|
||||
---
|
||||
|
||||
|
||||
|
||||
<!-- WARNING: this file was generated by test. -->
|
||||
<!-- Do not edit by hand unless you're certain you know what you are doing! -->
|
||||
|
||||
|
||||
|
||||
|
||||
## Create a Cat Resource {#create}
|
||||
{{< chooser language "typescript,python,go,csharp" / >}}
|
||||
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-typescript" data-lang="typescript"><span class="k">new </span><span class="nx">Cat</span><span class="p">(</span><span class="nx">name</span><span class="p">:</span> <span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p">?:</span> <span class="nx"><a href="#inputs">CatArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p">?:</span> <span class="nx"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span><span class="p">);</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-python" data-lang="python"><span class=nd>@overload</span>
|
||||
<span class="k">def </span><span class="nx">Cat</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
|
||||
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">)</span>
|
||||
<span class=nd>@overload</span>
|
||||
<span class="k">def </span><span class="nx">Cat</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
|
||||
<span class="nx">args</span><span class="p">:</span> <span class="nx"><a href="#inputs">Optional[CatArgs]</a></span> = None<span class="p">,</span>
|
||||
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-go" data-lang="go"><span class="k">func </span><span class="nx">NewCat</span><span class="p">(</span><span class="nx">ctx</span><span class="p"> *</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span><span class="p">,</span> <span class="nx">name</span><span class="p"> </span><span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p"> *</span><span class="nx"><a href="#inputs">CatArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p"> ...</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span><span class="p">) (*<span class="nx">Cat</span>, error)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-csharp" data-lang="csharp"><span class="k">public </span><span class="nx">Cat</span><span class="p">(</span><span class="nx">string</span><span class="p"> </span><span class="nx">name<span class="p">,</span> <span class="nx"><a href="#inputs">CatArgs</a></span><span class="p">? </span><span class="nx">args = null<span class="p">,</span> <span class="nx"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span><span class="p">? </span><span class="nx">opts = null<span class="p">)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">CatArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>resource_name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">CatArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">ResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>ctx</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span>
|
||||
</dt>
|
||||
<dd>Context object for the current deployment.</dd><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">CatArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">CatArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
## Cat Resource Properties {#properties}
|
||||
|
||||
To learn more about resource properties and how to use them, see [Inputs and Outputs]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) in the Architecture and Concepts docs.
|
||||
|
||||
### Inputs
|
||||
|
||||
The Cat resource accepts the following [input]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) properties:
|
||||
|
||||
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
### Outputs
|
||||
|
||||
All [input](#inputs) properties are implicitly available as output properties. Additionally, the Cat resource produces the following output properties:
|
||||
|
||||
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_csharp">
|
||||
<a href="#id_csharp" style="color: inherit; text-decoration: inherit;">Id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="foes_csharp">
|
||||
<a href="#foes_csharp" style="color: inherit; text-decoration: inherit;">Foes</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Dictionary<string, Toy></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="friends_csharp">
|
||||
<a href="#friends_csharp" style="color: inherit; text-decoration: inherit;">Friends</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">List<Toy></a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="name_csharp">
|
||||
<a href="#name_csharp" style="color: inherit; text-decoration: inherit;">Name</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="other_csharp">
|
||||
<a href="#other_csharp" style="color: inherit; text-decoration: inherit;">Other</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Pulumi.<wbr>Example.<wbr>God</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="toy_csharp">
|
||||
<a href="#toy_csharp" style="color: inherit; text-decoration: inherit;">Toy</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_go">
|
||||
<a href="#id_go" style="color: inherit; text-decoration: inherit;">Id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="foes_go">
|
||||
<a href="#foes_go" style="color: inherit; text-decoration: inherit;">Foes</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">map[string]Toy</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="friends_go">
|
||||
<a href="#friends_go" style="color: inherit; text-decoration: inherit;">Friends</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">[]Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="name_go">
|
||||
<a href="#name_go" style="color: inherit; text-decoration: inherit;">Name</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="other_go">
|
||||
<a href="#other_go" style="color: inherit; text-decoration: inherit;">Other</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">God</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="toy_go">
|
||||
<a href="#toy_go" style="color: inherit; text-decoration: inherit;">Toy</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_nodejs">
|
||||
<a href="#id_nodejs" style="color: inherit; text-decoration: inherit;">id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="foes_nodejs">
|
||||
<a href="#foes_nodejs" style="color: inherit; text-decoration: inherit;">foes</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">{[key: string]: Toy}</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="friends_nodejs">
|
||||
<a href="#friends_nodejs" style="color: inherit; text-decoration: inherit;">friends</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy[]</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="name_nodejs">
|
||||
<a href="#name_nodejs" style="color: inherit; text-decoration: inherit;">name</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="other_nodejs">
|
||||
<a href="#other_nodejs" style="color: inherit; text-decoration: inherit;">other</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">God</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="toy_nodejs">
|
||||
<a href="#toy_nodejs" style="color: inherit; text-decoration: inherit;">toy</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_python">
|
||||
<a href="#id_python" style="color: inherit; text-decoration: inherit;">id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="foes_python">
|
||||
<a href="#foes_python" style="color: inherit; text-decoration: inherit;">foes</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Mapping[str, Toy]</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="friends_python">
|
||||
<a href="#friends_python" style="color: inherit; text-decoration: inherit;">friends</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Sequence[Toy]</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="name_python">
|
||||
<a href="#name_python" style="color: inherit; text-decoration: inherit;">name</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="other_python">
|
||||
<a href="#other_python" style="color: inherit; text-decoration: inherit;">other</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">God</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="toy_python">
|
||||
<a href="#toy_python" style="color: inherit; text-decoration: inherit;">toy</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Supporting Types
|
||||
|
||||
|
||||
|
||||
<h4 id="toy">Toy</h4>
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="associated_csharp">
|
||||
<a href="#associated_csharp" style="color: inherit; text-decoration: inherit;">Associated</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="color_csharp">
|
||||
<a href="#color_csharp" style="color: inherit; text-decoration: inherit;">Color</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="wear_csharp">
|
||||
<a href="#wear_csharp" style="color: inherit; text-decoration: inherit;">Wear</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">double</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="associated_go">
|
||||
<a href="#associated_go" style="color: inherit; text-decoration: inherit;">Associated</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="color_go">
|
||||
<a href="#color_go" style="color: inherit; text-decoration: inherit;">Color</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="wear_go">
|
||||
<a href="#wear_go" style="color: inherit; text-decoration: inherit;">Wear</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">float64</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="associated_nodejs">
|
||||
<a href="#associated_nodejs" style="color: inherit; text-decoration: inherit;">associated</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="color_nodejs">
|
||||
<a href="#color_nodejs" style="color: inherit; text-decoration: inherit;">color</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="wear_nodejs">
|
||||
<a href="#wear_nodejs" style="color: inherit; text-decoration: inherit;">wear</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">number</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="associated_python">
|
||||
<a href="#associated_python" style="color: inherit; text-decoration: inherit;">associated</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="color_python">
|
||||
<a href="#color_python" style="color: inherit; text-decoration: inherit;">color</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="wear_python">
|
||||
<a href="#wear_python" style="color: inherit; text-decoration: inherit;">wear</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">float</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
<h2 id="package-details">Package Details</h2>
|
||||
<dl class="package-details">
|
||||
<dt>Repository</dt>
|
||||
<dd><a href=""></a></dd>
|
||||
<dt>License</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
271
pkg/codegen/internal/test/testdata/replace-on-change/docs/dog/_index.md
vendored
Normal file
271
pkg/codegen/internal/test/testdata/replace-on-change/docs/dog/_index.md
vendored
Normal file
|
@ -0,0 +1,271 @@
|
|||
|
||||
---
|
||||
title: "Dog"
|
||||
title_tag: "example.Dog"
|
||||
meta_desc: "Documentation for the example.Dog resource with examples, input properties, output properties, lookup functions, and supporting types."
|
||||
---
|
||||
|
||||
|
||||
|
||||
<!-- WARNING: this file was generated by test. -->
|
||||
<!-- Do not edit by hand unless you're certain you know what you are doing! -->
|
||||
|
||||
|
||||
|
||||
|
||||
## Create a Dog Resource {#create}
|
||||
{{< chooser language "typescript,python,go,csharp" / >}}
|
||||
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-typescript" data-lang="typescript"><span class="k">new </span><span class="nx">Dog</span><span class="p">(</span><span class="nx">name</span><span class="p">:</span> <span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p">?:</span> <span class="nx"><a href="#inputs">DogArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p">?:</span> <span class="nx"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span><span class="p">);</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-python" data-lang="python"><span class=nd>@overload</span>
|
||||
<span class="k">def </span><span class="nx">Dog</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
|
||||
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">)</span>
|
||||
<span class=nd>@overload</span>
|
||||
<span class="k">def </span><span class="nx">Dog</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
|
||||
<span class="nx">args</span><span class="p">:</span> <span class="nx"><a href="#inputs">Optional[DogArgs]</a></span> = None<span class="p">,</span>
|
||||
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-go" data-lang="go"><span class="k">func </span><span class="nx">NewDog</span><span class="p">(</span><span class="nx">ctx</span><span class="p"> *</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span><span class="p">,</span> <span class="nx">name</span><span class="p"> </span><span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p"> *</span><span class="nx"><a href="#inputs">DogArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p"> ...</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span><span class="p">) (*<span class="nx">Dog</span>, error)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-csharp" data-lang="csharp"><span class="k">public </span><span class="nx">Dog</span><span class="p">(</span><span class="nx">string</span><span class="p"> </span><span class="nx">name<span class="p">,</span> <span class="nx"><a href="#inputs">DogArgs</a></span><span class="p">? </span><span class="nx">args = null<span class="p">,</span> <span class="nx"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span><span class="p">? </span><span class="nx">opts = null<span class="p">)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">DogArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>resource_name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">DogArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">ResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>ctx</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span>
|
||||
</dt>
|
||||
<dd>Context object for the current deployment.</dd><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">DogArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">DogArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
## Dog Resource Properties {#properties}
|
||||
|
||||
To learn more about resource properties and how to use them, see [Inputs and Outputs]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) in the Architecture and Concepts docs.
|
||||
|
||||
### Inputs
|
||||
|
||||
The Dog resource accepts the following [input]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) properties:
|
||||
|
||||
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
### Outputs
|
||||
|
||||
All [input](#inputs) properties are implicitly available as output properties. Additionally, the Dog resource produces the following output properties:
|
||||
|
||||
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_csharp">
|
||||
<a href="#id_csharp" style="color: inherit; text-decoration: inherit;">Id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="bone_csharp">
|
||||
<a href="#bone_csharp" style="color: inherit; text-decoration: inherit;">Bone</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_go">
|
||||
<a href="#id_go" style="color: inherit; text-decoration: inherit;">Id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="bone_go">
|
||||
<a href="#bone_go" style="color: inherit; text-decoration: inherit;">Bone</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_nodejs">
|
||||
<a href="#id_nodejs" style="color: inherit; text-decoration: inherit;">id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="bone_nodejs">
|
||||
<a href="#bone_nodejs" style="color: inherit; text-decoration: inherit;">bone</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_python">
|
||||
<a href="#id_python" style="color: inherit; text-decoration: inherit;">id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="bone_python">
|
||||
<a href="#bone_python" style="color: inherit; text-decoration: inherit;">bone</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2 id="package-details">Package Details</h2>
|
||||
<dl class="package-details">
|
||||
<dt>Repository</dt>
|
||||
<dd><a href=""></a></dd>
|
||||
<dt>License</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
271
pkg/codegen/internal/test/testdata/replace-on-change/docs/god/_index.md
vendored
Normal file
271
pkg/codegen/internal/test/testdata/replace-on-change/docs/god/_index.md
vendored
Normal file
|
@ -0,0 +1,271 @@
|
|||
|
||||
---
|
||||
title: "God"
|
||||
title_tag: "example.God"
|
||||
meta_desc: "Documentation for the example.God resource with examples, input properties, output properties, lookup functions, and supporting types."
|
||||
---
|
||||
|
||||
|
||||
|
||||
<!-- WARNING: this file was generated by test. -->
|
||||
<!-- Do not edit by hand unless you're certain you know what you are doing! -->
|
||||
|
||||
|
||||
|
||||
|
||||
## Create a God Resource {#create}
|
||||
{{< chooser language "typescript,python,go,csharp" / >}}
|
||||
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-typescript" data-lang="typescript"><span class="k">new </span><span class="nx">God</span><span class="p">(</span><span class="nx">name</span><span class="p">:</span> <span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p">?:</span> <span class="nx"><a href="#inputs">GodArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p">?:</span> <span class="nx"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span><span class="p">);</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-python" data-lang="python"><span class=nd>@overload</span>
|
||||
<span class="k">def </span><span class="nx">God</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
|
||||
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">)</span>
|
||||
<span class=nd>@overload</span>
|
||||
<span class="k">def </span><span class="nx">God</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
|
||||
<span class="nx">args</span><span class="p">:</span> <span class="nx"><a href="#inputs">Optional[GodArgs]</a></span> = None<span class="p">,</span>
|
||||
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-go" data-lang="go"><span class="k">func </span><span class="nx">NewGod</span><span class="p">(</span><span class="nx">ctx</span><span class="p"> *</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span><span class="p">,</span> <span class="nx">name</span><span class="p"> </span><span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p"> *</span><span class="nx"><a href="#inputs">GodArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p"> ...</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span><span class="p">) (*<span class="nx">God</span>, error)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-csharp" data-lang="csharp"><span class="k">public </span><span class="nx">God</span><span class="p">(</span><span class="nx">string</span><span class="p"> </span><span class="nx">name<span class="p">,</span> <span class="nx"><a href="#inputs">GodArgs</a></span><span class="p">? </span><span class="nx">args = null<span class="p">,</span> <span class="nx"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span><span class="p">? </span><span class="nx">opts = null<span class="p">)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">GodArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>resource_name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">GodArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">ResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>ctx</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span>
|
||||
</dt>
|
||||
<dd>Context object for the current deployment.</dd><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">GodArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">GodArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
## God Resource Properties {#properties}
|
||||
|
||||
To learn more about resource properties and how to use them, see [Inputs and Outputs]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) in the Architecture and Concepts docs.
|
||||
|
||||
### Inputs
|
||||
|
||||
The God resource accepts the following [input]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) properties:
|
||||
|
||||
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
### Outputs
|
||||
|
||||
All [input](#inputs) properties are implicitly available as output properties. Additionally, the God resource produces the following output properties:
|
||||
|
||||
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_csharp">
|
||||
<a href="#id_csharp" style="color: inherit; text-decoration: inherit;">Id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="backwards_csharp">
|
||||
<a href="#backwards_csharp" style="color: inherit; text-decoration: inherit;">Backwards</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Pulumi.<wbr>Example.<wbr>Dog</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_go">
|
||||
<a href="#id_go" style="color: inherit; text-decoration: inherit;">Id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="backwards_go">
|
||||
<a href="#backwards_go" style="color: inherit; text-decoration: inherit;">Backwards</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Dog</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_nodejs">
|
||||
<a href="#id_nodejs" style="color: inherit; text-decoration: inherit;">id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="backwards_nodejs">
|
||||
<a href="#backwards_nodejs" style="color: inherit; text-decoration: inherit;">backwards</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Dog</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_python">
|
||||
<a href="#id_python" style="color: inherit; text-decoration: inherit;">id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="backwards_python">
|
||||
<a href="#backwards_python" style="color: inherit; text-decoration: inherit;">backwards</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Dog</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2 id="package-details">Package Details</h2>
|
||||
<dl class="package-details">
|
||||
<dt>Repository</dt>
|
||||
<dd><a href=""></a></dd>
|
||||
<dt>License</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
239
pkg/codegen/internal/test/testdata/replace-on-change/docs/provider/_index.md
vendored
Normal file
239
pkg/codegen/internal/test/testdata/replace-on-change/docs/provider/_index.md
vendored
Normal file
|
@ -0,0 +1,239 @@
|
|||
|
||||
---
|
||||
title: "Provider"
|
||||
title_tag: "example.Provider"
|
||||
meta_desc: "Documentation for the example.Provider resource with examples, input properties, output properties, lookup functions, and supporting types."
|
||||
---
|
||||
|
||||
|
||||
|
||||
<!-- WARNING: this file was generated by test. -->
|
||||
<!-- Do not edit by hand unless you're certain you know what you are doing! -->
|
||||
|
||||
|
||||
|
||||
|
||||
## Create a Provider Resource {#create}
|
||||
{{< chooser language "typescript,python,go,csharp" / >}}
|
||||
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-typescript" data-lang="typescript"><span class="k">new </span><span class="nx">Provider</span><span class="p">(</span><span class="nx">name</span><span class="p">:</span> <span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p">?:</span> <span class="nx"><a href="#inputs">ProviderArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p">?:</span> <span class="nx"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span><span class="p">);</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-python" data-lang="python"><span class=nd>@overload</span>
|
||||
<span class="k">def </span><span class="nx">Provider</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
|
||||
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">)</span>
|
||||
<span class=nd>@overload</span>
|
||||
<span class="k">def </span><span class="nx">Provider</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
|
||||
<span class="nx">args</span><span class="p">:</span> <span class="nx"><a href="#inputs">Optional[ProviderArgs]</a></span> = None<span class="p">,</span>
|
||||
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-go" data-lang="go"><span class="k">func </span><span class="nx">NewProvider</span><span class="p">(</span><span class="nx">ctx</span><span class="p"> *</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span><span class="p">,</span> <span class="nx">name</span><span class="p"> </span><span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p"> *</span><span class="nx"><a href="#inputs">ProviderArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p"> ...</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span><span class="p">) (*<span class="nx">Provider</span>, error)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-csharp" data-lang="csharp"><span class="k">public </span><span class="nx">Provider</span><span class="p">(</span><span class="nx">string</span><span class="p"> </span><span class="nx">name<span class="p">,</span> <span class="nx"><a href="#inputs">ProviderArgs</a></span><span class="p">? </span><span class="nx">args = null<span class="p">,</span> <span class="nx"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span><span class="p">? </span><span class="nx">opts = null<span class="p">)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">ProviderArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>resource_name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">ProviderArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">ResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>ctx</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span>
|
||||
</dt>
|
||||
<dd>Context object for the current deployment.</dd><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">ProviderArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">ProviderArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
## Provider Resource Properties {#properties}
|
||||
|
||||
To learn more about resource properties and how to use them, see [Inputs and Outputs]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) in the Architecture and Concepts docs.
|
||||
|
||||
### Inputs
|
||||
|
||||
The Provider resource accepts the following [input]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) properties:
|
||||
|
||||
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
### Outputs
|
||||
|
||||
All [input](#inputs) properties are implicitly available as output properties. Additionally, the Provider resource produces the following output properties:
|
||||
|
||||
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_csharp">
|
||||
<a href="#id_csharp" style="color: inherit; text-decoration: inherit;">Id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_go">
|
||||
<a href="#id_go" style="color: inherit; text-decoration: inherit;">Id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_nodejs">
|
||||
<a href="#id_nodejs" style="color: inherit; text-decoration: inherit;">id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_python">
|
||||
<a href="#id_python" style="color: inherit; text-decoration: inherit;">id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2 id="package-details">Package Details</h2>
|
||||
<dl class="package-details">
|
||||
<dt>Repository</dt>
|
||||
<dd><a href=""></a></dd>
|
||||
<dt>License</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
485
pkg/codegen/internal/test/testdata/replace-on-change/docs/toystore/_index.md
vendored
Normal file
485
pkg/codegen/internal/test/testdata/replace-on-change/docs/toystore/_index.md
vendored
Normal file
|
@ -0,0 +1,485 @@
|
|||
|
||||
---
|
||||
title: "ToyStore"
|
||||
title_tag: "example.ToyStore"
|
||||
meta_desc: "Documentation for the example.ToyStore resource with examples, input properties, output properties, lookup functions, and supporting types."
|
||||
---
|
||||
|
||||
|
||||
|
||||
<!-- WARNING: this file was generated by test. -->
|
||||
<!-- Do not edit by hand unless you're certain you know what you are doing! -->
|
||||
|
||||
|
||||
|
||||
|
||||
## Create a ToyStore Resource {#create}
|
||||
{{< chooser language "typescript,python,go,csharp" / >}}
|
||||
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-typescript" data-lang="typescript"><span class="k">new </span><span class="nx">ToyStore</span><span class="p">(</span><span class="nx">name</span><span class="p">:</span> <span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p">?:</span> <span class="nx"><a href="#inputs">ToyStoreArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p">?:</span> <span class="nx"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span><span class="p">);</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-python" data-lang="python"><span class=nd>@overload</span>
|
||||
<span class="k">def </span><span class="nx">ToyStore</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
|
||||
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">)</span>
|
||||
<span class=nd>@overload</span>
|
||||
<span class="k">def </span><span class="nx">ToyStore</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
|
||||
<span class="nx">args</span><span class="p">:</span> <span class="nx"><a href="#inputs">Optional[ToyStoreArgs]</a></span> = None<span class="p">,</span>
|
||||
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-go" data-lang="go"><span class="k">func </span><span class="nx">NewToyStore</span><span class="p">(</span><span class="nx">ctx</span><span class="p"> *</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span><span class="p">,</span> <span class="nx">name</span><span class="p"> </span><span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p"> *</span><span class="nx"><a href="#inputs">ToyStoreArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p"> ...</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span><span class="p">) (*<span class="nx">ToyStore</span>, error)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<div class="highlight"><pre class="chroma"><code class="language-csharp" data-lang="csharp"><span class="k">public </span><span class="nx">ToyStore</span><span class="p">(</span><span class="nx">string</span><span class="p"> </span><span class="nx">name<span class="p">,</span> <span class="nx"><a href="#inputs">ToyStoreArgs</a></span><span class="p">? </span><span class="nx">args = null<span class="p">,</span> <span class="nx"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span><span class="p">? </span><span class="nx">opts = null<span class="p">)</span></code></pre></div>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">ToyStoreArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>resource_name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">ToyStoreArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">ResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>ctx</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span>
|
||||
</dt>
|
||||
<dd>Context object for the current deployment.</dd><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">ToyStoreArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
|
||||
<dl class="resources-properties"><dt
|
||||
class="property-required" title="Required">
|
||||
<span>name</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>The unique name of the resource.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>args</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#inputs">ToyStoreArgs</a></span>
|
||||
</dt>
|
||||
<dd>The arguments to resource properties.</dd><dt
|
||||
class="property-optional" title="Optional">
|
||||
<span>opts</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span>
|
||||
</dt>
|
||||
<dd>Bag of options to control resource's behavior.</dd></dl>
|
||||
|
||||
{{% /choosable %}}
|
||||
|
||||
## ToyStore Resource Properties {#properties}
|
||||
|
||||
To learn more about resource properties and how to use them, see [Inputs and Outputs]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) in the Architecture and Concepts docs.
|
||||
|
||||
### Inputs
|
||||
|
||||
The ToyStore resource accepts the following [input]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) properties:
|
||||
|
||||
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
### Outputs
|
||||
|
||||
All [input](#inputs) properties are implicitly available as output properties. Additionally, the ToyStore resource produces the following output properties:
|
||||
|
||||
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_csharp">
|
||||
<a href="#id_csharp" style="color: inherit; text-decoration: inherit;">Id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="chew_csharp">
|
||||
<a href="#chew_csharp" style="color: inherit; text-decoration: inherit;">Chew</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Pulumi.<wbr>Example.<wbr>Chew</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="laser_csharp">
|
||||
<a href="#laser_csharp" style="color: inherit; text-decoration: inherit;">Laser</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Pulumi.<wbr>Example.<wbr>Laser</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="stuff_csharp">
|
||||
<a href="#stuff_csharp" style="color: inherit; text-decoration: inherit;">Stuff</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">List<Toy></a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="wanted_csharp">
|
||||
<a href="#wanted_csharp" style="color: inherit; text-decoration: inherit;">Wanted</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">List<Toy></a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_go">
|
||||
<a href="#id_go" style="color: inherit; text-decoration: inherit;">Id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="chew_go">
|
||||
<a href="#chew_go" style="color: inherit; text-decoration: inherit;">Chew</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Chew</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="laser_go">
|
||||
<a href="#laser_go" style="color: inherit; text-decoration: inherit;">Laser</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Laser</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="stuff_go">
|
||||
<a href="#stuff_go" style="color: inherit; text-decoration: inherit;">Stuff</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">[]Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="wanted_go">
|
||||
<a href="#wanted_go" style="color: inherit; text-decoration: inherit;">Wanted</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">[]Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_nodejs">
|
||||
<a href="#id_nodejs" style="color: inherit; text-decoration: inherit;">id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="chew_nodejs">
|
||||
<a href="#chew_nodejs" style="color: inherit; text-decoration: inherit;">chew</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Chew</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="laser_nodejs">
|
||||
<a href="#laser_nodejs" style="color: inherit; text-decoration: inherit;">laser</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Laser</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="stuff_nodejs">
|
||||
<a href="#stuff_nodejs" style="color: inherit; text-decoration: inherit;">stuff</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy[]</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="wanted_nodejs">
|
||||
<a href="#wanted_nodejs" style="color: inherit; text-decoration: inherit;">wanted</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy[]</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"><dt class="property-"
|
||||
title="">
|
||||
<span id="id_python">
|
||||
<a href="#id_python" style="color: inherit; text-decoration: inherit;">id</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="chew_python">
|
||||
<a href="#chew_python" style="color: inherit; text-decoration: inherit;">chew</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Chew</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="laser_python">
|
||||
<a href="#laser_python" style="color: inherit; text-decoration: inherit;">laser</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">Laser</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="stuff_python">
|
||||
<a href="#stuff_python" style="color: inherit; text-decoration: inherit;">stuff</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Sequence[Toy]</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-"
|
||||
title="">
|
||||
<span id="wanted_python">
|
||||
<a href="#wanted_python" style="color: inherit; text-decoration: inherit;">wanted</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Sequence[Toy]</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Supporting Types
|
||||
|
||||
|
||||
|
||||
<h4 id="toy">Toy</h4>
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="associated_csharp">
|
||||
<a href="#associated_csharp" style="color: inherit; text-decoration: inherit;">Associated</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="color_csharp">
|
||||
<a href="#color_csharp" style="color: inherit; text-decoration: inherit;">Color</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="wear_csharp">
|
||||
<a href="#wear_csharp" style="color: inherit; text-decoration: inherit;">Wear</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">double</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="associated_go">
|
||||
<a href="#associated_go" style="color: inherit; text-decoration: inherit;">Associated</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="color_go">
|
||||
<a href="#color_go" style="color: inherit; text-decoration: inherit;">Color</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="wear_go">
|
||||
<a href="#wear_go" style="color: inherit; text-decoration: inherit;">Wear</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">float64</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="associated_nodejs">
|
||||
<a href="#associated_nodejs" style="color: inherit; text-decoration: inherit;">associated</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="color_nodejs">
|
||||
<a href="#color_nodejs" style="color: inherit; text-decoration: inherit;">color</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="wear_nodejs">
|
||||
<a href="#wear_nodejs" style="color: inherit; text-decoration: inherit;">wear</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">number</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="associated_python">
|
||||
<a href="#associated_python" style="color: inherit; text-decoration: inherit;">associated</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toy">Toy</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="color_python">
|
||||
<a href="#color_python" style="color: inherit; text-decoration: inherit;">color</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">str</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="wear_python">
|
||||
<a href="#wear_python" style="color: inherit; text-decoration: inherit;">wear</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type">float</span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
<h2 id="package-details">Package Details</h2>
|
||||
<dl class="package-details">
|
||||
<dt>Repository</dt>
|
||||
<dd><a href=""></a></dd>
|
||||
<dt>License</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
92
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Cat.cs
vendored
Normal file
92
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Cat.cs
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
// *** 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.Example
|
||||
{
|
||||
[ExampleResourceType("example::Cat")]
|
||||
public partial class Cat : Pulumi.CustomResource
|
||||
{
|
||||
[Output("foes")]
|
||||
public Output<ImmutableDictionary<string, Outputs.Toy>?> Foes { get; private set; } = null!;
|
||||
|
||||
[Output("friends")]
|
||||
public Output<ImmutableArray<Outputs.Toy>> Friends { get; private set; } = null!;
|
||||
|
||||
[Output("name")]
|
||||
public Output<string?> Name { get; private set; } = null!;
|
||||
|
||||
[Output("other")]
|
||||
public Output<Pulumi.Example.God?> Other { get; private set; } = null!;
|
||||
|
||||
[Output("toy")]
|
||||
public Output<Outputs.Toy?> Toy { get; private set; } = null!;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a Cat 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 Cat(string name, CatArgs? args = null, CustomResourceOptions? options = null)
|
||||
: base("example::Cat", name, args ?? new CatArgs(), MakeResourceOptions(options, ""))
|
||||
{
|
||||
}
|
||||
|
||||
private Cat(string name, Input<string> id, CustomResourceOptions? options = null)
|
||||
: base("example::Cat", name, null, MakeResourceOptions(options, id))
|
||||
{
|
||||
}
|
||||
|
||||
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
|
||||
{
|
||||
var defaultOptions = new CustomResourceOptions
|
||||
{
|
||||
Version = Utilities.Version,
|
||||
AdditionalSecretOutputs =
|
||||
{
|
||||
"name",
|
||||
},
|
||||
ReplaceOnChanges =
|
||||
{
|
||||
"foes.*.associated.color",
|
||||
"foes.*.color",
|
||||
"friends[*].associated.color",
|
||||
"friends[*].color",
|
||||
"name",
|
||||
"toy.color",
|
||||
},
|
||||
};
|
||||
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 Cat 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 Cat Get(string name, Input<string> id, CustomResourceOptions? options = null)
|
||||
{
|
||||
return new Cat(name, id, options);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CatArgs : Pulumi.ResourceArgs
|
||||
{
|
||||
public CatArgs()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
71
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Dog.cs
vendored
Normal file
71
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Dog.cs
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
// *** 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.Example
|
||||
{
|
||||
[ExampleResourceType("example::Dog")]
|
||||
public partial class Dog : Pulumi.CustomResource
|
||||
{
|
||||
[Output("bone")]
|
||||
public Output<string?> Bone { get; private set; } = null!;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a Dog 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 Dog(string name, DogArgs? args = null, CustomResourceOptions? options = null)
|
||||
: base("example::Dog", name, args ?? new DogArgs(), MakeResourceOptions(options, ""))
|
||||
{
|
||||
}
|
||||
|
||||
private Dog(string name, Input<string> id, CustomResourceOptions? options = null)
|
||||
: base("example::Dog", name, null, MakeResourceOptions(options, id))
|
||||
{
|
||||
}
|
||||
|
||||
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
|
||||
{
|
||||
var defaultOptions = new CustomResourceOptions
|
||||
{
|
||||
Version = Utilities.Version,
|
||||
ReplaceOnChanges =
|
||||
{
|
||||
"bone",
|
||||
},
|
||||
};
|
||||
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 Dog 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 Dog Get(string name, Input<string> id, CustomResourceOptions? options = null)
|
||||
{
|
||||
return new Dog(name, id, options);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class DogArgs : Pulumi.ResourceArgs
|
||||
{
|
||||
public DogArgs()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
67
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/God.cs
vendored
Normal file
67
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/God.cs
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
// *** 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.Example
|
||||
{
|
||||
[ExampleResourceType("example::God")]
|
||||
public partial class God : Pulumi.CustomResource
|
||||
{
|
||||
[Output("backwards")]
|
||||
public Output<Pulumi.Example.Dog?> Backwards { get; private set; } = null!;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a God 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 God(string name, GodArgs? args = null, CustomResourceOptions? options = null)
|
||||
: base("example::God", name, args ?? new GodArgs(), MakeResourceOptions(options, ""))
|
||||
{
|
||||
}
|
||||
|
||||
private God(string name, Input<string> id, CustomResourceOptions? options = null)
|
||||
: base("example::God", name, null, MakeResourceOptions(options, id))
|
||||
{
|
||||
}
|
||||
|
||||
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
|
||||
{
|
||||
var defaultOptions = new CustomResourceOptions
|
||||
{
|
||||
Version = Utilities.Version,
|
||||
};
|
||||
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 God 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 God Get(string name, Input<string> id, CustomResourceOptions? options = null)
|
||||
{
|
||||
return new God(name, id, options);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GodArgs : Pulumi.ResourceArgs
|
||||
{
|
||||
public GodArgs()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
36
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Outputs/Toy.cs
vendored
Normal file
36
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Outputs/Toy.cs
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
// *** 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.Example.Outputs
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This is a toy
|
||||
/// </summary>
|
||||
[OutputType]
|
||||
public sealed class Toy
|
||||
{
|
||||
public readonly Outputs.Toy? Associated;
|
||||
public readonly string? Color;
|
||||
public readonly double? Wear;
|
||||
|
||||
[OutputConstructor]
|
||||
private Toy(
|
||||
Outputs.Toy? associated,
|
||||
|
||||
string? color,
|
||||
|
||||
double? wear)
|
||||
{
|
||||
Associated = associated;
|
||||
Color = color;
|
||||
Wear = wear;
|
||||
}
|
||||
}
|
||||
}
|
46
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Provider.cs
vendored
Normal file
46
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Provider.cs
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
// *** 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.Example
|
||||
{
|
||||
[ExampleResourceType("pulumi:providers:example")]
|
||||
public partial class Provider : Pulumi.ProviderResource
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a Provider 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 Provider(string name, ProviderArgs? args = null, CustomResourceOptions? options = null)
|
||||
: base("example", name, args ?? new ProviderArgs(), MakeResourceOptions(options, ""))
|
||||
{
|
||||
}
|
||||
|
||||
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
|
||||
{
|
||||
var defaultOptions = new CustomResourceOptions
|
||||
{
|
||||
Version = Utilities.Version,
|
||||
};
|
||||
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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
52
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Pulumi.Example.csproj
vendored
Normal file
52
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Pulumi.Example.csproj
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Authors>Pulumi Corp.</Authors>
|
||||
<Company>Pulumi Corp.</Company>
|
||||
<Description></Description>
|
||||
<PackageLicenseExpression></PackageLicenseExpression>
|
||||
<PackageProjectUrl></PackageProjectUrl>
|
||||
<RepositoryUrl></RepositoryUrl>
|
||||
<PackageIcon>logo.png</PackageIcon>
|
||||
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseSharedCompilation>false</UseSharedCompilation>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>1701;1702;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
|
||||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="version.txt" />
|
||||
<None Include="version.txt" Pack="True" PackagePath="content" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="logo.png">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath></PackagePath>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
0
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/README.md
vendored
Normal file
0
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/README.md
vendored
Normal file
83
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/ToyStore.cs
vendored
Normal file
83
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/ToyStore.cs
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
// *** 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.Example
|
||||
{
|
||||
[ExampleResourceType("example::ToyStore")]
|
||||
public partial class ToyStore : Pulumi.CustomResource
|
||||
{
|
||||
[Output("chew")]
|
||||
public Output<Pulumi.Example.Chew?> Chew { get; private set; } = null!;
|
||||
|
||||
[Output("laser")]
|
||||
public Output<Pulumi.Example.Laser?> Laser { get; private set; } = null!;
|
||||
|
||||
[Output("stuff")]
|
||||
public Output<ImmutableArray<Outputs.Toy>> Stuff { get; private set; } = null!;
|
||||
|
||||
[Output("wanted")]
|
||||
public Output<ImmutableArray<Outputs.Toy>> Wanted { get; private set; } = null!;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a ToyStore 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 ToyStore(string name, ToyStoreArgs? args = null, CustomResourceOptions? options = null)
|
||||
: base("example::ToyStore", name, args ?? new ToyStoreArgs(), MakeResourceOptions(options, ""))
|
||||
{
|
||||
}
|
||||
|
||||
private ToyStore(string name, Input<string> id, CustomResourceOptions? options = null)
|
||||
: base("example::ToyStore", name, null, MakeResourceOptions(options, id))
|
||||
{
|
||||
}
|
||||
|
||||
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
|
||||
{
|
||||
var defaultOptions = new CustomResourceOptions
|
||||
{
|
||||
Version = Utilities.Version,
|
||||
ReplaceOnChanges =
|
||||
{
|
||||
"stuff[*].associated.color",
|
||||
"stuff[*].color",
|
||||
"wanted[*].associated.color",
|
||||
"wanted[*].color",
|
||||
},
|
||||
};
|
||||
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 ToyStore 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 ToyStore Get(string name, Input<string> id, CustomResourceOptions? options = null)
|
||||
{
|
||||
return new ToyStore(name, id, options);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ToyStoreArgs : Pulumi.ResourceArgs
|
||||
{
|
||||
public ToyStoreArgs()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
87
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Utilities.cs
vendored
Normal file
87
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/Utilities.cs
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
// *** 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.IO;
|
||||
using System.Reflection;
|
||||
using Pulumi;
|
||||
|
||||
namespace Pulumi.Example
|
||||
{
|
||||
static class Utilities
|
||||
{
|
||||
public static string? GetEnv(params string[] names)
|
||||
{
|
||||
foreach (var n in names)
|
||||
{
|
||||
var value = Environment.GetEnvironmentVariable(n);
|
||||
if (value != null)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static string[] trueValues = { "1", "t", "T", "true", "TRUE", "True" };
|
||||
static string[] falseValues = { "0", "f", "F", "false", "FALSE", "False" };
|
||||
public static bool? GetEnvBoolean(params string[] names)
|
||||
{
|
||||
var s = GetEnv(names);
|
||||
if (s != null)
|
||||
{
|
||||
if (Array.IndexOf(trueValues, s) != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (Array.IndexOf(falseValues, s) != -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int? GetEnvInt32(params string[] names) => int.TryParse(GetEnv(names), out int v) ? (int?)v : null;
|
||||
|
||||
public static double? GetEnvDouble(params string[] names) => double.TryParse(GetEnv(names), out double v) ? (double?)v : null;
|
||||
|
||||
public static InvokeOptions WithVersion(this InvokeOptions? options)
|
||||
{
|
||||
if (options?.Version != null)
|
||||
{
|
||||
return options;
|
||||
}
|
||||
return new InvokeOptions
|
||||
{
|
||||
Parent = options?.Parent,
|
||||
Provider = options?.Provider,
|
||||
Version = Version,
|
||||
};
|
||||
}
|
||||
|
||||
private readonly static string version;
|
||||
public static string Version => version;
|
||||
|
||||
static Utilities()
|
||||
{
|
||||
var assembly = typeof(Utilities).GetTypeInfo().Assembly;
|
||||
using var stream = assembly.GetManifestResourceStream("Pulumi.Example.version.txt");
|
||||
using var reader = new StreamReader(stream ?? throw new NotSupportedException("Missing embedded version.txt file"));
|
||||
version = reader.ReadToEnd().Trim();
|
||||
var parts = version.Split("\n");
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
// The first part is the provider name.
|
||||
version = parts[1].Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class ExampleResourceTypeAttribute : Pulumi.ResourceTypeAttribute
|
||||
{
|
||||
public ExampleResourceTypeAttribute(string type) : base(type, Utilities.Version)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
BIN
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/logo.png
vendored
Normal file
BIN
pkg/codegen/internal/test/testdata/replace-on-change/dotnet/logo.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
279
pkg/codegen/internal/test/testdata/replace-on-change/go/example/cat.go
vendored
Normal file
279
pkg/codegen/internal/test/testdata/replace-on-change/go/example/cat.go
vendored
Normal file
|
@ -0,0 +1,279 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package example
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type Cat struct {
|
||||
pulumi.CustomResourceState
|
||||
|
||||
Foes ToyMapOutput `pulumi:"foes"`
|
||||
Friends ToyArrayOutput `pulumi:"friends"`
|
||||
Name pulumi.StringPtrOutput `pulumi:"name"`
|
||||
Other GodOutput `pulumi:"other"`
|
||||
Toy ToyPtrOutput `pulumi:"toy"`
|
||||
}
|
||||
|
||||
// NewCat registers a new resource with the given unique name, arguments, and options.
|
||||
func NewCat(ctx *pulumi.Context,
|
||||
name string, args *CatArgs, opts ...pulumi.ResourceOption) (*Cat, error) {
|
||||
if args == nil {
|
||||
args = &CatArgs{}
|
||||
}
|
||||
|
||||
if args.Name != nil {
|
||||
args.Name = pulumi.ToSecret(args.Name).(pulumi.StringPtrOutput)
|
||||
}
|
||||
secrets := pulumi.AdditionalSecretOutputs([]string{
|
||||
"name",
|
||||
})
|
||||
opts = append(opts, secrets)
|
||||
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
|
||||
"foes.*.associated.color",
|
||||
"foes.*.color",
|
||||
"friends[*].associated.color",
|
||||
"friends[*].color",
|
||||
"name",
|
||||
"toy.color",
|
||||
})
|
||||
opts = append(opts, replaceOnChanges)
|
||||
var resource Cat
|
||||
err := ctx.RegisterResource("example::Cat", name, args, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// GetCat gets an existing Cat resource's state with the given name, ID, and optional
|
||||
// state properties that are used to uniquely qualify the lookup (nil if not required).
|
||||
func GetCat(ctx *pulumi.Context,
|
||||
name string, id pulumi.IDInput, state *CatState, opts ...pulumi.ResourceOption) (*Cat, error) {
|
||||
var resource Cat
|
||||
err := ctx.ReadResource("example::Cat", name, id, state, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// Input properties used for looking up and filtering Cat resources.
|
||||
type catState struct {
|
||||
}
|
||||
|
||||
type CatState struct {
|
||||
}
|
||||
|
||||
func (CatState) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*catState)(nil)).Elem()
|
||||
}
|
||||
|
||||
type catArgs struct {
|
||||
}
|
||||
|
||||
// The set of arguments for constructing a Cat resource.
|
||||
type CatArgs struct {
|
||||
}
|
||||
|
||||
func (CatArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*catArgs)(nil)).Elem()
|
||||
}
|
||||
|
||||
type CatInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToCatOutput() CatOutput
|
||||
ToCatOutputWithContext(ctx context.Context) CatOutput
|
||||
}
|
||||
|
||||
func (*Cat) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Cat)(nil))
|
||||
}
|
||||
|
||||
func (i *Cat) ToCatOutput() CatOutput {
|
||||
return i.ToCatOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *Cat) ToCatOutputWithContext(ctx context.Context) CatOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(CatOutput)
|
||||
}
|
||||
|
||||
func (i *Cat) ToCatPtrOutput() CatPtrOutput {
|
||||
return i.ToCatPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *Cat) ToCatPtrOutputWithContext(ctx context.Context) CatPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(CatPtrOutput)
|
||||
}
|
||||
|
||||
type CatPtrInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToCatPtrOutput() CatPtrOutput
|
||||
ToCatPtrOutputWithContext(ctx context.Context) CatPtrOutput
|
||||
}
|
||||
|
||||
type catPtrType CatArgs
|
||||
|
||||
func (*catPtrType) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Cat)(nil))
|
||||
}
|
||||
|
||||
func (i *catPtrType) ToCatPtrOutput() CatPtrOutput {
|
||||
return i.ToCatPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *catPtrType) ToCatPtrOutputWithContext(ctx context.Context) CatPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(CatPtrOutput)
|
||||
}
|
||||
|
||||
// CatArrayInput is an input type that accepts CatArray and CatArrayOutput values.
|
||||
// You can construct a concrete instance of `CatArrayInput` via:
|
||||
//
|
||||
// CatArray{ CatArgs{...} }
|
||||
type CatArrayInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToCatArrayOutput() CatArrayOutput
|
||||
ToCatArrayOutputWithContext(context.Context) CatArrayOutput
|
||||
}
|
||||
|
||||
type CatArray []CatInput
|
||||
|
||||
func (CatArray) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*[]*Cat)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i CatArray) ToCatArrayOutput() CatArrayOutput {
|
||||
return i.ToCatArrayOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i CatArray) ToCatArrayOutputWithContext(ctx context.Context) CatArrayOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(CatArrayOutput)
|
||||
}
|
||||
|
||||
// CatMapInput is an input type that accepts CatMap and CatMapOutput values.
|
||||
// You can construct a concrete instance of `CatMapInput` via:
|
||||
//
|
||||
// CatMap{ "key": CatArgs{...} }
|
||||
type CatMapInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToCatMapOutput() CatMapOutput
|
||||
ToCatMapOutputWithContext(context.Context) CatMapOutput
|
||||
}
|
||||
|
||||
type CatMap map[string]CatInput
|
||||
|
||||
func (CatMap) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*map[string]*Cat)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i CatMap) ToCatMapOutput() CatMapOutput {
|
||||
return i.ToCatMapOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i CatMap) ToCatMapOutputWithContext(ctx context.Context) CatMapOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(CatMapOutput)
|
||||
}
|
||||
|
||||
type CatOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (CatOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Cat)(nil))
|
||||
}
|
||||
|
||||
func (o CatOutput) ToCatOutput() CatOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o CatOutput) ToCatOutputWithContext(ctx context.Context) CatOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o CatOutput) ToCatPtrOutput() CatPtrOutput {
|
||||
return o.ToCatPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (o CatOutput) ToCatPtrOutputWithContext(ctx context.Context) CatPtrOutput {
|
||||
return o.ApplyTWithContext(ctx, func(_ context.Context, v Cat) *Cat {
|
||||
return &v
|
||||
}).(CatPtrOutput)
|
||||
}
|
||||
|
||||
type CatPtrOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (CatPtrOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Cat)(nil))
|
||||
}
|
||||
|
||||
func (o CatPtrOutput) ToCatPtrOutput() CatPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o CatPtrOutput) ToCatPtrOutputWithContext(ctx context.Context) CatPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o CatPtrOutput) Elem() CatOutput {
|
||||
return o.ApplyT(func(v *Cat) Cat {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
var ret Cat
|
||||
return ret
|
||||
}).(CatOutput)
|
||||
}
|
||||
|
||||
type CatArrayOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (CatArrayOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*[]Cat)(nil))
|
||||
}
|
||||
|
||||
func (o CatArrayOutput) ToCatArrayOutput() CatArrayOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o CatArrayOutput) ToCatArrayOutputWithContext(ctx context.Context) CatArrayOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o CatArrayOutput) Index(i pulumi.IntInput) CatOutput {
|
||||
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Cat {
|
||||
return vs[0].([]Cat)[vs[1].(int)]
|
||||
}).(CatOutput)
|
||||
}
|
||||
|
||||
type CatMapOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (CatMapOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*map[string]Cat)(nil))
|
||||
}
|
||||
|
||||
func (o CatMapOutput) ToCatMapOutput() CatMapOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o CatMapOutput) ToCatMapOutputWithContext(ctx context.Context) CatMapOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o CatMapOutput) MapIndex(k pulumi.StringInput) CatOutput {
|
||||
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Cat {
|
||||
return vs[0].(map[string]Cat)[vs[1].(string)]
|
||||
}).(CatOutput)
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterOutputType(CatOutput{})
|
||||
pulumi.RegisterOutputType(CatPtrOutput{})
|
||||
pulumi.RegisterOutputType(CatArrayOutput{})
|
||||
pulumi.RegisterOutputType(CatMapOutput{})
|
||||
}
|
3
pkg/codegen/internal/test/testdata/replace-on-change/go/example/doc.go
vendored
Normal file
3
pkg/codegen/internal/test/testdata/replace-on-change/go/example/doc.go
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Package example exports types, functions, subpackages for provisioning example resources.
|
||||
//
|
||||
package example
|
263
pkg/codegen/internal/test/testdata/replace-on-change/go/example/dog.go
vendored
Normal file
263
pkg/codegen/internal/test/testdata/replace-on-change/go/example/dog.go
vendored
Normal file
|
@ -0,0 +1,263 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package example
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type Dog struct {
|
||||
pulumi.CustomResourceState
|
||||
|
||||
Bone pulumi.StringPtrOutput `pulumi:"bone"`
|
||||
}
|
||||
|
||||
// NewDog registers a new resource with the given unique name, arguments, and options.
|
||||
func NewDog(ctx *pulumi.Context,
|
||||
name string, args *DogArgs, opts ...pulumi.ResourceOption) (*Dog, error) {
|
||||
if args == nil {
|
||||
args = &DogArgs{}
|
||||
}
|
||||
|
||||
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
|
||||
"bone",
|
||||
})
|
||||
opts = append(opts, replaceOnChanges)
|
||||
var resource Dog
|
||||
err := ctx.RegisterResource("example::Dog", name, args, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// GetDog gets an existing Dog resource's state with the given name, ID, and optional
|
||||
// state properties that are used to uniquely qualify the lookup (nil if not required).
|
||||
func GetDog(ctx *pulumi.Context,
|
||||
name string, id pulumi.IDInput, state *DogState, opts ...pulumi.ResourceOption) (*Dog, error) {
|
||||
var resource Dog
|
||||
err := ctx.ReadResource("example::Dog", name, id, state, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// Input properties used for looking up and filtering Dog resources.
|
||||
type dogState struct {
|
||||
}
|
||||
|
||||
type DogState struct {
|
||||
}
|
||||
|
||||
func (DogState) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*dogState)(nil)).Elem()
|
||||
}
|
||||
|
||||
type dogArgs struct {
|
||||
}
|
||||
|
||||
// The set of arguments for constructing a Dog resource.
|
||||
type DogArgs struct {
|
||||
}
|
||||
|
||||
func (DogArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*dogArgs)(nil)).Elem()
|
||||
}
|
||||
|
||||
type DogInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToDogOutput() DogOutput
|
||||
ToDogOutputWithContext(ctx context.Context) DogOutput
|
||||
}
|
||||
|
||||
func (*Dog) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Dog)(nil))
|
||||
}
|
||||
|
||||
func (i *Dog) ToDogOutput() DogOutput {
|
||||
return i.ToDogOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *Dog) ToDogOutputWithContext(ctx context.Context) DogOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(DogOutput)
|
||||
}
|
||||
|
||||
func (i *Dog) ToDogPtrOutput() DogPtrOutput {
|
||||
return i.ToDogPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *Dog) ToDogPtrOutputWithContext(ctx context.Context) DogPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(DogPtrOutput)
|
||||
}
|
||||
|
||||
type DogPtrInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToDogPtrOutput() DogPtrOutput
|
||||
ToDogPtrOutputWithContext(ctx context.Context) DogPtrOutput
|
||||
}
|
||||
|
||||
type dogPtrType DogArgs
|
||||
|
||||
func (*dogPtrType) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Dog)(nil))
|
||||
}
|
||||
|
||||
func (i *dogPtrType) ToDogPtrOutput() DogPtrOutput {
|
||||
return i.ToDogPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *dogPtrType) ToDogPtrOutputWithContext(ctx context.Context) DogPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(DogPtrOutput)
|
||||
}
|
||||
|
||||
// DogArrayInput is an input type that accepts DogArray and DogArrayOutput values.
|
||||
// You can construct a concrete instance of `DogArrayInput` via:
|
||||
//
|
||||
// DogArray{ DogArgs{...} }
|
||||
type DogArrayInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToDogArrayOutput() DogArrayOutput
|
||||
ToDogArrayOutputWithContext(context.Context) DogArrayOutput
|
||||
}
|
||||
|
||||
type DogArray []DogInput
|
||||
|
||||
func (DogArray) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*[]*Dog)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i DogArray) ToDogArrayOutput() DogArrayOutput {
|
||||
return i.ToDogArrayOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i DogArray) ToDogArrayOutputWithContext(ctx context.Context) DogArrayOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(DogArrayOutput)
|
||||
}
|
||||
|
||||
// DogMapInput is an input type that accepts DogMap and DogMapOutput values.
|
||||
// You can construct a concrete instance of `DogMapInput` via:
|
||||
//
|
||||
// DogMap{ "key": DogArgs{...} }
|
||||
type DogMapInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToDogMapOutput() DogMapOutput
|
||||
ToDogMapOutputWithContext(context.Context) DogMapOutput
|
||||
}
|
||||
|
||||
type DogMap map[string]DogInput
|
||||
|
||||
func (DogMap) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*map[string]*Dog)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i DogMap) ToDogMapOutput() DogMapOutput {
|
||||
return i.ToDogMapOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i DogMap) ToDogMapOutputWithContext(ctx context.Context) DogMapOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(DogMapOutput)
|
||||
}
|
||||
|
||||
type DogOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (DogOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Dog)(nil))
|
||||
}
|
||||
|
||||
func (o DogOutput) ToDogOutput() DogOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o DogOutput) ToDogOutputWithContext(ctx context.Context) DogOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o DogOutput) ToDogPtrOutput() DogPtrOutput {
|
||||
return o.ToDogPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (o DogOutput) ToDogPtrOutputWithContext(ctx context.Context) DogPtrOutput {
|
||||
return o.ApplyTWithContext(ctx, func(_ context.Context, v Dog) *Dog {
|
||||
return &v
|
||||
}).(DogPtrOutput)
|
||||
}
|
||||
|
||||
type DogPtrOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (DogPtrOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Dog)(nil))
|
||||
}
|
||||
|
||||
func (o DogPtrOutput) ToDogPtrOutput() DogPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o DogPtrOutput) ToDogPtrOutputWithContext(ctx context.Context) DogPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o DogPtrOutput) Elem() DogOutput {
|
||||
return o.ApplyT(func(v *Dog) Dog {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
var ret Dog
|
||||
return ret
|
||||
}).(DogOutput)
|
||||
}
|
||||
|
||||
type DogArrayOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (DogArrayOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*[]Dog)(nil))
|
||||
}
|
||||
|
||||
func (o DogArrayOutput) ToDogArrayOutput() DogArrayOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o DogArrayOutput) ToDogArrayOutputWithContext(ctx context.Context) DogArrayOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o DogArrayOutput) Index(i pulumi.IntInput) DogOutput {
|
||||
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Dog {
|
||||
return vs[0].([]Dog)[vs[1].(int)]
|
||||
}).(DogOutput)
|
||||
}
|
||||
|
||||
type DogMapOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (DogMapOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*map[string]Dog)(nil))
|
||||
}
|
||||
|
||||
func (o DogMapOutput) ToDogMapOutput() DogMapOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o DogMapOutput) ToDogMapOutputWithContext(ctx context.Context) DogMapOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o DogMapOutput) MapIndex(k pulumi.StringInput) DogOutput {
|
||||
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Dog {
|
||||
return vs[0].(map[string]Dog)[vs[1].(string)]
|
||||
}).(DogOutput)
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterOutputType(DogOutput{})
|
||||
pulumi.RegisterOutputType(DogPtrOutput{})
|
||||
pulumi.RegisterOutputType(DogArrayOutput{})
|
||||
pulumi.RegisterOutputType(DogMapOutput{})
|
||||
}
|
259
pkg/codegen/internal/test/testdata/replace-on-change/go/example/god.go
vendored
Normal file
259
pkg/codegen/internal/test/testdata/replace-on-change/go/example/god.go
vendored
Normal file
|
@ -0,0 +1,259 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package example
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type God struct {
|
||||
pulumi.CustomResourceState
|
||||
|
||||
Backwards DogOutput `pulumi:"backwards"`
|
||||
}
|
||||
|
||||
// NewGod registers a new resource with the given unique name, arguments, and options.
|
||||
func NewGod(ctx *pulumi.Context,
|
||||
name string, args *GodArgs, opts ...pulumi.ResourceOption) (*God, error) {
|
||||
if args == nil {
|
||||
args = &GodArgs{}
|
||||
}
|
||||
|
||||
var resource God
|
||||
err := ctx.RegisterResource("example::God", name, args, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// GetGod gets an existing God resource's state with the given name, ID, and optional
|
||||
// state properties that are used to uniquely qualify the lookup (nil if not required).
|
||||
func GetGod(ctx *pulumi.Context,
|
||||
name string, id pulumi.IDInput, state *GodState, opts ...pulumi.ResourceOption) (*God, error) {
|
||||
var resource God
|
||||
err := ctx.ReadResource("example::God", name, id, state, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// Input properties used for looking up and filtering God resources.
|
||||
type godState struct {
|
||||
}
|
||||
|
||||
type GodState struct {
|
||||
}
|
||||
|
||||
func (GodState) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*godState)(nil)).Elem()
|
||||
}
|
||||
|
||||
type godArgs struct {
|
||||
}
|
||||
|
||||
// The set of arguments for constructing a God resource.
|
||||
type GodArgs struct {
|
||||
}
|
||||
|
||||
func (GodArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*godArgs)(nil)).Elem()
|
||||
}
|
||||
|
||||
type GodInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToGodOutput() GodOutput
|
||||
ToGodOutputWithContext(ctx context.Context) GodOutput
|
||||
}
|
||||
|
||||
func (*God) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*God)(nil))
|
||||
}
|
||||
|
||||
func (i *God) ToGodOutput() GodOutput {
|
||||
return i.ToGodOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *God) ToGodOutputWithContext(ctx context.Context) GodOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(GodOutput)
|
||||
}
|
||||
|
||||
func (i *God) ToGodPtrOutput() GodPtrOutput {
|
||||
return i.ToGodPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *God) ToGodPtrOutputWithContext(ctx context.Context) GodPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(GodPtrOutput)
|
||||
}
|
||||
|
||||
type GodPtrInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToGodPtrOutput() GodPtrOutput
|
||||
ToGodPtrOutputWithContext(ctx context.Context) GodPtrOutput
|
||||
}
|
||||
|
||||
type godPtrType GodArgs
|
||||
|
||||
func (*godPtrType) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**God)(nil))
|
||||
}
|
||||
|
||||
func (i *godPtrType) ToGodPtrOutput() GodPtrOutput {
|
||||
return i.ToGodPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *godPtrType) ToGodPtrOutputWithContext(ctx context.Context) GodPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(GodPtrOutput)
|
||||
}
|
||||
|
||||
// GodArrayInput is an input type that accepts GodArray and GodArrayOutput values.
|
||||
// You can construct a concrete instance of `GodArrayInput` via:
|
||||
//
|
||||
// GodArray{ GodArgs{...} }
|
||||
type GodArrayInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToGodArrayOutput() GodArrayOutput
|
||||
ToGodArrayOutputWithContext(context.Context) GodArrayOutput
|
||||
}
|
||||
|
||||
type GodArray []GodInput
|
||||
|
||||
func (GodArray) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*[]*God)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i GodArray) ToGodArrayOutput() GodArrayOutput {
|
||||
return i.ToGodArrayOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i GodArray) ToGodArrayOutputWithContext(ctx context.Context) GodArrayOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(GodArrayOutput)
|
||||
}
|
||||
|
||||
// GodMapInput is an input type that accepts GodMap and GodMapOutput values.
|
||||
// You can construct a concrete instance of `GodMapInput` via:
|
||||
//
|
||||
// GodMap{ "key": GodArgs{...} }
|
||||
type GodMapInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToGodMapOutput() GodMapOutput
|
||||
ToGodMapOutputWithContext(context.Context) GodMapOutput
|
||||
}
|
||||
|
||||
type GodMap map[string]GodInput
|
||||
|
||||
func (GodMap) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*map[string]*God)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i GodMap) ToGodMapOutput() GodMapOutput {
|
||||
return i.ToGodMapOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i GodMap) ToGodMapOutputWithContext(ctx context.Context) GodMapOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(GodMapOutput)
|
||||
}
|
||||
|
||||
type GodOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (GodOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*God)(nil))
|
||||
}
|
||||
|
||||
func (o GodOutput) ToGodOutput() GodOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o GodOutput) ToGodOutputWithContext(ctx context.Context) GodOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o GodOutput) ToGodPtrOutput() GodPtrOutput {
|
||||
return o.ToGodPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (o GodOutput) ToGodPtrOutputWithContext(ctx context.Context) GodPtrOutput {
|
||||
return o.ApplyTWithContext(ctx, func(_ context.Context, v God) *God {
|
||||
return &v
|
||||
}).(GodPtrOutput)
|
||||
}
|
||||
|
||||
type GodPtrOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (GodPtrOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**God)(nil))
|
||||
}
|
||||
|
||||
func (o GodPtrOutput) ToGodPtrOutput() GodPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o GodPtrOutput) ToGodPtrOutputWithContext(ctx context.Context) GodPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o GodPtrOutput) Elem() GodOutput {
|
||||
return o.ApplyT(func(v *God) God {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
var ret God
|
||||
return ret
|
||||
}).(GodOutput)
|
||||
}
|
||||
|
||||
type GodArrayOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (GodArrayOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*[]God)(nil))
|
||||
}
|
||||
|
||||
func (o GodArrayOutput) ToGodArrayOutput() GodArrayOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o GodArrayOutput) ToGodArrayOutputWithContext(ctx context.Context) GodArrayOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o GodArrayOutput) Index(i pulumi.IntInput) GodOutput {
|
||||
return pulumi.All(o, i).ApplyT(func(vs []interface{}) God {
|
||||
return vs[0].([]God)[vs[1].(int)]
|
||||
}).(GodOutput)
|
||||
}
|
||||
|
||||
type GodMapOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (GodMapOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*map[string]God)(nil))
|
||||
}
|
||||
|
||||
func (o GodMapOutput) ToGodMapOutput() GodMapOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o GodMapOutput) ToGodMapOutputWithContext(ctx context.Context) GodMapOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o GodMapOutput) MapIndex(k pulumi.StringInput) GodOutput {
|
||||
return pulumi.All(o, k).ApplyT(func(vs []interface{}) God {
|
||||
return vs[0].(map[string]God)[vs[1].(string)]
|
||||
}).(GodOutput)
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterOutputType(GodOutput{})
|
||||
pulumi.RegisterOutputType(GodPtrOutput{})
|
||||
pulumi.RegisterOutputType(GodArrayOutput{})
|
||||
pulumi.RegisterOutputType(GodMapOutput{})
|
||||
}
|
71
pkg/codegen/internal/test/testdata/replace-on-change/go/example/init.go
vendored
Normal file
71
pkg/codegen/internal/test/testdata/replace-on-change/go/example/init.go
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type module struct {
|
||||
version semver.Version
|
||||
}
|
||||
|
||||
func (m *module) Version() semver.Version {
|
||||
return m.version
|
||||
}
|
||||
|
||||
func (m *module) Construct(ctx *pulumi.Context, name, typ, urn string) (r pulumi.Resource, err error) {
|
||||
switch typ {
|
||||
case "example::Cat":
|
||||
r = &Cat{}
|
||||
case "example::Dog":
|
||||
r = &Dog{}
|
||||
case "example::God":
|
||||
r = &God{}
|
||||
case "example::ToyStore":
|
||||
r = &ToyStore{}
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown resource type: %s", typ)
|
||||
}
|
||||
|
||||
err = ctx.RegisterResource(typ, name, nil, r, pulumi.URN_(urn))
|
||||
return
|
||||
}
|
||||
|
||||
type pkg struct {
|
||||
version semver.Version
|
||||
}
|
||||
|
||||
func (p *pkg) Version() semver.Version {
|
||||
return p.version
|
||||
}
|
||||
|
||||
func (p *pkg) ConstructProvider(ctx *pulumi.Context, name, typ, urn string) (pulumi.ProviderResource, error) {
|
||||
if typ != "pulumi:providers:example" {
|
||||
return nil, fmt.Errorf("unknown provider type: %s", typ)
|
||||
}
|
||||
|
||||
r := &Provider{}
|
||||
err := ctx.RegisterResource(typ, name, nil, r, pulumi.URN_(urn))
|
||||
return r, err
|
||||
}
|
||||
|
||||
func init() {
|
||||
version, err := PkgVersion()
|
||||
if err != nil {
|
||||
fmt.Printf("failed to determine package version. defaulting to v1: %v\n", err)
|
||||
}
|
||||
pulumi.RegisterResourceModule(
|
||||
"example",
|
||||
"",
|
||||
&module{version},
|
||||
)
|
||||
pulumi.RegisterResourcePackage(
|
||||
"example",
|
||||
&pkg{version},
|
||||
)
|
||||
}
|
142
pkg/codegen/internal/test/testdata/replace-on-change/go/example/provider.go
vendored
Normal file
142
pkg/codegen/internal/test/testdata/replace-on-change/go/example/provider.go
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package example
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
pulumi.ProviderResourceState
|
||||
}
|
||||
|
||||
// NewProvider registers a new resource with the given unique name, arguments, and options.
|
||||
func NewProvider(ctx *pulumi.Context,
|
||||
name string, args *ProviderArgs, opts ...pulumi.ResourceOption) (*Provider, error) {
|
||||
if args == nil {
|
||||
args = &ProviderArgs{}
|
||||
}
|
||||
|
||||
var resource Provider
|
||||
err := ctx.RegisterResource("pulumi:providers:example", name, args, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
type providerArgs struct {
|
||||
}
|
||||
|
||||
// The set of arguments for constructing a Provider resource.
|
||||
type ProviderArgs struct {
|
||||
}
|
||||
|
||||
func (ProviderArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*providerArgs)(nil)).Elem()
|
||||
}
|
||||
|
||||
type ProviderInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToProviderOutput() ProviderOutput
|
||||
ToProviderOutputWithContext(ctx context.Context) ProviderOutput
|
||||
}
|
||||
|
||||
func (*Provider) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Provider)(nil))
|
||||
}
|
||||
|
||||
func (i *Provider) ToProviderOutput() ProviderOutput {
|
||||
return i.ToProviderOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *Provider) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ProviderOutput)
|
||||
}
|
||||
|
||||
func (i *Provider) ToProviderPtrOutput() ProviderPtrOutput {
|
||||
return i.ToProviderPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *Provider) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ProviderPtrOutput)
|
||||
}
|
||||
|
||||
type ProviderPtrInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToProviderPtrOutput() ProviderPtrOutput
|
||||
ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput
|
||||
}
|
||||
|
||||
type providerPtrType ProviderArgs
|
||||
|
||||
func (*providerPtrType) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Provider)(nil))
|
||||
}
|
||||
|
||||
func (i *providerPtrType) ToProviderPtrOutput() ProviderPtrOutput {
|
||||
return i.ToProviderPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *providerPtrType) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ProviderPtrOutput)
|
||||
}
|
||||
|
||||
type ProviderOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ProviderOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Provider)(nil))
|
||||
}
|
||||
|
||||
func (o ProviderOutput) ToProviderOutput() ProviderOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ProviderOutput) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ProviderOutput) ToProviderPtrOutput() ProviderPtrOutput {
|
||||
return o.ToProviderPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (o ProviderOutput) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
|
||||
return o.ApplyTWithContext(ctx, func(_ context.Context, v Provider) *Provider {
|
||||
return &v
|
||||
}).(ProviderPtrOutput)
|
||||
}
|
||||
|
||||
type ProviderPtrOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ProviderPtrOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Provider)(nil))
|
||||
}
|
||||
|
||||
func (o ProviderPtrOutput) ToProviderPtrOutput() ProviderPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ProviderPtrOutput) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ProviderPtrOutput) Elem() ProviderOutput {
|
||||
return o.ApplyT(func(v *Provider) Provider {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
var ret Provider
|
||||
return ret
|
||||
}).(ProviderOutput)
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterOutputType(ProviderOutput{})
|
||||
pulumi.RegisterOutputType(ProviderPtrOutput{})
|
||||
}
|
392
pkg/codegen/internal/test/testdata/replace-on-change/go/example/pulumiTypes.go
vendored
Normal file
392
pkg/codegen/internal/test/testdata/replace-on-change/go/example/pulumiTypes.go
vendored
Normal file
|
@ -0,0 +1,392 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package example
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
// A toy for a dog
|
||||
type Chew struct {
|
||||
Owner *Dog `pulumi:"owner"`
|
||||
}
|
||||
|
||||
// ChewInput is an input type that accepts ChewArgs and ChewOutput values.
|
||||
// You can construct a concrete instance of `ChewInput` via:
|
||||
//
|
||||
// ChewArgs{...}
|
||||
type ChewInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToChewOutput() ChewOutput
|
||||
ToChewOutputWithContext(context.Context) ChewOutput
|
||||
}
|
||||
|
||||
// A toy for a dog
|
||||
type ChewArgs struct {
|
||||
Owner DogInput `pulumi:"owner"`
|
||||
}
|
||||
|
||||
func (ChewArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Chew)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i ChewArgs) ToChewOutput() ChewOutput {
|
||||
return i.ToChewOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i ChewArgs) ToChewOutputWithContext(ctx context.Context) ChewOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ChewOutput)
|
||||
}
|
||||
|
||||
// A toy for a dog
|
||||
type ChewOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ChewOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Chew)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o ChewOutput) ToChewOutput() ChewOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ChewOutput) ToChewOutputWithContext(ctx context.Context) ChewOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ChewOutput) Owner() DogOutput {
|
||||
return o.ApplyT(func(v Chew) *Dog { return v.Owner }).(DogOutput)
|
||||
}
|
||||
|
||||
// A Toy for a cat
|
||||
type Laser struct {
|
||||
Animal *Cat `pulumi:"animal"`
|
||||
Batteries *bool `pulumi:"batteries"`
|
||||
Light *float64 `pulumi:"light"`
|
||||
}
|
||||
|
||||
// LaserInput is an input type that accepts LaserArgs and LaserOutput values.
|
||||
// You can construct a concrete instance of `LaserInput` via:
|
||||
//
|
||||
// LaserArgs{...}
|
||||
type LaserInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToLaserOutput() LaserOutput
|
||||
ToLaserOutputWithContext(context.Context) LaserOutput
|
||||
}
|
||||
|
||||
// A Toy for a cat
|
||||
type LaserArgs struct {
|
||||
Animal CatInput `pulumi:"animal"`
|
||||
Batteries pulumi.BoolPtrInput `pulumi:"batteries"`
|
||||
Light pulumi.Float64PtrInput `pulumi:"light"`
|
||||
}
|
||||
|
||||
func (LaserArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Laser)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i LaserArgs) ToLaserOutput() LaserOutput {
|
||||
return i.ToLaserOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i LaserArgs) ToLaserOutputWithContext(ctx context.Context) LaserOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(LaserOutput)
|
||||
}
|
||||
|
||||
// A Toy for a cat
|
||||
type LaserOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (LaserOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Laser)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o LaserOutput) ToLaserOutput() LaserOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o LaserOutput) ToLaserOutputWithContext(ctx context.Context) LaserOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o LaserOutput) Animal() CatOutput {
|
||||
return o.ApplyT(func(v Laser) *Cat { return v.Animal }).(CatOutput)
|
||||
}
|
||||
|
||||
func (o LaserOutput) Batteries() pulumi.BoolPtrOutput {
|
||||
return o.ApplyT(func(v Laser) *bool { return v.Batteries }).(pulumi.BoolPtrOutput)
|
||||
}
|
||||
|
||||
func (o LaserOutput) Light() pulumi.Float64PtrOutput {
|
||||
return o.ApplyT(func(v Laser) *float64 { return v.Light }).(pulumi.Float64PtrOutput)
|
||||
}
|
||||
|
||||
// This is a toy
|
||||
type Toy struct {
|
||||
Associated *Toy `pulumi:"associated"`
|
||||
Color *string `pulumi:"color"`
|
||||
Wear *float64 `pulumi:"wear"`
|
||||
}
|
||||
|
||||
// ToyInput is an input type that accepts ToyArgs and ToyOutput values.
|
||||
// You can construct a concrete instance of `ToyInput` via:
|
||||
//
|
||||
// ToyArgs{...}
|
||||
type ToyInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToToyOutput() ToyOutput
|
||||
ToToyOutputWithContext(context.Context) ToyOutput
|
||||
}
|
||||
|
||||
// This is a toy
|
||||
type ToyArgs struct {
|
||||
Associated ToyPtrInput `pulumi:"associated"`
|
||||
Color pulumi.StringPtrInput `pulumi:"color"`
|
||||
Wear pulumi.Float64PtrInput `pulumi:"wear"`
|
||||
}
|
||||
|
||||
func (ToyArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Toy)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i ToyArgs) ToToyOutput() ToyOutput {
|
||||
return i.ToToyOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i ToyArgs) ToToyOutputWithContext(ctx context.Context) ToyOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ToyOutput)
|
||||
}
|
||||
|
||||
func (i ToyArgs) ToToyPtrOutput() ToyPtrOutput {
|
||||
return i.ToToyPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i ToyArgs) ToToyPtrOutputWithContext(ctx context.Context) ToyPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ToyOutput).ToToyPtrOutputWithContext(ctx)
|
||||
}
|
||||
|
||||
// ToyPtrInput is an input type that accepts ToyArgs, ToyPtr and ToyPtrOutput values.
|
||||
// You can construct a concrete instance of `ToyPtrInput` via:
|
||||
//
|
||||
// ToyArgs{...}
|
||||
//
|
||||
// or:
|
||||
//
|
||||
// nil
|
||||
type ToyPtrInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToToyPtrOutput() ToyPtrOutput
|
||||
ToToyPtrOutputWithContext(context.Context) ToyPtrOutput
|
||||
}
|
||||
|
||||
type toyPtrType ToyArgs
|
||||
|
||||
func ToyPtr(v *ToyArgs) ToyPtrInput {
|
||||
return (*toyPtrType)(v)
|
||||
}
|
||||
|
||||
func (*toyPtrType) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Toy)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i *toyPtrType) ToToyPtrOutput() ToyPtrOutput {
|
||||
return i.ToToyPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *toyPtrType) ToToyPtrOutputWithContext(ctx context.Context) ToyPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ToyPtrOutput)
|
||||
}
|
||||
|
||||
// ToyArrayInput is an input type that accepts ToyArray and ToyArrayOutput values.
|
||||
// You can construct a concrete instance of `ToyArrayInput` via:
|
||||
//
|
||||
// ToyArray{ ToyArgs{...} }
|
||||
type ToyArrayInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToToyArrayOutput() ToyArrayOutput
|
||||
ToToyArrayOutputWithContext(context.Context) ToyArrayOutput
|
||||
}
|
||||
|
||||
type ToyArray []ToyInput
|
||||
|
||||
func (ToyArray) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*[]Toy)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i ToyArray) ToToyArrayOutput() ToyArrayOutput {
|
||||
return i.ToToyArrayOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i ToyArray) ToToyArrayOutputWithContext(ctx context.Context) ToyArrayOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ToyArrayOutput)
|
||||
}
|
||||
|
||||
// ToyMapInput is an input type that accepts ToyMap and ToyMapOutput values.
|
||||
// You can construct a concrete instance of `ToyMapInput` via:
|
||||
//
|
||||
// ToyMap{ "key": ToyArgs{...} }
|
||||
type ToyMapInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToToyMapOutput() ToyMapOutput
|
||||
ToToyMapOutputWithContext(context.Context) ToyMapOutput
|
||||
}
|
||||
|
||||
type ToyMap map[string]ToyInput
|
||||
|
||||
func (ToyMap) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*map[string]Toy)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i ToyMap) ToToyMapOutput() ToyMapOutput {
|
||||
return i.ToToyMapOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i ToyMap) ToToyMapOutputWithContext(ctx context.Context) ToyMapOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ToyMapOutput)
|
||||
}
|
||||
|
||||
// This is a toy
|
||||
type ToyOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ToyOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*Toy)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o ToyOutput) ToToyOutput() ToyOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyOutput) ToToyOutputWithContext(ctx context.Context) ToyOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyOutput) ToToyPtrOutput() ToyPtrOutput {
|
||||
return o.ToToyPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (o ToyOutput) ToToyPtrOutputWithContext(ctx context.Context) ToyPtrOutput {
|
||||
return o.ApplyTWithContext(ctx, func(_ context.Context, v Toy) *Toy {
|
||||
return &v
|
||||
}).(ToyPtrOutput)
|
||||
}
|
||||
|
||||
func (o ToyOutput) Associated() ToyPtrOutput {
|
||||
return o.ApplyT(func(v Toy) *Toy { return v.Associated }).(ToyPtrOutput)
|
||||
}
|
||||
|
||||
func (o ToyOutput) Color() pulumi.StringPtrOutput {
|
||||
return o.ApplyT(func(v Toy) *string { return v.Color }).(pulumi.StringPtrOutput)
|
||||
}
|
||||
|
||||
func (o ToyOutput) Wear() pulumi.Float64PtrOutput {
|
||||
return o.ApplyT(func(v Toy) *float64 { return v.Wear }).(pulumi.Float64PtrOutput)
|
||||
}
|
||||
|
||||
type ToyPtrOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ToyPtrOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**Toy)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o ToyPtrOutput) ToToyPtrOutput() ToyPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyPtrOutput) ToToyPtrOutputWithContext(ctx context.Context) ToyPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyPtrOutput) Elem() ToyOutput {
|
||||
return o.ApplyT(func(v *Toy) Toy {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
var ret Toy
|
||||
return ret
|
||||
}).(ToyOutput)
|
||||
}
|
||||
|
||||
func (o ToyPtrOutput) Associated() ToyPtrOutput {
|
||||
return o.ApplyT(func(v *Toy) *Toy {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
return v.Associated
|
||||
}).(ToyPtrOutput)
|
||||
}
|
||||
|
||||
func (o ToyPtrOutput) Color() pulumi.StringPtrOutput {
|
||||
return o.ApplyT(func(v *Toy) *string {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
return v.Color
|
||||
}).(pulumi.StringPtrOutput)
|
||||
}
|
||||
|
||||
func (o ToyPtrOutput) Wear() pulumi.Float64PtrOutput {
|
||||
return o.ApplyT(func(v *Toy) *float64 {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
return v.Wear
|
||||
}).(pulumi.Float64PtrOutput)
|
||||
}
|
||||
|
||||
type ToyArrayOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ToyArrayOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*[]Toy)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o ToyArrayOutput) ToToyArrayOutput() ToyArrayOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyArrayOutput) ToToyArrayOutputWithContext(ctx context.Context) ToyArrayOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyArrayOutput) Index(i pulumi.IntInput) ToyOutput {
|
||||
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Toy {
|
||||
return vs[0].([]Toy)[vs[1].(int)]
|
||||
}).(ToyOutput)
|
||||
}
|
||||
|
||||
type ToyMapOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ToyMapOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*map[string]Toy)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o ToyMapOutput) ToToyMapOutput() ToyMapOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyMapOutput) ToToyMapOutputWithContext(ctx context.Context) ToyMapOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyMapOutput) MapIndex(k pulumi.StringInput) ToyOutput {
|
||||
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Toy {
|
||||
return vs[0].(map[string]Toy)[vs[1].(string)]
|
||||
}).(ToyOutput)
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterOutputType(ChewOutput{})
|
||||
pulumi.RegisterOutputType(LaserOutput{})
|
||||
pulumi.RegisterOutputType(ToyOutput{})
|
||||
pulumi.RegisterOutputType(ToyPtrOutput{})
|
||||
pulumi.RegisterOutputType(ToyArrayOutput{})
|
||||
pulumi.RegisterOutputType(ToyMapOutput{})
|
||||
}
|
77
pkg/codegen/internal/test/testdata/replace-on-change/go/example/pulumiUtilities.go
vendored
Normal file
77
pkg/codegen/internal/test/testdata/replace-on-change/go/example/pulumiUtilities.go
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type envParser func(v string) interface{}
|
||||
|
||||
func parseEnvBool(v string) interface{} {
|
||||
b, err := strconv.ParseBool(v)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func parseEnvInt(v string) interface{} {
|
||||
i, err := strconv.ParseInt(v, 0, 0)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return int(i)
|
||||
}
|
||||
|
||||
func parseEnvFloat(v string) interface{} {
|
||||
f, err := strconv.ParseFloat(v, 64)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
func parseEnvStringArray(v string) interface{} {
|
||||
var result pulumi.StringArray
|
||||
for _, item := range strings.Split(v, ";") {
|
||||
result = append(result, pulumi.String(item))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func getEnvOrDefault(def interface{}, parser envParser, vars ...string) interface{} {
|
||||
for _, v := range vars {
|
||||
if value := os.Getenv(v); value != "" {
|
||||
if parser != nil {
|
||||
return parser(value)
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
return def
|
||||
}
|
||||
|
||||
// PkgVersion uses reflection to determine the version of the current package.
|
||||
func PkgVersion() (semver.Version, error) {
|
||||
type sentinal struct{}
|
||||
pkgPath := reflect.TypeOf(sentinal{}).PkgPath()
|
||||
re := regexp.MustCompile("^.*/pulumi-example/sdk(/v\\d+)?")
|
||||
if match := re.FindStringSubmatch(pkgPath); match != nil {
|
||||
vStr := match[1]
|
||||
if len(vStr) == 0 { // If the version capture group was empty, default to v1.
|
||||
return semver.Version{Major: 1}, nil
|
||||
}
|
||||
return semver.MustParse(fmt.Sprintf("%s.0.0", vStr[2:])), nil
|
||||
}
|
||||
return semver.Version{}, fmt.Errorf("failed to determine the package version from %s", pkgPath)
|
||||
}
|
269
pkg/codegen/internal/test/testdata/replace-on-change/go/example/toyStore.go
vendored
Normal file
269
pkg/codegen/internal/test/testdata/replace-on-change/go/example/toyStore.go
vendored
Normal file
|
@ -0,0 +1,269 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package example
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type ToyStore struct {
|
||||
pulumi.CustomResourceState
|
||||
|
||||
Chew ChewOutput `pulumi:"chew"`
|
||||
Laser LaserOutput `pulumi:"laser"`
|
||||
Stuff ToyArrayOutput `pulumi:"stuff"`
|
||||
Wanted ToyArrayOutput `pulumi:"wanted"`
|
||||
}
|
||||
|
||||
// NewToyStore registers a new resource with the given unique name, arguments, and options.
|
||||
func NewToyStore(ctx *pulumi.Context,
|
||||
name string, args *ToyStoreArgs, opts ...pulumi.ResourceOption) (*ToyStore, error) {
|
||||
if args == nil {
|
||||
args = &ToyStoreArgs{}
|
||||
}
|
||||
|
||||
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
|
||||
"stuff[*].associated.color",
|
||||
"stuff[*].color",
|
||||
"wanted[*].associated.color",
|
||||
"wanted[*].color",
|
||||
})
|
||||
opts = append(opts, replaceOnChanges)
|
||||
var resource ToyStore
|
||||
err := ctx.RegisterResource("example::ToyStore", name, args, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// GetToyStore gets an existing ToyStore resource's state with the given name, ID, and optional
|
||||
// state properties that are used to uniquely qualify the lookup (nil if not required).
|
||||
func GetToyStore(ctx *pulumi.Context,
|
||||
name string, id pulumi.IDInput, state *ToyStoreState, opts ...pulumi.ResourceOption) (*ToyStore, error) {
|
||||
var resource ToyStore
|
||||
err := ctx.ReadResource("example::ToyStore", name, id, state, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// Input properties used for looking up and filtering ToyStore resources.
|
||||
type toyStoreState struct {
|
||||
}
|
||||
|
||||
type ToyStoreState struct {
|
||||
}
|
||||
|
||||
func (ToyStoreState) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*toyStoreState)(nil)).Elem()
|
||||
}
|
||||
|
||||
type toyStoreArgs struct {
|
||||
}
|
||||
|
||||
// The set of arguments for constructing a ToyStore resource.
|
||||
type ToyStoreArgs struct {
|
||||
}
|
||||
|
||||
func (ToyStoreArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*toyStoreArgs)(nil)).Elem()
|
||||
}
|
||||
|
||||
type ToyStoreInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToToyStoreOutput() ToyStoreOutput
|
||||
ToToyStoreOutputWithContext(ctx context.Context) ToyStoreOutput
|
||||
}
|
||||
|
||||
func (*ToyStore) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*ToyStore)(nil))
|
||||
}
|
||||
|
||||
func (i *ToyStore) ToToyStoreOutput() ToyStoreOutput {
|
||||
return i.ToToyStoreOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *ToyStore) ToToyStoreOutputWithContext(ctx context.Context) ToyStoreOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ToyStoreOutput)
|
||||
}
|
||||
|
||||
func (i *ToyStore) ToToyStorePtrOutput() ToyStorePtrOutput {
|
||||
return i.ToToyStorePtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *ToyStore) ToToyStorePtrOutputWithContext(ctx context.Context) ToyStorePtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ToyStorePtrOutput)
|
||||
}
|
||||
|
||||
type ToyStorePtrInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToToyStorePtrOutput() ToyStorePtrOutput
|
||||
ToToyStorePtrOutputWithContext(ctx context.Context) ToyStorePtrOutput
|
||||
}
|
||||
|
||||
type toyStorePtrType ToyStoreArgs
|
||||
|
||||
func (*toyStorePtrType) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**ToyStore)(nil))
|
||||
}
|
||||
|
||||
func (i *toyStorePtrType) ToToyStorePtrOutput() ToyStorePtrOutput {
|
||||
return i.ToToyStorePtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *toyStorePtrType) ToToyStorePtrOutputWithContext(ctx context.Context) ToyStorePtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ToyStorePtrOutput)
|
||||
}
|
||||
|
||||
// ToyStoreArrayInput is an input type that accepts ToyStoreArray and ToyStoreArrayOutput values.
|
||||
// You can construct a concrete instance of `ToyStoreArrayInput` via:
|
||||
//
|
||||
// ToyStoreArray{ ToyStoreArgs{...} }
|
||||
type ToyStoreArrayInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToToyStoreArrayOutput() ToyStoreArrayOutput
|
||||
ToToyStoreArrayOutputWithContext(context.Context) ToyStoreArrayOutput
|
||||
}
|
||||
|
||||
type ToyStoreArray []ToyStoreInput
|
||||
|
||||
func (ToyStoreArray) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*[]*ToyStore)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i ToyStoreArray) ToToyStoreArrayOutput() ToyStoreArrayOutput {
|
||||
return i.ToToyStoreArrayOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i ToyStoreArray) ToToyStoreArrayOutputWithContext(ctx context.Context) ToyStoreArrayOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ToyStoreArrayOutput)
|
||||
}
|
||||
|
||||
// ToyStoreMapInput is an input type that accepts ToyStoreMap and ToyStoreMapOutput values.
|
||||
// You can construct a concrete instance of `ToyStoreMapInput` via:
|
||||
//
|
||||
// ToyStoreMap{ "key": ToyStoreArgs{...} }
|
||||
type ToyStoreMapInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToToyStoreMapOutput() ToyStoreMapOutput
|
||||
ToToyStoreMapOutputWithContext(context.Context) ToyStoreMapOutput
|
||||
}
|
||||
|
||||
type ToyStoreMap map[string]ToyStoreInput
|
||||
|
||||
func (ToyStoreMap) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*map[string]*ToyStore)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i ToyStoreMap) ToToyStoreMapOutput() ToyStoreMapOutput {
|
||||
return i.ToToyStoreMapOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i ToyStoreMap) ToToyStoreMapOutputWithContext(ctx context.Context) ToyStoreMapOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ToyStoreMapOutput)
|
||||
}
|
||||
|
||||
type ToyStoreOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ToyStoreOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*ToyStore)(nil))
|
||||
}
|
||||
|
||||
func (o ToyStoreOutput) ToToyStoreOutput() ToyStoreOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyStoreOutput) ToToyStoreOutputWithContext(ctx context.Context) ToyStoreOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyStoreOutput) ToToyStorePtrOutput() ToyStorePtrOutput {
|
||||
return o.ToToyStorePtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (o ToyStoreOutput) ToToyStorePtrOutputWithContext(ctx context.Context) ToyStorePtrOutput {
|
||||
return o.ApplyTWithContext(ctx, func(_ context.Context, v ToyStore) *ToyStore {
|
||||
return &v
|
||||
}).(ToyStorePtrOutput)
|
||||
}
|
||||
|
||||
type ToyStorePtrOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ToyStorePtrOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**ToyStore)(nil))
|
||||
}
|
||||
|
||||
func (o ToyStorePtrOutput) ToToyStorePtrOutput() ToyStorePtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyStorePtrOutput) ToToyStorePtrOutputWithContext(ctx context.Context) ToyStorePtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyStorePtrOutput) Elem() ToyStoreOutput {
|
||||
return o.ApplyT(func(v *ToyStore) ToyStore {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
var ret ToyStore
|
||||
return ret
|
||||
}).(ToyStoreOutput)
|
||||
}
|
||||
|
||||
type ToyStoreArrayOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ToyStoreArrayOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*[]ToyStore)(nil))
|
||||
}
|
||||
|
||||
func (o ToyStoreArrayOutput) ToToyStoreArrayOutput() ToyStoreArrayOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyStoreArrayOutput) ToToyStoreArrayOutputWithContext(ctx context.Context) ToyStoreArrayOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyStoreArrayOutput) Index(i pulumi.IntInput) ToyStoreOutput {
|
||||
return pulumi.All(o, i).ApplyT(func(vs []interface{}) ToyStore {
|
||||
return vs[0].([]ToyStore)[vs[1].(int)]
|
||||
}).(ToyStoreOutput)
|
||||
}
|
||||
|
||||
type ToyStoreMapOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ToyStoreMapOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*map[string]ToyStore)(nil))
|
||||
}
|
||||
|
||||
func (o ToyStoreMapOutput) ToToyStoreMapOutput() ToyStoreMapOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyStoreMapOutput) ToToyStoreMapOutputWithContext(ctx context.Context) ToyStoreMapOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ToyStoreMapOutput) MapIndex(k pulumi.StringInput) ToyStoreOutput {
|
||||
return pulumi.All(o, k).ApplyT(func(vs []interface{}) ToyStore {
|
||||
return vs[0].(map[string]ToyStore)[vs[1].(string)]
|
||||
}).(ToyStoreOutput)
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterOutputType(ToyStoreOutput{})
|
||||
pulumi.RegisterOutputType(ToyStorePtrOutput{})
|
||||
pulumi.RegisterOutputType(ToyStoreArrayOutput{})
|
||||
pulumi.RegisterOutputType(ToyStoreMapOutput{})
|
||||
}
|
0
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/README.md
vendored
Normal file
0
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/README.md
vendored
Normal file
81
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/cat.ts
vendored
Normal file
81
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/cat.ts
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import { input as inputs, output as outputs } from "./types";
|
||||
import * as utilities from "./utilities";
|
||||
|
||||
import {God} from "./index";
|
||||
|
||||
export class Cat extends pulumi.CustomResource {
|
||||
/**
|
||||
* Get an existing Cat resource's state with the given name, ID, and optional extra
|
||||
* properties used to qualify the lookup.
|
||||
*
|
||||
* @param name The _unique_ name of the resulting resource.
|
||||
* @param id The _unique_ provider ID of the resource to lookup.
|
||||
* @param opts Optional settings to control the behavior of the CustomResource.
|
||||
*/
|
||||
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Cat {
|
||||
return new Cat(name, undefined as any, { ...opts, id: id });
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
public static readonly __pulumiType = 'example::Cat';
|
||||
|
||||
/**
|
||||
* Returns true if the given object is an instance of Cat. This is designed to work even
|
||||
* when multiple copies of the Pulumi SDK have been loaded into the same process.
|
||||
*/
|
||||
public static isInstance(obj: any): obj is Cat {
|
||||
if (obj === undefined || obj === null) {
|
||||
return false;
|
||||
}
|
||||
return obj['__pulumiType'] === Cat.__pulumiType;
|
||||
}
|
||||
|
||||
public /*out*/ readonly foes!: pulumi.Output<{[key: string]: outputs.Toy} | undefined>;
|
||||
public /*out*/ readonly friends!: pulumi.Output<outputs.Toy[] | undefined>;
|
||||
public /*out*/ readonly name!: pulumi.Output<string | undefined>;
|
||||
public /*out*/ readonly other!: pulumi.Output<God | undefined>;
|
||||
public /*out*/ readonly toy!: pulumi.Output<outputs.Toy | undefined>;
|
||||
|
||||
/**
|
||||
* Create a Cat resource with the given unique name, arguments, and options.
|
||||
*
|
||||
* @param name The _unique_ name of the resource.
|
||||
* @param args The arguments to use to populate this resource's properties.
|
||||
* @param opts A bag of options that control this resource's behavior.
|
||||
*/
|
||||
constructor(name: string, args?: CatArgs, opts?: pulumi.CustomResourceOptions) {
|
||||
let inputs: pulumi.Inputs = {};
|
||||
opts = opts || {};
|
||||
if (!opts.id) {
|
||||
inputs["foes"] = undefined /*out*/;
|
||||
inputs["friends"] = undefined /*out*/;
|
||||
inputs["name"] = undefined /*out*/;
|
||||
inputs["other"] = undefined /*out*/;
|
||||
inputs["toy"] = undefined /*out*/;
|
||||
} else {
|
||||
inputs["foes"] = undefined /*out*/;
|
||||
inputs["friends"] = undefined /*out*/;
|
||||
inputs["name"] = undefined /*out*/;
|
||||
inputs["other"] = undefined /*out*/;
|
||||
inputs["toy"] = undefined /*out*/;
|
||||
}
|
||||
if (!opts.version) {
|
||||
opts = pulumi.mergeOptions(opts, { version: utilities.getVersion()});
|
||||
}
|
||||
const secretOpts = { additionalSecretOutputs: ["name"] };
|
||||
opts = pulumi.mergeOptions(opts, secretOpts);
|
||||
const replaceOnChanges = { replaceOnChanges: ["foes.*.associated.color", "foes.*.color", "friends[*].associated.color", "friends[*].color", "name", "toy.color"] };
|
||||
opts = pulumi.mergeOptions(opts, replaceOnChanges);
|
||||
super(Cat.__pulumiType, name, inputs, opts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The set of arguments for constructing a Cat resource.
|
||||
*/
|
||||
export interface CatArgs {
|
||||
}
|
64
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/dog.ts
vendored
Normal file
64
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/dog.ts
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as utilities from "./utilities";
|
||||
|
||||
export class Dog extends pulumi.CustomResource {
|
||||
/**
|
||||
* Get an existing Dog resource's state with the given name, ID, and optional extra
|
||||
* properties used to qualify the lookup.
|
||||
*
|
||||
* @param name The _unique_ name of the resulting resource.
|
||||
* @param id The _unique_ provider ID of the resource to lookup.
|
||||
* @param opts Optional settings to control the behavior of the CustomResource.
|
||||
*/
|
||||
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Dog {
|
||||
return new Dog(name, undefined as any, { ...opts, id: id });
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
public static readonly __pulumiType = 'example::Dog';
|
||||
|
||||
/**
|
||||
* Returns true if the given object is an instance of Dog. This is designed to work even
|
||||
* when multiple copies of the Pulumi SDK have been loaded into the same process.
|
||||
*/
|
||||
public static isInstance(obj: any): obj is Dog {
|
||||
if (obj === undefined || obj === null) {
|
||||
return false;
|
||||
}
|
||||
return obj['__pulumiType'] === Dog.__pulumiType;
|
||||
}
|
||||
|
||||
public /*out*/ readonly bone!: pulumi.Output<string | undefined>;
|
||||
|
||||
/**
|
||||
* Create a Dog resource with the given unique name, arguments, and options.
|
||||
*
|
||||
* @param name The _unique_ name of the resource.
|
||||
* @param args The arguments to use to populate this resource's properties.
|
||||
* @param opts A bag of options that control this resource's behavior.
|
||||
*/
|
||||
constructor(name: string, args?: DogArgs, opts?: pulumi.CustomResourceOptions) {
|
||||
let inputs: pulumi.Inputs = {};
|
||||
opts = opts || {};
|
||||
if (!opts.id) {
|
||||
inputs["bone"] = undefined /*out*/;
|
||||
} else {
|
||||
inputs["bone"] = undefined /*out*/;
|
||||
}
|
||||
if (!opts.version) {
|
||||
opts = pulumi.mergeOptions(opts, { version: utilities.getVersion()});
|
||||
}
|
||||
const replaceOnChanges = { replaceOnChanges: ["bone"] };
|
||||
opts = pulumi.mergeOptions(opts, replaceOnChanges);
|
||||
super(Dog.__pulumiType, name, inputs, opts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The set of arguments for constructing a Dog resource.
|
||||
*/
|
||||
export interface DogArgs {
|
||||
}
|
64
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/god.ts
vendored
Normal file
64
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/god.ts
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as utilities from "./utilities";
|
||||
|
||||
import {Dog} from "./index";
|
||||
|
||||
export class God extends pulumi.CustomResource {
|
||||
/**
|
||||
* Get an existing God resource's state with the given name, ID, and optional extra
|
||||
* properties used to qualify the lookup.
|
||||
*
|
||||
* @param name The _unique_ name of the resulting resource.
|
||||
* @param id The _unique_ provider ID of the resource to lookup.
|
||||
* @param opts Optional settings to control the behavior of the CustomResource.
|
||||
*/
|
||||
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): God {
|
||||
return new God(name, undefined as any, { ...opts, id: id });
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
public static readonly __pulumiType = 'example::God';
|
||||
|
||||
/**
|
||||
* Returns true if the given object is an instance of God. This is designed to work even
|
||||
* when multiple copies of the Pulumi SDK have been loaded into the same process.
|
||||
*/
|
||||
public static isInstance(obj: any): obj is God {
|
||||
if (obj === undefined || obj === null) {
|
||||
return false;
|
||||
}
|
||||
return obj['__pulumiType'] === God.__pulumiType;
|
||||
}
|
||||
|
||||
public /*out*/ readonly backwards!: pulumi.Output<Dog | undefined>;
|
||||
|
||||
/**
|
||||
* Create a God resource with the given unique name, arguments, and options.
|
||||
*
|
||||
* @param name The _unique_ name of the resource.
|
||||
* @param args The arguments to use to populate this resource's properties.
|
||||
* @param opts A bag of options that control this resource's behavior.
|
||||
*/
|
||||
constructor(name: string, args?: GodArgs, opts?: pulumi.CustomResourceOptions) {
|
||||
let inputs: pulumi.Inputs = {};
|
||||
opts = opts || {};
|
||||
if (!opts.id) {
|
||||
inputs["backwards"] = undefined /*out*/;
|
||||
} else {
|
||||
inputs["backwards"] = undefined /*out*/;
|
||||
}
|
||||
if (!opts.version) {
|
||||
opts = pulumi.mergeOptions(opts, { version: utilities.getVersion()});
|
||||
}
|
||||
super(God.__pulumiType, name, inputs, opts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The set of arguments for constructing a God resource.
|
||||
*/
|
||||
export interface GodArgs {
|
||||
}
|
56
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/index.ts
vendored
Normal file
56
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/index.ts
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as utilities from "./utilities";
|
||||
|
||||
// Export members:
|
||||
export * from "./cat";
|
||||
export * from "./dog";
|
||||
export * from "./god";
|
||||
export * from "./provider";
|
||||
export * from "./toyStore";
|
||||
|
||||
// Export sub-modules:
|
||||
import * as types from "./types";
|
||||
|
||||
export {
|
||||
types,
|
||||
};
|
||||
|
||||
// Import resources to register:
|
||||
import { Cat } from "./cat";
|
||||
import { Dog } from "./dog";
|
||||
import { God } from "./god";
|
||||
import { ToyStore } from "./toyStore";
|
||||
|
||||
const _module = {
|
||||
version: utilities.getVersion(),
|
||||
construct: (name: string, type: string, urn: string): pulumi.Resource => {
|
||||
switch (type) {
|
||||
case "example::Cat":
|
||||
return new Cat(name, <any>undefined, { urn })
|
||||
case "example::Dog":
|
||||
return new Dog(name, <any>undefined, { urn })
|
||||
case "example::God":
|
||||
return new God(name, <any>undefined, { urn })
|
||||
case "example::ToyStore":
|
||||
return new ToyStore(name, <any>undefined, { urn })
|
||||
default:
|
||||
throw new Error(`unknown resource type ${type}`);
|
||||
}
|
||||
},
|
||||
};
|
||||
pulumi.runtime.registerResourceModule("example", "", _module)
|
||||
|
||||
import { Provider } from "./provider";
|
||||
|
||||
pulumi.runtime.registerResourcePackage("example", {
|
||||
version: utilities.getVersion(),
|
||||
constructProvider: (name: string, type: string, urn: string): pulumi.ProviderResource => {
|
||||
if (type !== "pulumi:providers:example") {
|
||||
throw new Error(`unknown provider type ${type}`);
|
||||
}
|
||||
return new Provider(name, <any>undefined, { urn });
|
||||
},
|
||||
});
|
16
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/package.json
vendored
Normal file
16
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/package.json
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "@pulumi/example",
|
||||
"version": "${VERSION}",
|
||||
"scripts": {
|
||||
"build": "tsc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@pulumi/pulumi": "latest"
|
||||
},
|
||||
"pulumi": {
|
||||
"resource": true
|
||||
}
|
||||
}
|
46
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/provider.ts
vendored
Normal file
46
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/provider.ts
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as utilities from "./utilities";
|
||||
|
||||
export class Provider extends pulumi.ProviderResource {
|
||||
/** @internal */
|
||||
public static readonly __pulumiType = 'example';
|
||||
|
||||
/**
|
||||
* Returns true if the given object is an instance of Provider. This is designed to work even
|
||||
* when multiple copies of the Pulumi SDK have been loaded into the same process.
|
||||
*/
|
||||
public static isInstance(obj: any): obj is Provider {
|
||||
if (obj === undefined || obj === null) {
|
||||
return false;
|
||||
}
|
||||
return obj['__pulumiType'] === Provider.__pulumiType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a Provider resource with the given unique name, arguments, and options.
|
||||
*
|
||||
* @param name The _unique_ name of the resource.
|
||||
* @param args The arguments to use to populate this resource's properties.
|
||||
* @param opts A bag of options that control this resource's behavior.
|
||||
*/
|
||||
constructor(name: string, args?: ProviderArgs, opts?: pulumi.ResourceOptions) {
|
||||
let inputs: pulumi.Inputs = {};
|
||||
opts = opts || {};
|
||||
{
|
||||
}
|
||||
if (!opts.version) {
|
||||
opts = pulumi.mergeOptions(opts, { version: utilities.getVersion()});
|
||||
}
|
||||
super(Provider.__pulumiType, name, inputs, opts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The set of arguments for constructing a Provider resource.
|
||||
*/
|
||||
export interface ProviderArgs {
|
||||
}
|
74
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/toyStore.ts
vendored
Normal file
74
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/toyStore.ts
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import { input as inputs, output as outputs } from "./types";
|
||||
import * as utilities from "./utilities";
|
||||
|
||||
export class ToyStore extends pulumi.CustomResource {
|
||||
/**
|
||||
* Get an existing ToyStore resource's state with the given name, ID, and optional extra
|
||||
* properties used to qualify the lookup.
|
||||
*
|
||||
* @param name The _unique_ name of the resulting resource.
|
||||
* @param id The _unique_ provider ID of the resource to lookup.
|
||||
* @param opts Optional settings to control the behavior of the CustomResource.
|
||||
*/
|
||||
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): ToyStore {
|
||||
return new ToyStore(name, undefined as any, { ...opts, id: id });
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
public static readonly __pulumiType = 'example::ToyStore';
|
||||
|
||||
/**
|
||||
* Returns true if the given object is an instance of ToyStore. This is designed to work even
|
||||
* when multiple copies of the Pulumi SDK have been loaded into the same process.
|
||||
*/
|
||||
public static isInstance(obj: any): obj is ToyStore {
|
||||
if (obj === undefined || obj === null) {
|
||||
return false;
|
||||
}
|
||||
return obj['__pulumiType'] === ToyStore.__pulumiType;
|
||||
}
|
||||
|
||||
public /*out*/ readonly chew!: pulumi.Output<Chew | undefined>;
|
||||
public /*out*/ readonly laser!: pulumi.Output<Laser | undefined>;
|
||||
public /*out*/ readonly stuff!: pulumi.Output<outputs.Toy[] | undefined>;
|
||||
public /*out*/ readonly wanted!: pulumi.Output<outputs.Toy[] | undefined>;
|
||||
|
||||
/**
|
||||
* Create a ToyStore resource with the given unique name, arguments, and options.
|
||||
*
|
||||
* @param name The _unique_ name of the resource.
|
||||
* @param args The arguments to use to populate this resource's properties.
|
||||
* @param opts A bag of options that control this resource's behavior.
|
||||
*/
|
||||
constructor(name: string, args?: ToyStoreArgs, opts?: pulumi.CustomResourceOptions) {
|
||||
let inputs: pulumi.Inputs = {};
|
||||
opts = opts || {};
|
||||
if (!opts.id) {
|
||||
inputs["chew"] = undefined /*out*/;
|
||||
inputs["laser"] = undefined /*out*/;
|
||||
inputs["stuff"] = undefined /*out*/;
|
||||
inputs["wanted"] = undefined /*out*/;
|
||||
} else {
|
||||
inputs["chew"] = undefined /*out*/;
|
||||
inputs["laser"] = undefined /*out*/;
|
||||
inputs["stuff"] = undefined /*out*/;
|
||||
inputs["wanted"] = undefined /*out*/;
|
||||
}
|
||||
if (!opts.version) {
|
||||
opts = pulumi.mergeOptions(opts, { version: utilities.getVersion()});
|
||||
}
|
||||
const replaceOnChanges = { replaceOnChanges: ["stuff[*].associated.color", "stuff[*].color", "wanted[*].associated.color", "wanted[*].color"] };
|
||||
opts = pulumi.mergeOptions(opts, replaceOnChanges);
|
||||
super(ToyStore.__pulumiType, name, inputs, opts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The set of arguments for constructing a ToyStore resource.
|
||||
*/
|
||||
export interface ToyStoreArgs {
|
||||
}
|
27
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/tsconfig.json
vendored
Normal file
27
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/tsconfig.json
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "bin",
|
||||
"target": "es2016",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"stripInternal": true,
|
||||
"experimentalDecorators": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true
|
||||
},
|
||||
"files": [
|
||||
"cat.ts",
|
||||
"dog.ts",
|
||||
"god.ts",
|
||||
"index.ts",
|
||||
"provider.ts",
|
||||
"toyStore.ts",
|
||||
"types/index.ts",
|
||||
"types/input.ts",
|
||||
"types/output.ts",
|
||||
"utilities.ts"
|
||||
]
|
||||
}
|
11
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/types/index.ts
vendored
Normal file
11
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/types/index.ts
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
// Export sub-modules:
|
||||
import * as input from "./input";
|
||||
import * as output from "./output";
|
||||
|
||||
export {
|
||||
input,
|
||||
output,
|
||||
};
|
8
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/types/input.ts
vendored
Normal file
8
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/types/input.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import { input as inputs, output as outputs } from "../types";
|
||||
|
||||
import {Cat, Dog} from "..";
|
||||
|
17
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/types/output.ts
vendored
Normal file
17
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/types/output.ts
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import { input as inputs, output as outputs } from "../types";
|
||||
|
||||
import {Cat, Dog} from "..";
|
||||
|
||||
/**
|
||||
* This is a toy
|
||||
*/
|
||||
export interface Toy {
|
||||
associated?: outputs.Toy;
|
||||
color?: string;
|
||||
wear?: number;
|
||||
}
|
||||
|
49
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/utilities.ts
vendored
Normal file
49
pkg/codegen/internal/test/testdata/replace-on-change/nodejs/utilities.ts
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
|
||||
export function getEnv(...vars: string[]): string | undefined {
|
||||
for (const v of vars) {
|
||||
const value = process.env[v];
|
||||
if (value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getEnvBoolean(...vars: string[]): boolean | undefined {
|
||||
const s = getEnv(...vars);
|
||||
if (s !== undefined) {
|
||||
// NOTE: these values are taken from https://golang.org/src/strconv/atob.go?s=351:391#L1, which is what
|
||||
// Terraform uses internally when parsing boolean values.
|
||||
if (["1", "t", "T", "true", "TRUE", "True"].find(v => v === s) !== undefined) {
|
||||
return true;
|
||||
}
|
||||
if (["0", "f", "F", "false", "FALSE", "False"].find(v => v === s) !== undefined) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getEnvNumber(...vars: string[]): number | undefined {
|
||||
const s = getEnv(...vars);
|
||||
if (s !== undefined) {
|
||||
const f = parseFloat(s);
|
||||
if (!isNaN(f)) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getVersion(): string {
|
||||
let version = require('./package.json').version;
|
||||
// Node allows for the version to be prefixed by a "v", while semver doesn't.
|
||||
// If there is a v, strip it off.
|
||||
if (version.indexOf('v') === 0) {
|
||||
version = version.slice(1);
|
||||
}
|
||||
return version;
|
||||
}
|
0
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/README.md
vendored
Normal file
0
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/README.md
vendored
Normal file
40
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/__init__.py
vendored
Normal file
40
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/__init__.py
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by test. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
from . import _utilities
|
||||
import typing
|
||||
# Export this package's modules as members:
|
||||
from .cat import *
|
||||
from .dog import *
|
||||
from .god import *
|
||||
from .provider import *
|
||||
from .toy_store import *
|
||||
from . import outputs
|
||||
_utilities.register(
|
||||
resource_modules="""
|
||||
[
|
||||
{
|
||||
"pkg": "example",
|
||||
"mod": "",
|
||||
"fqn": "pulumi_example",
|
||||
"classes": {
|
||||
"example::Cat": "Cat",
|
||||
"example::Dog": "Dog",
|
||||
"example::God": "God",
|
||||
"example::ToyStore": "ToyStore"
|
||||
}
|
||||
}
|
||||
]
|
||||
""",
|
||||
resource_packages="""
|
||||
[
|
||||
{
|
||||
"pkg": "example",
|
||||
"token": "pulumi:providers:example",
|
||||
"fqn": "pulumi_example",
|
||||
"class": "Provider"
|
||||
}
|
||||
]
|
||||
"""
|
||||
)
|
235
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/_utilities.py
vendored
Normal file
235
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/_utilities.py
vendored
Normal file
|
@ -0,0 +1,235 @@
|
|||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by test. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
|
||||
import importlib.util
|
||||
import inspect
|
||||
import json
|
||||
import os
|
||||
import pkg_resources
|
||||
import sys
|
||||
import typing
|
||||
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
|
||||
from semver import VersionInfo as SemverVersion
|
||||
from parver import Version as PEP440Version
|
||||
|
||||
|
||||
def get_env(*args):
|
||||
for v in args:
|
||||
value = os.getenv(v)
|
||||
if value is not None:
|
||||
return value
|
||||
return None
|
||||
|
||||
|
||||
def get_env_bool(*args):
|
||||
str = get_env(*args)
|
||||
if str is not None:
|
||||
# NOTE: these values are taken from https://golang.org/src/strconv/atob.go?s=351:391#L1, which is what
|
||||
# Terraform uses internally when parsing boolean values.
|
||||
if str in ["1", "t", "T", "true", "TRUE", "True"]:
|
||||
return True
|
||||
if str in ["0", "f", "F", "false", "FALSE", "False"]:
|
||||
return False
|
||||
return None
|
||||
|
||||
|
||||
def get_env_int(*args):
|
||||
str = get_env(*args)
|
||||
if str is not None:
|
||||
try:
|
||||
return int(str)
|
||||
except:
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
def get_env_float(*args):
|
||||
str = get_env(*args)
|
||||
if str is not None:
|
||||
try:
|
||||
return float(str)
|
||||
except:
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
def _get_semver_version():
|
||||
# __name__ is set to the fully-qualified name of the current module, In our case, it will be
|
||||
# <some module>._utilities. <some module> is the module we want to query the version for.
|
||||
root_package, *rest = __name__.split('.')
|
||||
|
||||
# pkg_resources uses setuptools to inspect the set of installed packages. We use it here to ask
|
||||
# for the currently installed version of the root package (i.e. us) and get its version.
|
||||
|
||||
# Unfortunately, PEP440 and semver differ slightly in incompatible ways. The Pulumi engine expects
|
||||
# to receive a valid semver string when receiving requests from the language host, so it's our
|
||||
# responsibility as the library to convert our own PEP440 version into a valid semver string.
|
||||
|
||||
pep440_version_string = pkg_resources.require(root_package)[0].version
|
||||
pep440_version = PEP440Version.parse(pep440_version_string)
|
||||
(major, minor, patch) = pep440_version.release
|
||||
prerelease = None
|
||||
if pep440_version.pre_tag == 'a':
|
||||
prerelease = f"alpha.{pep440_version.pre}"
|
||||
elif pep440_version.pre_tag == 'b':
|
||||
prerelease = f"beta.{pep440_version.pre}"
|
||||
elif pep440_version.pre_tag == 'rc':
|
||||
prerelease = f"rc.{pep440_version.pre}"
|
||||
elif pep440_version.dev is not None:
|
||||
prerelease = f"dev.{pep440_version.dev}"
|
||||
|
||||
# The only significant difference between PEP440 and semver as it pertains to us is that PEP440 has explicit support
|
||||
# for dev builds, while semver encodes them as "prerelease" versions. In order to bridge between the two, we convert
|
||||
# our dev build version into a prerelease tag. This matches what all of our other packages do when constructing
|
||||
# their own semver string.
|
||||
return SemverVersion(major=major, minor=minor, patch=patch, prerelease=prerelease)
|
||||
|
||||
|
||||
# Determine the version once and cache the value, which measurably improves program performance.
|
||||
_version = _get_semver_version()
|
||||
_version_str = str(_version)
|
||||
|
||||
|
||||
def get_version():
|
||||
return _version_str
|
||||
|
||||
|
||||
def get_resource_args_opts(resource_args_type, resource_options_type, *args, **kwargs):
|
||||
"""
|
||||
Return the resource args and options given the *args and **kwargs of a resource's
|
||||
__init__ method.
|
||||
"""
|
||||
|
||||
resource_args, opts = None, None
|
||||
|
||||
# If the first item is the resource args type, save it and remove it from the args list.
|
||||
if args and isinstance(args[0], resource_args_type):
|
||||
resource_args, args = args[0], args[1:]
|
||||
|
||||
# Now look at the first item in the args list again.
|
||||
# If the first item is the resource options class, save it.
|
||||
if args and isinstance(args[0], resource_options_type):
|
||||
opts = args[0]
|
||||
|
||||
# If resource_args is None, see if "args" is in kwargs, and, if so, if it's typed as the
|
||||
# the resource args type.
|
||||
if resource_args is None:
|
||||
a = kwargs.get("args")
|
||||
if isinstance(a, resource_args_type):
|
||||
resource_args = a
|
||||
|
||||
# If opts is None, look it up in kwargs.
|
||||
if opts is None:
|
||||
opts = kwargs.get("opts")
|
||||
|
||||
return resource_args, opts
|
||||
|
||||
|
||||
# Temporary: just use pulumi._utils.lazy_import once everyone upgrades.
|
||||
def lazy_import(fullname):
|
||||
|
||||
import pulumi._utils as u
|
||||
f = getattr(u, 'lazy_import', None)
|
||||
if f is None:
|
||||
f = _lazy_import_temp
|
||||
|
||||
return f(fullname)
|
||||
|
||||
|
||||
# Copied from pulumi._utils.lazy_import, see comments there.
|
||||
def _lazy_import_temp(fullname):
|
||||
m = sys.modules.get(fullname, None)
|
||||
if m is not None:
|
||||
return m
|
||||
|
||||
spec = importlib.util.find_spec(fullname)
|
||||
|
||||
m = sys.modules.get(fullname, None)
|
||||
if m is not None:
|
||||
return m
|
||||
|
||||
loader = importlib.util.LazyLoader(spec.loader)
|
||||
spec.loader = loader
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
|
||||
m = sys.modules.get(fullname, None)
|
||||
if m is not None:
|
||||
return m
|
||||
|
||||
sys.modules[fullname] = module
|
||||
loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
class Package(pulumi.runtime.ResourcePackage):
|
||||
def __init__(self, pkg_info):
|
||||
super().__init__()
|
||||
self.pkg_info = pkg_info
|
||||
|
||||
def version(self):
|
||||
return _version
|
||||
|
||||
def construct_provider(self, name: str, typ: str, urn: str) -> pulumi.ProviderResource:
|
||||
if typ != self.pkg_info['token']:
|
||||
raise Exception(f"unknown provider type {typ}")
|
||||
Provider = getattr(lazy_import(self.pkg_info['fqn']), self.pkg_info['class'])
|
||||
return Provider(name, pulumi.ResourceOptions(urn=urn))
|
||||
|
||||
|
||||
class Module(pulumi.runtime.ResourceModule):
|
||||
def __init__(self, mod_info):
|
||||
super().__init__()
|
||||
self.mod_info = mod_info
|
||||
|
||||
def version(self):
|
||||
return _version
|
||||
|
||||
def construct(self, name: str, typ: str, urn: str) -> pulumi.Resource:
|
||||
class_name = self.mod_info['classes'].get(typ, None)
|
||||
|
||||
if class_name is None:
|
||||
raise Exception(f"unknown resource type {typ}")
|
||||
|
||||
TheClass = getattr(lazy_import(self.mod_info['fqn']), class_name)
|
||||
return TheClass(name, pulumi.ResourceOptions(urn=urn))
|
||||
|
||||
|
||||
def register(resource_modules, resource_packages):
|
||||
resource_modules = json.loads(resource_modules)
|
||||
resource_packages = json.loads(resource_packages)
|
||||
|
||||
for pkg_info in resource_packages:
|
||||
pulumi.runtime.register_resource_package(pkg_info['pkg'], Package(pkg_info))
|
||||
|
||||
for mod_info in resource_modules:
|
||||
pulumi.runtime.register_resource_module(
|
||||
mod_info['pkg'],
|
||||
mod_info['mod'],
|
||||
Module(mod_info))
|
||||
|
||||
|
||||
_F = typing.TypeVar('_F', bound=typing.Callable[..., typing.Any])
|
||||
|
||||
|
||||
def lift_output_func(func: typing.Any) -> typing.Callable[[_F], _F]:
|
||||
"""Decorator internally used on {fn}_output lifted function versions
|
||||
to implement them automatically from the un-lifted function."""
|
||||
|
||||
func_sig = inspect.signature(func)
|
||||
|
||||
def lifted_func(*args, opts=None, **kwargs):
|
||||
bound_args = func_sig.bind(*args, **kwargs)
|
||||
|
||||
return pulumi.Output.from_input({
|
||||
'args': bound_args.args,
|
||||
'kwargs': bound_args.kwargs
|
||||
}).apply(lambda resolved_args: func(*resolved_args['args'],
|
||||
opts=opts,
|
||||
**resolved_args['kwargs']))
|
||||
|
||||
return (lambda _: lifted_func)
|
132
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/cat.py
vendored
Normal file
132
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/cat.py
vendored
Normal file
|
@ -0,0 +1,132 @@
|
|||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by test. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import warnings
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
||||
from . import _utilities
|
||||
from . import outputs
|
||||
from .god import God
|
||||
|
||||
__all__ = ['CatArgs', 'Cat']
|
||||
|
||||
@pulumi.input_type
|
||||
class CatArgs:
|
||||
def __init__(__self__):
|
||||
"""
|
||||
The set of arguments for constructing a Cat resource.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class Cat(pulumi.CustomResource):
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
__props__=None):
|
||||
"""
|
||||
Create a Cat resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
args: Optional[CatArgs] = None,
|
||||
opts: Optional[pulumi.ResourceOptions] = None):
|
||||
"""
|
||||
Create a Cat resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param CatArgs args: The arguments to use to populate this resource's properties.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
def __init__(__self__, resource_name: str, *args, **kwargs):
|
||||
resource_args, opts = _utilities.get_resource_args_opts(CatArgs, pulumi.ResourceOptions, *args, **kwargs)
|
||||
if resource_args is not None:
|
||||
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
|
||||
else:
|
||||
__self__._internal_init(resource_name, *args, **kwargs)
|
||||
|
||||
def _internal_init(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
__props__=None):
|
||||
if opts is None:
|
||||
opts = pulumi.ResourceOptions()
|
||||
if not isinstance(opts, pulumi.ResourceOptions):
|
||||
raise TypeError('Expected resource options to be a ResourceOptions instance')
|
||||
if opts.version is None:
|
||||
opts.version = _utilities.get_version()
|
||||
if opts.id is None:
|
||||
if __props__ is not None:
|
||||
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
|
||||
__props__ = CatArgs.__new__(CatArgs)
|
||||
|
||||
__props__.__dict__["foes"] = None
|
||||
__props__.__dict__["friends"] = None
|
||||
__props__.__dict__["name"] = None
|
||||
__props__.__dict__["other"] = None
|
||||
__props__.__dict__["toy"] = None
|
||||
secret_opts = pulumi.ResourceOptions(additional_secret_outputs=["name"])
|
||||
opts = pulumi.ResourceOptions.merge(opts, secret_opts)
|
||||
replace_on_changes = pulumi.ResourceOptions(replace_on_changes=["foes.*.associated.color", "foes.*.color", "friends[*].associated.color", "friends[*].color", "name", "toy.color"])
|
||||
opts = pulumi.ResourceOptions.merge(opts, replace_on_changes)
|
||||
super(Cat, __self__).__init__(
|
||||
'example::Cat',
|
||||
resource_name,
|
||||
__props__,
|
||||
opts)
|
||||
|
||||
@staticmethod
|
||||
def get(resource_name: str,
|
||||
id: pulumi.Input[str],
|
||||
opts: Optional[pulumi.ResourceOptions] = None) -> 'Cat':
|
||||
"""
|
||||
Get an existing Cat resource's state with the given name, id, and optional extra
|
||||
properties used to qualify the lookup.
|
||||
|
||||
:param str resource_name: The unique name of the resulting resource.
|
||||
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
|
||||
|
||||
__props__ = CatArgs.__new__(CatArgs)
|
||||
|
||||
__props__.__dict__["foes"] = None
|
||||
__props__.__dict__["friends"] = None
|
||||
__props__.__dict__["name"] = None
|
||||
__props__.__dict__["other"] = None
|
||||
__props__.__dict__["toy"] = None
|
||||
return Cat(resource_name, opts=opts, __props__=__props__)
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def foes(self) -> pulumi.Output[Optional[Mapping[str, 'outputs.Toy']]]:
|
||||
return pulumi.get(self, "foes")
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def friends(self) -> pulumi.Output[Optional[Sequence['outputs.Toy']]]:
|
||||
return pulumi.get(self, "friends")
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def name(self) -> pulumi.Output[Optional[str]]:
|
||||
return pulumi.get(self, "name")
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def other(self) -> pulumi.Output[Optional['God']]:
|
||||
return pulumi.get(self, "other")
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def toy(self) -> pulumi.Output[Optional['outputs.Toy']]:
|
||||
return pulumi.get(self, "toy")
|
||||
|
100
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/dog.py
vendored
Normal file
100
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/dog.py
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by test. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import warnings
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
||||
from . import _utilities
|
||||
|
||||
__all__ = ['DogArgs', 'Dog']
|
||||
|
||||
@pulumi.input_type
|
||||
class DogArgs:
|
||||
def __init__(__self__):
|
||||
"""
|
||||
The set of arguments for constructing a Dog resource.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class Dog(pulumi.CustomResource):
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
__props__=None):
|
||||
"""
|
||||
Create a Dog resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
args: Optional[DogArgs] = None,
|
||||
opts: Optional[pulumi.ResourceOptions] = None):
|
||||
"""
|
||||
Create a Dog resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param DogArgs args: The arguments to use to populate this resource's properties.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
def __init__(__self__, resource_name: str, *args, **kwargs):
|
||||
resource_args, opts = _utilities.get_resource_args_opts(DogArgs, pulumi.ResourceOptions, *args, **kwargs)
|
||||
if resource_args is not None:
|
||||
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
|
||||
else:
|
||||
__self__._internal_init(resource_name, *args, **kwargs)
|
||||
|
||||
def _internal_init(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
__props__=None):
|
||||
if opts is None:
|
||||
opts = pulumi.ResourceOptions()
|
||||
if not isinstance(opts, pulumi.ResourceOptions):
|
||||
raise TypeError('Expected resource options to be a ResourceOptions instance')
|
||||
if opts.version is None:
|
||||
opts.version = _utilities.get_version()
|
||||
if opts.id is None:
|
||||
if __props__ is not None:
|
||||
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
|
||||
__props__ = DogArgs.__new__(DogArgs)
|
||||
|
||||
__props__.__dict__["bone"] = None
|
||||
replace_on_changes = pulumi.ResourceOptions(replace_on_changes=["bone"])
|
||||
opts = pulumi.ResourceOptions.merge(opts, replace_on_changes)
|
||||
super(Dog, __self__).__init__(
|
||||
'example::Dog',
|
||||
resource_name,
|
||||
__props__,
|
||||
opts)
|
||||
|
||||
@staticmethod
|
||||
def get(resource_name: str,
|
||||
id: pulumi.Input[str],
|
||||
opts: Optional[pulumi.ResourceOptions] = None) -> 'Dog':
|
||||
"""
|
||||
Get an existing Dog resource's state with the given name, id, and optional extra
|
||||
properties used to qualify the lookup.
|
||||
|
||||
:param str resource_name: The unique name of the resulting resource.
|
||||
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
|
||||
|
||||
__props__ = DogArgs.__new__(DogArgs)
|
||||
|
||||
__props__.__dict__["bone"] = None
|
||||
return Dog(resource_name, opts=opts, __props__=__props__)
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def bone(self) -> pulumi.Output[Optional[str]]:
|
||||
return pulumi.get(self, "bone")
|
||||
|
99
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/god.py
vendored
Normal file
99
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/god.py
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by test. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import warnings
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
||||
from . import _utilities
|
||||
from .dog import Dog
|
||||
|
||||
__all__ = ['GodArgs', 'God']
|
||||
|
||||
@pulumi.input_type
|
||||
class GodArgs:
|
||||
def __init__(__self__):
|
||||
"""
|
||||
The set of arguments for constructing a God resource.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class God(pulumi.CustomResource):
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
__props__=None):
|
||||
"""
|
||||
Create a God resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
args: Optional[GodArgs] = None,
|
||||
opts: Optional[pulumi.ResourceOptions] = None):
|
||||
"""
|
||||
Create a God resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param GodArgs args: The arguments to use to populate this resource's properties.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
def __init__(__self__, resource_name: str, *args, **kwargs):
|
||||
resource_args, opts = _utilities.get_resource_args_opts(GodArgs, pulumi.ResourceOptions, *args, **kwargs)
|
||||
if resource_args is not None:
|
||||
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
|
||||
else:
|
||||
__self__._internal_init(resource_name, *args, **kwargs)
|
||||
|
||||
def _internal_init(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
__props__=None):
|
||||
if opts is None:
|
||||
opts = pulumi.ResourceOptions()
|
||||
if not isinstance(opts, pulumi.ResourceOptions):
|
||||
raise TypeError('Expected resource options to be a ResourceOptions instance')
|
||||
if opts.version is None:
|
||||
opts.version = _utilities.get_version()
|
||||
if opts.id is None:
|
||||
if __props__ is not None:
|
||||
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
|
||||
__props__ = GodArgs.__new__(GodArgs)
|
||||
|
||||
__props__.__dict__["backwards"] = None
|
||||
super(God, __self__).__init__(
|
||||
'example::God',
|
||||
resource_name,
|
||||
__props__,
|
||||
opts)
|
||||
|
||||
@staticmethod
|
||||
def get(resource_name: str,
|
||||
id: pulumi.Input[str],
|
||||
opts: Optional[pulumi.ResourceOptions] = None) -> 'God':
|
||||
"""
|
||||
Get an existing God resource's state with the given name, id, and optional extra
|
||||
properties used to qualify the lookup.
|
||||
|
||||
:param str resource_name: The unique name of the resulting resource.
|
||||
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
|
||||
|
||||
__props__ = GodArgs.__new__(GodArgs)
|
||||
|
||||
__props__.__dict__["backwards"] = None
|
||||
return God(resource_name, opts=opts, __props__=__props__)
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def backwards(self) -> pulumi.Output[Optional['Dog']]:
|
||||
return pulumi.get(self, "backwards")
|
||||
|
50
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/outputs.py
vendored
Normal file
50
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/outputs.py
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by test. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import warnings
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
||||
from . import _utilities
|
||||
from . import outputs
|
||||
|
||||
__all__ = [
|
||||
'Toy',
|
||||
]
|
||||
|
||||
@pulumi.output_type
|
||||
class Toy(dict):
|
||||
"""
|
||||
This is a toy
|
||||
"""
|
||||
def __init__(__self__, *,
|
||||
associated: Optional['outputs.Toy'] = None,
|
||||
color: Optional[str] = None,
|
||||
wear: Optional[float] = None):
|
||||
"""
|
||||
This is a toy
|
||||
"""
|
||||
if associated is not None:
|
||||
pulumi.set(__self__, "associated", associated)
|
||||
if color is not None:
|
||||
pulumi.set(__self__, "color", color)
|
||||
if wear is not None:
|
||||
pulumi.set(__self__, "wear", wear)
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def associated(self) -> Optional['outputs.Toy']:
|
||||
return pulumi.get(self, "associated")
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def color(self) -> Optional[str]:
|
||||
return pulumi.get(self, "color")
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def wear(self) -> Optional[float]:
|
||||
return pulumi.get(self, "wear")
|
||||
|
||||
|
73
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/provider.py
vendored
Normal file
73
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/provider.py
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by test. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import warnings
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
||||
from . import _utilities
|
||||
|
||||
__all__ = ['ProviderArgs', 'Provider']
|
||||
|
||||
@pulumi.input_type
|
||||
class ProviderArgs:
|
||||
def __init__(__self__):
|
||||
"""
|
||||
The set of arguments for constructing a Provider resource.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class Provider(pulumi.ProviderResource):
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
__props__=None):
|
||||
"""
|
||||
Create a Example resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
args: Optional[ProviderArgs] = None,
|
||||
opts: Optional[pulumi.ResourceOptions] = None):
|
||||
"""
|
||||
Create a Example resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param ProviderArgs args: The arguments to use to populate this resource's properties.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
def __init__(__self__, resource_name: str, *args, **kwargs):
|
||||
resource_args, opts = _utilities.get_resource_args_opts(ProviderArgs, pulumi.ResourceOptions, *args, **kwargs)
|
||||
if resource_args is not None:
|
||||
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
|
||||
else:
|
||||
__self__._internal_init(resource_name, *args, **kwargs)
|
||||
|
||||
def _internal_init(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
__props__=None):
|
||||
if opts is None:
|
||||
opts = pulumi.ResourceOptions()
|
||||
if not isinstance(opts, pulumi.ResourceOptions):
|
||||
raise TypeError('Expected resource options to be a ResourceOptions instance')
|
||||
if opts.version is None:
|
||||
opts.version = _utilities.get_version()
|
||||
if opts.id is None:
|
||||
if __props__ is not None:
|
||||
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
|
||||
__props__ = ProviderArgs.__new__(ProviderArgs)
|
||||
|
||||
super(Provider, __self__).__init__(
|
||||
'example',
|
||||
resource_name,
|
||||
__props__,
|
||||
opts)
|
||||
|
0
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/py.typed
vendored
Normal file
0
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/py.typed
vendored
Normal file
124
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/toy_store.py
vendored
Normal file
124
pkg/codegen/internal/test/testdata/replace-on-change/python/pulumi_example/toy_store.py
vendored
Normal file
|
@ -0,0 +1,124 @@
|
|||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by test. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import warnings
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
||||
from . import _utilities
|
||||
from . import outputs
|
||||
from .chew import Chew
|
||||
from .laser import Laser
|
||||
|
||||
__all__ = ['ToyStoreArgs', 'ToyStore']
|
||||
|
||||
@pulumi.input_type
|
||||
class ToyStoreArgs:
|
||||
def __init__(__self__):
|
||||
"""
|
||||
The set of arguments for constructing a ToyStore resource.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class ToyStore(pulumi.CustomResource):
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
__props__=None):
|
||||
"""
|
||||
Create a ToyStore resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
args: Optional[ToyStoreArgs] = None,
|
||||
opts: Optional[pulumi.ResourceOptions] = None):
|
||||
"""
|
||||
Create a ToyStore resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param ToyStoreArgs args: The arguments to use to populate this resource's properties.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
def __init__(__self__, resource_name: str, *args, **kwargs):
|
||||
resource_args, opts = _utilities.get_resource_args_opts(ToyStoreArgs, pulumi.ResourceOptions, *args, **kwargs)
|
||||
if resource_args is not None:
|
||||
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
|
||||
else:
|
||||
__self__._internal_init(resource_name, *args, **kwargs)
|
||||
|
||||
def _internal_init(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
__props__=None):
|
||||
if opts is None:
|
||||
opts = pulumi.ResourceOptions()
|
||||
if not isinstance(opts, pulumi.ResourceOptions):
|
||||
raise TypeError('Expected resource options to be a ResourceOptions instance')
|
||||
if opts.version is None:
|
||||
opts.version = _utilities.get_version()
|
||||
if opts.id is None:
|
||||
if __props__ is not None:
|
||||
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
|
||||
__props__ = ToyStoreArgs.__new__(ToyStoreArgs)
|
||||
|
||||
__props__.__dict__["chew"] = None
|
||||
__props__.__dict__["laser"] = None
|
||||
__props__.__dict__["stuff"] = None
|
||||
__props__.__dict__["wanted"] = None
|
||||
replace_on_changes = pulumi.ResourceOptions(replace_on_changes=["stuff[*].associated.color", "stuff[*].color", "wanted[*].associated.color", "wanted[*].color"])
|
||||
opts = pulumi.ResourceOptions.merge(opts, replace_on_changes)
|
||||
super(ToyStore, __self__).__init__(
|
||||
'example::ToyStore',
|
||||
resource_name,
|
||||
__props__,
|
||||
opts)
|
||||
|
||||
@staticmethod
|
||||
def get(resource_name: str,
|
||||
id: pulumi.Input[str],
|
||||
opts: Optional[pulumi.ResourceOptions] = None) -> 'ToyStore':
|
||||
"""
|
||||
Get an existing ToyStore resource's state with the given name, id, and optional extra
|
||||
properties used to qualify the lookup.
|
||||
|
||||
:param str resource_name: The unique name of the resulting resource.
|
||||
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
|
||||
|
||||
__props__ = ToyStoreArgs.__new__(ToyStoreArgs)
|
||||
|
||||
__props__.__dict__["chew"] = None
|
||||
__props__.__dict__["laser"] = None
|
||||
__props__.__dict__["stuff"] = None
|
||||
__props__.__dict__["wanted"] = None
|
||||
return ToyStore(resource_name, opts=opts, __props__=__props__)
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def chew(self) -> pulumi.Output[Optional['Chew']]:
|
||||
return pulumi.get(self, "chew")
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def laser(self) -> pulumi.Output[Optional['Laser']]:
|
||||
return pulumi.get(self, "laser")
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def stuff(self) -> pulumi.Output[Optional[Sequence['outputs.Toy']]]:
|
||||
return pulumi.get(self, "stuff")
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def wanted(self) -> pulumi.Output[Optional[Sequence['outputs.Toy']]]:
|
||||
return pulumi.get(self, "wanted")
|
||||
|
58
pkg/codegen/internal/test/testdata/replace-on-change/python/setup.py
vendored
Normal file
58
pkg/codegen/internal/test/testdata/replace-on-change/python/setup.py
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by test. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import errno
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.install import install
|
||||
from subprocess import check_call
|
||||
|
||||
|
||||
VERSION = "0.0.0"
|
||||
PLUGIN_VERSION = "0.0.0"
|
||||
|
||||
class InstallPluginCommand(install):
|
||||
def run(self):
|
||||
install.run(self)
|
||||
try:
|
||||
check_call(['pulumi', 'plugin', 'install', 'resource', 'example', PLUGIN_VERSION])
|
||||
except OSError as error:
|
||||
if error.errno == errno.ENOENT:
|
||||
print(f"""
|
||||
There was an error installing the example resource provider plugin.
|
||||
It looks like `pulumi` is not installed on your system.
|
||||
Please visit https://pulumi.com/ to install the Pulumi CLI.
|
||||
You may try manually installing the plugin by running
|
||||
`pulumi plugin install resource example {PLUGIN_VERSION}`
|
||||
""")
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def readme():
|
||||
try:
|
||||
with open('README.md', encoding='utf-8') as f:
|
||||
return f.read()
|
||||
except FileNotFoundError:
|
||||
return "example Pulumi Package - Development Version"
|
||||
|
||||
|
||||
setup(name='pulumi_example',
|
||||
version=VERSION,
|
||||
long_description=readme(),
|
||||
long_description_content_type='text/markdown',
|
||||
cmdclass={
|
||||
'install': InstallPluginCommand,
|
||||
},
|
||||
packages=find_packages(),
|
||||
package_data={
|
||||
'pulumi_example': [
|
||||
'py.typed',
|
||||
]
|
||||
},
|
||||
install_requires=[
|
||||
'parver>=0.2.1',
|
||||
'pulumi',
|
||||
'semver>=2.8.1'
|
||||
],
|
||||
zip_safe=False)
|
124
pkg/codegen/internal/test/testdata/replace-on-change/schema.json
vendored
Normal file
124
pkg/codegen/internal/test/testdata/replace-on-change/schema.json
vendored
Normal file
|
@ -0,0 +1,124 @@
|
|||
{
|
||||
"name": "example",
|
||||
"version": "0.0.1",
|
||||
"resources": {
|
||||
"example::ToyStore": {
|
||||
"properties": {
|
||||
"chew": {
|
||||
"$ref": "#/resources/example::Chew"
|
||||
},
|
||||
"laser": {
|
||||
"$ref": "#/resources/example::Laser"
|
||||
},
|
||||
"stuff": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/types/example::Toy"
|
||||
}
|
||||
},
|
||||
"wanted": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/types/example::Toy"
|
||||
},
|
||||
"replaceOnChange": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"example::God": {
|
||||
"properties": {
|
||||
"backwards": {
|
||||
"$ref": "#/resources/example::Dog"
|
||||
}
|
||||
}
|
||||
},
|
||||
"example::Dog": {
|
||||
"properties": {
|
||||
"bone": {
|
||||
"type": "string",
|
||||
"replaceOnChanges": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"example::Cat": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"secret": true,
|
||||
"replaceOnChanges": true
|
||||
},
|
||||
"other": {
|
||||
"$ref": "#/resources/example::God"
|
||||
},
|
||||
"toy": {
|
||||
"$ref": "#/types/example::Toy"
|
||||
},
|
||||
"friends": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/types/example::Toy"
|
||||
}
|
||||
},
|
||||
"foes": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/types/example::Toy"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"types": {
|
||||
"example::Toy": {
|
||||
"description": "This is a toy",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"color": {
|
||||
"type": "string",
|
||||
"secret": true,
|
||||
"replaceOnChanges": true
|
||||
},
|
||||
"wear": {
|
||||
"type": "number"
|
||||
},
|
||||
"associated": {
|
||||
"$ref": "#/types/example::Toy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"example::Laser": {
|
||||
"description": "A Toy for a cat",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"animal": {
|
||||
"$ref": "#/resources/example::Cat"
|
||||
},
|
||||
"light": {
|
||||
"type": "number"
|
||||
},
|
||||
"batteries": {
|
||||
"type": "boolean",
|
||||
"replaceOnChanges": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"example::Chew": {
|
||||
"description": "A toy for a dog",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"owner": {
|
||||
"$ref": "#/resources/example::Dog",
|
||||
"replaceOnChange": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"language": {
|
||||
"csharp": {},
|
||||
"go": {
|
||||
"generateResourceContainerTypes": true
|
||||
},
|
||||
"nodejs": {},
|
||||
"python": {}
|
||||
}
|
||||
}
|
14
pkg/codegen/internal/test/testdata/schema/replace-on-changes-1.json
vendored
Normal file
14
pkg/codegen/internal/test/testdata/schema/replace-on-changes-1.json
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"version": "0.0.1",
|
||||
"name": "example",
|
||||
"resources": {
|
||||
"example::Dog": {
|
||||
"properties": {
|
||||
"bone": {
|
||||
"type": "string",
|
||||
"replaceOnChanges": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
13
pkg/codegen/internal/test/testdata/schema/replace-on-changes-2.json
vendored
Normal file
13
pkg/codegen/internal/test/testdata/schema/replace-on-changes-2.json
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"version": "0.0.1",
|
||||
"name": "example",
|
||||
"resources": {
|
||||
"example::Dog": {
|
||||
"properties": {
|
||||
"bone": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
42
pkg/codegen/internal/test/testdata/schema/replace-on-changes-3.json
vendored
Normal file
42
pkg/codegen/internal/test/testdata/schema/replace-on-changes-3.json
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"version": "0.0.1",
|
||||
"name": "example",
|
||||
"types": {
|
||||
"example::Dog": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"bone": {
|
||||
"type": "string",
|
||||
"replaceOnChanges": true
|
||||
},
|
||||
"cat": {
|
||||
"$ref": "#/types/example::Cat"
|
||||
}
|
||||
}
|
||||
},
|
||||
"example::Cat": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fish": {
|
||||
"type": "string",
|
||||
"replaceOnChanges": true
|
||||
},
|
||||
"dog": {
|
||||
"$ref": "#/types/example::Dog"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"example::Pets": {
|
||||
"properties": {
|
||||
"dog": {
|
||||
"$ref": "#/types/example::Dog"
|
||||
},
|
||||
"cat": {
|
||||
"$ref": "#/types/example::Cat"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
27
pkg/codegen/internal/test/testdata/schema/replace-on-changes-4.json
vendored
Normal file
27
pkg/codegen/internal/test/testdata/schema/replace-on-changes-4.json
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"version": "0.0.1",
|
||||
"name": "example",
|
||||
"types": {
|
||||
"example::Dog": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"bone": {
|
||||
"type": "string",
|
||||
"replaceOnChanges": true
|
||||
},
|
||||
"dog": {
|
||||
"$ref": "#/types/example::Dog"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"example::Pets": {
|
||||
"properties": {
|
||||
"dog": {
|
||||
"$ref": "#/types/example::Dog"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
55
pkg/codegen/internal/test/testdata/schema/replace-on-changes-5.json
vendored
Normal file
55
pkg/codegen/internal/test/testdata/schema/replace-on-changes-5.json
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"version": "0.0.1",
|
||||
"name": "example",
|
||||
"resources": {
|
||||
"example::Dog": {
|
||||
"properties": {
|
||||
"bone": {
|
||||
"type": "string",
|
||||
"replaceOnChanges": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"example::Pets": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"replaceOnChanges": true
|
||||
},
|
||||
"other": {
|
||||
"$ref": "#/resources/example::Dog"
|
||||
},
|
||||
"toy": {
|
||||
"$ref": "#/types/example::toy"
|
||||
},
|
||||
"friends": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/types/example::toy"
|
||||
}
|
||||
},
|
||||
"foes": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/types/example::toy"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"types": {
|
||||
"example::toy": {
|
||||
"description": "This is a cat toy",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"color": {
|
||||
"type": "string",
|
||||
"replaceOnChanges": true
|
||||
},
|
||||
"wear": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,6 +35,8 @@ import (
|
|||
|
||||
"github.com/pulumi/pulumi/pkg/v3/codegen"
|
||||
"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/diag"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
|
||||
)
|
||||
|
||||
|
@ -704,6 +706,17 @@ func (mod *modContext) genResource(w io.Writer, r *schema.Resource) error {
|
|||
fmt.Fprintf(w, "\n opts = pulumi.mergeOptions(opts, secretOpts);\n")
|
||||
}
|
||||
|
||||
replaceOnChanges, errList := r.ReplaceOnChanges()
|
||||
for _, err := range errList {
|
||||
cmdutil.Diag().Warningf(&diag.Diag{Message: err.Error()})
|
||||
}
|
||||
replaceOnChangesStrings := schema.PropertyListJoinToString(replaceOnChanges,
|
||||
func(x string) string { return x })
|
||||
if len(replaceOnChanges) > 0 {
|
||||
fmt.Fprintf(w, ` const replaceOnChanges = { replaceOnChanges: ["%s"] };`, strings.Join(replaceOnChangesStrings, `", "`))
|
||||
fmt.Fprintf(w, "\n opts = pulumi.mergeOptions(opts, replaceOnChanges);\n")
|
||||
}
|
||||
|
||||
// If it's a ComponentResource, set the remote option.
|
||||
if r.IsComponent {
|
||||
fmt.Fprintf(w, " super(%s.__pulumiType, name, inputs, opts, true /*remote*/);\n", name)
|
||||
|
|
|
@ -36,7 +36,9 @@ import (
|
|||
|
||||
"github.com/pulumi/pulumi/pkg/v3/codegen"
|
||||
"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/diag"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
|
||||
)
|
||||
|
||||
|
@ -1274,6 +1276,16 @@ func (mod *modContext) genResource(res *schema.Resource) (string, error) {
|
|||
fmt.Fprintf(w, "\n opts = pulumi.ResourceOptions.merge(opts, secret_opts)\n")
|
||||
}
|
||||
|
||||
replaceOnChangesProps, errList := res.ReplaceOnChanges()
|
||||
for _, err := range errList {
|
||||
cmdutil.Diag().Warningf(&diag.Diag{Message: err.Error()})
|
||||
}
|
||||
if len(replaceOnChangesProps) > 0 {
|
||||
replaceOnChangesStrings := schema.PropertyListJoinToString(replaceOnChangesProps, PyName)
|
||||
fmt.Fprintf(w, ` replace_on_changes = pulumi.ResourceOptions(replace_on_changes=["%s"])`, strings.Join(replaceOnChangesStrings, `", "`))
|
||||
fmt.Fprintf(w, "\n opts = pulumi.ResourceOptions.merge(opts, replace_on_changes)\n")
|
||||
}
|
||||
|
||||
// Finally, chain to the base constructor, which will actually register the resource.
|
||||
tok := res.Token
|
||||
if res.IsProvider {
|
||||
|
|
|
@ -349,6 +349,8 @@ type Property struct {
|
|||
Language map[string]interface{}
|
||||
// Secret is true if the property is secret (default false).
|
||||
Secret bool
|
||||
// ReplaceOnChanges specifies if the property is to be replaced instead of updated (default false).
|
||||
ReplaceOnChanges bool
|
||||
}
|
||||
|
||||
// IsRequired returns true if this property is required (i.e. its type is not Optional).
|
||||
|
@ -395,6 +397,110 @@ type Resource struct {
|
|||
Methods []*Method
|
||||
}
|
||||
|
||||
// The set of resource paths where ReplaceOnChanges is true.
|
||||
//
|
||||
// For example, if you have the following resource struct:
|
||||
//
|
||||
// Resource A {
|
||||
// Properties: {
|
||||
// Resource B {
|
||||
// Object D: {
|
||||
// ReplaceOnChanges: true
|
||||
// }
|
||||
// Object F: {}
|
||||
// }
|
||||
// Object C {
|
||||
// ReplaceOnChanges: true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// A.ReplaceOnChanges() == [[B, D], [C]]
|
||||
func (r *Resource) ReplaceOnChanges() (changes [][]*Property, err []error) {
|
||||
for _, p := range r.Properties {
|
||||
if p.ReplaceOnChanges {
|
||||
changes = append(changes, []*Property{p})
|
||||
} else {
|
||||
stack := map[string]struct{}{p.Type.String(): {}}
|
||||
childChanges, errList := replaceOnChangesType(p.Type, &stack)
|
||||
err = append(err, errList...)
|
||||
|
||||
for _, c := range childChanges {
|
||||
changes = append(changes, append([]*Property{p}, c...))
|
||||
}
|
||||
}
|
||||
}
|
||||
for i, e := range err {
|
||||
err[i] = errors.Wrapf(e, "Failed to genereate full `ReplaceOnChanges`")
|
||||
}
|
||||
return changes, err
|
||||
}
|
||||
|
||||
func replaceOnChangesType(t Type, stack *map[string]struct{}) ([][]*Property, []error) {
|
||||
var errTmp []error
|
||||
if o, ok := t.(*OptionalType); ok {
|
||||
return replaceOnChangesType(o.ElementType, stack)
|
||||
} else if o, ok := t.(*ObjectType); ok {
|
||||
changes := [][]*Property{}
|
||||
err := []error{}
|
||||
for _, p := range o.Properties {
|
||||
if p.ReplaceOnChanges {
|
||||
changes = append(changes, []*Property{p})
|
||||
} else if _, ok := (*stack)[p.Type.String()]; !ok {
|
||||
// We handle recursive objects
|
||||
(*stack)[p.Type.String()] = struct{}{}
|
||||
var object [][]*Property
|
||||
object, errTmp = replaceOnChangesType(p.Type, stack)
|
||||
err = append(err, errTmp...)
|
||||
for _, path := range object {
|
||||
changes = append(changes, append([]*Property{p}, path...))
|
||||
}
|
||||
|
||||
delete(*stack, p.Type.String())
|
||||
} else {
|
||||
err = append(err, errors.Errorf("Found recursive object %q", p.Name))
|
||||
}
|
||||
}
|
||||
return changes, err
|
||||
} else if a, ok := t.(*ArrayType); ok {
|
||||
// This looks for types internal to the array, not a property of the array.
|
||||
return replaceOnChangesType(a.ElementType, stack)
|
||||
} else if m, ok := t.(*MapType); ok {
|
||||
// This looks for types internal to the map, not a property of the array.
|
||||
return replaceOnChangesType(m.ElementType, stack)
|
||||
}
|
||||
return [][]*Property{}, []error{}
|
||||
}
|
||||
|
||||
// Joins the output of `ReplaceOnChanges` into property path names.
|
||||
//
|
||||
// For example, given an input [[B, D], [C]] where each property has a name
|
||||
// equivalent to it's variable, this function should yield: ["B.D", "C"]
|
||||
func PropertyListJoinToString(propertyList [][]*Property, nameConverter func(string) string) []string {
|
||||
var nonOptional func(Type) Type
|
||||
nonOptional = func(t Type) Type {
|
||||
if o, ok := t.(*OptionalType); ok {
|
||||
return nonOptional(o.ElementType)
|
||||
}
|
||||
return t
|
||||
}
|
||||
out := make([]string, len(propertyList))
|
||||
for i, p := range propertyList {
|
||||
names := make([]string, len(p))
|
||||
for j, n := range p {
|
||||
if _, ok := nonOptional(n.Type).(*ArrayType); ok {
|
||||
names[j] = nameConverter(n.Name) + "[*]"
|
||||
} else if _, ok := nonOptional(n.Type).(*MapType); ok {
|
||||
names[j] = nameConverter(n.Name) + ".*"
|
||||
} else {
|
||||
names[j] = nameConverter(n.Name)
|
||||
}
|
||||
}
|
||||
out[i] = strings.Join(names, ".")
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
type Method struct {
|
||||
// Name is the name of the method.
|
||||
Name string
|
||||
|
@ -1222,6 +1328,8 @@ type PropertySpec struct {
|
|||
Language map[string]RawMessage `json:"language,omitempty" yaml:"language,omitempty"`
|
||||
// Secret specifies if the property is secret (default false).
|
||||
Secret bool `json:"secret,omitempty" yaml:"secret,omitempty"`
|
||||
// ReplaceOnChanges specifies if the property is to be replaced instead of updated (default false).
|
||||
ReplaceOnChanges bool `json:"replaceOnChanges,omitempty" yaml:"replaceOnChanges,omitempty"`
|
||||
}
|
||||
|
||||
// ObjectTypeSpec is the serializable form of an object type.
|
||||
|
@ -2068,6 +2176,7 @@ func (t *types) bindProperties(path string, properties map[string]PropertySpec,
|
|||
DeprecationMessage: spec.DeprecationMessage,
|
||||
Language: language,
|
||||
Secret: spec.Secret,
|
||||
ReplaceOnChanges: spec.ReplaceOnChanges,
|
||||
}
|
||||
|
||||
propertyMap[name], result = p, append(result, p)
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
"net/url"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/blang/semver"
|
||||
|
@ -410,3 +411,82 @@ func TestMethods(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Tests that the method ReplaceOnChanges works as expected. Does not test
|
||||
// codegen.
|
||||
func TestReplaceOnChanges(t *testing.T) {
|
||||
for _, tt := range []struct {
|
||||
name string
|
||||
filePath string
|
||||
resource string
|
||||
result []string
|
||||
errors []string
|
||||
}{
|
||||
{
|
||||
name: "Simple case",
|
||||
filePath: "replace-on-changes-1.json",
|
||||
resource: "example::Dog",
|
||||
result: []string{"bone"},
|
||||
},
|
||||
{
|
||||
name: "No replaceOnChanges",
|
||||
filePath: "replace-on-changes-2.json",
|
||||
resource: "example::Dog",
|
||||
},
|
||||
{
|
||||
name: "Mutually Recursive",
|
||||
filePath: "replace-on-changes-3.json",
|
||||
resource: "example::Pets",
|
||||
result: []string{
|
||||
"cat.fish",
|
||||
"dog.bone",
|
||||
"dog.cat.fish",
|
||||
"cat.dog.bone"},
|
||||
errors: []string{
|
||||
"Failed to genereate full `ReplaceOnChanges`: Found recursive object \"cat\"",
|
||||
"Failed to genereate full `ReplaceOnChanges`: Found recursive object \"dog\""},
|
||||
},
|
||||
{
|
||||
name: "Singularly Recursive",
|
||||
filePath: "replace-on-changes-4.json",
|
||||
resource: "example::Pets",
|
||||
result: []string{"dog.bone"},
|
||||
errors: []string{"Failed to genereate full `ReplaceOnChanges`: Found recursive object \"dog\""},
|
||||
},
|
||||
{
|
||||
name: "Drill Correctly",
|
||||
filePath: "replace-on-changes-5.json",
|
||||
resource: "example::Pets",
|
||||
result: []string{"foes.*.color", "friends[*].color", "name", "toy.color"},
|
||||
},
|
||||
} {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// We sort each result before comparison. We don't enforce that the
|
||||
// results have the same order, just the same content.
|
||||
sort.Strings(tt.result)
|
||||
sort.Strings(tt.errors)
|
||||
pkgSpec := readSchemaFile(
|
||||
filepath.Join("schema", tt.filePath))
|
||||
pkg, err := ImportSpec(pkgSpec, nil)
|
||||
assert.NoError(t, err, "Import should be successful")
|
||||
resource, found := pkg.GetResource(tt.resource)
|
||||
assert.True(t, found, "The resource should exist")
|
||||
replaceOnChanges, errListErrors := resource.ReplaceOnChanges()
|
||||
errList := make([]string, len(errListErrors))
|
||||
for i, e := range errListErrors {
|
||||
errList[i] = e.Error()
|
||||
}
|
||||
actualResult := PropertyListJoinToString(replaceOnChanges,
|
||||
func(x string) string { return x })
|
||||
sort.Strings(actualResult)
|
||||
if tt.result != nil || len(actualResult) > 0 {
|
||||
assert.Equal(t, tt.result, actualResult,
|
||||
"Get the correct result")
|
||||
}
|
||||
if tt.errors != nil || len(errList) > 0 {
|
||||
assert.Equal(t, tt.errors, errList,
|
||||
"Get correct error messages")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue