checkpoint

This commit is contained in:
evanboyle 2020-02-10 14:01:05 -08:00
parent 00e2c46300
commit 6564acb570
2 changed files with 26 additions and 13 deletions

View file

@ -313,13 +313,14 @@ func (ctx *Context) ReadResource(
logging.V(9).Infof("ReadResource(%s, %s): Goroutine spawned, RPC call being made", t, name)
resp, err := ctx.monitor.ReadResource(ctx.ctx, &pulumirpc.ReadResourceRequest{
Type: t,
Name: name,
Parent: inputs.parent,
Properties: inputs.rpcProps,
Provider: inputs.provider,
Id: string(idToRead),
Aliases: inputs.aliases,
Type: t,
Name: name,
Parent: inputs.parent,
Properties: inputs.rpcProps,
Provider: inputs.provider,
Id: string(idToRead),
Aliases: inputs.aliases,
AcceptSecrets: true,
})
if err != nil {
logging.V(9).Infof("ReadResource(%s, %s): error: %v", t, name, err)
@ -443,6 +444,7 @@ func (ctx *Context) RegisterResource(
CustomTimeouts: inputs.customTimeouts,
IgnoreChanges: inputs.ignoreChanges,
Aliases: inputs.aliases,
AcceptSecrets: true,
})
if err != nil {
logging.V(9).Infof("RegisterResource(%s, %s): error: %v", t, name, err)

View file

@ -399,6 +399,17 @@ func (o *OutputState) ApplyTWithContext(ctx context.Context, applier interface{}
return result
}
func SecretT(input interface{}) Output {
return SecretTWithContext(context.Background(), input)
}
func SecretTWithContext(ctx context.Context, input interface{}) Output {
o := ToOutputWithContext(ctx, input)
// not sure if this is totally right, the input value may resolve and clobber the secret state
o.getState().secret = true
return o
}
// All returns an ArrayOutput that will resolve when all of the provided inputs will resolve. Each element of the
// array will contain the resolved value of the corresponding output. The output will be rejected if any of the inputs
// is rejected.
@ -795,11 +806,11 @@ func (o IDOutput) ToStringPtrOutputWithContext(ctx context.Context) StringPtrOut
}
func (o IDOutput) awaitID(ctx context.Context) (ID, bool, bool, error) {
id, known, secret, err := o.await(ctx)
id, known, _, err := o.await(ctx)
if !known || err != nil {
return "", known, secret, err
return "", known, false, err
}
return ID(convert(id, stringType).(string)), true, secret, nil
return ID(convert(id, stringType).(string)), true, false, nil
}
func (in URN) ToStringPtrOutput() StringPtrOutput {
@ -819,11 +830,11 @@ func (o URNOutput) ToStringPtrOutputWithContext(ctx context.Context) StringPtrOu
}
func (o URNOutput) awaitURN(ctx context.Context) (URN, bool, bool, error) {
id, known, secret, err := o.await(ctx)
id, known, _, err := o.await(ctx)
if !known || err != nil {
return "", known, secret, err
return "", known, false, err
}
return URN(convert(id, stringType).(string)), true, secret, nil
return URN(convert(id, stringType).(string)), true, false, nil
}
func convert(v interface{}, to reflect.Type) interface{} {