Compare commits

..

8 commits

Author SHA1 Message Date
Pat Gavlin b45c31043b Use pulumictl cover merge instead of covmerge
Depends on https://github.com/pulumi/pulumictl/pull/42.
2021-11-24 11:15:38 -08:00
Pat Gavlin d2825522f2 [github] Enable code coverage collection.
- Set the `PULUMI_TEST_COVERAGE_PATH` environment variable during tests
- Use the codecov action to upload coverage data at the end of each leg
2021-11-24 11:00:03 -08:00
Pat Gavlin 9d233c0140 [coverage] Add a tool to merge Go coverage data.
Merging coverage data makes it easier to consume via the existing Go
tools and makes for a smaller upload to coverage reporters like
codecov.io.
2021-11-24 10:59:06 -08:00
Pat Gavlin 008ac014d4 [testing/dotnet] Support gathering coverage data.
Use the `coverlet` collector to gather and report coverage data.
Coverage is only gathered and reported if the
`PULUMI_TEST_COVERAGE_PATH` environment variable is set.
2021-11-24 10:59:05 -08:00
Pat Gavlin 96746ddeab [testing/python] Support gathering coverage data.
Use the `coverage` tool during tests to gather code coverage data and
conditionally write the results under PULUMI_TEST_COVERAGE_PATH.
2021-11-24 10:58:46 -08:00
Pat Gavlin 960a044abc [testing/nodejs] Support gathering coverage data.
- Update istanbul and mocha to their most recent versions. The istanbul
  CLI has been replaced by the nyc CLI. This is required in order to
  exclude tests from test sets and to exclude certain files (closure
  cases) from instrumentation.
- Add support for gathering and reporting coverage data under the
  `PULUMI_TEST_COVERAGE_PATH` environment variable.
2021-11-24 10:58:46 -08:00
Pat Gavlin c72bd3568a [testing] Support gathering coverage data.
- Add infrastructure for running integration tests using a
  coverage-instrumented CLI.
- Add infrastructure for running Go tests with code coverage enabled.

All coverage profiles are emitted into a single directory. Coverage is
enabled if the `PULUMI_TEST_COVERAGE_PATH` environment variable set.
2021-11-24 10:58:46 -08:00
Pat Gavlin 6ffea35ddc [cli] Support gathering code coverage data.
Add support for gathering code coverage data from a special build of
the Pulumi CLI. This build takes advantage of `go test` and `TestMain`
to build a coverage-instrumented binary.
2021-11-24 10:58:45 -08:00
65 changed files with 242 additions and 1848 deletions

View file

@ -31,7 +31,7 @@ jobs:
language: ["nodejs", "python", "dotnet"]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}
@ -86,7 +86,7 @@ jobs:
go-version: [1.17.x]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout Repo
@ -149,7 +149,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}
@ -218,8 +218,11 @@ jobs:
- name: Set PULUMI_TEST_SUBSET env var
run: |
echo "PULUMI_TEST_SUBSET=${{ matrix.test-subset }}" >> $GITHUB_ENV
- name: Enable code coverage
run: |
echo "PULUMI_TEST_COVERAGE_PATH=$(pwd)/coverage" >> $GITHUB_ENV
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}
@ -285,6 +288,17 @@ jobs:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Merge Go coverage data
run: |
pulumictl cover merge -in ./coverage -out ./coverage/go-all.txt
rm ./coverage/*.cov
- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
directory: coverage
files: '*'
fail_ci_if_error: true
verbose: true
windows-build:
name: Windows Build + Test + Publish
strategy:
@ -314,7 +328,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}

View file

@ -31,7 +31,7 @@ jobs:
language: ["nodejs", "python", "dotnet"]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}
@ -85,7 +85,7 @@ jobs:
go-version: [1.17.x]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout Repo
@ -132,7 +132,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}
@ -196,7 +196,7 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}
@ -291,7 +291,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}

View file

@ -123,7 +123,7 @@ jobs:
language: ["nodejs", "python", "dotnet"]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}
@ -177,7 +177,7 @@ jobs:
go-version: [1.17.x]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout Repo
@ -225,7 +225,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}
@ -295,7 +295,7 @@ jobs:
run: |
echo "PULUMI_TEST_SUBSET=${{ matrix.test-subset }}" >> $GITHUB_ENV
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}
@ -397,7 +397,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}

View file

@ -71,7 +71,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}
@ -159,8 +159,11 @@ jobs:
- name: Set PULUMI_TEST_SUBSET env var
run: |
echo "PULUMI_TEST_SUBSET=${{ matrix.test-subset }}" >> $GITHUB_ENV
- name: Enable code coverage
run: |
echo "PULUMI_TEST_COVERAGE_PATH=$(pwd)/coverage" >> $GITHUB_ENV
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}
@ -236,6 +239,17 @@ jobs:
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
- name: Merge Go coverage data
run: |
pulumictl cover merge -in ./coverage -out ./coverage/go-all.txt
rm ./coverage/*.cov
- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
directory: coverage
files: '*'
fail_ci_if_error: true
verbose: true
- name: Summarize Test Time by Package
run: |
mkdir -p test-results
@ -270,7 +284,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python ${{ matrix.python-version }}

View file

@ -40,7 +40,7 @@ jobs:
fail-fast: false
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: Install Node.js

1
.gitignore vendored
View file

@ -10,6 +10,7 @@
coverage.cov
*.coverprofile
**/obj/
coverage/
**/.idea/
*.iml

View file

@ -31,18 +31,31 @@ generate::
$(call STEP_MESSAGE)
echo "This command does not do anything anymore. It will be removed in a future version."
ifeq ($(PULUMI_TEST_COVERAGE_PATH),)
build::
cd pkg && go install -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
install::
cd pkg && GOBIN=$(PULUMI_BIN) go install -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
else
build:: build_cover
mkdir -p $(PULUMI_TEST_COVERAGE_PATH)
install:: install_cover
endif
build_debug::
cd pkg && go install -gcflags="all=-N -l" -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
build_cover::
cd pkg && go test -coverpkg github.com/pulumi/pulumi/pkg/v3/...,github.com/pulumi/pulumi/sdk/v3/... -cover -c -o $(shell go env GOPATH)/bin/pulumi -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
install_cover:: build_cover
cp $(shell go env GOPATH)/bin/pulumi $(PULUMI_BIN)
developer_docs::
cd developer-docs && make html
install::
cd pkg && GOBIN=$(PULUMI_BIN) go install -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
install_all:: install
dist:: build

View file

@ -0,0 +1,81 @@
package main
import (
"flag"
"fmt"
"io"
"os"
"path"
"testing"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
"github.com/spf13/pflag"
)
type noTestDeps int
func (noTestDeps) ImportPath() string { return "" }
func (noTestDeps) MatchString(pat, str string) (bool, error) { return false, nil }
func (noTestDeps) SetPanicOnExit0(bool) {}
func (noTestDeps) StartCPUProfile(io.Writer) error { return nil }
func (noTestDeps) StopCPUProfile() {}
func (noTestDeps) StartTestLog(io.Writer) {}
func (noTestDeps) StopTestLog() error { return nil }
func (noTestDeps) WriteProfileTo(string, io.Writer, int) error { return nil }
// flushProfiles flushes test profiles to disk.
func flushProfiles() {
// Redirect Stdout/err temporarily so the testing code doesn't output the
// regular:
// PASS
// coverage: 21.4% of statements
oldstdout, oldstderr := os.Stdout, os.Stderr
defer func() {
os.Stdout, os.Stderr = oldstdout, oldstderr
}()
os.Stdout, _ = os.Open(os.DevNull)
os.Stderr, _ = os.Open(os.DevNull)
cmdLine := flag.CommandLine
defer func() { flag.CommandLine = cmdLine }()
flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
err := flag.CommandLine.Parse(nil)
contract.IgnoreError(err)
m := testing.MainStart(noTestDeps(0), nil, nil, nil)
m.Run()
}
func addGoFlag(pf *pflag.FlagSet, f *flag.Flag) {
if pf.Lookup(f.Name) != nil || len(f.Name) == 1 && pf.ShorthandLookup(f.Name) != nil {
return
}
pf.AddGoFlag(f)
}
func TestMain(m *testing.M) {
// If the binary is invoked as `pulumi`, we are being asked to run the coverage-instrumented program. Otherwise,
// we are running tests as usual.
if path.Base(os.Args[0]) != "pulumi" {
flag.Parse()
os.Exit(m.Run())
}
defer panicHandler()
// Copy the test flags into the Pulumi command's flags.
cmd := NewPulumiCmd()
flag.CommandLine.VisitAll(func(f *flag.Flag) {
addGoFlag(cmd.PersistentFlags(), f)
})
// Now, execute the Pulumi command and dump coverage data if requested.
err := cmd.Execute()
flushProfiles()
if err != nil {
_, err = fmt.Fprintf(os.Stderr, "An error occurred: %v\n", err)
contract.IgnoreError(err)
os.Exit(1)
}
}

View file

@ -3110,10 +3110,8 @@ func generatePackageContextMap(tool string, pkg *schema.Package, goInfo GoPackag
pkg.functions = append(pkg.functions, f)
name := tokenToName(f.Token)
if pkg.names.Has(name) ||
pkg.names.Has(name+"Args") ||
pkg.names.Has(name+"Result") {
originalName := name
if pkg.names.Has(name) {
switch {
case strings.HasPrefix(name, "New"):
name = "Create" + name[3:]
@ -3126,9 +3124,15 @@ func generatePackageContextMap(tool string, pkg *schema.Package, goInfo GoPackag
if f.Inputs != nil {
pkg.names.Add(name + "Args")
if originalName != name {
pkg.renamed[originalName+"Args"] = name + "Args"
}
}
if f.Outputs != nil {
pkg.names.Add(name + "Result")
if originalName != name {
pkg.renamed[originalName+"Result"] = name + "Result"
}
}
}

View file

@ -203,11 +203,6 @@ var sdkTests = []sdkTest{
Skip: codegen.NewStringSet("python/test", "nodejs/test"),
SkipCompileCheck: codegen.NewStringSet(dotnet),
},
{
Directory: "regress-8403",
Description: "Regress pulumi/pulumi#8403",
SkipCompileCheck: codegen.NewStringSet(dotnet, python, nodejs),
},
}
var genSDKOnly bool

View file

@ -1,33 +0,0 @@
---
title: "MongoDB Atlas"
title_tag: "mongodbatlas.MongoDB Atlas"
meta_desc: ""
layout: api
no_edit_this_page: true
---
<!-- WARNING: this file was generated by test. -->
<!-- Do not edit by hand unless you're certain you know what you are doing! -->
<h2 id="resources">Resources</h2>
<ul class="api">
<li><a href="provider" title="Provider"><span class="api-symbol api-symbol--resource"></span>Provider</a></li>
</ul>
<h2 id="functions">Functions</h2>
<ul class="api">
<li><a href="getcustomdbroles" title="GetCustomDbRoles"><span class="api-symbol api-symbol--function"></span>GetCustomDbRoles</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>

View file

@ -1,7 +0,0 @@
{
"emittedFiles": [
"_index.md",
"getcustomdbroles/_index.md",
"provider/_index.md"
]
}

View file

@ -1,144 +0,0 @@
---
title: "getCustomDbRoles"
title_tag: "mongodbatlas.getCustomDbRoles"
meta_desc: "Documentation for the mongodbatlas.getCustomDbRoles function with examples, input properties, output properties, and supporting types."
layout: api
no_edit_this_page: true
---
<!-- WARNING: this file was generated by test. -->
<!-- Do not edit by hand unless you're certain you know what you are doing! -->
## Using getCustomDbRoles {#using}
{{< 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">function </span>getCustomDbRoles<span class="p">(</span><span class="nx">args</span><span class="p">:</span> <span class="nx">GetCustomDbRolesArgs</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/#InvokeOptions">InvokeOptions</a></span><span class="p">): Promise&lt;<span class="nx"><a href="#result">GetCustomDbRolesResult</a></span>></span
></code></pre></div>
{{% /choosable %}}
{{% choosable language python %}}
<div class="highlight"><pre class="chroma"><code class="language-python" data-lang="python"
><span class="k">def </span>get_custom_db_roles<span class="p">(</span><span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.InvokeOptions">Optional[InvokeOptions]</a></span> = None<span class="p">) -&gt;</span> <span>GetCustomDbRolesResult</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>LookupCustomDbRoles<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">args</span><span class="p"> *</span><span class="nx">LookupCustomDbRolesArgs</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#InvokeOption">InvokeOption</a></span><span class="p">) (*<span class="nx"><a href="#result">LookupCustomDbRolesResult</a></span>, error)</span
></code></pre></div>
&gt; Note: This function is named `LookupCustomDbRoles` in the Go SDK.
{{% /choosable %}}
{{% choosable language csharp %}}
<div class="highlight"><pre class="chroma"><code class="language-csharp" data-lang="csharp"><span class="k">public static class </span><span class="nx">GetCustomDbRoles </span><span class="p">
{</span><span class="k">
public static </span>Task&lt;<span class="nx"><a href="#result">GetCustomDbRolesResult</a></span>> <span class="p">InvokeAsync(</span><span class="nx">GetCustomDbRolesArgs</span><span class="p"> </span><span class="nx">args<span class="p">,</span> <span class="nx"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.InvokeOptions.html">InvokeOptions</a></span><span class="p">? </span><span class="nx">opts = null<span class="p">)</span><span class="p">
}</span></code></pre></div>
{{% /choosable %}}
The following arguments are supported:
{{% 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 %}}
## getCustomDbRoles Result {#result}
The following output properties are available:
{{% choosable language csharp %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="result_csharp">
<a href="#result_csharp" style="color: inherit; text-decoration: inherit;">Result</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#getcustomdbrolesresult">Get<wbr>Custom<wbr>Db<wbr>Roles<wbr>Result</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language go %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="result_go">
<a href="#result_go" style="color: inherit; text-decoration: inherit;">Result</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#getcustomdbrolesresult">Get<wbr>Custom<wbr>Db<wbr>Roles<wbr>Result</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language nodejs %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="result_nodejs">
<a href="#result_nodejs" style="color: inherit; text-decoration: inherit;">result</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#getcustomdbrolesresult">Get<wbr>Custom<wbr>Db<wbr>Roles<wbr>Result</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language python %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="result_python">
<a href="#result_python" style="color: inherit; text-decoration: inherit;">result</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#getcustomdbrolesresult">Get<wbr>Custom<wbr>Db<wbr>Roles<wbr>Result</a></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>

View file

@ -1,241 +0,0 @@
---
title: "Provider"
title_tag: "mongodbatlas.Provider"
meta_desc: "Documentation for the mongodbatlas.Provider resource with examples, input properties, output properties, lookup functions, and supporting types."
layout: api
no_edit_this_page: true
---
<!-- 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&#39;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&#39;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&#39;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&#39;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>

View file

@ -1,38 +0,0 @@
// *** 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.Mongodbatlas
{
public static class GetCustomDbRoles
{
public static Task<GetCustomDbRolesResult> InvokeAsync(GetCustomDbRolesArgs? args = null, InvokeOptions? options = null)
=> Pulumi.Deployment.Instance.InvokeAsync<GetCustomDbRolesResult>("mongodbatlas::getCustomDbRoles", args ?? new GetCustomDbRolesArgs(), options.WithVersion());
}
public sealed class GetCustomDbRolesArgs : Pulumi.InvokeArgs
{
public GetCustomDbRolesArgs()
{
}
}
[OutputType]
public sealed class GetCustomDbRolesResult
{
public readonly Outputs.GetCustomDbRolesResult? Result;
[OutputConstructor]
private GetCustomDbRolesResult(Outputs.GetCustomDbRolesResult? result)
{
Result = result;
}
}
}

View file

@ -1,21 +0,0 @@
// *** 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.Mongodbatlas.Outputs
{
[OutputType]
public sealed class GetCustomDbRolesResult
{
[OutputConstructor]
private GetCustomDbRolesResult()
{
}
}
}

View file

@ -1,46 +0,0 @@
// *** 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.Mongodbatlas
{
[MongodbatlasResourceType("pulumi:providers:mongodbatlas")]
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("mongodbatlas", 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()
{
}
}
}

View file

@ -1,55 +0,0 @@
<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>
</ItemGroup>
<ItemGroup>
<None Include="logo.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>

View file

@ -1,87 +0,0 @@
// *** 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.Mongodbatlas
{
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.Mongodbatlas.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 MongodbatlasResourceTypeAttribute : Pulumi.ResourceTypeAttribute
{
public MongodbatlasResourceTypeAttribute(string type) : base(type, Utilities.Version)
{
}
}
}

View file

@ -1,11 +0,0 @@
{
"emittedFiles": [
"GetCustomDbRoles.cs",
"Outputs/GetCustomDbRolesResult.cs",
"Provider.cs",
"Pulumi.Mongodbatlas.csproj",
"README.md",
"Utilities.cs",
"logo.png"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

View file

@ -1,10 +0,0 @@
{
"emittedFiles": [
"mongodbatlas/doc.go",
"mongodbatlas/getCustomDbRoles.go",
"mongodbatlas/init.go",
"mongodbatlas/provider.go",
"mongodbatlas/pulumiTypes.go",
"mongodbatlas/pulumiUtilities.go"
]
}

View file

@ -1,3 +0,0 @@
// Package mongodbatlas exports types, functions, subpackages for provisioning mongodbatlas resources.
//
package mongodbatlas

View file

@ -1,24 +0,0 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package mongodbatlas
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupCustomDbRoles(ctx *pulumi.Context, args *LookupCustomDbRolesArgs, opts ...pulumi.InvokeOption) (*LookupCustomDbRolesResult, error) {
var rv LookupCustomDbRolesResult
err := ctx.Invoke("mongodbatlas::getCustomDbRoles", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type LookupCustomDbRolesArgs struct {
}
type LookupCustomDbRolesResult struct {
Result *GetCustomDbRolesResult `pulumi:"result"`
}

View file

@ -1,40 +0,0 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package mongodbatlas
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:mongodbatlas" {
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(
"mongodbatlas",
&pkg{version},
)
}

View file

@ -1,79 +0,0 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package mongodbatlas
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:mongodbatlas", 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)).Elem()
}
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)).Elem()
}
func (o ProviderOutput) ToProviderOutput() ProviderOutput {
return o
}
func (o ProviderOutput) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
return o
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ProviderInput)(nil)).Elem(), &Provider{})
pulumi.RegisterOutputType(ProviderOutput{})
}

View file

@ -1,136 +0,0 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package mongodbatlas
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type GetCustomDbRolesResult struct {
}
// GetCustomDbRolesResultInput is an input type that accepts GetCustomDbRolesResultArgs and GetCustomDbRolesResultOutput values.
// You can construct a concrete instance of `GetCustomDbRolesResultInput` via:
//
// GetCustomDbRolesResultArgs{...}
type GetCustomDbRolesResultInput interface {
pulumi.Input
ToGetCustomDbRolesResultOutput() GetCustomDbRolesResultOutput
ToGetCustomDbRolesResultOutputWithContext(context.Context) GetCustomDbRolesResultOutput
}
type GetCustomDbRolesResultArgs struct {
}
func (GetCustomDbRolesResultArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetCustomDbRolesResult)(nil)).Elem()
}
func (i GetCustomDbRolesResultArgs) ToGetCustomDbRolesResultOutput() GetCustomDbRolesResultOutput {
return i.ToGetCustomDbRolesResultOutputWithContext(context.Background())
}
func (i GetCustomDbRolesResultArgs) ToGetCustomDbRolesResultOutputWithContext(ctx context.Context) GetCustomDbRolesResultOutput {
return pulumi.ToOutputWithContext(ctx, i).(GetCustomDbRolesResultOutput)
}
func (i GetCustomDbRolesResultArgs) ToGetCustomDbRolesResultPtrOutput() GetCustomDbRolesResultPtrOutput {
return i.ToGetCustomDbRolesResultPtrOutputWithContext(context.Background())
}
func (i GetCustomDbRolesResultArgs) ToGetCustomDbRolesResultPtrOutputWithContext(ctx context.Context) GetCustomDbRolesResultPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(GetCustomDbRolesResultOutput).ToGetCustomDbRolesResultPtrOutputWithContext(ctx)
}
// GetCustomDbRolesResultPtrInput is an input type that accepts GetCustomDbRolesResultArgs, GetCustomDbRolesResultPtr and GetCustomDbRolesResultPtrOutput values.
// You can construct a concrete instance of `GetCustomDbRolesResultPtrInput` via:
//
// GetCustomDbRolesResultArgs{...}
//
// or:
//
// nil
type GetCustomDbRolesResultPtrInput interface {
pulumi.Input
ToGetCustomDbRolesResultPtrOutput() GetCustomDbRolesResultPtrOutput
ToGetCustomDbRolesResultPtrOutputWithContext(context.Context) GetCustomDbRolesResultPtrOutput
}
type getCustomDbRolesResultPtrType GetCustomDbRolesResultArgs
func GetCustomDbRolesResultPtr(v *GetCustomDbRolesResultArgs) GetCustomDbRolesResultPtrInput {
return (*getCustomDbRolesResultPtrType)(v)
}
func (*getCustomDbRolesResultPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**GetCustomDbRolesResult)(nil)).Elem()
}
func (i *getCustomDbRolesResultPtrType) ToGetCustomDbRolesResultPtrOutput() GetCustomDbRolesResultPtrOutput {
return i.ToGetCustomDbRolesResultPtrOutputWithContext(context.Background())
}
func (i *getCustomDbRolesResultPtrType) ToGetCustomDbRolesResultPtrOutputWithContext(ctx context.Context) GetCustomDbRolesResultPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(GetCustomDbRolesResultPtrOutput)
}
type GetCustomDbRolesResultOutput struct{ *pulumi.OutputState }
func (GetCustomDbRolesResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetCustomDbRolesResult)(nil)).Elem()
}
func (o GetCustomDbRolesResultOutput) ToGetCustomDbRolesResultOutput() GetCustomDbRolesResultOutput {
return o
}
func (o GetCustomDbRolesResultOutput) ToGetCustomDbRolesResultOutputWithContext(ctx context.Context) GetCustomDbRolesResultOutput {
return o
}
func (o GetCustomDbRolesResultOutput) ToGetCustomDbRolesResultPtrOutput() GetCustomDbRolesResultPtrOutput {
return o.ToGetCustomDbRolesResultPtrOutputWithContext(context.Background())
}
func (o GetCustomDbRolesResultOutput) ToGetCustomDbRolesResultPtrOutputWithContext(ctx context.Context) GetCustomDbRolesResultPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v GetCustomDbRolesResult) *GetCustomDbRolesResult {
return &v
}).(GetCustomDbRolesResultPtrOutput)
}
type GetCustomDbRolesResultPtrOutput struct{ *pulumi.OutputState }
func (GetCustomDbRolesResultPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**GetCustomDbRolesResult)(nil)).Elem()
}
func (o GetCustomDbRolesResultPtrOutput) ToGetCustomDbRolesResultPtrOutput() GetCustomDbRolesResultPtrOutput {
return o
}
func (o GetCustomDbRolesResultPtrOutput) ToGetCustomDbRolesResultPtrOutputWithContext(ctx context.Context) GetCustomDbRolesResultPtrOutput {
return o
}
func (o GetCustomDbRolesResultPtrOutput) Elem() GetCustomDbRolesResultOutput {
return o.ApplyT(func(v *GetCustomDbRolesResult) GetCustomDbRolesResult {
if v != nil {
return *v
}
var ret GetCustomDbRolesResult
return ret
}).(GetCustomDbRolesResultOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*GetCustomDbRolesResultInput)(nil)).Elem(), GetCustomDbRolesResultArgs{})
pulumi.RegisterInputType(reflect.TypeOf((*GetCustomDbRolesResultPtrInput)(nil)).Elem(), GetCustomDbRolesResultArgs{})
pulumi.RegisterOutputType(GetCustomDbRolesResultOutput{})
pulumi.RegisterOutputType(GetCustomDbRolesResultPtrOutput{})
}

View file

@ -1,85 +0,0 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package mongodbatlas
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-mongodbatlas/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)
}
// isZero is a null safe check for if a value is it's types zero value.
func isZero(v interface{}) bool {
if v == nil {
return true
}
return reflect.ValueOf(v).IsZero()
}

View file

@ -1,14 +0,0 @@
{
"emittedFiles": [
"README.md",
"getCustomDbRoles.ts",
"index.ts",
"package.json",
"provider.ts",
"tsconfig.json",
"types/index.ts",
"types/input.ts",
"types/output.ts",
"utilities.ts"
]
}

View file

@ -1,26 +0,0 @@
// *** 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 function getCustomDbRoles(args?: GetCustomDbRolesArgs, opts?: pulumi.InvokeOptions): Promise<GetCustomDbRolesResult> {
args = args || {};
if (!opts) {
opts = {}
}
if (!opts.version) {
opts.version = utilities.getVersion();
}
return pulumi.runtime.invoke("mongodbatlas::getCustomDbRoles", {
}, opts);
}
export interface GetCustomDbRolesArgs {
}
export interface GetCustomDbRolesResult {
readonly result?: outputs.GetCustomDbRolesResult;
}

View file

@ -1,28 +0,0 @@
// *** 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 "./getCustomDbRoles";
export * from "./provider";
// Export sub-modules:
import * as types from "./types";
export {
types,
};
import { Provider } from "./provider";
pulumi.runtime.registerResourcePackage("mongodbatlas", {
version: utilities.getVersion(),
constructProvider: (name: string, type: string, urn: string): pulumi.ProviderResource => {
if (type !== "pulumi:providers:mongodbatlas") {
throw new Error(`unknown provider type ${type}`);
}
return new Provider(name, <any>undefined, { urn });
},
});

View file

@ -1,16 +0,0 @@
{
"name": "@pulumi/mongodbatlas",
"version": "${VERSION}",
"scripts": {
"build": "tsc"
},
"devDependencies": {
"typescript": "^4.3.5"
},
"peerDependencies": {
"@pulumi/pulumi": "latest"
},
"pulumi": {
"resource": true
}
}

View file

@ -1,46 +0,0 @@
// *** 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 = 'mongodbatlas';
/**
* 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 resourceInputs: pulumi.Inputs = {};
opts = opts || {};
{
}
if (!opts.version) {
opts = pulumi.mergeOptions(opts, { version: utilities.getVersion()});
}
super(Provider.__pulumiType, name, resourceInputs, opts);
}
}
/**
* The set of arguments for constructing a Provider resource.
*/
export interface ProviderArgs {
}

View file

@ -1,24 +0,0 @@
{
"compilerOptions": {
"outDir": "bin",
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"stripInternal": true,
"experimentalDecorators": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"strict": true
},
"files": [
"getCustomDbRoles.ts",
"index.ts",
"provider.ts",
"types/index.ts",
"types/input.ts",
"types/output.ts",
"utilities.ts"
]
}

View file

@ -1,11 +0,0 @@
// *** 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,
};

View file

@ -1,6 +0,0 @@
// *** 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";

View file

@ -1,9 +0,0 @@
// *** 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 GetCustomDbRolesResult {
}

View file

@ -1,49 +0,0 @@
// *** 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;
}

View file

@ -1,12 +0,0 @@
{
"emittedFiles": [
"pulumi_mongodbatlas/README.md",
"pulumi_mongodbatlas/__init__.py",
"pulumi_mongodbatlas/_utilities.py",
"pulumi_mongodbatlas/get_custom_db_roles.py",
"pulumi_mongodbatlas/outputs.py",
"pulumi_mongodbatlas/provider.py",
"pulumi_mongodbatlas/py.typed",
"setup.py"
]
}

View file

@ -1,25 +0,0 @@
# 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 .get_custom_db_roles import *
from .provider import *
from . import outputs
_utilities.register(
resource_modules="""
[]
""",
resource_packages="""
[
{
"pkg": "mongodbatlas",
"token": "pulumi:providers:mongodbatlas",
"fqn": "pulumi_mongodbatlas",
"class": "Provider"
}
]
"""
)

View file

@ -1,236 +0,0 @@
# coding=utf-8
# *** WARNING: this file was generated by test. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import importlib.util
import inspect
import json
import os
import pkg_resources
import sys
import typing
import pulumi
import pulumi.runtime
from semver import VersionInfo as SemverVersion
from parver import Version as PEP440Version
def get_env(*args):
for v in args:
value = os.getenv(v)
if value is not None:
return value
return None
def get_env_bool(*args):
str = get_env(*args)
if str is not None:
# NOTE: these values are taken from https://golang.org/src/strconv/atob.go?s=351:391#L1, which is what
# Terraform uses internally when parsing boolean values.
if str in ["1", "t", "T", "true", "TRUE", "True"]:
return True
if str in ["0", "f", "F", "false", "FALSE", "False"]:
return False
return None
def get_env_int(*args):
str = get_env(*args)
if str is not None:
try:
return int(str)
except:
return None
return None
def get_env_float(*args):
str = get_env(*args)
if str is not None:
try:
return float(str)
except:
return None
return None
def _get_semver_version():
# __name__ is set to the fully-qualified name of the current module, In our case, it will be
# <some module>._utilities. <some module> is the module we want to query the version for.
root_package, *rest = __name__.split('.')
# pkg_resources uses setuptools to inspect the set of installed packages. We use it here to ask
# for the currently installed version of the root package (i.e. us) and get its version.
# Unfortunately, PEP440 and semver differ slightly in incompatible ways. The Pulumi engine expects
# to receive a valid semver string when receiving requests from the language host, so it's our
# responsibility as the library to convert our own PEP440 version into a valid semver string.
pep440_version_string = pkg_resources.require(root_package)[0].version
pep440_version = PEP440Version.parse(pep440_version_string)
(major, minor, patch) = pep440_version.release
prerelease = None
if pep440_version.pre_tag == 'a':
prerelease = f"alpha.{pep440_version.pre}"
elif pep440_version.pre_tag == 'b':
prerelease = f"beta.{pep440_version.pre}"
elif pep440_version.pre_tag == 'rc':
prerelease = f"rc.{pep440_version.pre}"
elif pep440_version.dev is not None:
prerelease = f"dev.{pep440_version.dev}"
# The only significant difference between PEP440 and semver as it pertains to us is that PEP440 has explicit support
# for dev builds, while semver encodes them as "prerelease" versions. In order to bridge between the two, we convert
# our dev build version into a prerelease tag. This matches what all of our other packages do when constructing
# their own semver string.
return SemverVersion(major=major, minor=minor, patch=patch, prerelease=prerelease)
# Determine the version once and cache the value, which measurably improves program performance.
_version = _get_semver_version()
_version_str = str(_version)
def get_version():
return _version_str
def get_resource_args_opts(resource_args_type, resource_options_type, *args, **kwargs):
"""
Return the resource args and options given the *args and **kwargs of a resource's
__init__ method.
"""
resource_args, opts = None, None
# If the first item is the resource args type, save it and remove it from the args list.
if args and isinstance(args[0], resource_args_type):
resource_args, args = args[0], args[1:]
# Now look at the first item in the args list again.
# If the first item is the resource options class, save it.
if args and isinstance(args[0], resource_options_type):
opts = args[0]
# If resource_args is None, see if "args" is in kwargs, and, if so, if it's typed as the
# the resource args type.
if resource_args is None:
a = kwargs.get("args")
if isinstance(a, resource_args_type):
resource_args = a
# If opts is None, look it up in kwargs.
if opts is None:
opts = kwargs.get("opts")
return resource_args, opts
# Temporary: just use pulumi._utils.lazy_import once everyone upgrades.
def lazy_import(fullname):
import pulumi._utils as u
f = getattr(u, 'lazy_import', None)
if f is None:
f = _lazy_import_temp
return f(fullname)
# Copied from pulumi._utils.lazy_import, see comments there.
def _lazy_import_temp(fullname):
m = sys.modules.get(fullname, None)
if m is not None:
return m
spec = importlib.util.find_spec(fullname)
m = sys.modules.get(fullname, None)
if m is not None:
return m
loader = importlib.util.LazyLoader(spec.loader)
spec.loader = loader
module = importlib.util.module_from_spec(spec)
m = sys.modules.get(fullname, None)
if m is not None:
return m
sys.modules[fullname] = module
loader.exec_module(module)
return module
class Package(pulumi.runtime.ResourcePackage):
def __init__(self, pkg_info):
super().__init__()
self.pkg_info = pkg_info
def version(self):
return _version
def construct_provider(self, name: str, typ: str, urn: str) -> pulumi.ProviderResource:
if typ != self.pkg_info['token']:
raise Exception(f"unknown provider type {typ}")
Provider = getattr(lazy_import(self.pkg_info['fqn']), self.pkg_info['class'])
return Provider(name, pulumi.ResourceOptions(urn=urn))
class Module(pulumi.runtime.ResourceModule):
def __init__(self, mod_info):
super().__init__()
self.mod_info = mod_info
def version(self):
return _version
def construct(self, name: str, typ: str, urn: str) -> pulumi.Resource:
class_name = self.mod_info['classes'].get(typ, None)
if class_name is None:
raise Exception(f"unknown resource type {typ}")
TheClass = getattr(lazy_import(self.mod_info['fqn']), class_name)
return TheClass(name, pulumi.ResourceOptions(urn=urn))
def register(resource_modules, resource_packages):
resource_modules = json.loads(resource_modules)
resource_packages = json.loads(resource_packages)
for pkg_info in resource_packages:
pulumi.runtime.register_resource_package(pkg_info['pkg'], Package(pkg_info))
for mod_info in resource_modules:
pulumi.runtime.register_resource_module(
mod_info['pkg'],
mod_info['mod'],
Module(mod_info))
_F = typing.TypeVar('_F', bound=typing.Callable[..., typing.Any])
def lift_output_func(func: typing.Any) -> typing.Callable[[_F], _F]:
"""Decorator internally used on {fn}_output lifted function versions
to implement them automatically from the un-lifted function."""
func_sig = inspect.signature(func)
def lifted_func(*args, opts=None, **kwargs):
bound_args = func_sig.bind(*args, **kwargs)
# Convert tuple to list, see pulumi/pulumi#8172
args_list = list(bound_args.args)
return pulumi.Output.from_input({
'args': args_list,
'kwargs': bound_args.kwargs
}).apply(lambda resolved_args: func(*resolved_args['args'],
opts=opts,
**resolved_args['kwargs']))
return (lambda _: lifted_func)

View file

@ -1,52 +0,0 @@
# coding=utf-8
# *** WARNING: this file was generated by test. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from . import outputs
__all__ = [
'GetCustomDbRolesResult',
'AwaitableGetCustomDbRolesResult',
'get_custom_db_roles',
]
@pulumi.output_type
class GetCustomDbRolesResult:
def __init__(__self__, result=None):
if result and not isinstance(result, dict):
raise TypeError("Expected argument 'result' to be a dict")
pulumi.set(__self__, "result", result)
@property
@pulumi.getter
def result(self) -> Optional['outputs.GetCustomDbRolesResult']:
return pulumi.get(self, "result")
class AwaitableGetCustomDbRolesResult(GetCustomDbRolesResult):
# pylint: disable=using-constant-test
def __await__(self):
if False:
yield self
return GetCustomDbRolesResult(
result=self.result)
def get_custom_db_roles(opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetCustomDbRolesResult:
"""
Use this data source to access information about an existing resource.
"""
__args__ = dict()
if opts is None:
opts = pulumi.InvokeOptions()
if opts.version is None:
opts.version = _utilities.get_version()
__ret__ = pulumi.runtime.invoke('mongodbatlas::getCustomDbRoles', __args__, opts=opts, typ=GetCustomDbRolesResult).value
return AwaitableGetCustomDbRolesResult(
result=__ret__.result)

View file

@ -1,20 +0,0 @@
# 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__ = [
'GetCustomDbRolesResult',
]
@pulumi.output_type
class GetCustomDbRolesResult(dict):
def __init__(__self__):
pass

View file

@ -1,73 +0,0 @@
# 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 Mongodbatlas 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 Mongodbatlas 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__(
'mongodbatlas',
resource_name,
__props__,
opts)

View file

@ -1,58 +0,0 @@
# 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', 'mongodbatlas', PLUGIN_VERSION])
except OSError as error:
if error.errno == errno.ENOENT:
print(f"""
There was an error installing the mongodbatlas 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 mongodbatlas {PLUGIN_VERSION}`
""")
else:
raise
def readme():
try:
with open('README.md', encoding='utf-8') as f:
return f.read()
except FileNotFoundError:
return "mongodbatlas Pulumi Package - Development Version"
setup(name='pulumi_mongodbatlas',
version=VERSION,
long_description=readme(),
long_description_content_type='text/markdown',
cmdclass={
'install': InstallPluginCommand,
},
packages=find_packages(),
package_data={
'pulumi_mongodbatlas': [
'py.typed',
]
},
install_requires=[
'parver>=0.2.1',
'pulumi',
'semver>=2.8.1'
],
zip_safe=False)

View file

@ -1,22 +0,0 @@
{
"version": "0.0.1",
"name": "mongodbatlas",
"types": {
"mongodbatlas::getCustomDbRolesResult": {
"type": "object"
}
},
"functions": {
"mongodbatlas::getCustomDbRoles": {
"inputs": {},
"outputs": {
"type": "object",
"properties": {
"result": {
"$ref": "#/types/mongodbatlas::getCustomDbRolesResult"
}
}
}
}
}
}

View file

@ -159,7 +159,7 @@ func TestSingleResourceDiffUnavailable(t *testing.T) {
for _, e := range events {
if e.Type == DiagEvent {
p := e.Payload().(DiagEventPayload)
if p.URN == resURN && p.Severity == diag.Warning && p.Message == "<{%reset%}>diff unavailable<{%reset%}>\n" {
if p.URN == resURN && p.Severity == diag.Warning && p.Message == "diff unavailable" {
found = true
break
}

View file

@ -96,12 +96,12 @@ func (op TestOp) RunWithContext(
_, res := op(info, ctx, opts, dryRun)
contract.IgnoreClose(journal)
if validate != nil {
res = validate(project, target, journal.Entries(), firedEvents, res)
}
if dryRun {
return nil, res
}
if validate != nil {
res = validate(project, target, journal.Entries(), firedEvents, res)
}
snap := journal.Snap(target.Snapshot)
if res == nil && snap != nil {
@ -210,8 +210,7 @@ func (p *TestPlan) Run(t *testing.T, snapshot *deploy.Snapshot) *deploy.Snapshot
if !step.SkipPreview {
previewSnap := CloneSnapshot(t, snap)
previewTarget := p.GetTarget(previewSnap)
// Don't run validate on the preview step
_, res := step.Op.Run(project, previewTarget, p.Options, true, p.BackendClient, nil)
_, res := step.Op.Run(project, previewTarget, p.Options, true, p.BackendClient, step.Validate)
if step.ExpectFailure {
assertIsErrorOrBailResult(t, res)
continue

View file

@ -43,6 +43,7 @@ require (
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.3
github.com/stretchr/testify v1.6.1
github.com/tklauser/go-sysconf v0.3.8 // indirect
github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7
@ -54,6 +55,7 @@ require (
golang.org/x/net v0.0.0-20210505214959-0714010a04ed
golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/tools v0.1.0
google.golang.org/api v0.46.0
google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2
google.golang.org/grpc v1.37.0

View file

@ -228,6 +228,12 @@ type ProgramTestOptions struct {
// file.
Tracing string
// If non-empty, specifies the value of the `--test.coverprofile` flag to pass to the Pulumi CLI. As with the
// Tracing field, the `{command}` template will expand to the current command name.
//
// If PULUMI_TEST_COVERAGE_PATH is set, this defaults to $PULUMI_TEST_COVERAGE_PATH/{command}-[random suffix].out
CoverProfile string
// NoParallel will opt the test out of being ran in parallel.
NoParallel bool
@ -447,6 +453,9 @@ func (opts ProgramTestOptions) With(overrides ProgramTestOptions) ProgramTestOpt
if overrides.Tracing != "" {
opts.Tracing = overrides.Tracing
}
if overrides.CoverProfile != "" {
opts.CoverProfile = overrides.CoverProfile
}
if overrides.NoParallel {
opts.NoParallel = overrides.NoParallel
}
@ -606,6 +615,16 @@ func prepareProgram(t *testing.T, opts *ProgramTestOptions) {
if opts.Tracing == "" {
opts.Tracing = os.Getenv("PULUMI_TEST_TRACE_ENDPOINT")
}
if opts.CoverProfile == "" {
if cov := os.Getenv("PULUMI_TEST_COVERAGE_PATH"); cov != "" {
var b [4]byte
if _, err := cryptorand.Read(b[:]); err != nil {
t.Errorf("could not read random bytes: %v", err)
}
opts.CoverProfile = filepath.Join(cov, "{command}-"+hex.EncodeToString(b[:])+".cov")
}
}
}
// ProgramTest runs a lifecycle of Pulumi commands in a program working directory, using the `pulumi` and `yarn`
@ -746,6 +765,9 @@ func (pt *ProgramTester) pulumiCmd(name string, args []string) ([]string, error)
if tracing := pt.opts.Tracing; tracing != "" {
cmd = append(cmd, "--tracing", strings.ReplaceAll(tracing, "{command}", name))
}
if cov := pt.opts.CoverProfile; cov != "" {
cmd = append(cmd, "--test.coverprofile", strings.ReplaceAll(cov, "{command}", name))
}
return cmd, nil
}

View file

@ -44,7 +44,13 @@ if not packages:
sys.exit(0)
options_and_packages = options(options_and_packages) + packages
options = options(options_and_packages)
cov = os.environ.get('PULUMI_TEST_COVERAGE_PATH', None)
if cov is not None:
options = options + [f'-coverprofile={cov}/go-test-{os.urandom(4).hex()}.cov', '-coverpkg=github.com/pulumi/pulumi/pkg/v3/...,github.com/pulumi/pulumi/sdk/v3/...']
options_and_packages = options + packages
if shutil.which('gotestsum') is not None:

View file

@ -18,6 +18,12 @@ ensure::
# We want to dotnet restore all projects on startup so that omnisharp doesn't complain about lots of missing types on startup.
dotnet restore dotnet.sln
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
TEST_COVERAGE_ARGS := /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(PULUMI_TEST_COVERAGE_PATH)
else
TEST_COVERAGE_ARGS := /p:CollectCoverage=false /p:CoverletOutput=$(PULUMI_TEST_COVERAGE_PATH)
endif
build::
# From the nuget docs:
#
@ -45,11 +51,11 @@ install:: build install_plugin
dotnet_test:: $(TEST_ALL_DEPS)
# include the version prefix/suffix to avoid generating a separate nupkg file
$(RUN_TESTSUITE) dotnet-test dotnet test --no-build --filter --filter FullyQualifiedName\\!~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
$(RUN_TESTSUITE) dotnet-test dotnet test --no-build --filter FullyQualifiedName\!~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION} ${TEST_COVERAGE_ARGS}/dotnet.xml
auto_test:: $(TEST_ALL_DEPS)
# include the version prefix/suffix to avoid generating a separate nupkg file
$(RUN_TESTSUITE) auto-dotnet dotnet test --no-build --filter --filter FullyQualifiedName~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
$(RUN_TESTSUITE) auto-dotnet dotnet test --no-build --filter FullyQualifiedName~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION} ${TEST_COVERAGE_ARGS}/dotnet-auto.xml
test_fast:: dotnet_test
$(GO_TEST_FAST) ${PROJECT_PKGS}

View file

@ -7,6 +7,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="xunit" Version="2.4.1" />

View file

@ -63,6 +63,13 @@ func Flush() {
glog.Flush()
}
func maybeSetFlag(name, value string) {
if f := flag.Lookup(name); f != nil {
err := f.Value.Set(value)
assertNoError(err)
}
}
// InitLogging ensures the logging library has been initialized with the given settings.
func InitLogging(logToStderr bool, verbose int, logFlow bool) {
// Remember the settings in case someone inquires.
@ -78,12 +85,10 @@ func InitLogging(logToStderr bool, verbose int, logFlow bool) {
assertNoError(err)
}
if logToStderr {
err := flag.Lookup("logtostderr").Value.Set("true")
assertNoError(err)
maybeSetFlag("logtostderr", "true")
}
if verbose > 0 {
err := flag.Lookup("v").Value.Set(strconv.Itoa(verbose))
assertNoError(err)
maybeSetFlag("v", strconv.Itoa(verbose))
}
}

View file

@ -4,3 +4,4 @@
/node_modules/
/custom_node/
/runtime/native/node_dev/
.nyc_output/

View file

@ -46,25 +46,28 @@ install_plugin:: build
install:: install_package install_plugin
istanbul_tests:: $(TEST_ALL_DEPS)
$(RUN_TESTSUITE) istanbul ./node_modules/.bin/istanbul test --print none _mocha -- --timeout 120000 --exclude 'bin/tests/automation/**/*.spec.js' 'bin/tests/**/*.spec.js'
./node_modules/.bin/istanbul report text-summary
./node_modules/.bin/istanbul report text
$(RUN_TESTSUITE) istanbul-with-mocks ./node_modules/.bin/istanbul test --print none _mocha -- 'bin/tests_with_mocks/**/*.spec.js'
unit_tests:: $(TEST_ALL_DEPS)
$(RUN_TESTSUITE) unit-nodejs ./node_modules/.bin/nyc -x 'bin/tests/runtime/*ClosureCases*.js' -s mocha --timeout 120000 --exclude 'bin/tests/automation/**/*.spec.js' --exclude 'bin/tests/runtime/closureLoader.spec.js' 'bin/tests/**/*.spec.js'
$(RUN_TESTSUITE) unit-nodejs mocha --timeout 120000 'bin/tests/runtime/closureLoader.spec.js'
$(RUN_TESTSUITE) unit-with-mocks-nodejs ./node_modules/.bin/nyc -s mocha 'bin/tests_with_mocks/**/*.spec.js'
auto_tests:: $(TEST_ALL_DEPS)
$(RUN_TESTSUITE) auto-nodejs ./node_modules/.bin/istanbul test --print none _mocha -- --timeout 120000 'bin/tests/automation/**/*.spec.js'
./node_modules/.bin/istanbul report text-summary
./node_modules/.bin/istanbul report text
$(RUN_TESTSUITE) auto-nodejs ./node_modules/.bin/nyc -s mocha --timeout 120000 'bin/tests/automation/**/*.spec.js'
sxs_tests:: $(TEST_ALL_DEPS)
pushd tests/sxs_ts_3.6 && yarn ; tsc ; popd
pushd tests/sxs_ts_latest && yarn ; tsc ; popd
test_fast:: sxs_tests istanbul_tests
test_fast:: sxs_tests unit_tests
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
if [ -e .nyc_output ]; then ./node_modules/.bin/nyc report -r cobertura --report-dir $(PULUMI_TEST_COVERAGE_PATH); fi
endif
$(GO_TEST_FAST) ${PROJECT_PKGS}
test_all:: sxs_tests istanbul_tests auto_tests
test_all:: sxs_tests unit_tests auto_tests
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
if [ -e .nyc_output ]; then ./node_modules/.bin/nyc report -r cobertura --report-dir $(PULUMI_TEST_COVERAGE_PATH); fi
endif
$(GO_TEST) ${PROJECT_PKGS}
dist:: build

View file

@ -39,13 +39,16 @@
"eslint": "^7.32.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.23.4",
"istanbul": "^0.4.5",
"mocha": "^3.5.0"
"nyc": "^15.1.0",
"mocha": "^9.0.0"
},
"pulumi": {
"comment": "Do not remove. Marks this as as a deployment-time-only package"
},
"engines": {
"node": ">=8.13.0 || >=10.10.0"
},
"mocha": {
"require": ["ts-node/register", "source-map-support/register"]
}
}

View file

@ -6,7 +6,7 @@
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"sourceMap": false,
"sourceMap": true,
"stripInternal": true,
"experimentalDecorators": true,
"pretty": true,

View file

@ -4,3 +4,4 @@
/env/
/*.egg-info
.venv/
.coverage

View file

@ -50,14 +50,20 @@ test_fast:: $(TEST_ALL_DEPS)
$(GO_TEST) ${PROJECT_PKGS}
pipenv install -e ./env/src
# TODO the ignored test seems to fail in pytest but not unittest. Need to trackdown why
$(RUN_TESTSUITE) python/lib/test pipenv run pytest lib/test --ignore lib/test/automation --ignore lib/test/langhost/resource_thens/test_resource_thens.py
$(RUN_TESTSUITE) python/lib/test/langhost/resource_thens pipenv run python -m unittest lib/test/langhost/resource_thens/test_resource_thens.py
$(RUN_TESTSUITE) python/lib/test pipenv run coverage run -m pytest lib/test --ignore lib/test/automation --ignore lib/test/langhost/resource_thens/test_resource_thens.py
$(RUN_TESTSUITE) python/lib/test/langhost/resource_thens pipenv run coverage run -m unittest lib/test/langhost/resource_thens/test_resource_thens.py
# Using python -m also adds lib/test_with_mocks to sys.path which avoids package resolution issues.
pushd lib/test_with_mocks; $(RUN_TESTSUITE) python/lib/test_with_mocks pipenv run python -m pytest; popd
pushd lib/test_with_mocks; $(RUN_TESTSUITE) python/lib/test_with_mocks pipenv run coverage run -m pytest; popd
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
if [ -e .coverage ]; then pipenv run coverage xml -o $(PULUMI_TEST_COVERAGE_PATH)/python-fast.xml; fi
endif
test_auto:: test_fast $(TEST_ALL_DEPS)
# Note that this target depends on test-fast for the call to `pipenv run pip install`
$(RUN_TESTSUITE) auto-python pipenv run pytest lib/test/automation
$(RUN_TESTSUITE) auto-python pipenv run coverage run -m pytest lib/test/automation
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
if [ -e .coverage ]; then pipenv run coverage xml -o $(PULUMI_TEST_COVERAGE_PATH)/python-auto.xml; fi
endif
test_all:: test_fast test_auto

View file

@ -21,3 +21,4 @@ types-six = "*"
types-pyyaml = "*"
types-protobuf = "*"
pytest-asyncio = "*"
coverage = ">=6.0.2"