Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flip transforms to non-experimental #270

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Improvements-270.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
component: sdk
kind: Improvements
body: Transforms are now stable, not experimental.
time: 2024-04-29T09:32:15.862863+01:00
custom:
PR: "270"
10 changes: 5 additions & 5 deletions integration_tests/transformations_remote/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public MyComponent(string name, ComponentResourceOptions? options = null)

class TransformsStack : Stack
{
public TransformsStack() : base(new StackOptions { XResourceTransforms = {Scenario3} })
public TransformsStack() : base(new StackOptions { ResourceTransforms = {Scenario3} })
{
// Scenario #1 - apply a transformation to a CustomResource
var res1 = new Random("res1", new RandomArgs { Length = 5 }, new CustomResourceOptions
{
XResourceTransforms =
ResourceTransforms =
{
async (args, _) =>
{
Expand All @@ -40,7 +40,7 @@ public TransformsStack() : base(new StackOptions { XResourceTransforms = {Scenar
// Scenario #2 - apply a transformation to a Component to transform its children
var res2 = new MyComponent("res2", new ComponentResourceOptions
{
XResourceTransforms =
ResourceTransforms =
{
async (args, _) =>
{
Expand Down Expand Up @@ -71,7 +71,7 @@ public TransformsStack() : base(new StackOptions { XResourceTransforms = {Scenar
// 4. Stack transformation
var res4 = new MyComponent("res4", new ComponentResourceOptions
{
XResourceTransforms = { (args, _) => scenario4(args, "default1"), (args, _) => scenario4(args, "default2") }
ResourceTransforms = { (args, _) => scenario4(args, "default1"), (args, _) => scenario4(args, "default2") }
});

async Task<ResourceTransformResult?> scenario4(ResourceTransformArgs args, string v)
Expand All @@ -89,7 +89,7 @@ public TransformsStack() : base(new StackOptions { XResourceTransforms = {Scenar
// Scenario #5 - mutate the properties of a resource
var res5 = new Random("res5", new RandomArgs { Length = 10 }, new CustomResourceOptions
{
XResourceTransforms =
ResourceTransforms =
{
async (args, _) =>
{
Expand Down
4 changes: 2 additions & 2 deletions sdk/Pulumi/Deployment/Deployment_Prepare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public partial class Deployment
var aliases = await PrepareAliases(res, options, resourceMonitorSupportsAliasSpecs).ConfigureAwait(false);

var transforms = new List<Pulumirpc.Callback>();
if (options.XResourceTransforms.Count > 0)
if (options.ResourceTransforms.Count > 0)
{
var resourceMonitorSupportsTransforms = await MonitorSupportsTransforms().ConfigureAwait(false);
if (!resourceMonitorSupportsTransforms)
Expand All @@ -132,7 +132,7 @@ public partial class Deployment

var callbacks = await this.GetCallbacksAsync(CancellationToken.None).ConfigureAwait(false);

foreach (var t in options.XResourceTransforms)
foreach (var t in options.ResourceTransforms)
{
transforms.Add(await AllocateTransform(callbacks.Callbacks, t).ConfigureAwait(false));
}
Expand Down
4 changes: 1 addition & 3 deletions sdk/Pulumi/Resources/ResourceOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ public List<ResourceTransformation> ResourceTransformations
/// <summary>
/// Optional list of transforms to apply to this resource during construction.The transforms are applied in
/// order, and are applied prior to transform applied to parents walking from the resource up to the stack.
///
/// This property is experimental.
/// </summary>
public List<ResourceTransform> XResourceTransforms
public List<ResourceTransform> ResourceTransforms
{
get => _resourceTransforms ??= new List<ResourceTransform>();
set => _resourceTransforms = value;
Expand Down
2 changes: 1 addition & 1 deletion sdk/Pulumi/Resources/ResourceOptions_Copy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal static TResourceOptions CreateCopy<TResourceOptions>(ResourceOptions op
PluginDownloadURL = options.PluginDownloadURL,
RetainOnDelete = options.RetainOnDelete,
DeletedWith = options.DeletedWith,
XResourceTransforms = options.XResourceTransforms.ToList(),
ResourceTransforms = options.ResourceTransforms.ToList(),
};

internal static CustomResourceOptions CreateCustomResourceOptionsCopy(ResourceOptions? options)
Expand Down
2 changes: 1 addition & 1 deletion sdk/Pulumi/Resources/ResourceTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Pulumi
{
/// <summary>
/// ResourceTransform is the callback signature for <see cref="ResourceOptions.XResourceTransforms"/>. A
/// ResourceTransform is the callback signature for <see cref="ResourceOptions.ResourceTransforms"/>. A
/// transform is passed the same set of inputs provided to the <see cref="Resource"/> constructor, and can
/// optionally return back alternate values for the <c>properties</c> and/or <c>options</c> prior to the resource
/// actually being created. The effect will be as though those <c>properties</c> and/or <c>options</c> were passed
Expand Down
4 changes: 1 addition & 3 deletions sdk/Pulumi/Resources/StackOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ public List<ResourceTransformation> ResourceTransformations
/// <summary>
/// Optional list of transforms to apply to this stack's resources during construction. The transforms are
/// applied in order, and are applied after all the transforms of custom and component resources in the stack.
///
/// This property is experimental.
/// </summary>
public List<ResourceTransform> XResourceTransforms
public List<ResourceTransform> ResourceTransforms
{
get => _resourceTransforms ??= new List<ResourceTransform>();
set => _resourceTransforms = value;
Expand Down
2 changes: 1 addition & 1 deletion sdk/Pulumi/Stack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ internal void RegisterPropertyOutputs()
return new ComponentResourceOptions
{
ResourceTransformations = options.ResourceTransformations,
XResourceTransforms = options.XResourceTransforms,
ResourceTransforms = options.ResourceTransforms,
};
}
}
Expand Down