/
stacks-context.ts
59 lines (54 loc) · 1.81 KB
/
stacks-context.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { CredentialManager } from "../aws/common/credentials.js"
import { StackGroup, StackGroupPath } from "../stacks/stack-group.js"
import { InternalStack, Stack, StackPath } from "../stacks/stack.js"
import { TemplateEngine } from "../templating/template-engine.js"
import { CommandContext, InternalCommandContext } from "./command-context.js"
/**
* Provides access to the current stack context and
* project configuration.
*/
export interface StacksContext extends CommandContext {
/**
* Credential manager that provides access to AWS credentials used
* to invoke the current operation.
*/
readonly credentialManager: CredentialManager
/**
* Template engine instance.
*/
readonly templateEngine: TemplateEngine
/**
* Return a stack by exact path or throw an error if no stack is found.
* The stack path can be relative if stackGroupPath is given.
*/
readonly getStackByExactPath: (
path: StackPath,
stackGroupPath?: StackGroupPath,
) => Stack
/**
* Return 0 or more stacks by path. The stack path can be relative if
* stackGroupPath is given.
*/
readonly getStacksByPath: (
path: StackPath,
stackGroupPath?: StackGroupPath,
) => ReadonlyArray<Stack>
}
export interface InternalStacksContext extends InternalCommandContext {
readonly concurrentStacks: number
readonly credentialManager: CredentialManager
readonly templateEngine: TemplateEngine
readonly rootStackGroup: StackGroup
readonly stacks: ReadonlyArray<InternalStack>
readonly getStackGroup: (
stackGroupPath: StackGroupPath,
) => StackGroup | undefined
readonly getStackByExactPath: (
path: StackPath,
stackGroupPath?: StackGroupPath,
) => InternalStack
readonly getStacksByPath: (
path: StackPath,
stackGroupPath?: StackGroupPath,
) => ReadonlyArray<InternalStack>
}