Fix Go generation for top-level module resources in a provider with a dash in name (#7692)
* Fix Go generation for top-level module resources in a provider with a dash * Add tests
This commit is contained in:
parent
24802142f2
commit
9c501b5bed
|
@ -159,7 +159,7 @@ func (pkg *pkgContext) tokenToType(tok string) string {
|
|||
return name
|
||||
}
|
||||
if mod == "" {
|
||||
mod = components[0]
|
||||
mod = goPackage(components[0])
|
||||
}
|
||||
mod = strings.Replace(mod, "/", "", -1) + "." + name
|
||||
return strings.Replace(mod, "-provider", "", -1)
|
||||
|
|
|
@ -21,6 +21,10 @@ type sdkTest struct {
|
|||
}
|
||||
|
||||
var sdkTests = []sdkTest{
|
||||
{
|
||||
Directory: "dash-named-schema",
|
||||
Description: "Simple schema with a two part name (foo-bar)",
|
||||
},
|
||||
{
|
||||
Directory: "external-resource-schema",
|
||||
Description: "External resource schema",
|
||||
|
|
34
pkg/codegen/internal/test/testdata/dash-named-schema/docs/_index.md
vendored
Normal file
34
pkg/codegen/internal/test/testdata/dash-named-schema/docs/_index.md
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: "foo-bar"
|
||||
title_tag: "foo-bar Package"
|
||||
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="modules">Modules</h2>
|
||||
<ul class="api">
|
||||
<li><a href="submodule1/" title="submodule1"><span class="symbol module"></span>submodule1</a></li>
|
||||
</ul>
|
||||
|
||||
<h2 id="resources">Resources</h2>
|
||||
<ul class="api">
|
||||
<li><a href="provider" title="Provider"><span class="symbol resource"></span>Provider</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>
|
||||
|
239
pkg/codegen/internal/test/testdata/dash-named-schema/docs/provider/_index.md
vendored
Normal file
239
pkg/codegen/internal/test/testdata/dash-named-schema/docs/provider/_index.md
vendored
Normal file
|
@ -0,0 +1,239 @@
|
|||
|
||||
---
|
||||
title: "Provider"
|
||||
title_tag: "foo-bar.Provider"
|
||||
meta_desc: "Documentation for the foo-bar.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>
|
||||
|
26
pkg/codegen/internal/test/testdata/dash-named-schema/docs/submodule1/_index.md
vendored
Normal file
26
pkg/codegen/internal/test/testdata/dash-named-schema/docs/submodule1/_index.md
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
title: "submodule1"
|
||||
title_tag: "foo-bar.submodule1"
|
||||
meta_desc: "Explore the resources and functions of the foo-bar.submodule1 module."
|
||||
---
|
||||
|
||||
<!-- WARNING: this file was generated by test. -->
|
||||
<!-- Do not edit by hand unless you're certain you know what you are doing! -->
|
||||
|
||||
Explore the resources and functions of the foo-bar.submodule1 module.
|
||||
|
||||
<h2 id="resources">Resources</h2>
|
||||
<ul class="api">
|
||||
<li><a href="moduleresource" title="ModuleResource"><span class="symbol resource"></span>ModuleResource</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>
|
||||
|
326
pkg/codegen/internal/test/testdata/dash-named-schema/docs/submodule1/moduleresource/_index.md
vendored
Normal file
326
pkg/codegen/internal/test/testdata/dash-named-schema/docs/submodule1/moduleresource/_index.md
vendored
Normal file
|
@ -0,0 +1,326 @@
|
|||
|
||||
---
|
||||
title: "ModuleResource"
|
||||
title_tag: "foo-bar.submodule1.ModuleResource"
|
||||
meta_desc: "Documentation for the foo-bar.submodule1.ModuleResource 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 ModuleResource 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">ModuleResource</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">ModuleResourceArgs</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">ModuleResource</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="nx">thing</span><span class="p">:</span> <span class="nx">Optional[_root_inputs.TopLevelArgs]</span> = None<span class="p">)</span>
|
||||
<span class=nd>@overload</span>
|
||||
<span class="k">def </span><span class="nx">ModuleResource</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[ModuleResourceArgs]</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">NewModuleResource</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">ModuleResourceArgs</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">ModuleResource</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">ModuleResource</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">ModuleResourceArgs</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">ModuleResourceArgs</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">ModuleResourceArgs</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">ModuleResourceArgs</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">ModuleResourceArgs</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 %}}
|
||||
|
||||
## ModuleResource 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 ModuleResource resource accepts the following [input]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) properties:
|
||||
|
||||
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="thing_csharp">
|
||||
<a href="#thing_csharp" style="color: inherit; text-decoration: inherit;">Thing</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toplevel">Pulumi.<wbr>Foo<wbr>Bar.<wbr>Inputs.<wbr>Top<wbr>Level<wbr>Args</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language go %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="thing_go">
|
||||
<a href="#thing_go" style="color: inherit; text-decoration: inherit;">Thing</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toplevel">Top<wbr>Level<wbr>Args</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language nodejs %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="thing_nodejs">
|
||||
<a href="#thing_nodejs" style="color: inherit; text-decoration: inherit;">thing</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toplevel">Top<wbr>Level<wbr>Args</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
{{% choosable language python %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="thing_python">
|
||||
<a href="#thing_python" style="color: inherit; text-decoration: inherit;">thing</a>
|
||||
</span>
|
||||
<span class="property-indicator"></span>
|
||||
<span class="property-type"><a href="#toplevel">Top<wbr>Level<wbr>Args</a></span>
|
||||
</dt>
|
||||
<dd>{{% md %}}{{% /md %}}</dd></dl>
|
||||
{{% /choosable %}}
|
||||
|
||||
|
||||
### Outputs
|
||||
|
||||
All [input](#inputs) properties are implicitly available as output properties. Additionally, the ModuleResource 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 %}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Supporting Types
|
||||
|
||||
|
||||
|
||||
<h4 id="toplevel">Top<wbr>Level</h4>
|
||||
|
||||
{{% choosable language csharp %}}
|
||||
<dl class="resources-properties"><dt class="property-optional"
|
||||
title="Optional">
|
||||
<span id="buzz_csharp">
|
||||
<a href="#buzz_csharp" style="color: inherit; text-decoration: inherit;">Buzz</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-optional"
|
||||
title="Optional">
|
||||
<span id="buzz_go">
|
||||
<a href="#buzz_go" style="color: inherit; text-decoration: inherit;">Buzz</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-optional"
|
||||
title="Optional">
|
||||
<span id="buzz_nodejs">
|
||||
<a href="#buzz_nodejs" style="color: inherit; text-decoration: inherit;">buzz</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-optional"
|
||||
title="Optional">
|
||||
<span id="buzz_python">
|
||||
<a href="#buzz_python" style="color: inherit; text-decoration: inherit;">buzz</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>
|
||||
|
22
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/Inputs/TopLevelArgs.cs
vendored
Normal file
22
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/Inputs/TopLevelArgs.cs
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
// *** 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.FooBar.Inputs
|
||||
{
|
||||
|
||||
public sealed class TopLevelArgs : Pulumi.ResourceArgs
|
||||
{
|
||||
[Input("buzz")]
|
||||
public Input<string>? Buzz { get; set; }
|
||||
|
||||
public TopLevelArgs()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
24
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/Outputs/TopLevel.cs
vendored
Normal file
24
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/Outputs/TopLevel.cs
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
// *** 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.FooBar.Outputs
|
||||
{
|
||||
|
||||
[OutputType]
|
||||
public sealed class TopLevel
|
||||
{
|
||||
public readonly string? Buzz;
|
||||
|
||||
[OutputConstructor]
|
||||
private TopLevel(string? buzz)
|
||||
{
|
||||
Buzz = buzz;
|
||||
}
|
||||
}
|
||||
}
|
46
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/Provider.cs
vendored
Normal file
46
pkg/codegen/internal/test/testdata/dash-named-schema/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.FooBar
|
||||
{
|
||||
[FooBarResourceType("pulumi:providers:foo-bar")]
|
||||
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("foo-bar", 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/dash-named-schema/dotnet/Pulumi.FooBar.csproj
vendored
Normal file
52
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/Pulumi.FooBar.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/dash-named-schema/dotnet/README.md
vendored
Normal file
0
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/README.md
vendored
Normal file
70
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/Submodule1/ModuleResource.cs
vendored
Normal file
70
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/Submodule1/ModuleResource.cs
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
// *** 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.FooBar.Submodule1
|
||||
{
|
||||
[FooBarResourceType("foo-bar:submodule1:ModuleResource")]
|
||||
public partial class ModuleResource : Pulumi.CustomResource
|
||||
{
|
||||
[Output("thing")]
|
||||
public Output<Pulumi.FooBar.Outputs.TopLevel?> Thing { get; private set; } = null!;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a ModuleResource 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 ModuleResource(string name, ModuleResourceArgs? args = null, CustomResourceOptions? options = null)
|
||||
: base("foo-bar:submodule1:ModuleResource", name, args ?? new ModuleResourceArgs(), MakeResourceOptions(options, ""))
|
||||
{
|
||||
}
|
||||
|
||||
private ModuleResource(string name, Input<string> id, CustomResourceOptions? options = null)
|
||||
: base("foo-bar:submodule1:ModuleResource", 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 ModuleResource 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 ModuleResource Get(string name, Input<string> id, CustomResourceOptions? options = null)
|
||||
{
|
||||
return new ModuleResource(name, id, options);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ModuleResourceArgs : Pulumi.ResourceArgs
|
||||
{
|
||||
[Input("thing")]
|
||||
public Input<Pulumi.FooBar.Inputs.TopLevelArgs>? Thing { get; set; }
|
||||
|
||||
public ModuleResourceArgs()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
0
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/Submodule1/README.md
vendored
Normal file
0
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/Submodule1/README.md
vendored
Normal file
87
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/Utilities.cs
vendored
Normal file
87
pkg/codegen/internal/test/testdata/dash-named-schema/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.FooBar
|
||||
{
|
||||
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.FooBar.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 FooBarResourceTypeAttribute : Pulumi.ResourceTypeAttribute
|
||||
{
|
||||
public FooBarResourceTypeAttribute(string type) : base(type, Utilities.Version)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
BIN
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/logo.png
vendored
Normal file
BIN
pkg/codegen/internal/test/testdata/dash-named-schema/dotnet/logo.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
3
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/doc.go
vendored
Normal file
3
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/doc.go
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Package foo-bar exports types, functions, subpackages for provisioning foo-bar resources.
|
||||
//
|
||||
package foo
|
40
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/init.go
vendored
Normal file
40
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/init.go
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package foo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
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:foo-bar" {
|
||||
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.RegisterResourcePackage(
|
||||
"foo-bar",
|
||||
&pkg{version},
|
||||
)
|
||||
}
|
78
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/provider.go
vendored
Normal file
78
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/provider.go
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package foo
|
||||
|
||||
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:foo-bar", 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)
|
||||
}
|
||||
|
||||
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 init() {
|
||||
pulumi.RegisterOutputType(ProviderOutput{})
|
||||
}
|
149
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/pulumiTypes.go
vendored
Normal file
149
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/pulumiTypes.go
vendored
Normal file
|
@ -0,0 +1,149 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package foo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type TopLevel struct {
|
||||
Buzz *string `pulumi:"buzz"`
|
||||
}
|
||||
|
||||
// TopLevelInput is an input type that accepts TopLevelArgs and TopLevelOutput values.
|
||||
// You can construct a concrete instance of `TopLevelInput` via:
|
||||
//
|
||||
// TopLevelArgs{...}
|
||||
type TopLevelInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToTopLevelOutput() TopLevelOutput
|
||||
ToTopLevelOutputWithContext(context.Context) TopLevelOutput
|
||||
}
|
||||
|
||||
type TopLevelArgs struct {
|
||||
Buzz pulumi.StringPtrInput `pulumi:"buzz"`
|
||||
}
|
||||
|
||||
func (TopLevelArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*TopLevel)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i TopLevelArgs) ToTopLevelOutput() TopLevelOutput {
|
||||
return i.ToTopLevelOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i TopLevelArgs) ToTopLevelOutputWithContext(ctx context.Context) TopLevelOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(TopLevelOutput)
|
||||
}
|
||||
|
||||
func (i TopLevelArgs) ToTopLevelPtrOutput() TopLevelPtrOutput {
|
||||
return i.ToTopLevelPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i TopLevelArgs) ToTopLevelPtrOutputWithContext(ctx context.Context) TopLevelPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(TopLevelOutput).ToTopLevelPtrOutputWithContext(ctx)
|
||||
}
|
||||
|
||||
// TopLevelPtrInput is an input type that accepts TopLevelArgs, TopLevelPtr and TopLevelPtrOutput values.
|
||||
// You can construct a concrete instance of `TopLevelPtrInput` via:
|
||||
//
|
||||
// TopLevelArgs{...}
|
||||
//
|
||||
// or:
|
||||
//
|
||||
// nil
|
||||
type TopLevelPtrInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToTopLevelPtrOutput() TopLevelPtrOutput
|
||||
ToTopLevelPtrOutputWithContext(context.Context) TopLevelPtrOutput
|
||||
}
|
||||
|
||||
type topLevelPtrType TopLevelArgs
|
||||
|
||||
func TopLevelPtr(v *TopLevelArgs) TopLevelPtrInput {
|
||||
return (*topLevelPtrType)(v)
|
||||
}
|
||||
|
||||
func (*topLevelPtrType) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**TopLevel)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (i *topLevelPtrType) ToTopLevelPtrOutput() TopLevelPtrOutput {
|
||||
return i.ToTopLevelPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *topLevelPtrType) ToTopLevelPtrOutputWithContext(ctx context.Context) TopLevelPtrOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(TopLevelPtrOutput)
|
||||
}
|
||||
|
||||
type TopLevelOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (TopLevelOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*TopLevel)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o TopLevelOutput) ToTopLevelOutput() TopLevelOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o TopLevelOutput) ToTopLevelOutputWithContext(ctx context.Context) TopLevelOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o TopLevelOutput) ToTopLevelPtrOutput() TopLevelPtrOutput {
|
||||
return o.ToTopLevelPtrOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (o TopLevelOutput) ToTopLevelPtrOutputWithContext(ctx context.Context) TopLevelPtrOutput {
|
||||
return o.ApplyTWithContext(ctx, func(_ context.Context, v TopLevel) *TopLevel {
|
||||
return &v
|
||||
}).(TopLevelPtrOutput)
|
||||
}
|
||||
|
||||
func (o TopLevelOutput) Buzz() pulumi.StringPtrOutput {
|
||||
return o.ApplyT(func(v TopLevel) *string { return v.Buzz }).(pulumi.StringPtrOutput)
|
||||
}
|
||||
|
||||
type TopLevelPtrOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (TopLevelPtrOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((**TopLevel)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (o TopLevelPtrOutput) ToTopLevelPtrOutput() TopLevelPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o TopLevelPtrOutput) ToTopLevelPtrOutputWithContext(ctx context.Context) TopLevelPtrOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o TopLevelPtrOutput) Elem() TopLevelOutput {
|
||||
return o.ApplyT(func(v *TopLevel) TopLevel {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
var ret TopLevel
|
||||
return ret
|
||||
}).(TopLevelOutput)
|
||||
}
|
||||
|
||||
func (o TopLevelPtrOutput) Buzz() pulumi.StringPtrOutput {
|
||||
return o.ApplyT(func(v *TopLevel) *string {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
return v.Buzz
|
||||
}).(pulumi.StringPtrOutput)
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterOutputType(TopLevelOutput{})
|
||||
pulumi.RegisterOutputType(TopLevelPtrOutput{})
|
||||
}
|
77
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/pulumiUtilities.go
vendored
Normal file
77
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/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 foo
|
||||
|
||||
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-foo-bar/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)
|
||||
}
|
44
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/submodule1/init.go
vendored
Normal file
44
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/submodule1/init.go
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package submodule1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/pulumi/pulumi/pkg/v3/codegen/internal/test/testdata/dash-named-schema/go/foo"
|
||||
"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 "foo-bar:submodule1:ModuleResource":
|
||||
r = &ModuleResource{}
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown resource type: %s", typ)
|
||||
}
|
||||
|
||||
err = ctx.RegisterResource(typ, name, nil, r, pulumi.URN_(urn))
|
||||
return
|
||||
}
|
||||
|
||||
func init() {
|
||||
version, err := foo.PkgVersion()
|
||||
if err != nil {
|
||||
fmt.Printf("failed to determine package version. defaulting to v1: %v\n", err)
|
||||
}
|
||||
pulumi.RegisterResourceModule(
|
||||
"foo-bar",
|
||||
"submodule1",
|
||||
&module{version},
|
||||
)
|
||||
}
|
106
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/submodule1/moduleResource.go
vendored
Normal file
106
pkg/codegen/internal/test/testdata/dash-named-schema/go/foo/submodule1/moduleResource.go
vendored
Normal file
|
@ -0,0 +1,106 @@
|
|||
// *** WARNING: this file was generated by test. ***
|
||||
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
package submodule1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/pulumi/pulumi/pkg/v3/codegen/internal/test/testdata/dash-named-schema/go/foo"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
type ModuleResource struct {
|
||||
pulumi.CustomResourceState
|
||||
|
||||
Thing foo.TopLevelPtrOutput `pulumi:"thing"`
|
||||
}
|
||||
|
||||
// NewModuleResource registers a new resource with the given unique name, arguments, and options.
|
||||
func NewModuleResource(ctx *pulumi.Context,
|
||||
name string, args *ModuleResourceArgs, opts ...pulumi.ResourceOption) (*ModuleResource, error) {
|
||||
if args == nil {
|
||||
args = &ModuleResourceArgs{}
|
||||
}
|
||||
|
||||
var resource ModuleResource
|
||||
err := ctx.RegisterResource("foo-bar:submodule1:ModuleResource", name, args, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// GetModuleResource gets an existing ModuleResource 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 GetModuleResource(ctx *pulumi.Context,
|
||||
name string, id pulumi.IDInput, state *ModuleResourceState, opts ...pulumi.ResourceOption) (*ModuleResource, error) {
|
||||
var resource ModuleResource
|
||||
err := ctx.ReadResource("foo-bar:submodule1:ModuleResource", name, id, state, &resource, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resource, nil
|
||||
}
|
||||
|
||||
// Input properties used for looking up and filtering ModuleResource resources.
|
||||
type moduleResourceState struct {
|
||||
}
|
||||
|
||||
type ModuleResourceState struct {
|
||||
}
|
||||
|
||||
func (ModuleResourceState) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*moduleResourceState)(nil)).Elem()
|
||||
}
|
||||
|
||||
type moduleResourceArgs struct {
|
||||
Thing *foo.TopLevel `pulumi:"thing"`
|
||||
}
|
||||
|
||||
// The set of arguments for constructing a ModuleResource resource.
|
||||
type ModuleResourceArgs struct {
|
||||
Thing foo.TopLevelPtrInput
|
||||
}
|
||||
|
||||
func (ModuleResourceArgs) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*moduleResourceArgs)(nil)).Elem()
|
||||
}
|
||||
|
||||
type ModuleResourceInput interface {
|
||||
pulumi.Input
|
||||
|
||||
ToModuleResourceOutput() ModuleResourceOutput
|
||||
ToModuleResourceOutputWithContext(ctx context.Context) ModuleResourceOutput
|
||||
}
|
||||
|
||||
func (*ModuleResource) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*ModuleResource)(nil))
|
||||
}
|
||||
|
||||
func (i *ModuleResource) ToModuleResourceOutput() ModuleResourceOutput {
|
||||
return i.ToModuleResourceOutputWithContext(context.Background())
|
||||
}
|
||||
|
||||
func (i *ModuleResource) ToModuleResourceOutputWithContext(ctx context.Context) ModuleResourceOutput {
|
||||
return pulumi.ToOutputWithContext(ctx, i).(ModuleResourceOutput)
|
||||
}
|
||||
|
||||
type ModuleResourceOutput struct{ *pulumi.OutputState }
|
||||
|
||||
func (ModuleResourceOutput) ElementType() reflect.Type {
|
||||
return reflect.TypeOf((*ModuleResource)(nil))
|
||||
}
|
||||
|
||||
func (o ModuleResourceOutput) ToModuleResourceOutput() ModuleResourceOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o ModuleResourceOutput) ToModuleResourceOutputWithContext(ctx context.Context) ModuleResourceOutput {
|
||||
return o
|
||||
}
|
||||
|
||||
func init() {
|
||||
pulumi.RegisterOutputType(ModuleResourceOutput{})
|
||||
}
|
0
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/README.md
vendored
Normal file
0
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/README.md
vendored
Normal file
29
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/index.ts
vendored
Normal file
29
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/index.ts
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
// *** 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 "./provider";
|
||||
|
||||
// Export sub-modules:
|
||||
import * as submodule1 from "./submodule1";
|
||||
import * as types from "./types";
|
||||
|
||||
export {
|
||||
submodule1,
|
||||
types,
|
||||
};
|
||||
|
||||
import { Provider } from "./provider";
|
||||
|
||||
pulumi.runtime.registerResourcePackage("foo-bar", {
|
||||
version: utilities.getVersion(),
|
||||
constructProvider: (name: string, type: string, urn: string): pulumi.ProviderResource => {
|
||||
if (type !== "pulumi:providers:foo-bar") {
|
||||
throw new Error(`unknown provider type ${type}`);
|
||||
}
|
||||
return new Provider(name, <any>undefined, { urn });
|
||||
},
|
||||
});
|
16
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/package.json
vendored
Normal file
16
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/package.json
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "@pulumi/foo-bar",
|
||||
"version": "${VERSION}",
|
||||
"scripts": {
|
||||
"build": "tsc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@pulumi/pulumi": "latest"
|
||||
},
|
||||
"pulumi": {
|
||||
"resource": true
|
||||
}
|
||||
}
|
46
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/provider.ts
vendored
Normal file
46
pkg/codegen/internal/test/testdata/dash-named-schema/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 = 'foo-bar';
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
}
|
24
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/submodule1/index.ts
vendored
Normal file
24
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/submodule1/index.ts
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
// *** 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 "./moduleResource";
|
||||
|
||||
// Import resources to register:
|
||||
import { ModuleResource } from "./moduleResource";
|
||||
|
||||
const _module = {
|
||||
version: utilities.getVersion(),
|
||||
construct: (name: string, type: string, urn: string): pulumi.Resource => {
|
||||
switch (type) {
|
||||
case "foo-bar:submodule1:ModuleResource":
|
||||
return new ModuleResource(name, <any>undefined, { urn })
|
||||
default:
|
||||
throw new Error(`unknown resource type ${type}`);
|
||||
}
|
||||
},
|
||||
};
|
||||
pulumi.runtime.registerResourceModule("foo-bar", "submodule1", _module)
|
64
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/submodule1/moduleResource.ts
vendored
Normal file
64
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/submodule1/moduleResource.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 { input as inputs, output as outputs } from "../types";
|
||||
import * as utilities from "../utilities";
|
||||
|
||||
export class ModuleResource extends pulumi.CustomResource {
|
||||
/**
|
||||
* Get an existing ModuleResource 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): ModuleResource {
|
||||
return new ModuleResource(name, undefined as any, { ...opts, id: id });
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
public static readonly __pulumiType = 'foo-bar:submodule1:ModuleResource';
|
||||
|
||||
/**
|
||||
* Returns true if the given object is an instance of ModuleResource. 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 ModuleResource {
|
||||
if (obj === undefined || obj === null) {
|
||||
return false;
|
||||
}
|
||||
return obj['__pulumiType'] === ModuleResource.__pulumiType;
|
||||
}
|
||||
|
||||
public readonly thing!: pulumi.Output<outputs.TopLevel | undefined>;
|
||||
|
||||
/**
|
||||
* Create a ModuleResource 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?: ModuleResourceArgs, opts?: pulumi.CustomResourceOptions) {
|
||||
let inputs: pulumi.Inputs = {};
|
||||
opts = opts || {};
|
||||
if (!opts.id) {
|
||||
inputs["thing"] = args ? args.thing : undefined;
|
||||
} else {
|
||||
inputs["thing"] = undefined /*out*/;
|
||||
}
|
||||
if (!opts.version) {
|
||||
opts = pulumi.mergeOptions(opts, { version: utilities.getVersion()});
|
||||
}
|
||||
super(ModuleResource.__pulumiType, name, inputs, opts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The set of arguments for constructing a ModuleResource resource.
|
||||
*/
|
||||
export interface ModuleResourceArgs {
|
||||
thing?: pulumi.Input<inputs.TopLevelArgs>;
|
||||
}
|
25
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/tsconfig.json
vendored
Normal file
25
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/tsconfig.json
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "bin",
|
||||
"target": "es2016",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"stripInternal": true,
|
||||
"experimentalDecorators": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true
|
||||
},
|
||||
"files": [
|
||||
"index.ts",
|
||||
"provider.ts",
|
||||
"submodule1/index.ts",
|
||||
"submodule1/moduleResource.ts",
|
||||
"types/index.ts",
|
||||
"types/input.ts",
|
||||
"types/output.ts",
|
||||
"utilities.ts"
|
||||
]
|
||||
}
|
11
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/types/index.ts
vendored
Normal file
11
pkg/codegen/internal/test/testdata/dash-named-schema/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,
|
||||
};
|
9
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/types/input.ts
vendored
Normal file
9
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/types/input.ts
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
// *** 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";
|
||||
|
||||
export interface TopLevelArgs {
|
||||
buzz?: pulumi.Input<string>;
|
||||
}
|
10
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/types/output.ts
vendored
Normal file
10
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/types/output.ts
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
// *** 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";
|
||||
|
||||
export interface TopLevel {
|
||||
buzz?: string;
|
||||
}
|
||||
|
49
pkg/codegen/internal/test/testdata/dash-named-schema/nodejs/utilities.ts
vendored
Normal file
49
pkg/codegen/internal/test/testdata/dash-named-schema/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/dash-named-schema/python/pulumi_foo_bar/README.md
vendored
Normal file
0
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/README.md
vendored
Normal file
42
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/__init__.py
vendored
Normal file
42
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/__init__.py
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
# 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 .provider import *
|
||||
from ._inputs import *
|
||||
from . import outputs
|
||||
|
||||
# Make subpackages available:
|
||||
if typing.TYPE_CHECKING:
|
||||
import pulumi_foo_bar.submodule1 as __submodule1
|
||||
submodule1 = __submodule1
|
||||
else:
|
||||
submodule1 = _utilities.lazy_import('pulumi_foo_bar.submodule1')
|
||||
|
||||
_utilities.register(
|
||||
resource_modules="""
|
||||
[
|
||||
{
|
||||
"pkg": "foo-bar",
|
||||
"mod": "submodule1",
|
||||
"fqn": "pulumi_foo_bar.submodule1",
|
||||
"classes": {
|
||||
"foo-bar:submodule1:ModuleResource": "ModuleResource"
|
||||
}
|
||||
}
|
||||
]
|
||||
""",
|
||||
resource_packages="""
|
||||
[
|
||||
{
|
||||
"pkg": "foo-bar",
|
||||
"token": "pulumi:providers:foo-bar",
|
||||
"fqn": "pulumi_foo_bar",
|
||||
"class": "Provider"
|
||||
}
|
||||
]
|
||||
"""
|
||||
)
|
31
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/_inputs.py
vendored
Normal file
31
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/_inputs.py
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
# 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__ = [
|
||||
'TopLevelArgs',
|
||||
]
|
||||
|
||||
@pulumi.input_type
|
||||
class TopLevelArgs:
|
||||
def __init__(__self__, *,
|
||||
buzz: Optional[pulumi.Input[str]] = None):
|
||||
if buzz is not None:
|
||||
pulumi.set(__self__, "buzz", buzz)
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def buzz(self) -> Optional[pulumi.Input[str]]:
|
||||
return pulumi.get(self, "buzz")
|
||||
|
||||
@buzz.setter
|
||||
def buzz(self, value: Optional[pulumi.Input[str]]):
|
||||
pulumi.set(self, "buzz", value)
|
||||
|
||||
|
211
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/_utilities.py
vendored
Normal file
211
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/_utilities.py
vendored
Normal file
|
@ -0,0 +1,211 @@
|
|||
# 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 json
|
||||
import os
|
||||
import sys
|
||||
import importlib.util
|
||||
import pkg_resources
|
||||
|
||||
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))
|
27
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/outputs.py
vendored
Normal file
27
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/outputs.py
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
# 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__ = [
|
||||
'TopLevel',
|
||||
]
|
||||
|
||||
@pulumi.output_type
|
||||
class TopLevel(dict):
|
||||
def __init__(__self__, *,
|
||||
buzz: Optional[str] = None):
|
||||
if buzz is not None:
|
||||
pulumi.set(__self__, "buzz", buzz)
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def buzz(self) -> Optional[str]:
|
||||
return pulumi.get(self, "buzz")
|
||||
|
||||
|
73
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/provider.py
vendored
Normal file
73
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/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 Foo-bar 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 Foo-bar 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__(
|
||||
'foo-bar',
|
||||
resource_name,
|
||||
__props__,
|
||||
opts)
|
||||
|
0
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/py.typed
vendored
Normal file
0
pkg/codegen/internal/test/testdata/dash-named-schema/python/pulumi_foo_bar/py.typed
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
# 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 .module_resource import *
|
|
@ -0,0 +1,113 @@
|
|||
# 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 _inputs as _root_inputs
|
||||
from .. import outputs as _root_outputs
|
||||
|
||||
__all__ = ['ModuleResourceArgs', 'ModuleResource']
|
||||
|
||||
@pulumi.input_type
|
||||
class ModuleResourceArgs:
|
||||
def __init__(__self__, *,
|
||||
thing: Optional[pulumi.Input['_root_inputs.TopLevelArgs']] = None):
|
||||
"""
|
||||
The set of arguments for constructing a ModuleResource resource.
|
||||
"""
|
||||
if thing is not None:
|
||||
pulumi.set(__self__, "thing", thing)
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def thing(self) -> Optional[pulumi.Input['_root_inputs.TopLevelArgs']]:
|
||||
return pulumi.get(self, "thing")
|
||||
|
||||
@thing.setter
|
||||
def thing(self, value: Optional[pulumi.Input['_root_inputs.TopLevelArgs']]):
|
||||
pulumi.set(self, "thing", value)
|
||||
|
||||
|
||||
class ModuleResource(pulumi.CustomResource):
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
thing: Optional[pulumi.Input[pulumi.InputType['_root_inputs.TopLevelArgs']]] = None,
|
||||
__props__=None):
|
||||
"""
|
||||
Create a ModuleResource 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[ModuleResourceArgs] = None,
|
||||
opts: Optional[pulumi.ResourceOptions] = None):
|
||||
"""
|
||||
Create a ModuleResource resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param ModuleResourceArgs 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(ModuleResourceArgs, 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,
|
||||
thing: Optional[pulumi.Input[pulumi.InputType['_root_inputs.TopLevelArgs']]] = 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__ = ModuleResourceArgs.__new__(ModuleResourceArgs)
|
||||
|
||||
__props__.__dict__["thing"] = thing
|
||||
super(ModuleResource, __self__).__init__(
|
||||
'foo-bar:submodule1:ModuleResource',
|
||||
resource_name,
|
||||
__props__,
|
||||
opts)
|
||||
|
||||
@staticmethod
|
||||
def get(resource_name: str,
|
||||
id: pulumi.Input[str],
|
||||
opts: Optional[pulumi.ResourceOptions] = None) -> 'ModuleResource':
|
||||
"""
|
||||
Get an existing ModuleResource 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__ = ModuleResourceArgs.__new__(ModuleResourceArgs)
|
||||
|
||||
__props__.__dict__["thing"] = None
|
||||
return ModuleResource(resource_name, opts=opts, __props__=__props__)
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def thing(self) -> pulumi.Output[Optional['_root_outputs.TopLevel']]:
|
||||
return pulumi.get(self, "thing")
|
||||
|
58
pkg/codegen/internal/test/testdata/dash-named-schema/python/setup.py
vendored
Normal file
58
pkg/codegen/internal/test/testdata/dash-named-schema/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', 'foo-bar', PLUGIN_VERSION])
|
||||
except OSError as error:
|
||||
if error.errno == errno.ENOENT:
|
||||
print(f"""
|
||||
There was an error installing the foo-bar 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 foo-bar {PLUGIN_VERSION}`
|
||||
""")
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def readme():
|
||||
try:
|
||||
with open('README.md', encoding='utf-8') as f:
|
||||
return f.read()
|
||||
except FileNotFoundError:
|
||||
return "foo-bar Pulumi Package - Development Version"
|
||||
|
||||
|
||||
setup(name='pulumi_foo_bar',
|
||||
version=VERSION,
|
||||
long_description=readme(),
|
||||
long_description_content_type='text/markdown',
|
||||
cmdclass={
|
||||
'install': InstallPluginCommand,
|
||||
},
|
||||
packages=find_packages(),
|
||||
package_data={
|
||||
'pulumi_foo_bar': [
|
||||
'py.typed',
|
||||
]
|
||||
},
|
||||
install_requires=[
|
||||
'parver>=0.2.1',
|
||||
'pulumi',
|
||||
'semver>=2.8.1'
|
||||
],
|
||||
zip_safe=False)
|
46
pkg/codegen/internal/test/testdata/dash-named-schema/schema.json
vendored
Normal file
46
pkg/codegen/internal/test/testdata/dash-named-schema/schema.json
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"version": "0.0.1",
|
||||
"name": "foo-bar",
|
||||
"types": {
|
||||
"foo-bar:index:TopLevel": {
|
||||
"properties": {
|
||||
"buzz": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"inputProperties": {
|
||||
"buzz": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"foo-bar:submodule1:ModuleResource": {
|
||||
"properties": {
|
||||
"thing": {
|
||||
"$ref": "#/types/foo-bar:index:TopLevel"
|
||||
}
|
||||
},
|
||||
"inputProperties": {
|
||||
"thing": {
|
||||
"$ref": "#/types/foo-bar:index:TopLevel"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"language": {
|
||||
"csharp": {
|
||||
"namespaces": {
|
||||
"foo-bar": "FooBar"
|
||||
}
|
||||
},
|
||||
"go": {
|
||||
"importBasePath": "github.com/pulumi/pulumi/pkg/v3/codegen/internal/test/testdata/dash-named-schema/go/foo"
|
||||
},
|
||||
"nodejs": {},
|
||||
"python": {}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue