Add ResourceOutput type to Go SDK (#4575)

This commit is contained in:
Levi Blackstone 2020-05-05 21:13:58 -06:00 committed by GitHub
parent 1fe5b1cb26
commit b445206101
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 3 deletions

View file

@ -14,6 +14,9 @@ CHANGELOG
- Don't call IMocks.NewResourceAsync for the root stack resource
[#4527](https://github.com/pulumi/pulumi/pull/4527)
- Add ResourceOutput type to Go SDK
[#4575](https://github.com/pulumi/pulumi/pull/4575)
## 2.1.0 (2020-04-28)

View file

@ -1,4 +1,4 @@
// Copyright 2016-2018, Pulumi Corporation.
// Copyright 2016-2020, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -14,7 +14,9 @@
package pulumi
import "reflect"
import (
"reflect"
)
type (
// ID is a unique identifier assigned by a resource provider to a resource.

View file

@ -1,4 +1,4 @@
// Copyright 2016-2018, Pulumi Corporation.
// Copyright 2016-2020, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -893,3 +893,16 @@ func convert(v interface{}, to reflect.Type) interface{} {
}
return rv.Convert(to).Interface()
}
// TODO: ResourceOutput and the init() should probably be code generated.
// ResourceOutput is an Output that returns Resource values.
type ResourceOutput struct{ *OutputState }
// ElementType returns the element type of this Output (Resource).
func (ResourceOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Resource)(nil)).Elem()
}
func init() {
RegisterOutputType(ResourceOutput{})
}