private static async Task <WorkspaceStack> CreateStackHelperAsync( InlineProgramArgs args, Func <string, Workspace, CancellationToken, Task <WorkspaceStack> > initFunc, CancellationToken cancellationToken) { if (args.ProjectSettings is null) { throw new ArgumentNullException(nameof(args.ProjectSettings)); } var ws = new LocalWorkspace( new LocalPulumiCmd(), args, cancellationToken); await ws._readyTask.ConfigureAwait(false); return(await initFunc(args.StackName, ws, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Creates or selects an existing Stack with a <see cref="LocalWorkspace"/> utilizing the specified /// inline (in process) <see cref="LocalWorkspaceOptions.Program"/>. This program /// is fully debuggable and runs in process. If no <see cref="LocalWorkspaceOptions.ProjectSettings"/> /// option is specified, default project settings will be created on behalf of the user. Similarly, unless a /// <see cref="LocalWorkspaceOptions.WorkDir"/> option is specified, the working directory will default /// to a new temporary directory provided by the OS. /// </summary> /// <param name="args"> /// A set of arguments to initialize a Stack with an inline <see cref="PulumiFn"/> program /// that runs in process, as well as any additional customizations to be applied to the /// workspace. /// </param> /// <param name="cancellationToken">A cancellation token.</param> public static Task <WorkspaceStack> CreateOrSelectStackAsync(InlineProgramArgs args, CancellationToken cancellationToken) => CreateStackHelperAsync(args, WorkspaceStack.CreateOrSelectAsync, cancellationToken);
/// <summary> /// Creates or selects an existing Stack with a <see cref="LocalWorkspace"/> utilizing the specified /// inline (in process) <see cref="LocalWorkspaceOptions.Program"/>. This program /// is fully debuggable and runs in process. If no <see cref="LocalWorkspaceOptions.ProjectSettings"/> /// option is specified, default project settings will be created on behalf of the user. Similarly, unless a /// <see cref="LocalWorkspaceOptions.WorkDir"/> option is specified, the working directory will default /// to a new temporary directory provided by the OS. /// </summary> /// <param name="args"> /// A set of arguments to initialize a Stack with an inline <see cref="PulumiFn"/> program /// that runs in process, as well as any additional customizations to be applied to the /// workspace. /// </param> public static Task <WorkspaceStack> CreateOrSelectStackAsync(InlineProgramArgs args) => CreateOrSelectStackAsync(args, default);