Skip to content

Commit cd38b32

Browse files
committed
add docstring to create prompter methods
1 parent 166183c commit cd38b32

File tree

5 files changed

+56
-0
lines changed

5 files changed

+56
-0
lines changed

packages/core/src/shared/ui/sam/bucketPrompter.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ export enum BucketSource {
1818
UserProvided,
1919
}
2020

21+
/**
22+
* Creates a quick pick prompter for configuring S3 bucket used for sync or deploy application artifact
23+
* Provides two options:
24+
* 1. Create a SAM CLI managed bucket
25+
* 2. Specify an existing bucket
26+
* @returns A QuickPick prompter configured with bucket source options
27+
*/
2128
export function createBucketSourcePrompter() {
2229
const items: DataQuickPickItem<BucketSource>[] = [
2330
{
@@ -37,6 +44,13 @@ export function createBucketSourcePrompter() {
3744
})
3845
}
3946

47+
/**
48+
* Creates a quick pick prompter for configuring S3 bucket name used for sync or deploy application artifact
49+
* The prompter supports choosing from existing s3 bucket name or creating a new one
50+
* @param client S3 client
51+
* @param mementoRootKey Memento key to store recent bucket name (e.g 'samcli.deploy.params')
52+
* @returns A quick pick prompter configured with bucket name options
53+
*/
4054
export function createBucketNamePrompter(client: DefaultS3Client, mementoRootKey: string) {
4155
const recentBucket = getRecentResponse(mementoRootKey, client.regionCode, 'bucketName')
4256
const items = client.listBucketsIterable().map((b) => [

packages/core/src/shared/ui/sam/ecrPrompter.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ import { getRecentResponse } from '../../sam/utils'
1414
export const localize = nls.loadMessageBundle()
1515
export const prefixNewRepoName = (name: string) => `newrepo:${name}`
1616

17+
/**
18+
* Creates a quick pick prompter for ECR repositories
19+
* The prompter supports choosing from existing option and new repositories by entering a name
20+
*
21+
* @param client ECR client used to list repositories
22+
* @param mementoRootKey Key used to store/retrieve recently used repository (e.g 'samcli.deploy.params')
23+
* @returns A quick pick prompter configured for ECR repository
24+
*/
1725
export function createEcrPrompter(client: DefaultEcrClient, mementoRootKey: string) {
1826
const recentEcrRepo = getRecentResponse(mementoRootKey, client.regionCode, 'ecrRepoUri')
1927
const consoleUrl = getAwsConsoleUrl('ecr', client.regionCode)

packages/core/src/shared/ui/sam/paramsSourcePrompter.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ function loadParamsSourcePrompterItems(existValidSamconfig: boolean | undefined)
3434
return items
3535
}
3636

37+
/**
38+
* Creates a quick pick prompter for SAM deploy parameter source selection
39+
*
40+
* @param existValidSamconfig Whether a valid samconfig.toml file exist and contain necessary flag for SAM sync operation
41+
* @returns A quick pick prompter
42+
*/
3743
export function createDeployParamsSourcePrompter(existValidSamconfig: boolean | undefined) {
3844
const items = loadParamsSourcePrompterItems(existValidSamconfig)
3945

@@ -44,6 +50,13 @@ export function createDeployParamsSourcePrompter(existValidSamconfig: boolean |
4450
})
4551
}
4652

53+
/**
54+
* Creates a quick pick prompter for SAM sync parameter source selection
55+
*
56+
* @param existValidSamconfig Whether a valid samconfig.toml file exist and contain necessary flag for SAM sync operation
57+
* @returns A quick pick prompter
58+
*/
59+
4760
export function createSyncParamsSourcePrompter(existValidSamconfig: boolean | undefined) {
4861
const items = loadParamsSourcePrompterItems(existValidSamconfig)
4962

packages/core/src/shared/ui/sam/stackPrompter.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ const canPickStack = (s: StackSummary) => s.StackStatus.endsWith('_COMPLETE')
1717
const canShowStack = (s: StackSummary) =>
1818
(s.StackStatus.endsWith('_COMPLETE') || s.StackStatus.endsWith('_IN_PROGRESS')) && !s.StackStatus.includes('DELETE')
1919

20+
/**
21+
* Creates a quick pick prompter for choosing a CloudFormation stack
22+
* The promper supports selecting from existing options or creating a new stack by entering a name
23+
*
24+
* @param client - CloudFormation client to use for listing stacks
25+
* @param mementoRootKey - Key used to store/retrieve recently used stack (e.g 'samcli.deploy.params')
26+
* @returns A quick pick prompter configured for stack selection
27+
*
28+
*/
2029
export function createStackPrompter(client: DefaultCloudFormationClient, mementoRootKey: string) {
2130
const recentStack = getRecentResponse(mementoRootKey, client.regionCode, 'stackName')
2231
const consoleUrl = getAwsConsoleUrl('cloudformation', client.regionCode)

packages/core/src/shared/ui/sam/templatePrompter.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ export interface TemplateItem {
2222
readonly data: CloudFormation.Template
2323
}
2424

25+
/**
26+
* Creates a quick pick prompter for choosing SAM/CloudFormation templates
27+
*
28+
* @param registry - Registry containing CloudFormation templates
29+
* @param mementoRootKey - Root key for storing recent template selections (e.g 'samcli.deploy.params')
30+
* @param projectRoot - Optional URI of the project root to filter templates
31+
* @returns A QuickPick prompter configured for template selection
32+
*
33+
* The prompter displays a list of SAM/CloudFormation templates found in the workspace.
34+
* Templates are shown with relative paths when possible, and workspace folder names when multiple folders exist.
35+
* Recently used templates are marked. If no templates are found, provides a help link.
36+
*/
2537
export function createTemplatePrompter(
2638
registry: CloudFormationTemplateRegistry,
2739
mementoRootKey: string,

0 commit comments

Comments
 (0)