diff --git a/sdk/dotnet/Local/Run.cs b/sdk/dotnet/Local/Run.cs index 02db6bbf..5a128888 100644 --- a/sdk/dotnet/Local/Run.cs +++ b/sdk/dotnet/Local/Run.cs @@ -24,6 +24,13 @@ public static Task InvokeAsync(RunArgs args, InvokeOptions? options = /// public static Output Invoke(RunInvokeArgs args, InvokeOptions? options = null) => global::Pulumi.Deployment.Instance.Invoke("command:local:run", args ?? new RunInvokeArgs(), options.WithDefaults()); + + /// + /// A local command to be executed. + /// This command will always be run on any preview or deployment. Use `local.Command` to avoid duplicating executions. + /// + public static Output Invoke(RunInvokeArgs args, InvokeOutputOptions options) + => global::Pulumi.Deployment.Instance.Invoke("command:local:run", args ?? new RunInvokeArgs(), options.WithDefaults()); } diff --git a/sdk/dotnet/Utilities.cs b/sdk/dotnet/Utilities.cs index f058b199..fe723232 100644 --- a/sdk/dotnet/Utilities.cs +++ b/sdk/dotnet/Utilities.cs @@ -56,6 +56,13 @@ static class Utilities return dst; } + public static global::Pulumi.InvokeOutputOptions WithDefaults(this global::Pulumi.InvokeOutputOptions? src) + { + var dst = src ?? new global::Pulumi.InvokeOutputOptions{}; + dst.Version = src?.Version ?? Version; + return dst; + } + private readonly static string version; public static string Version => version; diff --git a/sdk/dotnet/pulumi-plugin.json b/sdk/dotnet/pulumi-plugin.json index 9cb7752b..bcb12c84 100644 --- a/sdk/dotnet/pulumi-plugin.json +++ b/sdk/dotnet/pulumi-plugin.json @@ -1,5 +1,5 @@ { "resource": true, "name": "command", - "version": "1.0.0-alpha.0+dev" + "version": "1.1.0-alpha.1735343232+5a82aa6" } diff --git a/sdk/go/command/local/run.go b/sdk/go/command/local/run.go index aa18b7eb..3e20939c 100644 --- a/sdk/go/command/local/run.go +++ b/sdk/go/command/local/run.go @@ -183,23 +183,12 @@ func (val *RunResult) Defaults() *RunResult { } return &tmp } - func RunOutput(ctx *pulumi.Context, args RunOutputArgs, opts ...pulumi.InvokeOption) RunResultOutput { - return pulumi.ToOutputWithContext(context.Background(), args). + return pulumi.ToOutputWithContext(ctx.Context(), args). ApplyT(func(v interface{}) (RunResultOutput, error) { args := v.(RunArgs) - opts = internal.PkgInvokeDefaultOpts(opts) - var rv RunResult - secret, err := ctx.InvokePackageRaw("command:local:run", args.Defaults(), &rv, "", opts...) - if err != nil { - return RunResultOutput{}, err - } - - output := pulumi.ToOutput(rv).(RunResultOutput) - if secret { - return pulumi.ToSecret(output).(RunResultOutput), nil - } - return output, nil + options := pulumi.InvokeOutputOptions{InvokeOptions: internal.PkgInvokeDefaultOpts(opts)} + return ctx.InvokeOutput("command:local:run", args.Defaults(), RunResultOutput{}, options).(RunResultOutput), nil }).(RunResultOutput) } diff --git a/sdk/go/command/pulumi-plugin.json b/sdk/go/command/pulumi-plugin.json index 9cb7752b..bcb12c84 100644 --- a/sdk/go/command/pulumi-plugin.json +++ b/sdk/go/command/pulumi-plugin.json @@ -1,5 +1,5 @@ { "resource": true, "name": "command", - "version": "1.0.0-alpha.0+dev" + "version": "1.1.0-alpha.1735343232+5a82aa6" } diff --git a/sdk/java/src/main/java/com/pulumi/command/Utilities.java b/sdk/java/src/main/java/com/pulumi/command/Utilities.java index 7d12a056..15915732 100644 --- a/sdk/java/src/main/java/com/pulumi/command/Utilities.java +++ b/sdk/java/src/main/java/com/pulumi/command/Utilities.java @@ -14,6 +14,7 @@ import javax.annotation.Nullable; import com.pulumi.core.internal.Environment; import com.pulumi.deployment.InvokeOptions; +import com.pulumi.deployment.InvokeOutputOptions; public class Utilities { @@ -57,16 +58,28 @@ public static Optional getEnvDouble(java.lang.String... names) return Optional.empty(); } - public static InvokeOptions withVersion(@Nullable InvokeOptions options) { - if (options != null && options.getVersion().isPresent()) { - return options; - } - return new InvokeOptions( - options == null ? null : options.getParent().orElse(null), - options == null ? null : options.getProvider().orElse(null), - getVersion() - ); + public static InvokeOptions withVersion(@Nullable InvokeOptions options) { + if (options != null && options.getVersion().isPresent()) { + return options; + } + return new InvokeOptions( + options == null ? null : options.getParent().orElse(null), + options == null ? null : options.getProvider().orElse(null), + getVersion() + ); + } + + public static InvokeOutputOptions withVersion(@Nullable InvokeOutputOptions options) { + if (options != null && options.getVersion().isPresent()) { + return options; } + return new InvokeOutputOptions( + options == null ? null : options.getParent().orElse(null), + options == null ? null : options.getProvider().orElse(null), + getVersion(), + options == null ? null : options.getDependsOn() + ); + } private static final java.lang.String version; public static java.lang.String getVersion() { diff --git a/sdk/java/src/main/java/com/pulumi/command/local/LocalFunctions.java b/sdk/java/src/main/java/com/pulumi/command/local/LocalFunctions.java index afa69e91..0cd25f4d 100644 --- a/sdk/java/src/main/java/com/pulumi/command/local/LocalFunctions.java +++ b/sdk/java/src/main/java/com/pulumi/command/local/LocalFunctions.java @@ -11,6 +11,7 @@ import com.pulumi.core.TypeShape; import com.pulumi.deployment.Deployment; import com.pulumi.deployment.InvokeOptions; +import com.pulumi.deployment.InvokeOutputOptions; import java.util.concurrent.CompletableFuture; public final class LocalFunctions { @@ -38,6 +39,14 @@ public static CompletableFuture runPlain(RunPlainArgs args) { public static Output run(RunArgs args, InvokeOptions options) { return Deployment.getInstance().invoke("command:local:run", TypeShape.of(RunResult.class), args, Utilities.withVersion(options)); } + /** + * A local command to be executed. + * This command will always be run on any preview or deployment. Use `local.Command` to avoid duplicating executions. + * + */ + public static Output run(RunArgs args, InvokeOutputOptions options) { + return Deployment.getInstance().invoke("command:local:run", TypeShape.of(RunResult.class), args, Utilities.withVersion(options)); + } /** * A local command to be executed. * This command will always be run on any preview or deployment. Use `local.Command` to avoid duplicating executions.