Merge branch 'evan/fixArchive' of https://github.com/pulumi/pulumi into evan/fixArchive

This commit is contained in:
evanboyle 2020-04-09 09:21:56 -07:00
commit 4ac9a416b9
7 changed files with 49 additions and 13 deletions

View file

@ -31,6 +31,12 @@ CHANGELOG
- Change default format of FileArchive to be zip instead of tar
[#4018](https://github.com/pulumi/pulumi/pull/4018)
- Add helper methods for stack outputs in the Go SDK
[#4341](https://github.com/pulumi/pulumi/pull/4341)
- Add additional overloads to Deployment.RunAsync in .NET API.
[#4286](https://github.com/pulumi/pulumi/pull/4286)
## 1.14.0 (2020-04-01)
- Fix error related to side-by-side versions of `@pulumi/pulumi`.

View file

@ -45,9 +45,9 @@ namespace Pulumi
return WhileRunningAsync();
}
public Task<int> RunAsync(Func<Task<IDictionary<string, object?>>> func)
public Task<int> RunAsync(Func<Task<IDictionary<string, object?>>> func, StackOptions? options)
{
var stack = new Stack(func);
var stack = new Stack(func, options);
RegisterTask("User program code.", stack.Outputs.DataTask);
return WhileRunningAsync();
}

View file

@ -12,8 +12,9 @@ namespace Pulumi
public partial class Deployment
{
/// <summary>
/// <see cref="RunAsync(Func{Task{IDictionary{string, object}}})"/> for more details.
/// <see cref="RunAsync(Func{Task{IDictionary{string, object}}}, StackOptions)"/> for more details.
/// </summary>
/// <param name="action">Callback that creates stack resources.</param>
public static Task<int> RunAsync(Action action)
=> RunAsync(() =>
{
@ -22,15 +23,26 @@ namespace Pulumi
});
/// <summary>
/// <see cref="RunAsync(Func{Task{IDictionary{string, object}}})"/> for more details.
/// <see cref="RunAsync(Func{Task{IDictionary{string, object}}}, StackOptions)"/> for more details.
/// </summary>
/// <param name="func"></param>
/// <returns></returns>
/// <param name="func">Callback that creates stack resources.</param>
/// <returns>A dictionary of stack outputs.</returns>
public static Task<int> RunAsync(Func<IDictionary<string, object?>> func)
=> RunAsync(() => Task.FromResult(func()));
/// <summary>
/// <see cref="RunAsync(Func{Task{IDictionary{string, object}}}, StackOptions)"/> for more details.
/// </summary>
/// <param name="func">Callback that creates stack resources.</param>
public static Task<int> RunAsync(Func<Task> func)
=> RunAsync(async () =>
{
await func();
return ImmutableDictionary<string, object?>.Empty;
});
/// <summary>
/// <see cref="RunAsync(Func{Task{IDictionary{string, object}}})"/> is an
/// <see cref="RunAsync(Func{Task{IDictionary{string, object}}}, StackOptions)"/> is an
/// entry-point to a Pulumi application. .NET applications should perform all startup logic
/// they need in their <c>Main</c> method and then end with:
/// <para>
@ -53,12 +65,14 @@ namespace Pulumi
/// the running of the program are properly reported. Failure to do this may lead to the
/// program ending early before all resources are properly registered.
/// <para/>
/// The function passed to <see cref="RunAsync(Func{Task{IDictionary{string, object}}})"/>
/// The function passed to <see cref="RunAsync(Func{Task{IDictionary{string, object}}}, StackOptions)"/>
/// can optionally return an <see cref="IDictionary{TKey, TValue}"/>. The keys and values
/// in this dictionary will become the outputs for the Pulumi Stack that is created.
/// </summary>
public static Task<int> RunAsync(Func<Task<IDictionary<string, object?>>> func)
=> CreateRunner().RunAsync(func);
/// <param name="func">Callback that creates stack resources.</param>
/// <param name="options">Stack options.</param>
public static Task<int> RunAsync(Func<Task<IDictionary<string, object?>>> func, StackOptions? options = null)
=> CreateRunner().RunAsync(func, options);
/// <summary>
/// <see cref="RunAsync{TStack}()"/> is an entry-point to a Pulumi

View file

@ -9,7 +9,7 @@ namespace Pulumi
internal interface IRunner
{
void RegisterTask(string description, Task task);
Task<int> RunAsync(Func<Task<IDictionary<string, object?>>> func);
Task<int> RunAsync(Func<Task<IDictionary<string, object?>>> func, StackOptions? options);
Task<int> RunAsync<TStack>() where TStack : Stack, new();
}
}

View file

@ -227,7 +227,8 @@ static Pulumi.CustomResourceOptions.Merge(Pulumi.CustomResourceOptions options1,
static Pulumi.Deployment.Instance.get -> Pulumi.IDeployment
static Pulumi.Deployment.RunAsync(System.Action action) -> System.Threading.Tasks.Task<int>
static Pulumi.Deployment.RunAsync(System.Func<System.Collections.Generic.IDictionary<string, object>> func) -> System.Threading.Tasks.Task<int>
static Pulumi.Deployment.RunAsync(System.Func<System.Threading.Tasks.Task<System.Collections.Generic.IDictionary<string, object>>> func) -> System.Threading.Tasks.Task<int>
static Pulumi.Deployment.RunAsync(System.Func<System.Threading.Tasks.Task> func) -> System.Threading.Tasks.Task<int>
static Pulumi.Deployment.RunAsync(System.Func<System.Threading.Tasks.Task<System.Collections.Generic.IDictionary<string, object>>> func, Pulumi.StackOptions options = null) -> System.Threading.Tasks.Task<int>
static Pulumi.Deployment.RunAsync<TStack>() -> System.Threading.Tasks.Task<int>
static Pulumi.Deployment.TestAsync<TStack>(Pulumi.Testing.IMocks mocks, Pulumi.Testing.TestOptions options = null) -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Pulumi.Resource>>
static Pulumi.Input<T>.implicit operator Pulumi.Input<T>(Pulumi.Output<T> value) -> Pulumi.Input<T>

View file

@ -63,7 +63,7 @@ namespace Pulumi
/// An instance of this will be automatically created when any <see
/// cref="Deployment.RunAsync(Action)"/> overload is called.
/// </summary>
internal Stack(Func<Task<IDictionary<string, object?>>> init) : this()
internal Stack(Func<Task<IDictionary<string, object?>>> init, StackOptions? options) : this(options)
{
try
{

View file

@ -12,6 +12,7 @@ type StackReference struct {
Outputs MapOutput `pulumi:"outputs"`
}
// GetOutput returns a stack output keyed by the given name as an AnyOutput
func (s *StackReference) GetOutput(name StringInput) AnyOutput {
return All(name, s.Outputs).
ApplyT(func(args []interface{}) interface{} {
@ -20,6 +21,20 @@ func (s *StackReference) GetOutput(name StringInput) AnyOutput {
}).(AnyOutput)
}
// GetStringOutput returns a stack output keyed by the given name as an StringOutput
func (s *StackReference) GetStringOutput(name StringInput) StringOutput {
return s.GetOutput(name).ApplyString(func(v interface{}) string {
return v.(string)
})
}
// GetIDOutput returns a stack output keyed by the given name as an IDOutput
func (s *StackReference) GetIDOutput(name StringInput) IDOutput {
return s.GetOutput(name).ApplyID(func(v interface{}) ID {
return ID(v.(string))
})
}
type stackReferenceArgs struct {
Name string `pulumi:"name"`
}