Use appropriate types for go config methods (#4800)

This commit is contained in:
Evan Boyle 2020-06-10 18:24:05 -07:00 committed by GitHub
parent 074eb67e82
commit 3d2df8992f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 190 additions and 174 deletions

View file

@ -2,9 +2,9 @@ CHANGELOG
=========
## HEAD (Unreleased)
_(none)_
---
- Improve typing for Go SDK secret config values
[#4800](https://github.com/pulumi/pulumi/pull/4800)
## 2.4.0 (2020-06-10)
- Turn program generation NYIs into diagnostic errors

View file

@ -270,7 +270,7 @@ func (c *Config) TryUint8(key string) (uint8, error) {
// GetSecret loads an optional configuration value by its key
// or "" if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecret(key string) pulumi.Output {
func (c *Config) GetSecret(key string) pulumi.StringOutput {
return GetSecret(c.ctx, c.fullKey(key))
}
@ -282,85 +282,85 @@ func (c *Config) GetSecretObject(key string, output interface{}) (pulumi.Output,
// GetSecretBool loads an optional bool configuration value by its key
// or false if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretBool(key string) pulumi.Output {
func (c *Config) GetSecretBool(key string) pulumi.BoolOutput {
return GetSecretBool(c.ctx, c.fullKey(key))
}
// GetSecretFloat32 loads an optional float32 configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretFloat32(key string) pulumi.Output {
func (c *Config) GetSecretFloat32(key string) pulumi.Float32Output {
return GetSecretFloat32(c.ctx, c.fullKey(key))
}
// GetSecretFloat64 loads an optional float64 configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretFloat64(key string) pulumi.Output {
func (c *Config) GetSecretFloat64(key string) pulumi.Float64Output {
return GetSecretFloat64(c.ctx, c.fullKey(key))
}
// GetSecretInt loads an optional int configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretInt(key string) pulumi.Output {
func (c *Config) GetSecretInt(key string) pulumi.IntOutput {
return GetSecretInt(c.ctx, c.fullKey(key))
}
// GetSecretInt16 loads an optional int16 configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretInt16(key string) pulumi.Output {
func (c *Config) GetSecretInt16(key string) pulumi.Int16Output {
return GetSecretInt16(c.ctx, c.fullKey(key))
}
// GetSecretInt32 loads an optional int32 configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretInt32(key string) pulumi.Output {
func (c *Config) GetSecretInt32(key string) pulumi.Int32Output {
return GetSecretInt32(c.ctx, c.fullKey(key))
}
// GetSecretInt64 loads an optional int64 configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretInt64(key string) pulumi.Output {
func (c *Config) GetSecretInt64(key string) pulumi.Int64Output {
return GetSecretInt64(c.ctx, c.fullKey(key))
}
// GetSecretInt8 loads an optional int8 configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretInt8(key string) pulumi.Output {
func (c *Config) GetSecretInt8(key string) pulumi.Int8Output {
return GetSecretInt8(c.ctx, c.fullKey(key))
}
// GetSecretUint loads an optional uint configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretUint(key string) pulumi.Output {
func (c *Config) GetSecretUint(key string) pulumi.UintOutput {
return GetSecretUint(c.ctx, c.fullKey(key))
}
// GetSecretUint16 loads an optional uint16 configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretUint16(key string) pulumi.Output {
func (c *Config) GetSecretUint16(key string) pulumi.Uint16Output {
return GetSecretUint16(c.ctx, c.fullKey(key))
}
// GetSecretUint32 loads an optional uint32 configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretUint32(key string) pulumi.Output {
func (c *Config) GetSecretUint32(key string) pulumi.Uint32Output {
return GetSecretUint32(c.ctx, c.fullKey(key))
}
// GetSecretUint64 loads an optional uint64 configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretUint64(key string) pulumi.Output {
func (c *Config) GetSecretUint64(key string) pulumi.Uint64Output {
return GetSecretUint64(c.ctx, c.fullKey(key))
}
// GetSecretUint8 loads an optional uint8 configuration value by its key
// or 0 if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecretUint8(key string) pulumi.Output {
func (c *Config) GetSecretUint8(key string) pulumi.Uint8Output {
return GetSecretUint8(c.ctx, c.fullKey(key))
}
// RequireSecret loads a configuration value by its key
// and returns it wrapped in a secret output, or panics if it doesn't exist.
func (c *Config) RequireSecret(key string) pulumi.Output {
func (c *Config) RequireSecret(key string) pulumi.StringOutput {
return RequireSecret(c.ctx, c.fullKey(key))
}
@ -372,84 +372,84 @@ func (c *Config) RequireSecretObject(key string, output interface{}) pulumi.Outp
// RequireSecretBool loads a bool configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretBool(key string) pulumi.Output {
func (c *Config) RequireSecretBool(key string) pulumi.BoolOutput {
return RequireSecretBool(c.ctx, c.fullKey(key))
}
// RequireSecretFloat32 loads a float32 configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretFloat32(key string) pulumi.Output {
func (c *Config) RequireSecretFloat32(key string) pulumi.Float32Output {
return RequireSecretFloat32(c.ctx, c.fullKey(key))
}
// RequireSecretFloat64 loads a float64 configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretFloat64(key string) pulumi.Output {
func (c *Config) RequireSecretFloat64(key string) pulumi.Float64Output {
return RequireSecretFloat64(c.ctx, c.fullKey(key))
}
// RequireSecretInt loads a int configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretInt(key string) pulumi.Output {
func (c *Config) RequireSecretInt(key string) pulumi.IntOutput {
return RequireSecretInt(c.ctx, c.fullKey(key))
}
// RequireSecretInt16 loads a int16 configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretInt16(key string) pulumi.Output {
func (c *Config) RequireSecretInt16(key string) pulumi.Int16Output {
return RequireSecretInt16(c.ctx, c.fullKey(key))
}
// RequireSecretInt32 loads a int32 configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretInt32(key string) pulumi.Output {
func (c *Config) RequireSecretInt32(key string) pulumi.Int32Output {
return RequireSecretInt32(c.ctx, c.fullKey(key))
}
// RequireSecretInt64 loads a int64 configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretInt64(key string) pulumi.Output {
func (c *Config) RequireSecretInt64(key string) pulumi.Int64Output {
return RequireSecretInt64(c.ctx, c.fullKey(key))
}
// RequireSecretInt8 loads a int8 configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretInt8(key string) pulumi.Output {
func (c *Config) RequireSecretInt8(key string) pulumi.Int8Output {
return RequireSecretInt8(c.ctx, c.fullKey(key))
}
// RequireSecretUint loads a uint configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretUint(key string) pulumi.Output {
func (c *Config) RequireSecretUint(key string) pulumi.UintOutput {
return RequireSecretUint(c.ctx, c.fullKey(key))
}
// RequireSecretUint16 loads a uint16 configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretUint16(key string) pulumi.Output {
func (c *Config) RequireSecretUint16(key string) pulumi.Uint16Output {
return RequireSecretUint16(c.ctx, c.fullKey(key))
}
// RequireSecretUint32 loads a uint32 configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretUint32(key string) pulumi.Output {
func (c *Config) RequireSecretUint32(key string) pulumi.Uint32Output {
return RequireSecretUint32(c.ctx, c.fullKey(key))
}
// RequireSecretUint64 loads a uint64 configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretUint64(key string) pulumi.Output {
func (c *Config) RequireSecretUint64(key string) pulumi.Uint64Output {
return RequireSecretUint64(c.ctx, c.fullKey(key))
}
// RequireSecretUint8 loads a uint8 configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecretUint8(key string) pulumi.Output {
func (c *Config) RequireSecretUint8(key string) pulumi.Uint8Output {
return RequireSecretUint8(c.ctx, c.fullKey(key))
}
// TrySecret loads a configuration value by its key, returning a non-nil error if it doesn't exist.
func (c *Config) TrySecret(key string) (pulumi.Output, error) {
func (c *Config) TrySecret(key string) (pulumi.StringOutput, error) {
return TrySecret(c.ctx, c.fullKey(key))
}
@ -460,78 +460,78 @@ func (c *Config) TrySecretObject(key string, output interface{}) (pulumi.Output,
// TrySecretBool loads an optional bool configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretBool(key string) (pulumi.Output, error) {
func (c *Config) TrySecretBool(key string) (pulumi.BoolOutput, error) {
return TrySecretBool(c.ctx, c.fullKey(key))
}
// TrySecretFloat32 loads an optional float32 configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretFloat32(key string) (pulumi.Output, error) {
func (c *Config) TrySecretFloat32(key string) (pulumi.Float32Output, error) {
return TrySecretFloat32(c.ctx, c.fullKey(key))
}
// TrySecretFloat64 loads an optional float64 configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretFloat64(key string) (pulumi.Output, error) {
func (c *Config) TrySecretFloat64(key string) (pulumi.Float64Output, error) {
return TrySecretFloat64(c.ctx, c.fullKey(key))
}
// TrySecretInt loads an optional int configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretInt(key string) (pulumi.Output, error) {
func (c *Config) TrySecretInt(key string) (pulumi.IntOutput, error) {
return TrySecretInt(c.ctx, c.fullKey(key))
}
// TrySecretInt16 loads an optional int16 configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretInt16(key string) (pulumi.Output, error) {
func (c *Config) TrySecretInt16(key string) (pulumi.Int16Output, error) {
return TrySecretInt16(c.ctx, c.fullKey(key))
}
// TrySecretInt32 loads an optional int32 configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretInt32(key string) (pulumi.Output, error) {
func (c *Config) TrySecretInt32(key string) (pulumi.Int32Output, error) {
return TrySecretInt32(c.ctx, c.fullKey(key))
}
// TrySecretInt64 loads an optional int64 configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretInt64(key string) (pulumi.Output, error) {
func (c *Config) TrySecretInt64(key string) (pulumi.Int64Output, error) {
return TrySecretInt64(c.ctx, c.fullKey(key))
}
// TrySecretInt8 loads an optional int8 configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretInt8(key string) (pulumi.Output, error) {
func (c *Config) TrySecretInt8(key string) (pulumi.Int8Output, error) {
return TrySecretInt8(c.ctx, c.fullKey(key))
}
// TrySecretUint loads an optional uint configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretUint(key string) (pulumi.Output, error) {
func (c *Config) TrySecretUint(key string) (pulumi.UintOutput, error) {
return TrySecretUint(c.ctx, c.fullKey(key))
}
// TrySecretUint16 loads an optional uint16 configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretUint16(key string) (pulumi.Output, error) {
func (c *Config) TrySecretUint16(key string) (pulumi.Uint16Output, error) {
return TrySecretUint16(c.ctx, c.fullKey(key))
}
// TrySecretUint32 loads an optional uint32 configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretUint32(key string) (pulumi.Output, error) {
func (c *Config) TrySecretUint32(key string) (pulumi.Uint32Output, error) {
return TrySecretUint32(c.ctx, c.fullKey(key))
}
// TrySecretUint64 loads an optional uint64 configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretUint64(key string) (pulumi.Output, error) {
func (c *Config) TrySecretUint64(key string) (pulumi.Uint64Output, error) {
return TrySecretUint64(c.ctx, c.fullKey(key))
}
// TrySecretUint8 loads an optional uint8 configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecretUint8(key string) (pulumi.Output, error) {
func (c *Config) TrySecretUint8(key string) (pulumi.Uint8Output, error) {
return TrySecretUint8(c.ctx, c.fullKey(key))
}

View file

@ -221,13 +221,13 @@ func TestSecretConfig(t *testing.T) {
testStruct5 := TestStruct{}
testStruct6 := TestStruct{}
s1, err = cfg.TrySecretObject("obj", &testStruct4)
s4, err := cfg.TrySecretObject("obj", &testStruct4)
assert.Nil(t, err)
s2 = cfg.RequireSecretObject("obj", &testStruct5)
s3, err = cfg.GetSecretObject("obj", &testStruct6)
s5 := cfg.RequireSecretObject("obj", &testStruct5)
s6, err := cfg.GetSecretObject("obj", &testStruct6)
assert.Nil(t, err)
pulumi.All(s1, s2, s3).ApplyT(func(v []interface{}) ([]interface{}, error) {
pulumi.All(s4, s5, s6).ApplyT(func(v []interface{}) ([]interface{}, error) {
for _, val := range v {
ts := val.(*TestStruct)
if reflect.DeepEqual(expectedTestStruct, *ts) {
@ -250,15 +250,15 @@ func TestSecretConfig(t *testing.T) {
}
}
s1, err = cfg.TrySecretBool("bbb")
s2 = cfg.RequireSecretBool("bbb")
s3 = cfg.GetSecretBool("bbb")
s7, err := cfg.TrySecretBool("bbb")
s8 := cfg.RequireSecretBool("bbb")
s9 := cfg.GetSecretBool("bbb")
assert.Nil(t, err)
errChan = make(chan error)
resultBool := make(chan bool)
pulumi.All(s1, s2, s3).ApplyT(func(v []interface{}) ([]interface{}, error) {
pulumi.All(s7, s8, s9).ApplyT(func(v []interface{}) ([]interface{}, error) {
for _, val := range v {
if val == true {
resultBool <- val.(bool)
@ -281,15 +281,15 @@ func TestSecretConfig(t *testing.T) {
}
}
s1, err = cfg.TrySecretInt("intint")
s2 = cfg.RequireSecretInt("intint")
s3 = cfg.GetSecretInt("intint")
s10, err := cfg.TrySecretInt("intint")
s11 := cfg.RequireSecretInt("intint")
s12 := cfg.GetSecretInt("intint")
assert.Nil(t, err)
errChan = make(chan error)
resultInt := make(chan int)
pulumi.All(s1, s2, s3).ApplyT(func(v []interface{}) ([]interface{}, error) {
pulumi.All(s10, s11, s12).ApplyT(func(v []interface{}) ([]interface{}, error) {
for _, val := range v {
if val == 42 {
resultInt <- val.(int)

View file

@ -142,9 +142,9 @@ func GetUint8(ctx *pulumi.Context, key string) uint8 {
}
// GetSecret loads an optional configuration value by its key, or "" if it does not exist, into a secret Output.
func GetSecret(ctx *pulumi.Context, key string) pulumi.Output {
func GetSecret(ctx *pulumi.Context, key string) pulumi.StringOutput {
v, _ := ctx.GetConfig(key)
return pulumi.ToSecret(pulumi.String(v))
return pulumi.ToSecret(pulumi.String(v)).(pulumi.StringOutput)
}
// GetSecretObject attempts to load an optional configuration value by its key into the specified output variable.
@ -158,78 +158,78 @@ func GetSecretObject(ctx *pulumi.Context, key string, output interface{}) (pulum
// GetSecretBool loads an optional bool configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretBool(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetBool(ctx, key))
func GetSecretBool(ctx *pulumi.Context, key string) pulumi.BoolOutput {
return pulumi.ToSecret(GetBool(ctx, key)).(pulumi.BoolOutput)
}
// GetSecretFloat32 loads an optional float32 configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretFloat32(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetFloat32(ctx, key))
func GetSecretFloat32(ctx *pulumi.Context, key string) pulumi.Float32Output {
return pulumi.ToSecret(GetFloat32(ctx, key)).(pulumi.Float32Output)
}
// GetSecretFloat64 loads an optional float64 configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretFloat64(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetFloat64(ctx, key))
func GetSecretFloat64(ctx *pulumi.Context, key string) pulumi.Float64Output {
return pulumi.ToSecret(GetFloat64(ctx, key)).(pulumi.Float64Output)
}
// GetSecretInt loads an optional int configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretInt(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetInt(ctx, key))
func GetSecretInt(ctx *pulumi.Context, key string) pulumi.IntOutput {
return pulumi.ToSecret(GetInt(ctx, key)).(pulumi.IntOutput)
}
// GetSecretInt16 loads an optional int16 configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretInt16(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetInt16(ctx, key))
func GetSecretInt16(ctx *pulumi.Context, key string) pulumi.Int16Output {
return pulumi.ToSecret(GetInt16(ctx, key)).(pulumi.Int16Output)
}
// GetSecretInt32 loads an optional int32 configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretInt32(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetInt32(ctx, key))
func GetSecretInt32(ctx *pulumi.Context, key string) pulumi.Int32Output {
return pulumi.ToSecret(GetInt32(ctx, key)).(pulumi.Int32Output)
}
// GetSecretInt64 loads an optional int64 configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretInt64(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetInt64(ctx, key))
func GetSecretInt64(ctx *pulumi.Context, key string) pulumi.Int64Output {
return pulumi.ToSecret(GetInt64(ctx, key)).(pulumi.Int64Output)
}
// GetSecretInt8 loads an optional int8 configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretInt8(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetInt8(ctx, key))
func GetSecretInt8(ctx *pulumi.Context, key string) pulumi.Int8Output {
return pulumi.ToSecret(GetInt8(ctx, key)).(pulumi.Int8Output)
}
// GetSecretUint loads an optional uint configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretUint(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetUint(ctx, key))
func GetSecretUint(ctx *pulumi.Context, key string) pulumi.UintOutput {
return pulumi.ToSecret(GetUint(ctx, key)).(pulumi.UintOutput)
}
// GetSecretUint16 loads an optional uint16 configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretUint16(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetUint16(ctx, key))
func GetSecretUint16(ctx *pulumi.Context, key string) pulumi.Uint16Output {
return pulumi.ToSecret(GetUint16(ctx, key)).(pulumi.Uint16Output)
}
// GetSecretUint32 loads an optional uint32 configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretUint32(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetUint32(ctx, key))
func GetSecretUint32(ctx *pulumi.Context, key string) pulumi.Uint32Output {
return pulumi.ToSecret(GetUint32(ctx, key)).(pulumi.Uint32Output)
}
// GetSecretUint64 loads an optional uint64 configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretUint64(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetUint64(ctx, key))
func GetSecretUint64(ctx *pulumi.Context, key string) pulumi.Uint64Output {
return pulumi.ToSecret(GetUint64(ctx, key)).(pulumi.Uint64Output)
}
// GetSecretUint8 loads an optional uint8 configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecretUint8(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(GetUint8(ctx, key))
func GetSecretUint8(ctx *pulumi.Context, key string) pulumi.Uint8Output {
return pulumi.ToSecret(GetUint8(ctx, key)).(pulumi.Uint8Output)
}

View file

@ -121,8 +121,8 @@ func RequireUint8(ctx *pulumi.Context, key string) uint8 {
// RequireSecret loads a configuration value by its key returning it wrapped in a secret Output,
// or panics if it doesn't exist.
func RequireSecret(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(Require(ctx, key))
func RequireSecret(ctx *pulumi.Context, key string) pulumi.StringOutput {
return pulumi.ToSecret(Require(ctx, key)).(pulumi.StringOutput)
}
// RequireSecretObject loads an optional configuration value by its key into the output variable,
@ -134,78 +134,78 @@ func RequireSecretObject(ctx *pulumi.Context, key string, output interface{}) pu
// RequireSecretBool loads an optional configuration value by its key,
// as a bool wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretBool(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireBool(ctx, key))
func RequireSecretBool(ctx *pulumi.Context, key string) pulumi.BoolOutput {
return pulumi.ToSecret(RequireBool(ctx, key)).(pulumi.BoolOutput)
}
// RequireSecretFloat32 loads an optional configuration value by its key,
// as a float32 wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretFloat32(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireFloat32(ctx, key))
func RequireSecretFloat32(ctx *pulumi.Context, key string) pulumi.Float32Output {
return pulumi.ToSecret(RequireFloat32(ctx, key)).(pulumi.Float32Output)
}
// RequireSecretFloat64 loads an optional configuration value by its key,
// as a float64 wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretFloat64(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireFloat64(ctx, key))
func RequireSecretFloat64(ctx *pulumi.Context, key string) pulumi.Float64Output {
return pulumi.ToSecret(RequireFloat64(ctx, key)).(pulumi.Float64Output)
}
// RequireSecretInt loads an optional configuration value by its key,
// as a int wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretInt(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireInt(ctx, key))
func RequireSecretInt(ctx *pulumi.Context, key string) pulumi.IntOutput {
return pulumi.ToSecret(RequireInt(ctx, key)).(pulumi.IntOutput)
}
// RequireSecretInt16 loads an optional configuration value by its key,
// as a int16 wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretInt16(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireInt16(ctx, key))
func RequireSecretInt16(ctx *pulumi.Context, key string) pulumi.Int16Output {
return pulumi.ToSecret(RequireInt16(ctx, key)).(pulumi.Int16Output)
}
// RequireSecretInt32 loads an optional configuration value by its key,
// as a int32 wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretInt32(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireInt32(ctx, key))
func RequireSecretInt32(ctx *pulumi.Context, key string) pulumi.Int32Output {
return pulumi.ToSecret(RequireInt32(ctx, key)).(pulumi.Int32Output)
}
// RequireSecretInt64 loads an optional configuration value by its key,
// as a int64 wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretInt64(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireInt64(ctx, key))
func RequireSecretInt64(ctx *pulumi.Context, key string) pulumi.Int64Output {
return pulumi.ToSecret(RequireInt64(ctx, key)).(pulumi.Int64Output)
}
// RequireSecretInt8 loads an optional configuration value by its key,
// as a int8 wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretInt8(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireInt8(ctx, key))
func RequireSecretInt8(ctx *pulumi.Context, key string) pulumi.Int8Output {
return pulumi.ToSecret(RequireInt8(ctx, key)).(pulumi.Int8Output)
}
// RequireSecretUint loads an optional configuration value by its key,
// as a uint wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretUint(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireUint(ctx, key))
func RequireSecretUint(ctx *pulumi.Context, key string) pulumi.UintOutput {
return pulumi.ToSecret(RequireUint(ctx, key)).(pulumi.UintOutput)
}
// RequireSecretUint16 loads an optional configuration value by its key,
// as a uint16 wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretUint16(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireUint16(ctx, key))
func RequireSecretUint16(ctx *pulumi.Context, key string) pulumi.Uint16Output {
return pulumi.ToSecret(RequireUint16(ctx, key)).(pulumi.Uint16Output)
}
// RequireSecretUint32 loads an optional configuration value by its key,
// as a uint32 wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretUint32(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireUint32(ctx, key))
func RequireSecretUint32(ctx *pulumi.Context, key string) pulumi.Uint32Output {
return pulumi.ToSecret(RequireUint32(ctx, key)).(pulumi.Uint32Output)
}
// RequireSecretUint64 loads an optional configuration value by its key,
// as a uint64 wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretUint64(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireUint64(ctx, key))
func RequireSecretUint64(ctx *pulumi.Context, key string) pulumi.Uint64Output {
return pulumi.ToSecret(RequireUint64(ctx, key)).(pulumi.Uint64Output)
}
// RequireSecretUint8 loads an optional configuration value by its key,
// as a uint8 wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecretUint8(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(RequireUint8(ctx, key))
func RequireSecretUint8(ctx *pulumi.Context, key string) pulumi.Uint8Output {
return pulumi.ToSecret(RequireUint8(ctx, key)).(pulumi.Uint8Output)
}

View file

@ -161,12 +161,13 @@ func TryUint8(ctx *pulumi.Context, key string) (uint8, error) {
}
// TrySecret loads a configuration value by its key, returning a non-nil error if it doesn't exist.
func TrySecret(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecret(ctx *pulumi.Context, key string) (pulumi.StringOutput, error) {
v, err := Try(ctx, key)
if err != nil {
return nil, err
var empty pulumi.StringOutput
return empty, err
}
return pulumi.ToSecret(pulumi.String(v)), nil
return pulumi.ToSecret(pulumi.String(v)).(pulumi.StringOutput), nil
}
// TrySecretObject loads a configuration value by its key into the output variable,
@ -182,130 +183,143 @@ func TrySecretObject(ctx *pulumi.Context, key string, output interface{}) (pulum
// TrySecretBool loads an optional configuration value by its key, as a bool,
// or returns an error if it doesn't exist.
func TrySecretBool(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretBool(ctx *pulumi.Context, key string) (pulumi.BoolOutput, error) {
v, err := TryBool(ctx, key)
if err != nil {
return nil, err
var empty pulumi.BoolOutput
return empty, err
}
return pulumi.ToSecret(pulumi.Bool(v)), nil
return pulumi.ToSecret(pulumi.Bool(v)).(pulumi.BoolOutput), nil
}
// TrySecretFloat32 loads an optional configuration value by its key, as a float32,
// or returns an error if it doesn't exist.
func TrySecretFloat32(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretFloat32(ctx *pulumi.Context, key string) (pulumi.Float32Output, error) {
v, err := TryFloat32(ctx, key)
if err != nil {
return nil, err
var empty pulumi.Float32Output
return empty, err
}
return pulumi.ToSecret(pulumi.Float32(v)), nil
return pulumi.ToSecret(pulumi.Float32(v)).(pulumi.Float32Output), nil
}
// TrySecretFloat64 loads an optional configuration value by its key, as a float64,
// or returns an error if it doesn't exist.
func TrySecretFloat64(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretFloat64(ctx *pulumi.Context, key string) (pulumi.Float64Output, error) {
v, err := TryFloat64(ctx, key)
if err != nil {
return nil, err
var empty pulumi.Float64Output
return empty, err
}
return pulumi.ToSecret(pulumi.Float64(v)), nil
return pulumi.ToSecret(pulumi.Float64(v)).(pulumi.Float64Output), nil
}
// TrySecretInt loads an optional configuration value by its key, as a int,
// or returns an error if it doesn't exist.
func TrySecretInt(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretInt(ctx *pulumi.Context, key string) (pulumi.IntOutput, error) {
v, err := TryInt(ctx, key)
if err != nil {
return nil, err
var empty pulumi.IntOutput
return empty, err
}
return pulumi.ToSecret(pulumi.Int(v)), nil
return pulumi.ToSecret(pulumi.Int(v)).(pulumi.IntOutput), nil
}
// TrySecretInt16 loads an optional configuration value by its key, as a int16,
// or returns an error if it doesn't exist.
func TrySecretInt16(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretInt16(ctx *pulumi.Context, key string) (pulumi.Int16Output, error) {
v, err := TryInt16(ctx, key)
if err != nil {
return nil, err
var empty pulumi.Int16Output
return empty, err
}
return pulumi.ToSecret(pulumi.Int16(v)), nil
return pulumi.ToSecret(pulumi.Int16(v)).(pulumi.Int16Output), nil
}
// TrySecretInt32 loads an optional configuration value by its key, as a int32,
// or returns an error if it doesn't exist.
func TrySecretInt32(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretInt32(ctx *pulumi.Context, key string) (pulumi.Int32Output, error) {
v, err := TryInt32(ctx, key)
if err != nil {
return nil, err
var empty pulumi.Int32Output
return empty, err
}
return pulumi.ToSecret(pulumi.Int32(v)), nil
return pulumi.ToSecret(pulumi.Int32(v)).(pulumi.Int32Output), nil
}
// TrySecretInt64 loads an optional configuration value by its key, as a int64,
// or returns an error if it doesn't exist.
func TrySecretInt64(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretInt64(ctx *pulumi.Context, key string) (pulumi.Int64Output, error) {
v, err := TryInt64(ctx, key)
if err != nil {
return nil, err
var empty pulumi.Int64Output
return empty, err
}
return pulumi.ToSecret(pulumi.Int64(v)), nil
return pulumi.ToSecret(pulumi.Int64(v)).(pulumi.Int64Output), nil
}
// TrySecretInt8 loads an optional configuration value by its key, as a int8,
// or returns an error if it doesn't exist.
func TrySecretInt8(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretInt8(ctx *pulumi.Context, key string) (pulumi.Int8Output, error) {
v, err := TryInt8(ctx, key)
if err != nil {
return nil, err
var empty pulumi.Int8Output
return empty, err
}
return pulumi.ToSecret(pulumi.Int8(v)), nil
return pulumi.ToSecret(pulumi.Int8(v)).(pulumi.Int8Output), nil
}
// TrySecretUint loads an optional configuration value by its key, as a uint,
// or returns an error if it doesn't exist.
func TrySecretUint(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretUint(ctx *pulumi.Context, key string) (pulumi.UintOutput, error) {
v, err := TryUint(ctx, key)
if err != nil {
return nil, err
var empty pulumi.UintOutput
return empty, err
}
return pulumi.ToSecret(pulumi.Uint(v)), nil
return pulumi.ToSecret(pulumi.Uint(v)).(pulumi.UintOutput), nil
}
// TrySecretUint16 loads an optional configuration value by its key, as a uint16,
// or returns an error if it doesn't exist.
func TrySecretUint16(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretUint16(ctx *pulumi.Context, key string) (pulumi.Uint16Output, error) {
v, err := TryUint16(ctx, key)
if err != nil {
return nil, err
var empty pulumi.Uint16Output
return empty, err
}
return pulumi.ToSecret(pulumi.Uint16(v)), nil
return pulumi.ToSecret(pulumi.Uint16(v)).(pulumi.Uint16Output), nil
}
// TrySecretUint32 loads an optional configuration value by its key, as a uint32,
// or returns an error if it doesn't exist.
func TrySecretUint32(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretUint32(ctx *pulumi.Context, key string) (pulumi.Uint32Output, error) {
v, err := TryUint32(ctx, key)
if err != nil {
return nil, err
var empty pulumi.Uint32Output
return empty, err
}
return pulumi.ToSecret(pulumi.Uint32(v)), nil
return pulumi.ToSecret(pulumi.Uint32(v)).(pulumi.Uint32Output), nil
}
// TrySecretUint64 loads an optional configuration value by its key, as a uint64,
// or returns an error if it doesn't exist.
func TrySecretUint64(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretUint64(ctx *pulumi.Context, key string) (pulumi.Uint64Output, error) {
v, err := TryUint64(ctx, key)
if err != nil {
return nil, err
var empty pulumi.Uint64Output
return empty, err
}
return pulumi.ToSecret(pulumi.Uint64(v)), nil
return pulumi.ToSecret(pulumi.Uint64(v)).(pulumi.Uint64Output), nil
}
// TrySecretUint8 loads an optional configuration value by its key, as a uint8,
// or returns an error if it doesn't exist.
func TrySecretUint8(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecretUint8(ctx *pulumi.Context, key string) (pulumi.Uint8Output, error) {
v, err := TryUint8(ctx, key)
if err != nil {
return nil, err
var empty pulumi.Uint8Output
return empty, err
}
return pulumi.ToSecret(pulumi.Uint8(v)), nil
return pulumi.ToSecret(pulumi.Uint8(v)).(pulumi.Uint8Output), nil
}

View file

@ -102,7 +102,7 @@ func (c *Config) Try{{.Name}}(key string) ({{.Type}}, error) {
{{end}}
// GetSecret loads an optional configuration value by its key
// or "" if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecret(key string) pulumi.Output {
func (c *Config) GetSecret(key string) pulumi.StringOutput {
return GetSecret(c.ctx, c.fullKey(key))
}
@ -116,7 +116,7 @@ func (c *Config) GetSecretObject(key string, output interface{}) (pulumi.Output,
{{if .GenerateConfig}}
// GetSecret{{.Name}} loads an optional {{.Type}} configuration value by its key
// or {{.DefaultConfig}} if it doesn't exist, and returns it wrapped in a secret Output.
func (c *Config) GetSecret{{.Name}}(key string) pulumi.Output {
func (c *Config) GetSecret{{.Name}}(key string) pulumi.{{.Name}}Output {
return GetSecret{{.Name}}(c.ctx, c.fullKey(key))
}
@ -124,7 +124,7 @@ func (c *Config) GetSecret{{.Name}}(key string) pulumi.Output {
{{end}}
// RequireSecret loads a configuration value by its key
// and returns it wrapped in a secret output, or panics if it doesn't exist.
func (c *Config) RequireSecret(key string) pulumi.Output {
func (c *Config) RequireSecret(key string) pulumi.StringOutput {
return RequireSecret(c.ctx, c.fullKey(key))
}
@ -138,14 +138,14 @@ func (c *Config) RequireSecretObject(key string, output interface{}) pulumi.Outp
{{if .GenerateConfig}}
// RequireSecret{{.Name}} loads a {{.Type}} configuration value by its key
// and returns is wrapped in a secret Output, or panics if it doesn't exist.
func (c *Config) RequireSecret{{.Name}}(key string) pulumi.Output {
func (c *Config) RequireSecret{{.Name}}(key string) pulumi.{{.Name}}Output {
return RequireSecret{{.Name}}(c.ctx, c.fullKey(key))
}
{{end}}
{{end}}
// TrySecret loads a configuration value by its key, returning a non-nil error if it doesn't exist.
func (c *Config) TrySecret(key string) (pulumi.Output, error) {
func (c *Config) TrySecret(key string) (pulumi.StringOutput, error) {
return TrySecret(c.ctx, c.fullKey(key))
}
@ -158,7 +158,7 @@ func (c *Config) TrySecretObject(key string, output interface{}) (pulumi.Output,
{{if .GenerateConfig}}
// TrySecret{{.Name}} loads an optional {{.Type}} configuration value by its key into a secret Output,
// or returns an error if it doesn't exist.
func (c *Config) TrySecret{{.Name}}(key string) (pulumi.Output, error) {
func (c *Config) TrySecret{{.Name}}(key string) (pulumi.{{.Name}}Output, error) {
return TrySecret{{.Name}}(c.ctx, c.fullKey(key))
}

View file

@ -50,9 +50,9 @@ func Get{{.Name}}(ctx *pulumi.Context, key string) {{.Type}} {
{{end}}
{{end}}
// GetSecret loads an optional configuration value by its key, or "" if it does not exist, into a secret Output.
func GetSecret(ctx *pulumi.Context, key string) pulumi.Output {
func GetSecret(ctx *pulumi.Context, key string) pulumi.StringOutput {
v, _ := ctx.GetConfig(key)
return pulumi.ToSecret(pulumi.String(v))
return pulumi.ToSecret(pulumi.String(v)).(pulumi.StringOutput)
}
// GetSecretObject attempts to load an optional configuration value by its key into the specified output variable.
@ -68,8 +68,8 @@ func GetSecretObject(ctx *pulumi.Context, key string, output interface{}) (pulum
{{if .GenerateConfig}}
// GetSecret{{.Name}} loads an optional {{.Type}} configuration value by its key,
// or false if it does not exist, into a secret Output.
func GetSecret{{.Name}}(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(Get{{.Name}}(ctx, key))
func GetSecret{{.Name}}(ctx *pulumi.Context, key string) pulumi.{{.Name}}Output {
return pulumi.ToSecret(Get{{.Name}}(ctx, key)).(pulumi.{{.Name}}Output)
}
{{end}}
{{end}}

View file

@ -53,8 +53,8 @@ func Require{{.Name}}(ctx *pulumi.Context, key string) {{.Type}} {
{{end}}
// RequireSecret loads a configuration value by its key returning it wrapped in a secret Output,
// or panics if it doesn't exist.
func RequireSecret(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(Require(ctx, key))
func RequireSecret(ctx *pulumi.Context, key string) pulumi.StringOutput {
return pulumi.ToSecret(Require(ctx, key)).(pulumi.StringOutput)
}
// RequireSecretObject loads an optional configuration value by its key into the output variable,
@ -68,8 +68,8 @@ func RequireSecretObject(ctx *pulumi.Context, key string, output interface{}) pu
{{if .GenerateConfig}}
// RequireSecret{{.Name}} loads an optional configuration value by its key,
// as a {{.Type}} wrapped in a secret Output, or panics if it doesn't exist.
func RequireSecret{{.Name}}(ctx *pulumi.Context, key string) pulumi.Output {
return pulumi.ToSecret(Require{{.Name}}(ctx, key))
func RequireSecret{{.Name}}(ctx *pulumi.Context, key string) pulumi.{{.Name}}Output {
return pulumi.ToSecret(Require{{.Name}}(ctx, key)).(pulumi.{{.Name}}Output)
}
{{end}}
{{end}}

View file

@ -58,12 +58,13 @@ func Try{{.Name}}(ctx *pulumi.Context, key string) ({{.Type}}, error) {
{{end}}
// TrySecret loads a configuration value by its key, returning a non-nil error if it doesn't exist.
func TrySecret(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecret(ctx *pulumi.Context, key string) (pulumi.StringOutput, error) {
v, err := Try(ctx, key)
if err != nil {
return nil, err
var empty pulumi.StringOutput
return empty, err
}
return pulumi.ToSecret(pulumi.String(v)), nil
return pulumi.ToSecret(pulumi.String(v)).(pulumi.StringOutput), nil
}
// TrySecretObject loads a configuration value by its key into the output variable,
@ -81,12 +82,13 @@ func TrySecretObject(ctx *pulumi.Context, key string, output interface{}) (pulum
{{if .GenerateConfig}}
// TrySecret{{.Name}} loads an optional configuration value by its key, as a {{.Type}},
// or returns an error if it doesn't exist.
func TrySecret{{.Name}}(ctx *pulumi.Context, key string) (pulumi.Output, error) {
func TrySecret{{.Name}}(ctx *pulumi.Context, key string) (pulumi.{{.Name}}Output, error) {
v, err := Try{{.Name}}(ctx, key)
if err != nil {
return nil, err
var empty pulumi.{{.Name}}Output
return empty, err
}
return pulumi.ToSecret(pulumi.{{.Name}}(v)), nil
return pulumi.ToSecret(pulumi.{{.Name}}(v)).(pulumi.{{.Name}}Output), nil
}
{{end}}