[codegen/go] Call site defaults for Pulumi Object types (#8411)

* Add test case

* Fix tests

* Add test dependencies correctly

* Feed through error handling

* Include test output

* Get types to line up

* Add remaining test files

* Update changelog

* Correctly find type paths

* Handle transitive objects

* Handle required fields

* Add feature flag for go

* Add required+default test case

* Don't `<any>` cast known types.

* Add more flags.

I realize this should really wait for PR#8400 to merge.

* Add plain object to env-helper test

This test fails right now. My next problem is fixing it.

* Handle plain types

* Handle function inputs

* Fix the indentation

* Handle output types correctly

* Remove unnecessary `!`

* Add test case

* Fix tests

* Add test dependencies correctly

* Feed through error handling

* Include test output

* Get types to line up

* Add remaining test files

* Update changelog

* Correctly find type paths

* Handle transitive objects

* Handle required fields

* Add required+default test case

* Don't `<any>` cast known types.

* Add plain object to env-helper test

This test fails right now. My next problem is fixing it.

* Handle plain types

* Handle function inputs

* Fix the indentation

* Handle output types correctly

* Remove unnecessary `!`

* Start on `genPlainObjectDefaultFunc`

* Add missing change to fix test

* Run tests with merge

* Refactor out assign

* Merge in next _index.md diff

* Change method name to `Defaults`

* Handle enums correctly

* Another attempt at _index.md

* Make module generation deterministic

* Add checks for old values

* Insert defaults in resources

* Fix docs generation

Credit to @praneetloke

* Progress on adding defaults to Resource arguments

* Handle resource argument defaults

* Don't create defaults if disableObjectDefaults

* Rename test folder

* Add test for disable flag

* Fix disable test

* Update docs

* Abstract out nil comparisons

* Use reflection to test for empty values

* Simplify Ptr and pulumi.Any type handling

* Remove unused function

* Apply defaults to functions

* Update new test with master codegen

* Tests + nil check
This commit is contained in:
Ian Wahbe 2021-11-23 15:10:15 -08:00 committed by GitHub
parent 6cb801cf17
commit 4b7985384c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
187 changed files with 8111 additions and 132 deletions

View File

@ -8,3 +8,5 @@
### Bug Fixes
- [codegen/go] - Respect default values in Pulumi object types.
[#8411](https://github.com/pulumi/pulumi/pull/8400)

View File

@ -114,6 +114,9 @@ type pkgContext struct {
// Determines if we should emit type registration code
disableInputTypeRegistrations bool
// Determines if we should emit object defaults code
disableObjectDefaults bool
}
func (pkg *pkgContext) detailsForType(t schema.Type) *typeDetails {
@ -269,6 +272,7 @@ func rawResourceName(r *schema.Resource) string {
return tokenToName(r.Token)
}
// If `nil` is a valid value of type `t`.
func isNilType(t schema.Type) bool {
switch t := t.(type) {
case *schema.OptionalType, *schema.ArrayType, *schema.MapType, *schema.ResourceType, *schema.InputType:
@ -295,23 +299,6 @@ func isNilType(t schema.Type) bool {
return false
}
// The default value for a Pulumi primitive type.
func primitiveNilValue(t schema.Type) string {
contract.Assert(schema.IsPrimitiveType(t))
switch t {
case schema.BoolType:
return "false"
case schema.IntType:
return "0"
case schema.NumberType:
return "0.0"
case schema.StringType:
return "\"\""
default:
return "nil"
}
}
func (pkg *pkgContext) inputType(t schema.Type) (result string) {
switch t := codegen.SimplifyInputUnion(t).(type) {
case *schema.OptionalType:
@ -513,7 +500,12 @@ func (pkg *pkgContext) typeStringImpl(t schema.Type, argsType bool) string {
}
func (pkg *pkgContext) typeString(t schema.Type) string {
return pkg.typeStringImpl(t, false)
s := pkg.typeStringImpl(t, false)
if s == "pulumi." {
return "pulumi.Any"
}
return s
}
func (pkg *pkgContext) isExternalReference(t schema.Type) bool {
@ -633,6 +625,9 @@ func (pkg *pkgContext) outputType(t schema.Type) string {
}
// TODO(pdg): union types
return "pulumi.AnyOutput"
case *schema.InputType:
// We can't make output types for input types. We instead strip the input and try again.
return pkg.outputType(t.ElementType)
default:
switch t {
case schema.BoolType:
@ -1096,6 +1091,27 @@ func (pkg *pkgContext) genEnumInputFuncs(w io.Writer, typeName string, enum *sch
fmt.Fprintln(w)
}
func (pkg *pkgContext) assignProperty(w io.Writer, p *schema.Property, object, value string, indirectAssign bool) {
t := strings.TrimSuffix(pkg.typeString(p.Type), "Input")
switch codegen.UnwrapType(p.Type).(type) {
case *schema.EnumType:
t = ""
}
if codegen.IsNOptionalInput(p.Type) {
if t != "" {
value = fmt.Sprintf("%s(%s)", t, value)
}
fmt.Fprintf(w, "\targs.%s = %s\n", Title(p.Name), value)
} else if indirectAssign {
tmpName := camel(p.Name) + "_"
fmt.Fprintf(w, "%s := %s\n", tmpName, value)
fmt.Fprintf(w, "%s.%s = &%s\n", object, Title(p.Name), tmpName)
} else {
fmt.Fprintf(w, "%s.%s = %s\n", object, Title(p.Name), value)
}
}
func (pkg *pkgContext) genPlainType(w io.Writer, name, comment, deprecationMessage string,
properties []*schema.Property) {
@ -1108,6 +1124,66 @@ func (pkg *pkgContext) genPlainType(w io.Writer, name, comment, deprecationMessa
fmt.Fprintf(w, "}\n\n")
}
func (pkg *pkgContext) genPlainObjectDefaultFunc(w io.Writer, name string,
properties []*schema.Property) error {
defaults := []*schema.Property{}
for _, p := range properties {
if p.DefaultValue != nil || codegen.IsProvideDefaultsFuncRequired(p.Type) {
defaults = append(defaults, p)
}
}
// There are no defaults, so we don't need to generate a defaults function.
if len(defaults) == 0 {
return nil
}
printComment(w, fmt.Sprintf("%s sets the appropriate defaults for %s", ProvideDefaultsMethodName, name), false)
fmt.Fprintf(w, "func (val *%[1]s) %[2]s() *%[1]s {\n", name, ProvideDefaultsMethodName)
fmt.Fprint(w, "if val == nil {\n return nil\n}\n")
fmt.Fprint(w, "tmp := *val\n")
for _, p := range defaults {
if p.DefaultValue != nil {
dv, err := pkg.getDefaultValue(p.DefaultValue, codegen.UnwrapType(p.Type))
if err != nil {
return err
}
pkg.needsUtils = true
fmt.Fprintf(w, "if isZero(tmp.%s) {\n", Title(p.Name))
pkg.assignProperty(w, p, "tmp", dv, !p.IsRequired())
fmt.Fprintf(w, "}\n")
} else if funcName := pkg.provideDefaultsFuncName(p.Type); funcName != "" {
var member string
if codegen.IsNOptionalInput(p.Type) {
f := fmt.Sprintf("func(v %[1]s) %[1]s { return v.%[2]s*() }", name, funcName)
member = fmt.Sprintf("tmp.%[1]s.ApplyT(%[2]s)\n", Title(p.Name), f)
} else {
member = fmt.Sprintf("tmp.%[1]s.%[2]s()\n", Title(p.Name), funcName)
}
sigil := ""
if p.IsRequired() {
sigil = "*"
}
pkg.assignProperty(w, p, "tmp", sigil+member, false)
} else {
panic(fmt.Sprintf("Property %s[%s] should not be in the default list", p.Name, p.Type.String()))
}
}
fmt.Fprintf(w, "return &tmp\n}\n")
return nil
}
// The name of the method used to instantiate defaults.
const ProvideDefaultsMethodName = "Defaults"
func (pkg *pkgContext) provideDefaultsFuncName(typ schema.Type) string {
if !codegen.IsProvideDefaultsFuncRequired(typ) {
return ""
}
return ProvideDefaultsMethodName
}
func (pkg *pkgContext) genInputTypes(w io.Writer, t *schema.ObjectType, details *typeDetails) {
contract.Assert(t.IsInputShape())
@ -1298,6 +1374,11 @@ func (pkg *pkgContext) getDefaultValue(dv *schema.DefaultValue, t schema.Type) (
return "", err
}
val = v
switch t.(type) {
case *schema.EnumType:
typeName := strings.TrimSuffix(pkg.typeString(codegen.UnwrapType(t)), "Input")
val = fmt.Sprintf("%s(%s)", typeName, val)
}
}
if len(dv.Environment) > 0 {
@ -1381,6 +1462,8 @@ func (pkg *pkgContext) genResource(w io.Writer, r *schema.Resource, generateReso
fmt.Fprintf(w, "\t}\n\n")
// Produce the inputs.
// Check all required inputs are present
for _, p := range r.InputProperties {
if p.IsRequired() && isNilType(p.Type) && p.DefaultValue == nil {
fmt.Fprintf(w, "\tif args.%s == nil {\n", Title(p.Name))
@ -1389,26 +1472,8 @@ func (pkg *pkgContext) genResource(w io.Writer, r *schema.Resource, generateReso
}
}
assign := func(p *schema.Property, value string, indentation int) {
ind := strings.Repeat("\t", indentation)
t := strings.TrimSuffix(pkg.typeString(p.Type), "Input")
switch codegen.UnwrapType(p.Type).(type) {
case *schema.EnumType:
t = strings.TrimSuffix(t, "Ptr")
}
if t == "pulumi." {
t = "pulumi.Any"
}
if codegen.IsNOptionalInput(p.Type) {
fmt.Fprintf(w, "\targs.%s = %s(%s)\n", Title(p.Name), t, value)
} else if isNilType(p.Type) {
tmpName := camel(p.Name) + "_"
fmt.Fprintf(w, "%s%s := %s\n", ind, tmpName, value)
fmt.Fprintf(w, "%sargs.%s = &%s\n", ind, Title(p.Name), tmpName)
} else {
fmt.Fprintf(w, "%sargs.%s = %s\n", ind, Title(p.Name), value)
}
assign := func(p *schema.Property, value string) {
pkg.assignProperty(w, p, "args", value, isNilType(p.Type))
}
for _, p := range r.InputProperties {
@ -1417,19 +1482,51 @@ func (pkg *pkgContext) genResource(w io.Writer, r *schema.Resource, generateReso
if err != nil {
return err
}
assign(p, v, 1)
assign(p, v)
} else if p.DefaultValue != nil {
v, err := pkg.getDefaultValue(p.DefaultValue, codegen.UnwrapType(p.Type))
dv, err := pkg.getDefaultValue(p.DefaultValue, codegen.UnwrapType(p.Type))
if err != nil {
return err
}
defaultComp := "nil"
if !codegen.IsNOptionalInput(p.Type) && !isNilType(p.Type) {
defaultComp = primitiveNilValue(p.Type)
}
fmt.Fprintf(w, "\tif args.%s == %s {\n", Title(p.Name), defaultComp)
assign(p, v, 2)
pkg.needsUtils = true
fmt.Fprintf(w, "\tif isZero(args.%s) {\n", Title(p.Name))
assign(p, dv)
fmt.Fprintf(w, "\t}\n")
} else if name := pkg.provideDefaultsFuncName(p.Type); name != "" && !pkg.disableObjectDefaults {
var value string
var needsNilCheck bool
if codegen.IsNOptionalInput(p.Type) {
innerFuncType := strings.TrimSuffix(pkg.typeString(codegen.UnwrapType(p.Type)), "Args")
applyName := fmt.Sprintf("%sApplier", camel(p.Name))
fmt.Fprintf(w, "%[3]s := func(v %[1]s) *%[1]s { return v.%[2]s() }\n", innerFuncType, name, applyName)
outputValue := pkg.convertToOutput(fmt.Sprintf("args.%s", Title(p.Name)), p.Type)
outputType := pkg.typeString(p.Type)
if strings.HasSuffix(outputType, "Input") {
outputType = strings.TrimSuffix(outputType, "Input") + "Output"
}
// Because applies return pointers, we need to convert to PtrOutput and then call .Elem().
var tail string
if !strings.HasSuffix(outputType, "PtrOutput") {
outputType = strings.TrimSuffix(outputType, "Output") + "PtrOutput"
tail = ".Elem()"
}
needsNilCheck = !p.IsRequired()
value = fmt.Sprintf("%s.ApplyT(%s).(%s)%s", outputValue, applyName, outputType, tail)
} else {
value = fmt.Sprintf("args.%[1]s.%[2]s()", Title(p.Name), name)
}
v := func() {
fmt.Fprintf(w, "args.%[1]s = %s\n", Title(p.Name), value)
}
if needsNilCheck {
fmt.Fprintf(w, "if args.%s != nil {\n", Title(p.Name))
v()
fmt.Fprint(w, "}\n")
} else {
v()
}
}
}
@ -1723,6 +1820,30 @@ func (pkg *pkgContext) genResource(w io.Writer, r *schema.Resource, generateReso
return nil
}
// Takes an expression and type, and returns a string that converts that expression to an Output type.
//
// Examples:
// ("bar", Foo of ObjectType) => "bar.ToFooOutput()"
// ("id", FooOutput) => "id"
// ("ptr", FooInput of ObjectType) => "ptr.ToFooPtrOutput().Elem()"
func (pkg *pkgContext) convertToOutput(expr string, typ schema.Type) string {
elemConversion := ""
switch typ.(type) {
case *schema.OptionalType:
elemConversion = ".Elem()"
}
outputType := pkg.outputType(typ)
// Remove any element before the last .
outputType = outputType[strings.LastIndex(outputType, ".")+1:]
if strings.HasSuffix(outputType, "ArgsOutput") {
outputType = strings.TrimSuffix(outputType, "ArgsOutput") + "Output"
}
if elemConversion != "" {
outputType = strings.TrimSuffix(outputType, "Output") + "PtrOutput"
}
return fmt.Sprintf("%s.To%s()%s", expr, outputType, elemConversion)
}
func NeedsGoOutputVersion(f *schema.Function) bool {
fPkg := f.Package
@ -1740,7 +1861,7 @@ func NeedsGoOutputVersion(f *schema.Function) bool {
return f.NeedsOutputVersion()
}
func (pkg *pkgContext) genFunctionCodeFile(f *schema.Function) string {
func (pkg *pkgContext) genFunctionCodeFile(f *schema.Function) (string, error) {
importsAndAliases := map[string]string{}
pkg.getImports(f, importsAndAliases)
buffer := &bytes.Buffer{}
@ -1751,12 +1872,14 @@ func (pkg *pkgContext) genFunctionCodeFile(f *schema.Function) string {
}
pkg.genHeader(buffer, imports, importsAndAliases)
pkg.genFunction(buffer, f)
if err := pkg.genFunction(buffer, f); err != nil {
return "", err
}
pkg.genFunctionOutputVersion(buffer, f)
return buffer.String()
return buffer.String(), nil
}
func (pkg *pkgContext) genFunction(w io.Writer, f *schema.Function) {
func (pkg *pkgContext) genFunction(w io.Writer, f *schema.Function) error {
name := pkg.functionName(f)
printCommentWithDeprecationMessage(w, f.Comment, f.DeprecationMessage, false)
@ -1777,6 +1900,8 @@ func (pkg *pkgContext) genFunction(w io.Writer, f *schema.Function) {
var inputsVar string
if f.Inputs == nil {
inputsVar = "nil"
} else if codegen.IsProvideDefaultsFuncRequired(f.Inputs) && !pkg.disableObjectDefaults {
inputsVar = "args.Defaults()"
} else {
inputsVar = "args"
}
@ -1800,19 +1925,38 @@ func (pkg *pkgContext) genFunction(w io.Writer, f *schema.Function) {
fmt.Fprintf(w, "\t}\n")
// Return the result.
fmt.Fprintf(w, "\treturn &rv, nil\n")
var retValue string
if codegen.IsProvideDefaultsFuncRequired(f.Outputs) && !pkg.disableObjectDefaults {
retValue = "rv.Defaults()"
} else {
retValue = "&rv"
}
fmt.Fprintf(w, "\treturn %s, nil\n", retValue)
}
fmt.Fprintf(w, "}\n")
// If there are argument and/or return types, emit them.
if f.Inputs != nil {
fmt.Fprintf(w, "\n")
pkg.genPlainType(w, pkg.functionArgsTypeName(f), f.Inputs.Comment, "", f.Inputs.Properties)
fnInputsName := pkg.functionArgsTypeName(f)
pkg.genPlainType(w, fnInputsName, f.Inputs.Comment, "", f.Inputs.Properties)
if codegen.IsProvideDefaultsFuncRequired(f.Inputs) && !pkg.disableObjectDefaults {
if err := pkg.genPlainObjectDefaultFunc(w, fnInputsName, f.Inputs.Properties); err != nil {
return err
}
}
}
if f.Outputs != nil {
fmt.Fprintf(w, "\n")
pkg.genPlainType(w, pkg.functionResultTypeName(f), f.Outputs.Comment, "", f.Outputs.Properties)
fnOutputsName := pkg.functionResultTypeName(f)
pkg.genPlainType(w, fnOutputsName, f.Outputs.Comment, "", f.Outputs.Properties)
if codegen.IsProvideDefaultsFuncRequired(f.Outputs) && !pkg.disableObjectDefaults {
if err := pkg.genPlainObjectDefaultFunc(w, fnOutputsName, f.Outputs.Properties); err != nil {
return err
}
}
}
return nil
}
func (pkg *pkgContext) functionName(f *schema.Function) string {
@ -1991,16 +2135,24 @@ func rewriteCyclicObjectFields(pkg *schema.Package) {
}
}
func (pkg *pkgContext) genType(w io.Writer, obj *schema.ObjectType) {
func (pkg *pkgContext) genType(w io.Writer, obj *schema.ObjectType) error {
contract.Assert(!obj.IsInputShape())
if obj.IsOverlay {
// This type is generated by the provider, so no further action is required.
return
return nil
}
plainName := pkg.tokenToType(obj.Token)
pkg.genPlainType(w, plainName, obj.Comment, "", obj.Properties)
if !pkg.disableObjectDefaults {
if err := pkg.genPlainObjectDefaultFunc(w, plainName, obj.Properties); err != nil {
return err
}
}
pkg.genPlainType(w, pkg.tokenToType(obj.Token), obj.Comment, "", obj.Properties)
pkg.genInputTypes(w, obj.InputShape, pkg.detailsForType(obj))
pkg.genOutputTypes(w, genOutputTypesArgs{t: obj})
return nil
}
func (pkg *pkgContext) addSuffixesToName(typ schema.Type, name string) []string {
@ -2634,6 +2786,7 @@ func generatePackageContextMap(tool string, pkg *schema.Package, goInfo GoPackag
packages: packages,
liftSingleValueMethodReturns: goInfo.LiftSingleValueMethodReturns,
disableInputTypeRegistrations: goInfo.DisableInputTypeRegistrations,
disableObjectDefaults: goInfo.DisableObjectDefaults,
}
packages[mod] = pack
}
@ -3168,7 +3321,10 @@ func GeneratePackage(tool string, pkg *schema.Package) (map[string][]byte, error
}
fileName := path.Join(mod, camel(tokenToName(f.Token))+".go")
code := pkg.genFunctionCodeFile(f)
code, err := pkg.genFunctionCodeFile(f)
if err != nil {
return nil, err
}
setFile(fileName, code)
}
@ -3208,7 +3364,9 @@ func GeneratePackage(tool string, pkg *schema.Package) (map[string][]byte, error
pkg.genHeader(buffer, []string{"context", "reflect"}, importsAndAliases)
for _, t := range pkg.types {
pkg.genType(buffer, t)
if err := pkg.genType(buffer, t); err != nil {
return nil, err
}
delete(knownTypes, t)
}
@ -3344,4 +3502,12 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -43,7 +43,9 @@ func CRDTypes(tool string, pkg *schema.Package) (map[string]*bytes.Buffer, error
if len(pkg.types) > 0 {
for _, t := range pkg.types {
pkg.genType(buffer, t)
if err := pkg.genType(buffer, t); err != nil {
return nil, err
}
}
pkg.genTypeRegistrations(buffer, pkg.types)
}

View File

@ -60,6 +60,10 @@ type GoPackageInfo struct {
// Feature flag to disable generating input type registration. This is a
// space saving measure.
DisableInputTypeRegistrations bool `json:"disableInputTypeRegistrations,omitempty"`
// Feature flag to disable generating Pulumi object default functions. This is a
// space saving measure.
DisableObjectDefaults bool `json:"disableObjectDefaults,omitempty"`
}
// Importer implements schema.Language for Go.

View File

@ -192,8 +192,14 @@ var sdkTests = []sdkTest{
SkipCompileCheck: codegen.NewStringSet(nodejs),
},
{
Directory: "env-helper",
Description: "Ensure that eviromental helpers are generated (repro #8132)",
Directory: "plain-object-defaults",
Description: "Ensure that object defaults are generated (repro #8132)",
Skip: codegen.NewStringSet("python/test", "nodejs/test"),
SkipCompileCheck: codegen.NewStringSet(dotnet),
},
{
Directory: "plain-object-disable-defaults",
Description: "Ensure that we can still compile safely when defaults are disabled",
Skip: codegen.NewStringSet("python/test", "nodejs/test"),
SkipCompileCheck: codegen.NewStringSet(dotnet),
},

View File

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -9,6 +9,7 @@
"plant-provider/tree/v1/init.go",
"plant-provider/tree/v1/nursery.go",
"plant-provider/tree/v1/pulumiEnums.go",
"plant-provider/tree/v1/pulumiUtilities.go",
"plant-provider/tree/v1/rubberTree.go"
]
}

View File

@ -17,6 +17,19 @@ type Container struct {
Size ContainerSize `pulumi:"size"`
}
// Defaults sets the appropriate defaults for Container
func (val *Container) Defaults() *Container {
if val == nil {
return nil
}
tmp := *val
if isZero(tmp.Brightness) {
brightness_ := ContainerBrightness(1.0)
tmp.Brightness = &brightness_
}
return &tmp
}
// ContainerInput is an input type that accepts ContainerArgs and ContainerOutput values.
// You can construct a concrete instance of `ContainerInput` via:
//

View File

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -0,0 +1,85 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v1
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-plant/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

@ -29,16 +29,20 @@ func NewRubberTree(ctx *pulumi.Context,
return nil, errors.New("missing one or more required arguments")
}
if args.Diameter == nil {
containerApplier := func(v plantprovider.Container) *plantprovider.Container { return v.Defaults() }
if args.Container != nil {
args.Container = args.Container.ToContainerPtrOutput().Elem().ApplyT(containerApplier).(plantprovider.ContainerPtrOutput)
}
if isZero(args.Diameter) {
args.Diameter = Diameter(6.0)
}
if args.Farm == nil {
if isZero(args.Farm) {
args.Farm = pulumi.StringPtr("(unknown)")
}
if args.Size == nil {
if isZero(args.Size) {
args.Size = TreeSize("medium")
}
if args.Type == nil {
if isZero(args.Type) {
args.Type = RubberTreeVariety("Burgundy")
}
var resource RubberTree

View File

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -35,8 +35,8 @@ func (mocks) NewResource(args pulumi.MockResourceArgs) (string, resource.Propert
}
func (mocks) Call(args pulumi.MockCallArgs) (resource.PropertyMap, error) {
if args.Token == "mypkg::listStorageAccountKeys" {
switch args.Token {
case "mypkg::listStorageAccountKeys":
targs := mypkg.ListStorageAccountKeysArgs{}
for k, v := range args.Args {
switch k {
@ -72,12 +72,11 @@ func (mocks) Call(args pulumi.MockCallArgs) (resource.PropertyMap, error) {
"keys": result.Keys,
}
return resource.NewPropertyMapFromMap(outputs), nil
}
if args.Token == "mypkg::funcWithDefaultValue" ||
args.Token == "mypkg::funcWithAllOptionalInputs" ||
args.Token == "mypkg::funcWithListParam" ||
args.Token == "mypkg::funcWithDictParam" {
case "mypkg::funcWithDefaultValue",
"mypkg::funcWithAllOptionalInputs",
"mypkg::funcWithListParam",
"mypkg::funcWithDictParam":
result := mypkg.FuncWithDefaultValueResult{
R: fmt.Sprintf("%v", args.Args),
}
@ -85,9 +84,8 @@ func (mocks) Call(args pulumi.MockCallArgs) (resource.PropertyMap, error) {
"r": result.R,
}
return resource.NewPropertyMapFromMap(outputs), nil
}
if args.Token == "mypkg::getIntegrationRuntimeObjectMetadatum" {
case "mypkg::getIntegrationRuntimeObjectMetadatum":
targs := mypkg.GetIntegrationRuntimeObjectMetadatumArgs{}
for k, v := range args.Args {
switch k {
@ -151,16 +149,13 @@ func TestListStorageAccountKeysOutput(t *testing.T) {
})
}
// TODO[pulumi/pulumi#7811]: it seems that default values are not
// supported by Go codegen yet, hence we do not observe "B" populated
// to default at all here.
func TestFuncWithDefaultValueOutput(t *testing.T) {
pulumiTest(t, func(ctx *pulumi.Context) error {
output := mypkg.FuncWithDefaultValueOutput(ctx, mypkg.FuncWithDefaultValueOutputArgs{
A: pulumi.String("my-a"),
})
r := waitOut(t, output.R())
assert.Equal(t, "map[a:{my-a}]", r)
assert.Equal(t, "map[a:{my-a} b:{b-default}]", r)
return nil
})
}

View File

@ -13,7 +13,7 @@ import (
// Check codegen of functions with default values.
func FuncWithDefaultValue(ctx *pulumi.Context, args *FuncWithDefaultValueArgs, opts ...pulumi.InvokeOption) (*FuncWithDefaultValueResult, error) {
var rv FuncWithDefaultValueResult
err := ctx.Invoke("mypkg::funcWithDefaultValue", args, &rv, opts...)
err := ctx.Invoke("mypkg::funcWithDefaultValue", args.Defaults(), &rv, opts...)
if err != nil {
return nil, err
}
@ -25,6 +25,19 @@ type FuncWithDefaultValueArgs struct {
B *string `pulumi:"b"`
}
// Defaults sets the appropriate defaults for FuncWithDefaultValueArgs
func (val *FuncWithDefaultValueArgs) Defaults() *FuncWithDefaultValueArgs {
if val == nil {
return nil
}
tmp := *val
if isZero(tmp.B) {
b_ := "b-default"
tmp.B = &b_
}
return &tmp
}
type FuncWithDefaultValueResult struct {
R string `pulumi:"r"`
}

View File

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -22,53 +22,53 @@ func NewModuleResource(ctx *pulumi.Context,
return nil, errors.New("missing one or more required arguments")
}
if args.Optional_bool == nil {
if isZero(args.Optional_bool) {
args.Optional_bool = pulumi.BoolPtr(true)
}
args.Optional_const = pulumi.StringPtr("val")
if args.Optional_enum == nil {
if isZero(args.Optional_enum) {
args.Optional_enum = EnumThing(8)
}
if args.Optional_number == nil {
if isZero(args.Optional_number) {
args.Optional_number = pulumi.Float64Ptr(42.0)
}
if args.Optional_string == nil {
if isZero(args.Optional_string) {
args.Optional_string = pulumi.StringPtr("buzzer")
}
if args.Plain_optional_bool == nil {
if isZero(args.Plain_optional_bool) {
plain_optional_bool_ := true
args.Plain_optional_bool = &plain_optional_bool_
}
plain_optional_const_ := "val"
args.Plain_optional_const = &plain_optional_const_
if args.Plain_optional_number == nil {
if isZero(args.Plain_optional_number) {
plain_optional_number_ := 42.0
args.Plain_optional_number = &plain_optional_number_
}
if args.Plain_optional_string == nil {
if isZero(args.Plain_optional_string) {
plain_optional_string_ := "buzzer"
args.Plain_optional_string = &plain_optional_string_
}
if args.Plain_required_bool == false {
if isZero(args.Plain_required_bool) {
args.Plain_required_bool = true
}
args.Plain_required_const = "val"
if args.Plain_required_number == 0.0 {
if isZero(args.Plain_required_number) {
args.Plain_required_number = 42.0
}
if args.Plain_required_string == "" {
if isZero(args.Plain_required_string) {
args.Plain_required_string = "buzzer"
}
if args.Required_bool == nil {
if isZero(args.Required_bool) {
args.Required_bool = pulumi.Bool(true)
}
if args.Required_enum == nil {
if isZero(args.Required_enum) {
args.Required_enum = EnumThing(4)
}
if args.Required_number == nil {
if isZero(args.Required_number) {
args.Required_number = pulumi.Float64(42.0)
}
if args.Required_string == nil {
if isZero(args.Required_string) {
args.Required_string = pulumi.String("buzzer")
}
var resource ModuleResource

View File

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -0,0 +1,26 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Example.Mod1.Inputs
{
/// <summary>
/// A test for namespaces (mod 1)
/// </summary>
public sealed class TypArgs : Pulumi.ResourceArgs
{
[Input("val")]
public Input<string>? Val { get; set; }
public TypArgs()
{
Val = Utilities.GetEnv("PULUMI_EXAMPLE_MOD1_DEFAULT") ?? "mod1";
}
}
}

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -0,0 +1,118 @@
// Copyright 2016-2021, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package codegentest
import (
"fmt"
"os"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"plain-object-defaults/example"
)
type mocks int
// We assert that default values were passed to our constuctor
func (mocks) NewResource(args pulumi.MockResourceArgs) (string, resource.PropertyMap, error) {
checkFloat64 := func(v resource.PropertyValue, k string, expected float64) {
m := v.V.(resource.PropertyMap)
if m[resource.PropertyKey(k)].V.(float64) != expected {
panic(fmt.Sprintf("Expected %s to have value %.2f", k, expected))
}
}
for k, v := range args.Inputs {
switch k {
case "kubeClientSettings":
checkFloat64(v, "burst", 42)
case "backupKubeClientSettings":
checkFloat64(v, "qps", 7)
}
}
return args.Name, args.Inputs.Copy(), nil
}
func (mocks) Call(args pulumi.MockCallArgs) (resource.PropertyMap, error) {
panic("Call not supported")
}
func TestObjectDefaults(t *testing.T) {
path := "thePath"
defaultDriver := "secret"
kcs := example.HelmReleaseSettings{
PluginsPath: &path,
RequiredArg: "This is required",
}
withDefaults := kcs.Defaults()
assert.Equal(t, kcs.RequiredArg, withDefaults.RequiredArg)
assert.Equal(t, kcs.PluginsPath, withDefaults.PluginsPath)
assert.Nil(t, kcs.Driver)
assert.Equal(t, withDefaults.Driver, &defaultDriver)
}
func TestTransitiveObjectDefaults(t *testing.T) {
layered := example.LayeredType{
Other: example.HelmReleaseSettings{},
}
withDefaults := layered.Defaults()
assert.Equal(t, "secret", *withDefaults.Other.Driver)
}
// We already have that defaults for resources. We test that they translate through objects.
func TestDefaultResource(t *testing.T) {
os.Setenv("PULUMI_K8S_CLIENT_BURST", "42")
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := example.NewFoo(ctx, "foo", &example.FooArgs{
KubeClientSettings: example.KubeClientSettingsPtr(&example.KubeClientSettingsArgs{}),
BackupKubeClientSettings: &example.KubeClientSettingsArgs{Qps: pulumi.Float64(7)},
})
assert.NoError(t, err)
return nil
}, pulumi.WithMocks("example", "stack", mocks(0)))
}
func waitOut(t *testing.T, output pulumi.Output) interface{} {
result, err := waitOutput(output, 1*time.Second)
if err != nil {
t.Error(err)
return nil
}
return result
}
func waitOutput(output pulumi.Output, timeout time.Duration) (interface{}, error) {
c := make(chan interface{}, 2)
output.ApplyT(func(v interface{}) interface{} {
c <- v
return v
})
var timeoutMarker *int = new(int)
go func() {
time.Sleep(timeout)
c <- timeoutMarker
}()
result := <-c
if result == timeoutMarker {
return nil, fmt.Errorf("Timed out waiting for pulumi.Output after %v", timeout)
} else {
return result, nil
}
}

View File

@ -0,0 +1,16 @@
{
"emittedFiles": [
"example/doc.go",
"example/foo.go",
"example/funcWithAllOptionalInputs.go",
"example/init.go",
"example/mod1/pulumiTypes.go",
"example/mod1/pulumiUtilities.go",
"example/mod2/pulumiTypes.go",
"example/mod2/pulumiUtilities.go",
"example/moduleTest.go",
"example/provider.go",
"example/pulumiTypes.go",
"example/pulumiUtilities.go"
]
}

View File

@ -0,0 +1,134 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package example
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// test new feature with resoruces
type Foo struct {
pulumi.CustomResourceState
// A test for plain types
DefaultKubeClientSettings KubeClientSettingsPtrOutput `pulumi:"defaultKubeClientSettings"`
}
// NewFoo registers a new resource with the given unique name, arguments, and options.
func NewFoo(ctx *pulumi.Context,
name string, args *FooArgs, opts ...pulumi.ResourceOption) (*Foo, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.BackupKubeClientSettings == nil {
return nil, errors.New("invalid value for required argument 'BackupKubeClientSettings'")
}
backupKubeClientSettingsApplier := func(v KubeClientSettings) *KubeClientSettings { return v.Defaults() }
args.BackupKubeClientSettings = args.BackupKubeClientSettings.ToKubeClientSettingsOutput().ApplyT(backupKubeClientSettingsApplier).(KubeClientSettingsPtrOutput).Elem()
kubeClientSettingsApplier := func(v KubeClientSettings) *KubeClientSettings { return v.Defaults() }
if args.KubeClientSettings != nil {
args.KubeClientSettings = args.KubeClientSettings.ToKubeClientSettingsPtrOutput().Elem().ApplyT(kubeClientSettingsApplier).(KubeClientSettingsPtrOutput)
}
settingsApplier := func(v LayeredType) *LayeredType { return v.Defaults() }
if args.Settings != nil {
args.Settings = args.Settings.ToLayeredTypePtrOutput().Elem().ApplyT(settingsApplier).(LayeredTypePtrOutput)
}
var resource Foo
err := ctx.RegisterResource("example:index:Foo", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetFoo gets an existing Foo 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 GetFoo(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *FooState, opts ...pulumi.ResourceOption) (*Foo, error) {
var resource Foo
err := ctx.ReadResource("example:index:Foo", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Foo resources.
type fooState struct {
}
type FooState struct {
}
func (FooState) ElementType() reflect.Type {
return reflect.TypeOf((*fooState)(nil)).Elem()
}
type fooArgs struct {
Argument *string `pulumi:"argument"`
// Options for tuning the Kubernetes client used by a Provider.
BackupKubeClientSettings KubeClientSettings `pulumi:"backupKubeClientSettings"`
// Options for tuning the Kubernetes client used by a Provider.
KubeClientSettings *KubeClientSettings `pulumi:"kubeClientSettings"`
// describing things
Settings *LayeredType `pulumi:"settings"`
}
// The set of arguments for constructing a Foo resource.
type FooArgs struct {
Argument *string
// Options for tuning the Kubernetes client used by a Provider.
BackupKubeClientSettings KubeClientSettingsInput
// Options for tuning the Kubernetes client used by a Provider.
KubeClientSettings KubeClientSettingsPtrInput
// describing things
Settings LayeredTypePtrInput
}
func (FooArgs) ElementType() reflect.Type {
return reflect.TypeOf((*fooArgs)(nil)).Elem()
}
type FooInput interface {
pulumi.Input
ToFooOutput() FooOutput
ToFooOutputWithContext(ctx context.Context) FooOutput
}
func (*Foo) ElementType() reflect.Type {
return reflect.TypeOf((**Foo)(nil)).Elem()
}
func (i *Foo) ToFooOutput() FooOutput {
return i.ToFooOutputWithContext(context.Background())
}
func (i *Foo) ToFooOutputWithContext(ctx context.Context) FooOutput {
return pulumi.ToOutputWithContext(ctx, i).(FooOutput)
}
type FooOutput struct{ *pulumi.OutputState }
func (FooOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Foo)(nil)).Elem()
}
func (o FooOutput) ToFooOutput() FooOutput {
return o
}
func (o FooOutput) ToFooOutputWithContext(ctx context.Context) FooOutput {
return o
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*FooInput)(nil)).Elem(), &Foo{})
pulumi.RegisterOutputType(FooOutput{})
}

View File

@ -0,0 +1,89 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package example
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Check codegen of functions with all optional inputs.
func FuncWithAllOptionalInputs(ctx *pulumi.Context, args *FuncWithAllOptionalInputsArgs, opts ...pulumi.InvokeOption) (*FuncWithAllOptionalInputsResult, error) {
var rv FuncWithAllOptionalInputsResult
err := ctx.Invoke("mypkg::funcWithAllOptionalInputs", args.Defaults(), &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type FuncWithAllOptionalInputsArgs struct {
// Property A
A *HelmReleaseSettings `pulumi:"a"`
// Property B
B *string `pulumi:"b"`
}
// Defaults sets the appropriate defaults for FuncWithAllOptionalInputsArgs
func (val *FuncWithAllOptionalInputsArgs) Defaults() *FuncWithAllOptionalInputsArgs {
if val == nil {
return nil
}
tmp := *val
tmp.A = tmp.A.Defaults()
if isZero(tmp.B) {
b_ := "defValue"
tmp.B = &b_
}
return &tmp
}
type FuncWithAllOptionalInputsResult struct {
R string `pulumi:"r"`
}
func FuncWithAllOptionalInputsOutput(ctx *pulumi.Context, args FuncWithAllOptionalInputsOutputArgs, opts ...pulumi.InvokeOption) FuncWithAllOptionalInputsResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (FuncWithAllOptionalInputsResult, error) {
args := v.(FuncWithAllOptionalInputsArgs)
r, err := FuncWithAllOptionalInputs(ctx, &args, opts...)
return *r, err
}).(FuncWithAllOptionalInputsResultOutput)
}
type FuncWithAllOptionalInputsOutputArgs struct {
// Property A
A HelmReleaseSettingsPtrInput `pulumi:"a"`
// Property B
B pulumi.StringPtrInput `pulumi:"b"`
}
func (FuncWithAllOptionalInputsOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*FuncWithAllOptionalInputsArgs)(nil)).Elem()
}
type FuncWithAllOptionalInputsResultOutput struct{ *pulumi.OutputState }
func (FuncWithAllOptionalInputsResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*FuncWithAllOptionalInputsResult)(nil)).Elem()
}
func (o FuncWithAllOptionalInputsResultOutput) ToFuncWithAllOptionalInputsResultOutput() FuncWithAllOptionalInputsResultOutput {
return o
}
func (o FuncWithAllOptionalInputsResultOutput) ToFuncWithAllOptionalInputsResultOutputWithContext(ctx context.Context) FuncWithAllOptionalInputsResultOutput {
return o
}
func (o FuncWithAllOptionalInputsResultOutput) R() pulumi.StringOutput {
return o.ApplyT(func(v FuncWithAllOptionalInputsResult) string { return v.R }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(FuncWithAllOptionalInputsResultOutput{})
}

View File

@ -0,0 +1,167 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package mod1
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// A test for namespaces (mod 1)
type Typ struct {
Val *string `pulumi:"val"`
}
// Defaults sets the appropriate defaults for Typ
func (val *Typ) Defaults() *Typ {
if val == nil {
return nil
}
tmp := *val
if isZero(tmp.Val) {
val_ := getEnvOrDefault("mod1", nil, "PULUMI_EXAMPLE_MOD1_DEFAULT").(string)
tmp.Val = &val_
}
return &tmp
}
// TypInput is an input type that accepts TypArgs and TypOutput values.
// You can construct a concrete instance of `TypInput` via:
//
// TypArgs{...}
type TypInput interface {
pulumi.Input
ToTypOutput() TypOutput
ToTypOutputWithContext(context.Context) TypOutput
}
// A test for namespaces (mod 1)
type TypArgs struct {
Val pulumi.StringPtrInput `pulumi:"val"`
}
func (TypArgs) ElementType() reflect.Type {
return reflect.TypeOf((*Typ)(nil)).Elem()
}
func (i TypArgs) ToTypOutput() TypOutput {
return i.ToTypOutputWithContext(context.Background())
}
func (i TypArgs) ToTypOutputWithContext(ctx context.Context) TypOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypOutput)
}
func (i TypArgs) ToTypPtrOutput() TypPtrOutput {
return i.ToTypPtrOutputWithContext(context.Background())
}
func (i TypArgs) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypOutput).ToTypPtrOutputWithContext(ctx)
}
// TypPtrInput is an input type that accepts TypArgs, TypPtr and TypPtrOutput values.
// You can construct a concrete instance of `TypPtrInput` via:
//
// TypArgs{...}
//
// or:
//
// nil
type TypPtrInput interface {
pulumi.Input
ToTypPtrOutput() TypPtrOutput
ToTypPtrOutputWithContext(context.Context) TypPtrOutput
}
type typPtrType TypArgs
func TypPtr(v *TypArgs) TypPtrInput {
return (*typPtrType)(v)
}
func (*typPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Typ)(nil)).Elem()
}
func (i *typPtrType) ToTypPtrOutput() TypPtrOutput {
return i.ToTypPtrOutputWithContext(context.Background())
}
func (i *typPtrType) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypPtrOutput)
}
// A test for namespaces (mod 1)
type TypOutput struct{ *pulumi.OutputState }
func (TypOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Typ)(nil)).Elem()
}
func (o TypOutput) ToTypOutput() TypOutput {
return o
}
func (o TypOutput) ToTypOutputWithContext(ctx context.Context) TypOutput {
return o
}
func (o TypOutput) ToTypPtrOutput() TypPtrOutput {
return o.ToTypPtrOutputWithContext(context.Background())
}
func (o TypOutput) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v Typ) *Typ {
return &v
}).(TypPtrOutput)
}
func (o TypOutput) Val() pulumi.StringPtrOutput {
return o.ApplyT(func(v Typ) *string { return v.Val }).(pulumi.StringPtrOutput)
}
type TypPtrOutput struct{ *pulumi.OutputState }
func (TypPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Typ)(nil)).Elem()
}
func (o TypPtrOutput) ToTypPtrOutput() TypPtrOutput {
return o
}
func (o TypPtrOutput) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return o
}
func (o TypPtrOutput) Elem() TypOutput {
return o.ApplyT(func(v *Typ) Typ {
if v != nil {
return *v
}
var ret Typ
return ret
}).(TypOutput)
}
func (o TypPtrOutput) Val() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Typ) *string {
if v == nil {
return nil
}
return v.Val
}).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TypInput)(nil)).Elem(), TypArgs{})
pulumi.RegisterInputType(reflect.TypeOf((*TypPtrInput)(nil)).Elem(), TypArgs{})
pulumi.RegisterOutputType(TypOutput{})
pulumi.RegisterOutputType(TypPtrOutput{})
}

View File

@ -0,0 +1,85 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package mod1
import (
"fmt"
"os"
"reflect"
"regexp"
"strconv"
"strings"
"github.com/blang/semver"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type envParser func(v string) interface{}
func parseEnvBool(v string) interface{} {
b, err := strconv.ParseBool(v)
if err != nil {
return nil
}
return b
}
func parseEnvInt(v string) interface{} {
i, err := strconv.ParseInt(v, 0, 0)
if err != nil {
return nil
}
return int(i)
}
func parseEnvFloat(v string) interface{} {
f, err := strconv.ParseFloat(v, 64)
if err != nil {
return nil
}
return f
}
func parseEnvStringArray(v string) interface{} {
var result pulumi.StringArray
for _, item := range strings.Split(v, ";") {
result = append(result, pulumi.String(item))
}
return result
}
func getEnvOrDefault(def interface{}, parser envParser, vars ...string) interface{} {
for _, v := range vars {
if value := os.Getenv(v); value != "" {
if parser != nil {
return parser(value)
}
return value
}
}
return def
}
// PkgVersion uses reflection to determine the version of the current package.
func PkgVersion() (semver.Version, error) {
type sentinal struct{}
pkgPath := reflect.TypeOf(sentinal{}).PkgPath()
re := regexp.MustCompile("^.*/pulumi-example/sdk(/v\\d+)?")
if match := re.FindStringSubmatch(pkgPath); match != nil {
vStr := match[1]
if len(vStr) == 0 { // If the version capture group was empty, default to v1.
return semver.Version{Major: 1}, nil
}
return semver.MustParse(fmt.Sprintf("%s.0.0", vStr[2:])), nil
}
return semver.Version{}, fmt.Errorf("failed to determine the package version from %s", pkgPath)
}
// 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

@ -0,0 +1,185 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package mod2
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"plain-object-defaults/example/mod1"
)
// A test for namespaces (mod 2)
type Typ struct {
Mod1 *mod1.Typ `pulumi:"mod1"`
Val *string `pulumi:"val"`
}
// Defaults sets the appropriate defaults for Typ
func (val *Typ) Defaults() *Typ {
if val == nil {
return nil
}
tmp := *val
tmp.Mod1 = tmp.Mod1.Defaults()
if isZero(tmp.Val) {
val_ := "mod2"
tmp.Val = &val_
}
return &tmp
}
// TypInput is an input type that accepts TypArgs and TypOutput values.
// You can construct a concrete instance of `TypInput` via:
//
// TypArgs{...}
type TypInput interface {
pulumi.Input
ToTypOutput() TypOutput
ToTypOutputWithContext(context.Context) TypOutput
}
// A test for namespaces (mod 2)
type TypArgs struct {
Mod1 mod1.TypPtrInput `pulumi:"mod1"`
Val pulumi.StringPtrInput `pulumi:"val"`
}
func (TypArgs) ElementType() reflect.Type {
return reflect.TypeOf((*Typ)(nil)).Elem()
}
func (i TypArgs) ToTypOutput() TypOutput {
return i.ToTypOutputWithContext(context.Background())
}
func (i TypArgs) ToTypOutputWithContext(ctx context.Context) TypOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypOutput)
}
func (i TypArgs) ToTypPtrOutput() TypPtrOutput {
return i.ToTypPtrOutputWithContext(context.Background())
}
func (i TypArgs) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypOutput).ToTypPtrOutputWithContext(ctx)
}
// TypPtrInput is an input type that accepts TypArgs, TypPtr and TypPtrOutput values.
// You can construct a concrete instance of `TypPtrInput` via:
//
// TypArgs{...}
//
// or:
//
// nil
type TypPtrInput interface {
pulumi.Input
ToTypPtrOutput() TypPtrOutput
ToTypPtrOutputWithContext(context.Context) TypPtrOutput
}
type typPtrType TypArgs
func TypPtr(v *TypArgs) TypPtrInput {
return (*typPtrType)(v)
}
func (*typPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Typ)(nil)).Elem()
}
func (i *typPtrType) ToTypPtrOutput() TypPtrOutput {
return i.ToTypPtrOutputWithContext(context.Background())
}
func (i *typPtrType) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypPtrOutput)
}
// A test for namespaces (mod 2)
type TypOutput struct{ *pulumi.OutputState }
func (TypOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Typ)(nil)).Elem()
}
func (o TypOutput) ToTypOutput() TypOutput {
return o
}
func (o TypOutput) ToTypOutputWithContext(ctx context.Context) TypOutput {
return o
}
func (o TypOutput) ToTypPtrOutput() TypPtrOutput {
return o.ToTypPtrOutputWithContext(context.Background())
}
func (o TypOutput) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v Typ) *Typ {
return &v
}).(TypPtrOutput)
}
func (o TypOutput) Mod1() mod1.TypPtrOutput {
return o.ApplyT(func(v Typ) *mod1.Typ { return v.Mod1 }).(mod1.TypPtrOutput)
}
func (o TypOutput) Val() pulumi.StringPtrOutput {
return o.ApplyT(func(v Typ) *string { return v.Val }).(pulumi.StringPtrOutput)
}
type TypPtrOutput struct{ *pulumi.OutputState }
func (TypPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Typ)(nil)).Elem()
}
func (o TypPtrOutput) ToTypPtrOutput() TypPtrOutput {
return o
}
func (o TypPtrOutput) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return o
}
func (o TypPtrOutput) Elem() TypOutput {
return o.ApplyT(func(v *Typ) Typ {
if v != nil {
return *v
}
var ret Typ
return ret
}).(TypOutput)
}
func (o TypPtrOutput) Mod1() mod1.TypPtrOutput {
return o.ApplyT(func(v *Typ) *mod1.Typ {
if v == nil {
return nil
}
return v.Mod1
}).(mod1.TypPtrOutput)
}
func (o TypPtrOutput) Val() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Typ) *string {
if v == nil {
return nil
}
return v.Val
}).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TypInput)(nil)).Elem(), TypArgs{})
pulumi.RegisterInputType(reflect.TypeOf((*TypPtrInput)(nil)).Elem(), TypArgs{})
pulumi.RegisterOutputType(TypOutput{})
pulumi.RegisterOutputType(TypPtrOutput{})
}

View File

@ -0,0 +1,85 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package mod2
import (
"fmt"
"os"
"reflect"
"regexp"
"strconv"
"strings"
"github.com/blang/semver"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type envParser func(v string) interface{}
func parseEnvBool(v string) interface{} {
b, err := strconv.ParseBool(v)
if err != nil {
return nil
}
return b
}
func parseEnvInt(v string) interface{} {
i, err := strconv.ParseInt(v, 0, 0)
if err != nil {
return nil
}
return int(i)
}
func parseEnvFloat(v string) interface{} {
f, err := strconv.ParseFloat(v, 64)
if err != nil {
return nil
}
return f
}
func parseEnvStringArray(v string) interface{} {
var result pulumi.StringArray
for _, item := range strings.Split(v, ";") {
result = append(result, pulumi.String(item))
}
return result
}
func getEnvOrDefault(def interface{}, parser envParser, vars ...string) interface{} {
for _, v := range vars {
if value := os.Getenv(v); value != "" {
if parser != nil {
return parser(value)
}
return value
}
}
return def
}
// PkgVersion uses reflection to determine the version of the current package.
func PkgVersion() (semver.Version, error) {
type sentinal struct{}
pkgPath := reflect.TypeOf(sentinal{}).PkgPath()
re := regexp.MustCompile("^.*/pulumi-example/sdk(/v\\d+)?")
if match := re.FindStringSubmatch(pkgPath); match != nil {
vStr := match[1]
if len(vStr) == 0 { // If the version capture group was empty, default to v1.
return semver.Version{Major: 1}, nil
}
return semver.MustParse(fmt.Sprintf("%s.0.0", vStr[2:])), nil
}
return semver.Version{}, fmt.Errorf("failed to determine the package version from %s", pkgPath)
}
// 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

@ -0,0 +1,115 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package example
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"plain-object-defaults/example/mod1"
)
type ModuleTest struct {
pulumi.CustomResourceState
}
// NewModuleTest registers a new resource with the given unique name, arguments, and options.
func NewModuleTest(ctx *pulumi.Context,
name string, args *ModuleTestArgs, opts ...pulumi.ResourceOption) (*ModuleTest, error) {
if args == nil {
args = &ModuleTestArgs{}
}
mod1Applier := func(v mod1.Typ) *mod1.Typ { return v.Defaults() }
if args.Mod1 != nil {
args.Mod1 = args.Mod1.ToTypPtrOutput().Elem().ApplyT(mod1Applier).(mod1.TypPtrOutput)
}
valApplier := func(v Typ) *Typ { return v.Defaults() }
if args.Val != nil {
args.Val = args.Val.ToTypPtrOutput().Elem().ApplyT(valApplier).(TypPtrOutput)
}
var resource ModuleTest
err := ctx.RegisterResource("example:index:moduleTest", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetModuleTest gets an existing ModuleTest 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 GetModuleTest(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ModuleTestState, opts ...pulumi.ResourceOption) (*ModuleTest, error) {
var resource ModuleTest
err := ctx.ReadResource("example:index:moduleTest", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ModuleTest resources.
type moduleTestState struct {
}
type ModuleTestState struct {
}
func (ModuleTestState) ElementType() reflect.Type {
return reflect.TypeOf((*moduleTestState)(nil)).Elem()
}
type moduleTestArgs struct {
Mod1 *mod1.Typ `pulumi:"mod1"`
Val *Typ `pulumi:"val"`
}
// The set of arguments for constructing a ModuleTest resource.
type ModuleTestArgs struct {
Mod1 mod1.TypPtrInput
Val TypPtrInput
}
func (ModuleTestArgs) ElementType() reflect.Type {
return reflect.TypeOf((*moduleTestArgs)(nil)).Elem()
}
type ModuleTestInput interface {
pulumi.Input
ToModuleTestOutput() ModuleTestOutput
ToModuleTestOutputWithContext(ctx context.Context) ModuleTestOutput
}
func (*ModuleTest) ElementType() reflect.Type {
return reflect.TypeOf((**ModuleTest)(nil)).Elem()
}
func (i *ModuleTest) ToModuleTestOutput() ModuleTestOutput {
return i.ToModuleTestOutputWithContext(context.Background())
}
func (i *ModuleTest) ToModuleTestOutputWithContext(ctx context.Context) ModuleTestOutput {
return pulumi.ToOutputWithContext(ctx, i).(ModuleTestOutput)
}
type ModuleTestOutput struct{ *pulumi.OutputState }
func (ModuleTestOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ModuleTest)(nil)).Elem()
}
func (o ModuleTestOutput) ToModuleTestOutput() ModuleTestOutput {
return o
}
func (o ModuleTestOutput) ToModuleTestOutputWithContext(ctx context.Context) ModuleTestOutput {
return o
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ModuleTestInput)(nil)).Elem(), &ModuleTest{})
pulumi.RegisterOutputType(ModuleTestOutput{})
}

View File

@ -0,0 +1,88 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package example
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The provider type for the kubernetes package.
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{}
}
helmReleaseSettingsApplier := func(v HelmReleaseSettings) *HelmReleaseSettings { return v.Defaults() }
if args.HelmReleaseSettings != nil {
args.HelmReleaseSettings = args.HelmReleaseSettings.ToHelmReleaseSettingsPtrOutput().Elem().ApplyT(helmReleaseSettingsApplier).(HelmReleaseSettingsPtrOutput)
}
var resource Provider
err := ctx.RegisterResource("pulumi:providers:example", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
type providerArgs struct {
// BETA FEATURE - Options to configure the Helm Release resource.
HelmReleaseSettings *HelmReleaseSettings `pulumi:"helmReleaseSettings"`
}
// The set of arguments for constructing a Provider resource.
type ProviderArgs struct {
// BETA FEATURE - Options to configure the Helm Release resource.
HelmReleaseSettings HelmReleaseSettingsPtrInput
}
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

@ -0,0 +1,856 @@
// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package example
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"plain-object-defaults/example/mod1"
"plain-object-defaults/example/mod2"
)
// BETA FEATURE - Options to configure the Helm Release resource.
type HelmReleaseSettings struct {
// The backend storage driver for Helm. Values are: configmap, secret, memory, sql.
Driver *string `pulumi:"driver"`
// The path to the helm plugins directory.
PluginsPath *string `pulumi:"pluginsPath"`
// to test required args
RequiredArg string `pulumi:"requiredArg"`
}
// Defaults sets the appropriate defaults for HelmReleaseSettings
func (val *HelmReleaseSettings) Defaults() *HelmReleaseSettings {
if val == nil {
return nil
}
tmp := *val
if isZero(tmp.Driver) {
driver_ := getEnvOrDefault("secret", nil, "PULUMI_K8S_HELM_DRIVER").(string)
tmp.Driver = &driver_
}
if isZero(tmp.PluginsPath) {
pluginsPath_ := getEnvOrDefault("", nil, "PULUMI_K8S_HELM_PLUGINS_PATH").(string)
tmp.PluginsPath = &pluginsPath_
}
return &tmp
}
// HelmReleaseSettingsInput is an input type that accepts HelmReleaseSettingsArgs and HelmReleaseSettingsOutput values.
// You can construct a concrete instance of `HelmReleaseSettingsInput` via:
//
// HelmReleaseSettingsArgs{...}
type HelmReleaseSettingsInput interface {
pulumi.Input
ToHelmReleaseSettingsOutput() HelmReleaseSettingsOutput
ToHelmReleaseSettingsOutputWithContext(context.Context) HelmReleaseSettingsOutput
}
// BETA FEATURE - Options to configure the Helm Release resource.
type HelmReleaseSettingsArgs struct {
// The backend storage driver for Helm. Values are: configmap, secret, memory, sql.
Driver pulumi.StringPtrInput `pulumi:"driver"`
// The path to the helm plugins directory.
PluginsPath pulumi.StringPtrInput `pulumi:"pluginsPath"`
// to test required args
RequiredArg pulumi.StringInput `pulumi:"requiredArg"`
}
func (HelmReleaseSettingsArgs) ElementType() reflect.Type {
return reflect.TypeOf((*HelmReleaseSettings)(nil)).Elem()
}
func (i HelmReleaseSettingsArgs) ToHelmReleaseSettingsOutput() HelmReleaseSettingsOutput {
return i.ToHelmReleaseSettingsOutputWithContext(context.Background())
}
func (i HelmReleaseSettingsArgs) ToHelmReleaseSettingsOutputWithContext(ctx context.Context) HelmReleaseSettingsOutput {
return pulumi.ToOutputWithContext(ctx, i).(HelmReleaseSettingsOutput)
}
func (i HelmReleaseSettingsArgs) ToHelmReleaseSettingsPtrOutput() HelmReleaseSettingsPtrOutput {
return i.ToHelmReleaseSettingsPtrOutputWithContext(context.Background())
}
func (i HelmReleaseSettingsArgs) ToHelmReleaseSettingsPtrOutputWithContext(ctx context.Context) HelmReleaseSettingsPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(HelmReleaseSettingsOutput).ToHelmReleaseSettingsPtrOutputWithContext(ctx)
}
// HelmReleaseSettingsPtrInput is an input type that accepts HelmReleaseSettingsArgs, HelmReleaseSettingsPtr and HelmReleaseSettingsPtrOutput values.
// You can construct a concrete instance of `HelmReleaseSettingsPtrInput` via:
//
// HelmReleaseSettingsArgs{...}
//
// or:
//
// nil
type HelmReleaseSettingsPtrInput interface {
pulumi.Input
ToHelmReleaseSettingsPtrOutput() HelmReleaseSettingsPtrOutput
ToHelmReleaseSettingsPtrOutputWithContext(context.Context) HelmReleaseSettingsPtrOutput
}
type helmReleaseSettingsPtrType HelmReleaseSettingsArgs
func HelmReleaseSettingsPtr(v *HelmReleaseSettingsArgs) HelmReleaseSettingsPtrInput {
return (*helmReleaseSettingsPtrType)(v)
}
func (*helmReleaseSettingsPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**HelmReleaseSettings)(nil)).Elem()
}
func (i *helmReleaseSettingsPtrType) ToHelmReleaseSettingsPtrOutput() HelmReleaseSettingsPtrOutput {
return i.ToHelmReleaseSettingsPtrOutputWithContext(context.Background())
}
func (i *helmReleaseSettingsPtrType) ToHelmReleaseSettingsPtrOutputWithContext(ctx context.Context) HelmReleaseSettingsPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(HelmReleaseSettingsPtrOutput)
}
// BETA FEATURE - Options to configure the Helm Release resource.
type HelmReleaseSettingsOutput struct{ *pulumi.OutputState }
func (HelmReleaseSettingsOutput) ElementType() reflect.Type {
return reflect.TypeOf((*HelmReleaseSettings)(nil)).Elem()
}
func (o HelmReleaseSettingsOutput) ToHelmReleaseSettingsOutput() HelmReleaseSettingsOutput {
return o
}
func (o HelmReleaseSettingsOutput) ToHelmReleaseSettingsOutputWithContext(ctx context.Context) HelmReleaseSettingsOutput {
return o
}
func (o HelmReleaseSettingsOutput) ToHelmReleaseSettingsPtrOutput() HelmReleaseSettingsPtrOutput {
return o.ToHelmReleaseSettingsPtrOutputWithContext(context.Background())
}
func (o HelmReleaseSettingsOutput) ToHelmReleaseSettingsPtrOutputWithContext(ctx context.Context) HelmReleaseSettingsPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v HelmReleaseSettings) *HelmReleaseSettings {
return &v
}).(HelmReleaseSettingsPtrOutput)
}
// The backend storage driver for Helm. Values are: configmap, secret, memory, sql.
func (o HelmReleaseSettingsOutput) Driver() pulumi.StringPtrOutput {
return o.ApplyT(func(v HelmReleaseSettings) *string { return v.Driver }).(pulumi.StringPtrOutput)
}
// The path to the helm plugins directory.
func (o HelmReleaseSettingsOutput) PluginsPath() pulumi.StringPtrOutput {
return o.ApplyT(func(v HelmReleaseSettings) *string { return v.PluginsPath }).(pulumi.StringPtrOutput)
}
// to test required args
func (o HelmReleaseSettingsOutput) RequiredArg() pulumi.StringOutput {
return o.ApplyT(func(v HelmReleaseSettings) string { return v.RequiredArg }).(pulumi.StringOutput)
}
type HelmReleaseSettingsPtrOutput struct{ *pulumi.OutputState }
func (HelmReleaseSettingsPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**HelmReleaseSettings)(nil)).Elem()
}
func (o HelmReleaseSettingsPtrOutput) ToHelmReleaseSettingsPtrOutput() HelmReleaseSettingsPtrOutput {
return o
}
func (o HelmReleaseSettingsPtrOutput) ToHelmReleaseSettingsPtrOutputWithContext(ctx context.Context) HelmReleaseSettingsPtrOutput {
return o
}
func (o HelmReleaseSettingsPtrOutput) Elem() HelmReleaseSettingsOutput {
return o.ApplyT(func(v *HelmReleaseSettings) HelmReleaseSettings {
if v != nil {
return *v
}
var ret HelmReleaseSettings
return ret
}).(HelmReleaseSettingsOutput)
}
// The backend storage driver for Helm. Values are: configmap, secret, memory, sql.
func (o HelmReleaseSettingsPtrOutput) Driver() pulumi.StringPtrOutput {
return o.ApplyT(func(v *HelmReleaseSettings) *string {
if v == nil {
return nil
}
return v.Driver
}).(pulumi.StringPtrOutput)
}
// The path to the helm plugins directory.
func (o HelmReleaseSettingsPtrOutput) PluginsPath() pulumi.StringPtrOutput {
return o.ApplyT(func(v *HelmReleaseSettings) *string {
if v == nil {
return nil
}
return v.PluginsPath
}).(pulumi.StringPtrOutput)
}
// to test required args
func (o HelmReleaseSettingsPtrOutput) RequiredArg() pulumi.StringPtrOutput {
return o.ApplyT(func(v *HelmReleaseSettings) *string {
if v == nil {
return nil
}
return &v.RequiredArg
}).(pulumi.StringPtrOutput)
}
// Options for tuning the Kubernetes client used by a Provider.
type KubeClientSettings struct {
// Maximum burst for throttle. Default value is 10.
Burst *int `pulumi:"burst"`
// Maximum queries per second (QPS) to the API server from this client. Default value is 5.
Qps *float64 `pulumi:"qps"`
RecTest *KubeClientSettings `pulumi:"recTest"`
}
// Defaults sets the appropriate defaults for KubeClientSettings
func (val *KubeClientSettings) Defaults() *KubeClientSettings {
if val == nil {
return nil
}
tmp := *val
if isZero(tmp.Burst) {
burst_ := getEnvOrDefault(0, parseEnvInt, "PULUMI_K8S_CLIENT_BURST").(int)
tmp.Burst = &burst_
}
if isZero(tmp.Qps) {
qps_ := getEnvOrDefault(0.0, parseEnvFloat, "PULUMI_K8S_CLIENT_QPS").(float64)
tmp.Qps = &qps_
}
tmp.RecTest = tmp.RecTest.Defaults()
return &tmp
}
// KubeClientSettingsInput is an input type that accepts KubeClientSettingsArgs and KubeClientSettingsOutput values.
// You can construct a concrete instance of `KubeClientSettingsInput` via:
//
// KubeClientSettingsArgs{...}
type KubeClientSettingsInput interface {
pulumi.Input
ToKubeClientSettingsOutput() KubeClientSettingsOutput
ToKubeClientSettingsOutputWithContext(context.Context) KubeClientSettingsOutput
}
// Options for tuning the Kubernetes client used by a Provider.
type KubeClientSettingsArgs struct {
// Maximum burst for throttle. Default value is 10.
Burst pulumi.IntPtrInput `pulumi:"burst"`
// Maximum queries per second (QPS) to the API server from this client. Default value is 5.
Qps pulumi.Float64PtrInput `pulumi:"qps"`
RecTest KubeClientSettingsPtrInput `pulumi:"recTest"`
}
func (KubeClientSettingsArgs) ElementType() reflect.Type {
return reflect.TypeOf((*KubeClientSettings)(nil)).Elem()
}
func (i KubeClientSettingsArgs) ToKubeClientSettingsOutput() KubeClientSettingsOutput {
return i.ToKubeClientSettingsOutputWithContext(context.Background())
}
func (i KubeClientSettingsArgs) ToKubeClientSettingsOutputWithContext(ctx context.Context) KubeClientSettingsOutput {
return pulumi.ToOutputWithContext(ctx, i).(KubeClientSettingsOutput)
}
func (i KubeClientSettingsArgs) ToKubeClientSettingsPtrOutput() KubeClientSettingsPtrOutput {
return i.ToKubeClientSettingsPtrOutputWithContext(context.Background())
}
func (i KubeClientSettingsArgs) ToKubeClientSettingsPtrOutputWithContext(ctx context.Context) KubeClientSettingsPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(KubeClientSettingsOutput).ToKubeClientSettingsPtrOutputWithContext(ctx)
}
// KubeClientSettingsPtrInput is an input type that accepts KubeClientSettingsArgs, KubeClientSettingsPtr and KubeClientSettingsPtrOutput values.
// You can construct a concrete instance of `KubeClientSettingsPtrInput` via:
//
// KubeClientSettingsArgs{...}
//
// or:
//
// nil
type KubeClientSettingsPtrInput interface {
pulumi.Input
ToKubeClientSettingsPtrOutput() KubeClientSettingsPtrOutput
ToKubeClientSettingsPtrOutputWithContext(context.Context) KubeClientSettingsPtrOutput
}
type kubeClientSettingsPtrType KubeClientSettingsArgs
func KubeClientSettingsPtr(v *KubeClientSettingsArgs) KubeClientSettingsPtrInput {
return (*kubeClientSettingsPtrType)(v)
}
func (*kubeClientSettingsPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**KubeClientSettings)(nil)).Elem()
}
func (i *kubeClientSettingsPtrType) ToKubeClientSettingsPtrOutput() KubeClientSettingsPtrOutput {
return i.ToKubeClientSettingsPtrOutputWithContext(context.Background())
}
func (i *kubeClientSettingsPtrType) ToKubeClientSettingsPtrOutputWithContext(ctx context.Context) KubeClientSettingsPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(KubeClientSettingsPtrOutput)
}
// Options for tuning the Kubernetes client used by a Provider.
type KubeClientSettingsOutput struct{ *pulumi.OutputState }
func (KubeClientSettingsOutput) ElementType() reflect.Type {
return reflect.TypeOf((*KubeClientSettings)(nil)).Elem()
}
func (o KubeClientSettingsOutput) ToKubeClientSettingsOutput() KubeClientSettingsOutput {
return o
}
func (o KubeClientSettingsOutput) ToKubeClientSettingsOutputWithContext(ctx context.Context) KubeClientSettingsOutput {
return o
}
func (o KubeClientSettingsOutput) ToKubeClientSettingsPtrOutput() KubeClientSettingsPtrOutput {
return o.ToKubeClientSettingsPtrOutputWithContext(context.Background())
}
func (o KubeClientSettingsOutput) ToKubeClientSettingsPtrOutputWithContext(ctx context.Context) KubeClientSettingsPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v KubeClientSettings) *KubeClientSettings {
return &v
}).(KubeClientSettingsPtrOutput)
}
// Maximum burst for throttle. Default value is 10.
func (o KubeClientSettingsOutput) Burst() pulumi.IntPtrOutput {
return o.ApplyT(func(v KubeClientSettings) *int { return v.Burst }).(pulumi.IntPtrOutput)
}
// Maximum queries per second (QPS) to the API server from this client. Default value is 5.
func (o KubeClientSettingsOutput) Qps() pulumi.Float64PtrOutput {
return o.ApplyT(func(v KubeClientSettings) *float64 { return v.Qps }).(pulumi.Float64PtrOutput)
}
func (o KubeClientSettingsOutput) RecTest() KubeClientSettingsPtrOutput {
return o.ApplyT(func(v KubeClientSettings) *KubeClientSettings { return v.RecTest }).(KubeClientSettingsPtrOutput)
}
type KubeClientSettingsPtrOutput struct{ *pulumi.OutputState }
func (KubeClientSettingsPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**KubeClientSettings)(nil)).Elem()
}
func (o KubeClientSettingsPtrOutput) ToKubeClientSettingsPtrOutput() KubeClientSettingsPtrOutput {
return o
}
func (o KubeClientSettingsPtrOutput) ToKubeClientSettingsPtrOutputWithContext(ctx context.Context) KubeClientSettingsPtrOutput {
return o
}
func (o KubeClientSettingsPtrOutput) Elem() KubeClientSettingsOutput {
return o.ApplyT(func(v *KubeClientSettings) KubeClientSettings {
if v != nil {
return *v
}
var ret KubeClientSettings
return ret
}).(KubeClientSettingsOutput)
}
// Maximum burst for throttle. Default value is 10.
func (o KubeClientSettingsPtrOutput) Burst() pulumi.IntPtrOutput {
return o.ApplyT(func(v *KubeClientSettings) *int {
if v == nil {
return nil
}
return v.Burst
}).(pulumi.IntPtrOutput)
}
// Maximum queries per second (QPS) to the API server from this client. Default value is 5.
func (o KubeClientSettingsPtrOutput) Qps() pulumi.Float64PtrOutput {
return o.ApplyT(func(v *KubeClientSettings) *float64 {
if v == nil {
return nil
}
return v.Qps
}).(pulumi.Float64PtrOutput)
}
func (o KubeClientSettingsPtrOutput) RecTest() KubeClientSettingsPtrOutput {
return o.ApplyT(func(v *KubeClientSettings) *KubeClientSettings {
if v == nil {
return nil
}
return v.RecTest
}).(KubeClientSettingsPtrOutput)
}
// Make sure that defaults propagate through types
type LayeredType struct {
// The answer to the question
Answer *float64 `pulumi:"answer"`
Other HelmReleaseSettings `pulumi:"other"`
// Test how plain types interact
PlainOther *HelmReleaseSettings `pulumi:"plainOther"`
// The question already answered
Question *string `pulumi:"question"`
Recursive *LayeredType `pulumi:"recursive"`
// To ask and answer
Thinker string `pulumi:"thinker"`
}
// Defaults sets the appropriate defaults for LayeredType
func (val *LayeredType) Defaults() *LayeredType {
if val == nil {
return nil
}
tmp := *val
if isZero(tmp.Answer) {
answer_ := 42.0
tmp.Answer = &answer_
}
tmp.Other = *tmp.Other.Defaults()
tmp.PlainOther = tmp.PlainOther.Defaults()
if isZero(tmp.Question) {
question_ := getEnvOrDefault("<unknown>", nil, "PULUMI_THE_QUESTION").(string)
tmp.Question = &question_
}
tmp.Recursive = tmp.Recursive.Defaults()
if isZero(tmp.Thinker) {
tmp.Thinker = "not a good interaction"
}
return &tmp
}
// LayeredTypeInput is an input type that accepts LayeredTypeArgs and LayeredTypeOutput values.
// You can construct a concrete instance of `LayeredTypeInput` via:
//
// LayeredTypeArgs{...}
type LayeredTypeInput interface {
pulumi.Input
ToLayeredTypeOutput() LayeredTypeOutput
ToLayeredTypeOutputWithContext(context.Context) LayeredTypeOutput
}
// Make sure that defaults propagate through types
type LayeredTypeArgs struct {
// The answer to the question
Answer pulumi.Float64PtrInput `pulumi:"answer"`
Other HelmReleaseSettingsInput `pulumi:"other"`
// Test how plain types interact
PlainOther *HelmReleaseSettingsArgs `pulumi:"plainOther"`
// The question already answered
Question pulumi.StringPtrInput `pulumi:"question"`
Recursive LayeredTypePtrInput `pulumi:"recursive"`
// To ask and answer
Thinker pulumi.StringInput `pulumi:"thinker"`
}
func (LayeredTypeArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LayeredType)(nil)).Elem()
}
func (i LayeredTypeArgs) ToLayeredTypeOutput() LayeredTypeOutput {
return i.ToLayeredTypeOutputWithContext(context.Background())
}
func (i LayeredTypeArgs) ToLayeredTypeOutputWithContext(ctx context.Context) LayeredTypeOutput {
return pulumi.ToOutputWithContext(ctx, i).(LayeredTypeOutput)
}
func (i LayeredTypeArgs) ToLayeredTypePtrOutput() LayeredTypePtrOutput {
return i.ToLayeredTypePtrOutputWithContext(context.Background())
}
func (i LayeredTypeArgs) ToLayeredTypePtrOutputWithContext(ctx context.Context) LayeredTypePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(LayeredTypeOutput).ToLayeredTypePtrOutputWithContext(ctx)
}
// LayeredTypePtrInput is an input type that accepts LayeredTypeArgs, LayeredTypePtr and LayeredTypePtrOutput values.
// You can construct a concrete instance of `LayeredTypePtrInput` via:
//
// LayeredTypeArgs{...}
//
// or:
//
// nil
type LayeredTypePtrInput interface {
pulumi.Input
ToLayeredTypePtrOutput() LayeredTypePtrOutput
ToLayeredTypePtrOutputWithContext(context.Context) LayeredTypePtrOutput
}
type layeredTypePtrType LayeredTypeArgs
func LayeredTypePtr(v *LayeredTypeArgs) LayeredTypePtrInput {
return (*layeredTypePtrType)(v)
}
func (*layeredTypePtrType) ElementType() reflect.Type {
return reflect.TypeOf((**LayeredType)(nil)).Elem()
}
func (i *layeredTypePtrType) ToLayeredTypePtrOutput() LayeredTypePtrOutput {
return i.ToLayeredTypePtrOutputWithContext(context.Background())
}
func (i *layeredTypePtrType) ToLayeredTypePtrOutputWithContext(ctx context.Context) LayeredTypePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(LayeredTypePtrOutput)
}
// Make sure that defaults propagate through types
type LayeredTypeOutput struct{ *pulumi.OutputState }
func (LayeredTypeOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LayeredType)(nil)).Elem()
}
func (o LayeredTypeOutput) ToLayeredTypeOutput() LayeredTypeOutput {
return o
}
func (o LayeredTypeOutput) ToLayeredTypeOutputWithContext(ctx context.Context) LayeredTypeOutput {
return o
}
func (o LayeredTypeOutput) ToLayeredTypePtrOutput() LayeredTypePtrOutput {
return o.ToLayeredTypePtrOutputWithContext(context.Background())
}
func (o LayeredTypeOutput) ToLayeredTypePtrOutputWithContext(ctx context.Context) LayeredTypePtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v LayeredType) *LayeredType {
return &v
}).(LayeredTypePtrOutput)
}
// The answer to the question
func (o LayeredTypeOutput) Answer() pulumi.Float64PtrOutput {
return o.ApplyT(func(v LayeredType) *float64 { return v.Answer }).(pulumi.Float64PtrOutput)
}
func (o LayeredTypeOutput) Other() HelmReleaseSettingsOutput {
return o.ApplyT(func(v LayeredType) HelmReleaseSettings { return v.Other }).(HelmReleaseSettingsOutput)
}
// Test how plain types interact
func (o LayeredTypeOutput) PlainOther() HelmReleaseSettingsPtrOutput {
return o.ApplyT(func(v LayeredType) *HelmReleaseSettings { return v.PlainOther }).(HelmReleaseSettingsPtrOutput)
}
// The question already answered
func (o LayeredTypeOutput) Question() pulumi.StringPtrOutput {
return o.ApplyT(func(v LayeredType) *string { return v.Question }).(pulumi.StringPtrOutput)
}
func (o LayeredTypeOutput) Recursive() LayeredTypePtrOutput {
return o.ApplyT(func(v LayeredType) *LayeredType { return v.Recursive }).(LayeredTypePtrOutput)
}
// To ask and answer
func (o LayeredTypeOutput) Thinker() pulumi.StringOutput {
return o.ApplyT(func(v LayeredType) string { return v.Thinker }).(pulumi.StringOutput)
}
type LayeredTypePtrOutput struct{ *pulumi.OutputState }
func (LayeredTypePtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**LayeredType)(nil)).Elem()
}
func (o LayeredTypePtrOutput) ToLayeredTypePtrOutput() LayeredTypePtrOutput {
return o
}
func (o LayeredTypePtrOutput) ToLayeredTypePtrOutputWithContext(ctx context.Context) LayeredTypePtrOutput {
return o
}
func (o LayeredTypePtrOutput) Elem() LayeredTypeOutput {
return o.ApplyT(func(v *LayeredType) LayeredType {
if v != nil {
return *v
}
var ret LayeredType
return ret
}).(LayeredTypeOutput)
}
// The answer to the question
func (o LayeredTypePtrOutput) Answer() pulumi.Float64PtrOutput {
return o.ApplyT(func(v *LayeredType) *float64 {
if v == nil {
return nil
}
return v.Answer
}).(pulumi.Float64PtrOutput)
}
func (o LayeredTypePtrOutput) Other() HelmReleaseSettingsPtrOutput {
return o.ApplyT(func(v *LayeredType) *HelmReleaseSettings {
if v == nil {
return nil
}
return &v.Other
}).(HelmReleaseSettingsPtrOutput)
}
// Test how plain types interact
func (o LayeredTypePtrOutput) PlainOther() HelmReleaseSettingsPtrOutput {
return o.ApplyT(func(v *LayeredType) *HelmReleaseSettings {
if v == nil {
return nil
}
return v.PlainOther
}).(HelmReleaseSettingsPtrOutput)
}
// The question already answered
func (o LayeredTypePtrOutput) Question() pulumi.StringPtrOutput {
return o.ApplyT(func(v *LayeredType) *string {
if v == nil {
return nil
}
return v.Question
}).(pulumi.StringPtrOutput)
}
func (o LayeredTypePtrOutput) Recursive() LayeredTypePtrOutput {
return o.ApplyT(func(v *LayeredType) *LayeredType {
if v == nil {
return nil
}
return v.Recursive
}).(LayeredTypePtrOutput)
}
// To ask and answer
func (o LayeredTypePtrOutput) Thinker() pulumi.StringPtrOutput {
return o.ApplyT(func(v *LayeredType) *string {
if v == nil {
return nil
}
return &v.Thinker
}).(pulumi.StringPtrOutput)
}
// A test for namespaces (mod main)
type Typ struct {
Mod1 *mod1.Typ `pulumi:"mod1"`
Mod2 *mod2.Typ `pulumi:"mod2"`
Val *string `pulumi:"val"`
}
// Defaults sets the appropriate defaults for Typ
func (val *Typ) Defaults() *Typ {
if val == nil {
return nil
}
tmp := *val
tmp.Mod1 = tmp.Mod1.Defaults()
tmp.Mod2 = tmp.Mod2.Defaults()
if isZero(tmp.Val) {
val_ := "mod main"
tmp.Val = &val_
}
return &tmp
}
// TypInput is an input type that accepts TypArgs and TypOutput values.
// You can construct a concrete instance of `TypInput` via:
//
// TypArgs{...}
type TypInput interface {
pulumi.Input
ToTypOutput() TypOutput
ToTypOutputWithContext(context.Context) TypOutput
}
// A test for namespaces (mod main)
type TypArgs struct {
Mod1 mod1.TypPtrInput `pulumi:"mod1"`
Mod2 mod2.TypPtrInput `pulumi:"mod2"`
Val pulumi.StringPtrInput `pulumi:"val"`
}
func (TypArgs) ElementType() reflect.Type {
return reflect.TypeOf((*Typ)(nil)).Elem()
}
func (i TypArgs) ToTypOutput() TypOutput {
return i.ToTypOutputWithContext(context.Background())
}
func (i TypArgs) ToTypOutputWithContext(ctx context.Context) TypOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypOutput)
}
func (i TypArgs) ToTypPtrOutput() TypPtrOutput {
return i.ToTypPtrOutputWithContext(context.Background())
}
func (i TypArgs) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypOutput).ToTypPtrOutputWithContext(ctx)
}
// TypPtrInput is an input type that accepts TypArgs, TypPtr and TypPtrOutput values.
// You can construct a concrete instance of `TypPtrInput` via:
//
// TypArgs{...}
//
// or:
//
// nil
type TypPtrInput interface {
pulumi.Input
ToTypPtrOutput() TypPtrOutput
ToTypPtrOutputWithContext(context.Context) TypPtrOutput
}
type typPtrType TypArgs
func TypPtr(v *TypArgs) TypPtrInput {
return (*typPtrType)(v)
}
func (*typPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Typ)(nil)).Elem()
}
func (i *typPtrType) ToTypPtrOutput() TypPtrOutput {
return i.ToTypPtrOutputWithContext(context.Background())
}
func (i *typPtrType) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypPtrOutput)
}
// A test for namespaces (mod main)
type TypOutput struct{ *pulumi.OutputState }
func (TypOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Typ)(nil)).Elem()
}
func (o TypOutput) ToTypOutput() TypOutput {
return o
}
func (o TypOutput) ToTypOutputWithContext(ctx context.Context) TypOutput {
return o
}
func (o TypOutput) ToTypPtrOutput() TypPtrOutput {
return o.ToTypPtrOutputWithContext(context.Background())
}
func (o TypOutput) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v Typ) *Typ {
return &v
}).(TypPtrOutput)
}
func (o TypOutput) Mod1() mod1.TypPtrOutput {
return o.ApplyT(func(v Typ) *mod1.Typ { return v.Mod1 }).(mod1.TypPtrOutput)
}
func (o TypOutput) Mod2() mod2.TypPtrOutput {
return o.ApplyT(func(v Typ) *mod2.Typ { return v.Mod2 }).(mod2.TypPtrOutput)
}
func (o TypOutput) Val() pulumi.StringPtrOutput {
return o.ApplyT(func(v Typ) *string { return v.Val }).(pulumi.StringPtrOutput)
}
type TypPtrOutput struct{ *pulumi.OutputState }
func (TypPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Typ)(nil)).Elem()
}
func (o TypPtrOutput) ToTypPtrOutput() TypPtrOutput {
return o
}
func (o TypPtrOutput) ToTypPtrOutputWithContext(ctx context.Context) TypPtrOutput {
return o
}
func (o TypPtrOutput) Elem() TypOutput {
return o.ApplyT(func(v *Typ) Typ {
if v != nil {
return *v
}
var ret Typ
return ret
}).(TypOutput)
}
func (o TypPtrOutput) Mod1() mod1.TypPtrOutput {
return o.ApplyT(func(v *Typ) *mod1.Typ {
if v == nil {
return nil
}
return v.Mod1
}).(mod1.TypPtrOutput)
}
func (o TypPtrOutput) Mod2() mod2.TypPtrOutput {
return o.ApplyT(func(v *Typ) *mod2.Typ {
if v == nil {
return nil
}
return v.Mod2
}).(mod2.TypPtrOutput)
}
func (o TypPtrOutput) Val() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Typ) *string {
if v == nil {
return nil
}
return v.Val
}).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*HelmReleaseSettingsInput)(nil)).Elem(), HelmReleaseSettingsArgs{})
pulumi.RegisterInputType(reflect.TypeOf((*HelmReleaseSettingsPtrInput)(nil)).Elem(), HelmReleaseSettingsArgs{})
pulumi.RegisterInputType(reflect.TypeOf((*KubeClientSettingsInput)(nil)).Elem(), KubeClientSettingsArgs{})
pulumi.RegisterInputType(reflect.TypeOf((*KubeClientSettingsPtrInput)(nil)).Elem(), KubeClientSettingsArgs{})
pulumi.RegisterInputType(reflect.TypeOf((*LayeredTypeInput)(nil)).Elem(), LayeredTypeArgs{})
pulumi.RegisterInputType(reflect.TypeOf((*LayeredTypePtrInput)(nil)).Elem(), LayeredTypeArgs{})
pulumi.RegisterInputType(reflect.TypeOf((*TypInput)(nil)).Elem(), TypArgs{})
pulumi.RegisterInputType(reflect.TypeOf((*TypPtrInput)(nil)).Elem(), TypArgs{})
pulumi.RegisterOutputType(HelmReleaseSettingsOutput{})
pulumi.RegisterOutputType(HelmReleaseSettingsPtrOutput{})
pulumi.RegisterOutputType(KubeClientSettingsOutput{})
pulumi.RegisterOutputType(KubeClientSettingsPtrOutput{})
pulumi.RegisterOutputType(LayeredTypeOutput{})
pulumi.RegisterOutputType(LayeredTypePtrOutput{})
pulumi.RegisterOutputType(TypOutput{})
pulumi.RegisterOutputType(TypPtrOutput{})
}

View File

@ -75,3 +75,11 @@ func PkgVersion() (semver.Version, error) {
}
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

@ -0,0 +1,184 @@
// *** 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";
/**
* BETA FEATURE - Options to configure the Helm Release resource.
*/
export interface HelmReleaseSettings {
/**
* The backend storage driver for Helm. Values are: configmap, secret, memory, sql.
*/
driver?: string;
/**
* The path to the helm plugins directory.
*/
pluginsPath?: string;
/**
* to test required args
*/
requiredArg: string;
}
/**
* helmReleaseSettingsProvideDefaults sets the appropriate defaults for HelmReleaseSettings
*/
export function helmReleaseSettingsProvideDefaults(val: HelmReleaseSettings): HelmReleaseSettings {
return {
...val,
driver: (val.driver) ?? (utilities.getEnv("PULUMI_K8S_HELM_DRIVER") || "secret"),
pluginsPath: (val.pluginsPath) ?? utilities.getEnv("PULUMI_K8S_HELM_PLUGINS_PATH"),
};
}
/**
* BETA FEATURE - Options to configure the Helm Release resource.
*/
export interface HelmReleaseSettingsArgs {
/**
* The backend storage driver for Helm. Values are: configmap, secret, memory, sql.
*/
driver?: pulumi.Input<string>;
/**
* The path to the helm plugins directory.
*/
pluginsPath?: pulumi.Input<string>;
/**
* to test required args
*/
requiredArg: pulumi.Input<string>;
}
/**
* helmReleaseSettingsArgsProvideDefaults sets the appropriate defaults for HelmReleaseSettingsArgs
*/
export function helmReleaseSettingsArgsProvideDefaults(val: HelmReleaseSettingsArgs): HelmReleaseSettingsArgs {
return {
...val,
driver: (val.driver) ?? (utilities.getEnv("PULUMI_K8S_HELM_DRIVER") || "secret"),
pluginsPath: (val.pluginsPath) ?? utilities.getEnv("PULUMI_K8S_HELM_PLUGINS_PATH"),
};
}
/**
* Options for tuning the Kubernetes client used by a Provider.
*/
export interface KubeClientSettingsArgs {
/**
* Maximum burst for throttle. Default value is 10.
*/
burst?: pulumi.Input<number>;
/**
* Maximum queries per second (QPS) to the API server from this client. Default value is 5.
*/
qps?: pulumi.Input<number>;
recTest?: pulumi.Input<inputs.KubeClientSettingsArgs>;
}
/**
* kubeClientSettingsArgsProvideDefaults sets the appropriate defaults for KubeClientSettingsArgs
*/
export function kubeClientSettingsArgsProvideDefaults(val: KubeClientSettingsArgs): KubeClientSettingsArgs {
return {
...val,
burst: (val.burst) ?? utilities.getEnvNumber("PULUMI_K8S_CLIENT_BURST"),
qps: (val.qps) ?? utilities.getEnvNumber("PULUMI_K8S_CLIENT_QPS"),
recTest: (val.recTest ? pulumi.output(val.recTest).apply(inputs.kubeClientSettingsArgsProvideDefaults) : undefined),
};
}
/**
* Make sure that defaults propagate through types
*/
export interface LayeredTypeArgs {
/**
* The answer to the question
*/
answer?: pulumi.Input<number>;
other: pulumi.Input<inputs.HelmReleaseSettingsArgs>;
/**
* Test how plain types interact
*/
plainOther?: inputs.HelmReleaseSettingsArgs;
/**
* The question already answered
*/
question?: pulumi.Input<string>;
recursive?: pulumi.Input<inputs.LayeredTypeArgs>;
/**
* To ask and answer
*/
thinker: pulumi.Input<string>;
}
/**
* layeredTypeArgsProvideDefaults sets the appropriate defaults for LayeredTypeArgs
*/
export function layeredTypeArgsProvideDefaults(val: LayeredTypeArgs): LayeredTypeArgs {
return {
...val,
answer: (val.answer) ?? 42,
other: pulumi.output(val.other).apply(inputs.helmReleaseSettingsArgsProvideDefaults),
plainOther: (val.plainOther ? inputs.helmReleaseSettingsArgsProvideDefaults(val.plainOther) : undefined),
question: (val.question) ?? (utilities.getEnv("PULUMI_THE_QUESTION") || "<unknown>"),
recursive: (val.recursive ? pulumi.output(val.recursive).apply(inputs.layeredTypeArgsProvideDefaults) : undefined),
thinker: (val.thinker) ?? "not a good interaction",
};
}
/**
* A test for namespaces (mod main)
*/
export interface TypArgs {
mod1?: pulumi.Input<inputs.mod1.TypArgs>;
mod2?: pulumi.Input<inputs.mod2.TypArgs>;
val?: pulumi.Input<string>;
}
/**
* typArgsProvideDefaults sets the appropriate defaults for TypArgs
*/
export function typArgsProvideDefaults(val: TypArgs): TypArgs {
return {
...val,
mod1: (val.mod1 ? pulumi.output(val.mod1).apply(inputs.mod1.typArgsProvideDefaults) : undefined),
mod2: (val.mod2 ? pulumi.output(val.mod2).apply(inputs.mod2.typArgsProvideDefaults) : undefined),
val: (val.val) ?? "mod main",
};
}
export namespace mod1 {
/**
* A test for namespaces (mod 1)
*/
export interface TypArgs {
val?: pulumi.Input<string>;
}
/**
* typArgsProvideDefaults sets the appropriate defaults for TypArgs
*/
export function typArgsProvideDefaults(val: TypArgs): TypArgs {
return {
...val,
val: (val.val) ?? (utilities.getEnv("PULUMI_EXAMPLE_MOD1_DEFAULT") || "mod1"),
};
}
}
export namespace mod2 {
/**
* A test for namespaces (mod 2)
*/
export interface TypArgs {
mod1?: pulumi.Input<inputs.mod1.TypArgs>;
val?: pulumi.Input<string>;
}
/**
* typArgsProvideDefaults sets the appropriate defaults for TypArgs
*/
export function typArgsProvideDefaults(val: TypArgs): TypArgs {
return {
...val,
mod1: (val.mod1 ? pulumi.output(val.mod1).apply(inputs.mod1.typArgsProvideDefaults) : undefined),
val: (val.val) ?? "mod2",
};
}
}

View File

@ -0,0 +1,36 @@
# 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__ = [
'TypArgs',
]
@pulumi.input_type
class TypArgs:
def __init__(__self__, *,
val: Optional[pulumi.Input[str]] = None):
"""
A test for namespaces (mod 1)
"""
if val is None:
val = (_utilities.get_env('PULUMI_EXAMPLE_MOD1_DEFAULT') or 'mod1')
if val is not None:
pulumi.set(__self__, "val", val)
@property
@pulumi.getter
def val(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "val")
@val.setter
def val(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "val", value)

View File

@ -0,0 +1,237 @@
{
"version": "0.0.1",
"name": "example",
"provider": {
"description": "The provider type for the kubernetes package.",
"type": "object",
"inputProperties": {
"helmReleaseSettings": {
"$ref": "#/types/example:index:HelmReleaseSettings",
"description": "BETA FEATURE - Options to configure the Helm Release resource."
}
}
},
"resources": {
"example:index:Foo": {
"description": "test new feature with resoruces",
"inputProperties": {
"argument": {
"type": "string",
"plain": true
},
"settings": {
"$ref": "#/types/example:index:LayeredType",
"description": "describing things"
},
"kubeClientSettings": {
"$ref": "#/types/example:index:KubeClientSettings",
"description": "Options for tuning the Kubernetes client used by a Provider."
},
"backupKubeClientSettings": {
"$ref": "#/types/example:index:KubeClientSettings",
"description": "Options for tuning the Kubernetes client used by a Provider."
}
},
"properties": {
"defaultKubeClientSettings": {
"$ref": "#/types/example:index:KubeClientSettings",
"description": "A test for plain types",
"plain": true
}
},
"requiredInputs": ["backupKubeClientSettings"]
},
"example:index:moduleTest": {
"inputProperties": {
"val": {
"$ref": "#/types/example:index:typ"
},
"mod1": {
"$ref": "#/types/example:mod1:typ"
}
}
}
},
"types": {
"example:mod1:typ": {
"description": "A test for namespaces (mod 1)",
"properties": {
"val": {
"type": "string",
"default": "mod1",
"defaultInfo": {
"environment": ["PULUMI_EXAMPLE_MOD1_DEFAULT"]
}
}
},
"type": "object"
},
"example:mod2:typ": {
"description": "A test for namespaces (mod 2)",
"properties": {
"val": {
"type": "string",
"default": "mod2"
},
"mod1": {
"$ref": "#/types/example:mod1:typ"
}
},
"type": "object"
},
"example:index:typ": {
"description": "A test for namespaces (mod main)",
"properties": {
"val": {
"type": "string",
"default": "mod main"
},
"mod1": {
"$ref": "#/types/example:mod1:typ"
},
"mod2": {
"$ref": "#/types/example:mod2:typ"
}
},
"type": "object"
},
"example:index:HelmReleaseSettings": {
"description": "BETA FEATURE - Options to configure the Helm Release resource.",
"properties": {
"driver": {
"type": "string",
"description": "The backend storage driver for Helm. Values are: configmap, secret, memory, sql.",
"default": "secret",
"defaultInfo": {
"environment": ["PULUMI_K8S_HELM_DRIVER"]
}
},
"pluginsPath": {
"type": "string",
"description": "The path to the helm plugins directory.",
"defaultInfo": {
"environment": ["PULUMI_K8S_HELM_PLUGINS_PATH"]
}
},
"requiredArg": {
"type": "string",
"description": "to test required args"
}
},
"required": ["requiredArg"],
"type": "object"
},
"example:index:LayeredType": {
"description": "Make sure that defaults propagate through types",
"type": "object",
"properties": {
"answer": {
"description": "The answer to the question",
"type": "number",
"default": 42
},
"question": {
"description": "The question already answered",
"type": "string",
"default": "<unknown>",
"defaultInfo": {
"environment": ["PULUMI_THE_QUESTION"]
}
},
"thinker": {
"description": "To ask and answer",
"type": "string",
"default": "not a good interaction"
},
"other": {
"$ref": "#/types/example:index:HelmReleaseSettings"
},
"plainOther": {
"description": "Test how plain types interact",
"$ref": "#/types/example:index:HelmReleaseSettings",
"plain": true
},
"recursive": {
"$ref": "#/types/example:index:LayeredType"
}
},
"required": ["other", "thinker"]
},
"example:index:KubeClientSettings": {
"description": "Options for tuning the Kubernetes client used by a Provider.",
"properties": {
"burst": {
"type": "integer",
"description": "Maximum burst for throttle. Default value is 10.",
"defaultInfo": {
"environment": ["PULUMI_K8S_CLIENT_BURST"]
}
},
"qps": {
"type": "number",
"description": "Maximum queries per second (QPS) to the API server from this client. Default value is 5.",
"defaultInfo": {
"environment": ["PULUMI_K8S_CLIENT_QPS"]
}
},
"recTest": {
"$ref": "#/types/example:index:KubeClientSettings"
}
},
"type": "object"
}
},
"functions": {
"mypkg::funcWithAllOptionalInputs": {
"description": "Check codegen of functions with all optional inputs.",
"inputs": {
"type": "object",
"properties": {
"a": {
"$ref": "#/types/example:index:HelmReleaseSettings",
"description": "Property A"
},
"b": {
"type": "string",
"description": "Property B",
"default": "defValue"
}
}
},
"outputs": {
"properties": {
"r": {
"type": "string"
}
},
"type": "object",
"required": ["r"]
}
}
},
"language": {
"csharp": {
"packageReferences": {
"Pulumi": "3.12"
}
},
"go": {
"importBasePath": "plain-object-defaults/example"
},
"nodejs": {
"dependencies": {
"@pulumi/pulumi": "^3.12"
},
"devDependencies": {
"typescript": "^3.7.0"
}
},
"python": {}
}
}

View File

@ -0,0 +1,41 @@
---
title: "example"
title_tag: "example Package"
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="modules">Modules</h2>
<ul class="api">
<li><a href="mod1/" title="mod1"><span class="api-symbol api-symbol--module"></span>mod1</a></li>
<li><a href="mod2/" title="mod2"><span class="api-symbol api-symbol--module"></span>mod2</a></li>
</ul>
<h2 id="resources">Resources</h2>
<ul class="api">
<li><a href="foo" title="Foo"><span class="api-symbol api-symbol--resource"></span>Foo</a></li>
<li><a href="moduletest" title="ModuleTest"><span class="api-symbol api-symbol--resource"></span>ModuleTest</a></li>
<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="funcwithalloptionalinputs" title="FuncWithAllOptionalInputs"><span class="api-symbol api-symbol--function"></span>FuncWithAllOptionalInputs</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

@ -0,0 +1,11 @@
{
"emittedFiles": [
"_index.md",
"foo/_index.md",
"funcwithalloptionalinputs/_index.md",
"mod1/_index.md",
"mod2/_index.md",
"moduletest/_index.md",
"provider/_index.md"
]
}

View File

@ -0,0 +1,849 @@
---
title: "Foo"
title_tag: "example.Foo"
meta_desc: "Documentation for the example.Foo 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! -->
test new feature with resoruces
## Create a Foo 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">Foo</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">FooArgs</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">Foo</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">argument</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">backup_kube_client_settings</span><span class="p">:</span> <span class="nx">Optional[KubeClientSettingsArgs]</span> = None<span class="p">,</span>
<span class="nx">kube_client_settings</span><span class="p">:</span> <span class="nx">Optional[KubeClientSettingsArgs]</span> = None<span class="p">,</span>
<span class="nx">settings</span><span class="p">:</span> <span class="nx">Optional[LayeredTypeArgs]</span> = None<span class="p">)</span>
<span class=nd>@overload</span>
<span class="k">def </span><span class="nx">Foo</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">FooArgs</a></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></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">NewFoo</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">FooArgs</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">Foo</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">Foo</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">FooArgs</a></span><span class="p"> </span><span class="nx">args<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-required" title="Required">
<span>args</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#inputs">FooArgs</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-required" title="Required">
<span>args</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#inputs">FooArgs</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-required" title="Required">
<span>args</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#inputs">FooArgs</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-required" title="Required">
<span>args</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#inputs">FooArgs</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 %}}
## Foo 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 Foo resource accepts the following [input]({{< relref "/docs/intro/concepts/inputs-outputs" >}}) properties:
{{% choosable language csharp %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="backupkubeclientsettings_csharp">
<a href="#backupkubeclientsettings_csharp" style="color: inherit; text-decoration: inherit;">Backup<wbr>Kube<wbr>Client<wbr>Settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings<wbr>Args</a></span>
</dt>
<dd>{{% md %}}Options for tuning the Kubernetes client used by a Provider.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="argument_csharp">
<a href="#argument_csharp" style="color: inherit; text-decoration: inherit;">Argument</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="kubeclientsettings_csharp">
<a href="#kubeclientsettings_csharp" style="color: inherit; text-decoration: inherit;">Kube<wbr>Client<wbr>Settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings<wbr>Args</a></span>
</dt>
<dd>{{% md %}}Options for tuning the Kubernetes client used by a Provider.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="settings_csharp">
<a href="#settings_csharp" style="color: inherit; text-decoration: inherit;">Settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#layeredtype">Layered<wbr>Type<wbr>Args</a></span>
</dt>
<dd>{{% md %}}describing things{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language go %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="backupkubeclientsettings_go">
<a href="#backupkubeclientsettings_go" style="color: inherit; text-decoration: inherit;">Backup<wbr>Kube<wbr>Client<wbr>Settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings<wbr>Args</a></span>
</dt>
<dd>{{% md %}}Options for tuning the Kubernetes client used by a Provider.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="argument_go">
<a href="#argument_go" style="color: inherit; text-decoration: inherit;">Argument</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="kubeclientsettings_go">
<a href="#kubeclientsettings_go" style="color: inherit; text-decoration: inherit;">Kube<wbr>Client<wbr>Settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings<wbr>Args</a></span>
</dt>
<dd>{{% md %}}Options for tuning the Kubernetes client used by a Provider.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="settings_go">
<a href="#settings_go" style="color: inherit; text-decoration: inherit;">Settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#layeredtype">Layered<wbr>Type<wbr>Args</a></span>
</dt>
<dd>{{% md %}}describing things{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language nodejs %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="backupkubeclientsettings_nodejs">
<a href="#backupkubeclientsettings_nodejs" style="color: inherit; text-decoration: inherit;">backup<wbr>Kube<wbr>Client<wbr>Settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings<wbr>Args</a></span>
</dt>
<dd>{{% md %}}Options for tuning the Kubernetes client used by a Provider.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="argument_nodejs">
<a href="#argument_nodejs" style="color: inherit; text-decoration: inherit;">argument</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="kubeclientsettings_nodejs">
<a href="#kubeclientsettings_nodejs" style="color: inherit; text-decoration: inherit;">kube<wbr>Client<wbr>Settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings<wbr>Args</a></span>
</dt>
<dd>{{% md %}}Options for tuning the Kubernetes client used by a Provider.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="settings_nodejs">
<a href="#settings_nodejs" style="color: inherit; text-decoration: inherit;">settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#layeredtype">Layered<wbr>Type<wbr>Args</a></span>
</dt>
<dd>{{% md %}}describing things{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language python %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="backup_kube_client_settings_python">
<a href="#backup_kube_client_settings_python" style="color: inherit; text-decoration: inherit;">backup_<wbr>kube_<wbr>client_<wbr>settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings<wbr>Args</a></span>
</dt>
<dd>{{% md %}}Options for tuning the Kubernetes client used by a Provider.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="argument_python">
<a href="#argument_python" style="color: inherit; text-decoration: inherit;">argument</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="kube_client_settings_python">
<a href="#kube_client_settings_python" style="color: inherit; text-decoration: inherit;">kube_<wbr>client_<wbr>settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings<wbr>Args</a></span>
</dt>
<dd>{{% md %}}Options for tuning the Kubernetes client used by a Provider.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="settings_python">
<a href="#settings_python" style="color: inherit; text-decoration: inherit;">settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#layeredtype">Layered<wbr>Type<wbr>Args</a></span>
</dt>
<dd>{{% md %}}describing things{{% /md %}}</dd></dl>
{{% /choosable %}}
### Outputs
All [input](#inputs) properties are implicitly available as output properties. Additionally, the Foo resource produces the following output properties:
{{% choosable language csharp %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_csharp">
<a href="#id_csharp" style="color: inherit; text-decoration: inherit;">Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
title="">
<span id="defaultkubeclientsettings_csharp">
<a href="#defaultkubeclientsettings_csharp" style="color: inherit; text-decoration: inherit;">Default<wbr>Kube<wbr>Client<wbr>Settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}A test for plain types{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language go %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_go">
<a href="#id_go" style="color: inherit; text-decoration: inherit;">Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
title="">
<span id="defaultkubeclientsettings_go">
<a href="#defaultkubeclientsettings_go" style="color: inherit; text-decoration: inherit;">Default<wbr>Kube<wbr>Client<wbr>Settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}A test for plain types{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language nodejs %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_nodejs">
<a href="#id_nodejs" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
title="">
<span id="defaultkubeclientsettings_nodejs">
<a href="#defaultkubeclientsettings_nodejs" style="color: inherit; text-decoration: inherit;">default<wbr>Kube<wbr>Client<wbr>Settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}A test for plain types{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language python %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_python">
<a href="#id_python" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}The provider-assigned unique ID for this managed resource.{{% /md %}}</dd><dt class="property-"
title="">
<span id="default_kube_client_settings_python">
<a href="#default_kube_client_settings_python" style="color: inherit; text-decoration: inherit;">default_<wbr>kube_<wbr>client_<wbr>settings</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}A test for plain types{{% /md %}}</dd></dl>
{{% /choosable %}}
## Supporting Types
<h4 id="helmreleasesettings">Helm<wbr>Release<wbr>Settings</h4>
{{% choosable language csharp %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="requiredarg_csharp">
<a href="#requiredarg_csharp" style="color: inherit; text-decoration: inherit;">Required<wbr>Arg</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}to test required args{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="driver_csharp">
<a href="#driver_csharp" style="color: inherit; text-decoration: inherit;">Driver</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The backend storage driver for Helm. Values are: configmap, secret, memory, sql.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="pluginspath_csharp">
<a href="#pluginspath_csharp" style="color: inherit; text-decoration: inherit;">Plugins<wbr>Path</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The path to the helm plugins directory.{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language go %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="requiredarg_go">
<a href="#requiredarg_go" style="color: inherit; text-decoration: inherit;">Required<wbr>Arg</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}to test required args{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="driver_go">
<a href="#driver_go" style="color: inherit; text-decoration: inherit;">Driver</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The backend storage driver for Helm. Values are: configmap, secret, memory, sql.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="pluginspath_go">
<a href="#pluginspath_go" style="color: inherit; text-decoration: inherit;">Plugins<wbr>Path</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The path to the helm plugins directory.{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language nodejs %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="requiredarg_nodejs">
<a href="#requiredarg_nodejs" style="color: inherit; text-decoration: inherit;">required<wbr>Arg</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}to test required args{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="driver_nodejs">
<a href="#driver_nodejs" style="color: inherit; text-decoration: inherit;">driver</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The backend storage driver for Helm. Values are: configmap, secret, memory, sql.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="pluginspath_nodejs">
<a href="#pluginspath_nodejs" style="color: inherit; text-decoration: inherit;">plugins<wbr>Path</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The path to the helm plugins directory.{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language python %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="required_arg_python">
<a href="#required_arg_python" style="color: inherit; text-decoration: inherit;">required_<wbr>arg</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}to test required args{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="driver_python">
<a href="#driver_python" style="color: inherit; text-decoration: inherit;">driver</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}The backend storage driver for Helm. Values are: configmap, secret, memory, sql.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="plugins_path_python">
<a href="#plugins_path_python" style="color: inherit; text-decoration: inherit;">plugins_<wbr>path</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}The path to the helm plugins directory.{{% /md %}}</dd></dl>
{{% /choosable %}}
<h4 id="kubeclientsettings">Kube<wbr>Client<wbr>Settings</h4>
{{% choosable language csharp %}}
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="burst_csharp">
<a href="#burst_csharp" style="color: inherit; text-decoration: inherit;">Burst</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">int</span>
</dt>
<dd>{{% md %}}Maximum burst for throttle. Default value is 10.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="qps_csharp">
<a href="#qps_csharp" style="color: inherit; text-decoration: inherit;">Qps</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">double</span>
</dt>
<dd>{{% md %}}Maximum queries per second (QPS) to the API server from this client. Default value is 5.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="rectest_csharp">
<a href="#rectest_csharp" style="color: inherit; text-decoration: inherit;">Rec<wbr>Test</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language go %}}
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="burst_go">
<a href="#burst_go" style="color: inherit; text-decoration: inherit;">Burst</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">int</span>
</dt>
<dd>{{% md %}}Maximum burst for throttle. Default value is 10.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="qps_go">
<a href="#qps_go" style="color: inherit; text-decoration: inherit;">Qps</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">float64</span>
</dt>
<dd>{{% md %}}Maximum queries per second (QPS) to the API server from this client. Default value is 5.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="rectest_go">
<a href="#rectest_go" style="color: inherit; text-decoration: inherit;">Rec<wbr>Test</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language nodejs %}}
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="burst_nodejs">
<a href="#burst_nodejs" style="color: inherit; text-decoration: inherit;">burst</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">number</span>
</dt>
<dd>{{% md %}}Maximum burst for throttle. Default value is 10.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="qps_nodejs">
<a href="#qps_nodejs" style="color: inherit; text-decoration: inherit;">qps</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">number</span>
</dt>
<dd>{{% md %}}Maximum queries per second (QPS) to the API server from this client. Default value is 5.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="rectest_nodejs">
<a href="#rectest_nodejs" style="color: inherit; text-decoration: inherit;">rec<wbr>Test</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language python %}}
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="burst_python">
<a href="#burst_python" style="color: inherit; text-decoration: inherit;">burst</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">int</span>
</dt>
<dd>{{% md %}}Maximum burst for throttle. Default value is 10.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="qps_python">
<a href="#qps_python" style="color: inherit; text-decoration: inherit;">qps</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">float</span>
</dt>
<dd>{{% md %}}Maximum queries per second (QPS) to the API server from this client. Default value is 5.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="rec_test_python">
<a href="#rec_test_python" style="color: inherit; text-decoration: inherit;">rec_<wbr>test</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#kubeclientsettings">Kube<wbr>Client<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
<h4 id="layeredtype">Layered<wbr>Type</h4>
{{% choosable language csharp %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="other_csharp">
<a href="#other_csharp" style="color: inherit; text-decoration: inherit;">Other</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-required"
title="Required">
<span id="thinker_csharp">
<a href="#thinker_csharp" style="color: inherit; text-decoration: inherit;">Thinker</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}To ask and answer{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="answer_csharp">
<a href="#answer_csharp" style="color: inherit; text-decoration: inherit;">Answer</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">double</span>
</dt>
<dd>{{% md %}}The answer to the question{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="plainother_csharp">
<a href="#plainother_csharp" style="color: inherit; text-decoration: inherit;">Plain<wbr>Other</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}Test how plain types interact{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="question_csharp">
<a href="#question_csharp" style="color: inherit; text-decoration: inherit;">Question</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The question already answered{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="recursive_csharp">
<a href="#recursive_csharp" style="color: inherit; text-decoration: inherit;">Recursive</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#layeredtype">Layered<wbr>Type</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language go %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="other_go">
<a href="#other_go" style="color: inherit; text-decoration: inherit;">Other</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-required"
title="Required">
<span id="thinker_go">
<a href="#thinker_go" style="color: inherit; text-decoration: inherit;">Thinker</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}To ask and answer{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="answer_go">
<a href="#answer_go" style="color: inherit; text-decoration: inherit;">Answer</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">float64</span>
</dt>
<dd>{{% md %}}The answer to the question{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="plainother_go">
<a href="#plainother_go" style="color: inherit; text-decoration: inherit;">Plain<wbr>Other</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}Test how plain types interact{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="question_go">
<a href="#question_go" style="color: inherit; text-decoration: inherit;">Question</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The question already answered{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="recursive_go">
<a href="#recursive_go" style="color: inherit; text-decoration: inherit;">Recursive</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#layeredtype">Layered<wbr>Type</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language nodejs %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="other_nodejs">
<a href="#other_nodejs" style="color: inherit; text-decoration: inherit;">other</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-required"
title="Required">
<span id="thinker_nodejs">
<a href="#thinker_nodejs" style="color: inherit; text-decoration: inherit;">thinker</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}To ask and answer{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="answer_nodejs">
<a href="#answer_nodejs" style="color: inherit; text-decoration: inherit;">answer</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">number</span>
</dt>
<dd>{{% md %}}The answer to the question{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="plainother_nodejs">
<a href="#plainother_nodejs" style="color: inherit; text-decoration: inherit;">plain<wbr>Other</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}Test how plain types interact{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="question_nodejs">
<a href="#question_nodejs" style="color: inherit; text-decoration: inherit;">question</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The question already answered{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="recursive_nodejs">
<a href="#recursive_nodejs" style="color: inherit; text-decoration: inherit;">recursive</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#layeredtype">Layered<wbr>Type</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language python %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="other_python">
<a href="#other_python" style="color: inherit; text-decoration: inherit;">other</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd><dt class="property-required"
title="Required">
<span id="thinker_python">
<a href="#thinker_python" style="color: inherit; text-decoration: inherit;">thinker</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}To ask and answer{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="answer_python">
<a href="#answer_python" style="color: inherit; text-decoration: inherit;">answer</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">float</span>
</dt>
<dd>{{% md %}}The answer to the question{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="plain_other_python">
<a href="#plain_other_python" style="color: inherit; text-decoration: inherit;">plain_<wbr>other</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}Test how plain types interact{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="question_python">
<a href="#question_python" style="color: inherit; text-decoration: inherit;">question</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}The question already answered{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="recursive_python">
<a href="#recursive_python" style="color: inherit; text-decoration: inherit;">recursive</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#layeredtype">Layered<wbr>Type</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

@ -0,0 +1,348 @@
---
title: "funcWithAllOptionalInputs"
title_tag: "example.funcWithAllOptionalInputs"
meta_desc: "Documentation for the example.funcWithAllOptionalInputs 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! -->
Check codegen of functions with all optional inputs.
## Using funcWithAllOptionalInputs {#using}
Two invocation forms are available. The direct form accepts plain
arguments and either blocks until the result value is available, or
returns a Promise-wrapped result. The output form accepts
Input-wrapped arguments and returns an Output-wrapped result.
{{< 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>funcWithAllOptionalInputs<span class="p">(</span><span class="nx">args</span><span class="p">:</span> <span class="nx">FuncWithAllOptionalInputsArgs</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">FuncWithAllOptionalInputsResult</a></span>></span
><span class="k">
function </span>funcWithAllOptionalInputsOutput<span class="p">(</span><span class="nx">args</span><span class="p">:</span> <span class="nx">FuncWithAllOptionalInputsOutputArgs</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">): Output&lt;<span class="nx"><a href="#result">FuncWithAllOptionalInputsResult</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>func_with_all_optional_inputs<span class="p">(</span><span class="nx">a</span><span class="p">:</span> <span class="nx">Optional[HelmReleaseSettings]</span> = None<span class="p">,</span>
<span class="nx">b</span><span class="p">:</span> <span class="nx">Optional[str]</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.InvokeOptions">Optional[InvokeOptions]</a></span> = None<span class="p">) -&gt;</span> <span>FuncWithAllOptionalInputsResult</span
><span class="k">
def </span>func_with_all_optional_inputs_output<span class="p">(</span><span class="nx">a</span><span class="p">:</span> <span class="nx">Optional[pulumi.Input[HelmReleaseSettingsArgs]]</span> = None<span class="p">,</span>
<span class="nx">b</span><span class="p">:</span> <span class="nx">Optional[pulumi.Input[str]]</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.InvokeOptions">Optional[InvokeOptions]</a></span> = None<span class="p">) -&gt;</span> <span>Output[FuncWithAllOptionalInputsResult]</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>FuncWithAllOptionalInputs<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">FuncWithAllOptionalInputsArgs</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">FuncWithAllOptionalInputsResult</a></span>, error)</span
><span class="k">
func </span>FuncWithAllOptionalInputsOutput<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">FuncWithAllOptionalInputsOutputArgs</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">) FuncWithAllOptionalInputsResultOutput</span
></code></pre></div>
&gt; Note: This function is named `FuncWithAllOptionalInputs` 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">FuncWithAllOptionalInputs </span><span class="p">
{</span><span class="k">
public static </span>Task&lt;<span class="nx"><a href="#result">FuncWithAllOptionalInputsResult</a></span>> <span class="p">InvokeAsync(</span><span class="nx">FuncWithAllOptionalInputsArgs</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="k">
public static </span>Output&lt;<span class="nx"><a href="#result">FuncWithAllOptionalInputsResult</a></span>> <span class="p">Invoke(</span><span class="nx">FuncWithAllOptionalInputsInvokeArgs</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"><dt class="property-optional"
title="Optional">
<span id="a_csharp">
<a href="#a_csharp" style="color: inherit; text-decoration: inherit;">A</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}Property A{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="b_csharp">
<a href="#b_csharp" style="color: inherit; text-decoration: inherit;">B</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}Property B{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language go %}}
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="a_go">
<a href="#a_go" style="color: inherit; text-decoration: inherit;">A</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}Property A{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="b_go">
<a href="#b_go" style="color: inherit; text-decoration: inherit;">B</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}Property B{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language nodejs %}}
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="a_nodejs">
<a href="#a_nodejs" style="color: inherit; text-decoration: inherit;">a</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}Property A{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="b_nodejs">
<a href="#b_nodejs" style="color: inherit; text-decoration: inherit;">b</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}Property B{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language python %}}
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="a_python">
<a href="#a_python" style="color: inherit; text-decoration: inherit;">a</a>
</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#helmreleasesettings">Helm<wbr>Release<wbr>Settings</a></span>
</dt>
<dd>{{% md %}}Property A{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="b_python">
<a href="#b_python" style="color: inherit; text-decoration: inherit;">b</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}Property B{{% /md %}}</dd></dl>
{{% /choosable %}}
## funcWithAllOptionalInputs Result {#result}
The following output properties are available:
{{% choosable language csharp %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="r_csharp">
<a href="#r_csharp" style="color: inherit; text-decoration: inherit;">R</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language go %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="r_go">
<a href="#r_go" style="color: inherit; text-decoration: inherit;">R</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language nodejs %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="r_nodejs">
<a href="#r_nodejs" style="color: inherit; text-decoration: inherit;">r</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language python %}}
<dl class="resources-properties"><dt class="property-"
title="">
<span id="r_python">
<a href="#r_python" style="color: inherit; text-decoration: inherit;">r</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}{{% /md %}}</dd></dl>
{{% /choosable %}}
## Supporting Types
<h4 id="helmreleasesettings">Helm<wbr>Release<wbr>Settings</h4>
{{% choosable language csharp %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="requiredarg_csharp">
<a href="#requiredarg_csharp" style="color: inherit; text-decoration: inherit;">Required<wbr>Arg</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}to test required args{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="driver_csharp">
<a href="#driver_csharp" style="color: inherit; text-decoration: inherit;">Driver</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The backend storage driver for Helm. Values are: configmap, secret, memory, sql.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="pluginspath_csharp">
<a href="#pluginspath_csharp" style="color: inherit; text-decoration: inherit;">Plugins<wbr>Path</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The path to the helm plugins directory.{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language go %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="requiredarg_go">
<a href="#requiredarg_go" style="color: inherit; text-decoration: inherit;">Required<wbr>Arg</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}to test required args{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="driver_go">
<a href="#driver_go" style="color: inherit; text-decoration: inherit;">Driver</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The backend storage driver for Helm. Values are: configmap, secret, memory, sql.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="pluginspath_go">
<a href="#pluginspath_go" style="color: inherit; text-decoration: inherit;">Plugins<wbr>Path</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The path to the helm plugins directory.{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language nodejs %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="requiredarg_nodejs">
<a href="#requiredarg_nodejs" style="color: inherit; text-decoration: inherit;">required<wbr>Arg</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}to test required args{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="driver_nodejs">
<a href="#driver_nodejs" style="color: inherit; text-decoration: inherit;">driver</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The backend storage driver for Helm. Values are: configmap, secret, memory, sql.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="pluginspath_nodejs">
<a href="#pluginspath_nodejs" style="color: inherit; text-decoration: inherit;">plugins<wbr>Path</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>{{% md %}}The path to the helm plugins directory.{{% /md %}}</dd></dl>
{{% /choosable %}}
{{% choosable language python %}}
<dl class="resources-properties"><dt class="property-required"
title="Required">
<span id="required_arg_python">
<a href="#required_arg_python" style="color: inherit; text-decoration: inherit;">required_<wbr>arg</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}to test required args{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="driver_python">
<a href="#driver_python" style="color: inherit; text-decoration: inherit;">driver</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}The backend storage driver for Helm. Values are: configmap, secret, memory, sql.{{% /md %}}</dd><dt class="property-optional"
title="Optional">
<span id="plugins_path_python">
<a href="#plugins_path_python" style="color: inherit; text-decoration: inherit;">plugins_<wbr>path</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>{{% md %}}The path to the helm plugins directory.{{% /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

@ -0,0 +1,23 @@
---
title: "mod1"
title_tag: "example.mod1"
meta_desc: "Explore the resources and functions of the example.mod1 module."
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! -->
Explore the resources and functions of the example.mod1 module.
<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>

Some files were not shown because too many files have changed in this diff Show More