/
transformation.go
33 lines (30 loc) 路 1.52 KB
/
transformation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package pulumi
// ResourceTransformationArgs is the argument bag passed to a resource transformation.
type ResourceTransformationArgs struct {
// The resource instance that is being transformed.
Resource Resource
// The type of the resource.
Type string
// The name of the resource.
Name string
// The original properties passed to the resource constructor.
Props Input
// The original resource options passed to the resource constructor.
Opts []ResourceOption
}
// ResourceTransformationResult is the result that must be returned by a resource transformation
// callback. It includes new values to use for the `props` and `opts` of the `Resource` in place of
// the originally provided values.
type ResourceTransformationResult struct {
// The new properties to use in place of the original `props`.
Props Input
// The new resource options to use in place of the original `opts`.
Opts []ResourceOption
}
// ResourceTransformation is the callback signature for the `transformations` resource option. A
// transformation is passed the same set of inputs provided to the `Resource` constructor, and can
// optionally return back alternate values for the `props` and/or `opts` prior to the resource
// actually being created. The effect will be as though those props and opts were passed in place
// of the original call to the `Resource` constructor. If the transformation returns nil,
// this indicates that the resource will not be transformed.
type ResourceTransformation func(*ResourceTransformationArgs) *ResourceTransformationResult