-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced Stack() and Stack.exports (#348)
* Introduced Stack() and Stack.exports to replace faulty final for-comprehension. Updated integration tests, docs, examples and templates.
- Loading branch information
Showing
52 changed files
with
461 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package besom.internal | ||
|
||
import com.google.protobuf.struct.Struct | ||
|
||
/** The Stack is the final result of a Pulumi program. It contains the exports and dependencies of the program. * Exports are the values | ||
* that are exposed to the Pulumi runtime and available to other stacks via StackReference * Dependencies are the values that have to be | ||
* evaluated (and thus created) for the Stack to be created. | ||
* | ||
* The Stack is created in user's code using [[StackFactory]] and not directly to offer a nicer API. | ||
* | ||
* @param _exports | ||
* @param dependsOn | ||
*/ | ||
case class Stack private[besom] (private val _exports: Exports, private val dependsOn: Vector[Output[?]]): | ||
private[besom] def evaluateDependencies(using Context): Result[Unit] = | ||
Output.sequence(dependsOn).getData.void | ||
|
||
private[besom] def getExports: Exports = _exports | ||
|
||
private[besom] def getDependsOn: Vector[Output[?]] = dependsOn | ||
|
||
def exports: Export = Export(this) | ||
|
||
object Stack: | ||
def empty: Stack = Stack(Exports(Result.pure(Struct(Map.empty))), Vector.empty) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package besom.internal | ||
|
||
/** The Stack is the final result of a Pulumi program. It contains the exports and dependencies of the program. * Exports are the values | ||
* that are exposed to the Pulumi runtime and available to other stacks via StackReference * Dependencies are the values that have to be | ||
* evaluated (and thus created) for the Stack to be created | ||
* | ||
* There are three ways to create a Stack in user's code: | ||
* | ||
* * Stack(a, b) - creates a stack with dependencies a and b | ||
* | ||
* * Stack.exports(a = x, b = y) - creates a stack with exports a and b | ||
* | ||
* * Stack(a, b).exports(c = x, d = y) - creates a stack with dependencies a and b and exports c and d | ||
*/ | ||
trait StackFactory: | ||
val exports: EmptyExport.type = EmptyExport | ||
|
||
def apply(dependsOn: Output[?]*)(using Context): Stack = | ||
Stack.empty.copy(dependsOn = dependsOn.toVector) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.