lambda-function-search 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -27
- package/bin/run +10 -5
- package/lib/index.d.ts +16 -14
- package/lib/index.js +153 -84
- package/package.json +32 -21
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
lambda-function-search
|
|
2
2
|
======================
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
A CLI tool to search and list AWS Lambda functions across regions with filtering capabilities.
|
|
5
5
|
|
|
6
6
|
[](https://oclif.io)
|
|
7
7
|
[](https://npmjs.org/package/lambda-function-search)
|
|
@@ -9,16 +9,47 @@ Search your Lambda functions
|
|
|
9
9
|
[](https://github.com/hideokamoto/lambda-function-search/blob/master/package.json)
|
|
10
10
|
|
|
11
11
|
<!-- toc -->
|
|
12
|
-
# Install
|
|
13
12
|
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
- Node.js >= 18.0.0
|
|
16
|
+
- AWS credentials configured (via AWS CLI, environment variables, or IAM role)
|
|
17
|
+
|
|
18
|
+
## What's New in v0.6.0
|
|
19
|
+
|
|
20
|
+
- ✨ **Modernized Dependencies**: Migrated to AWS SDK v3 and oclif v4
|
|
21
|
+
- 🔒 **Security**: Fixed all 12 security vulnerabilities
|
|
22
|
+
- 🚀 **Updated Runtime Support**: Added support for latest Lambda runtimes (Node.js 18/20/22, Python 3.11/3.12/3.13, etc.)
|
|
23
|
+
- 🌍 **Expanded Regions**: Updated AWS region list to include all current regions (29 regions supported)
|
|
24
|
+
- 🛠️ **Developer Experience**: Migrated from TSLint to ESLint, updated TypeScript to v5
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
### Global Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm i -g lambda-function-search
|
|
14
32
|
```
|
|
15
|
-
$ npm i -g lambda-function-search
|
|
16
33
|
|
|
34
|
+
After installation, you can use the `lfs` or `lambda-function-search` command.
|
|
35
|
+
|
|
36
|
+
### Using with npx (No Installation Required)
|
|
37
|
+
|
|
38
|
+
You can use the tool directly with `npx` without installing it globally:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx lambda-function-search --region us-east-1
|
|
17
42
|
```
|
|
18
43
|
|
|
19
|
-
|
|
44
|
+
Or use the shorter alias:
|
|
20
45
|
|
|
46
|
+
```bash
|
|
47
|
+
npx lfs --region us-east-1
|
|
21
48
|
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```bash
|
|
22
53
|
$ lfs --help
|
|
23
54
|
Search Lambda functions
|
|
24
55
|
|
|
@@ -26,31 +57,39 @@ USAGE
|
|
|
26
57
|
$ lambda-function-search
|
|
27
58
|
|
|
28
59
|
OPTIONS
|
|
29
|
-
-A, --showAll Show all function data
|
|
60
|
+
-A, --showAll Show all function data (full JSON output)
|
|
30
61
|
|
|
31
|
-
-R, --runtime=runtime Lambda runtime
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
62
|
+
-R, --runtime=runtime Filter by Lambda runtime
|
|
63
|
+
Examples: nodejs18.x, nodejs20.x, nodejs22.x,
|
|
64
|
+
python3.11, python3.12, python3.13,
|
|
65
|
+
java11, java17, java21,
|
|
66
|
+
dotnet6, dotnet8,
|
|
67
|
+
ruby3.2, ruby3.3,
|
|
68
|
+
provided.al2, provided.al2023
|
|
36
69
|
|
|
37
|
-
-h, --help
|
|
70
|
+
-h, --help Show CLI help
|
|
38
71
|
|
|
39
|
-
-p, --profile=profile AWS CLI profile
|
|
72
|
+
-p, --profile=profile AWS CLI profile name
|
|
40
73
|
|
|
41
|
-
-r, --region=region region
|
|
74
|
+
-r, --region=region AWS region (use "all" to search all regions)
|
|
42
75
|
|
|
43
|
-
-s, --search=search
|
|
76
|
+
-s, --search=search Search by function name (regex supported)
|
|
44
77
|
```
|
|
45
78
|
|
|
46
|
-
|
|
47
|
-
|
|
79
|
+
## Examples
|
|
80
|
+
|
|
81
|
+
> **Note**: If you installed globally, you can use `lfs` or `lambda-function-search`. If using `npx`, replace `lfs` with `npx lambda-function-search` or `npx lfs`.
|
|
82
|
+
|
|
83
|
+
### List All Functions in a Region
|
|
48
84
|
|
|
49
|
-
## List all Function
|
|
50
85
|
```bash
|
|
86
|
+
# With global installation
|
|
51
87
|
$ lfs --region us-east-1
|
|
52
|
-
|
|
53
|
-
|
|
88
|
+
|
|
89
|
+
# Or with npx (no installation required)
|
|
90
|
+
$ npx lambda-function-search --region us-east-1
|
|
91
|
+
=== Matched Functions: 5 / 5 ===
|
|
92
|
+
Region : us-east-1
|
|
54
93
|
ContactFormLambda
|
|
55
94
|
serverlessContactForm
|
|
56
95
|
HelloAlexa
|
|
@@ -58,27 +97,120 @@ Example
|
|
|
58
97
|
ServerlessTest
|
|
59
98
|
```
|
|
60
99
|
|
|
61
|
-
|
|
100
|
+
### List All Functions Across All Regions
|
|
62
101
|
|
|
63
102
|
```bash
|
|
64
|
-
$ lfs --region
|
|
65
|
-
|
|
66
|
-
Matched Functions: 5 /
|
|
67
|
-
|
|
103
|
+
$ lfs --region all
|
|
104
|
+
# Or: npx lambda-function-search --region all
|
|
105
|
+
=== Matched Functions: 5 / 5 ===
|
|
106
|
+
Region : ap-northeast-2
|
|
68
107
|
ContactFormLambda
|
|
69
108
|
serverlessContactForm
|
|
70
109
|
HelloAlexa
|
|
71
110
|
Example
|
|
72
111
|
ServerlessTest
|
|
112
|
+
=== Matched Functions: 2 / 5 ===
|
|
113
|
+
Region : ap-northeast-1
|
|
114
|
+
ContactFormLambda
|
|
115
|
+
serverlessContactForm
|
|
116
|
+
...
|
|
73
117
|
```
|
|
74
118
|
|
|
75
|
-
|
|
119
|
+
### Search by Runtime
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
$ lfs --region us-east-1 --runtime nodejs20.x
|
|
123
|
+
# Or: npx lambda-function-search --region us-east-1 --runtime nodejs20.x
|
|
124
|
+
Search condition: Runtime === nodejs20.x
|
|
125
|
+
=== Matched Functions: 5 / 43 ===
|
|
126
|
+
Region : us-east-1
|
|
127
|
+
ContactFormLambda
|
|
128
|
+
serverlessContactForm
|
|
129
|
+
HelloAlexa
|
|
130
|
+
Example
|
|
131
|
+
ServerlessTest
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Search by Function Name
|
|
76
135
|
|
|
77
136
|
```bash
|
|
78
137
|
$ lfs --region us-east-1 --search Form
|
|
138
|
+
# Or: npx lambda-function-search --region us-east-1 --search Form
|
|
139
|
+
Search condition: FunctionName contains Form
|
|
140
|
+
=== Matched Functions: 2 / 43 ===
|
|
141
|
+
Region : us-east-1
|
|
142
|
+
ContactFormLambda
|
|
143
|
+
serverlessContactForm
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Show Full Function Details
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
$ lfs --region us-east-1 --search Form --showAll
|
|
150
|
+
# Or: npx lambda-function-search --region us-east-1 --search Form --showAll
|
|
151
|
+
Search condition: FunctionName contains Form
|
|
152
|
+
=== Matched Functions: 2 / 43 ===
|
|
153
|
+
Region : us-east-1
|
|
154
|
+
ContactFormLambda
|
|
155
|
+
{
|
|
156
|
+
FunctionName: 'ContactFormLambda',
|
|
157
|
+
FunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:ContactFormLambda',
|
|
158
|
+
Runtime: 'nodejs20.x',
|
|
159
|
+
Role: 'arn:aws:iam::123456789012:role/lambda-role',
|
|
160
|
+
...
|
|
161
|
+
}
|
|
162
|
+
serverlessContactForm
|
|
163
|
+
{
|
|
164
|
+
FunctionName: 'serverlessContactForm',
|
|
165
|
+
...
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Use AWS Profile
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
$ lfs --region us-east-1 --profile my-profile
|
|
173
|
+
# Or: npx lambda-function-search --region us-east-1 --profile my-profile
|
|
174
|
+
=== Matched Functions: 5 / 5 ===
|
|
175
|
+
Region : us-east-1
|
|
176
|
+
...
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Combine Filters
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
$ lfs --region us-east-1 --runtime nodejs20.x --search Form
|
|
183
|
+
# Or: npx lambda-function-search --region us-east-1 --runtime nodejs20.x --search Form
|
|
184
|
+
Search condition: Runtime === nodejs20.x
|
|
79
185
|
Search condition: FunctionName contains Form
|
|
80
|
-
Matched Functions: 2 / 43
|
|
81
|
-
|
|
186
|
+
=== Matched Functions: 2 / 43 ===
|
|
187
|
+
Region : us-east-1
|
|
82
188
|
ContactFormLambda
|
|
83
189
|
serverlessContactForm
|
|
84
190
|
```
|
|
191
|
+
|
|
192
|
+
## Supported Regions
|
|
193
|
+
|
|
194
|
+
The tool supports all 29 AWS regions:
|
|
195
|
+
- **Africa**: af-south-1
|
|
196
|
+
- **Asia Pacific**: ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-south-2, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4
|
|
197
|
+
- **Canada**: ca-central-1, ca-west-1
|
|
198
|
+
- **Europe**: eu-central-1, eu-central-2, eu-north-1, eu-south-1, eu-south-2, eu-west-1, eu-west-2, eu-west-3
|
|
199
|
+
- **Middle East**: il-central-1, me-central-1, me-south-1
|
|
200
|
+
- **South America**: sa-east-1
|
|
201
|
+
- **United States**: us-east-1, us-east-2, us-west-1, us-west-2
|
|
202
|
+
|
|
203
|
+
## Supported Runtimes
|
|
204
|
+
|
|
205
|
+
The tool supports filtering by all Lambda runtimes, including:
|
|
206
|
+
- **Node.js**: nodejs18.x, nodejs20.x, nodejs22.x (and older versions)
|
|
207
|
+
- **Python**: python3.11, python3.12, python3.13 (and older versions)
|
|
208
|
+
- **Java**: java11, java17, java21 (and older versions)
|
|
209
|
+
- **.NET**: dotnet6, dotnet8 (and older versions)
|
|
210
|
+
- **Ruby**: ruby3.2, ruby3.3 (and older versions)
|
|
211
|
+
- **Custom**: provided, provided.al2, provided.al2023
|
|
212
|
+
- **Go**: go1.x
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
MIT
|
package/bin/run
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const fs = require('fs')
|
|
4
3
|
const path = require('path')
|
|
5
|
-
const
|
|
4
|
+
const oclif = require('@oclif/core')
|
|
5
|
+
const flush = require('@oclif/core/flush')
|
|
6
|
+
const handle = require('@oclif/core/handle')
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
const run = async () => {
|
|
9
|
+
await oclif.run(process.argv.slice(2), {
|
|
10
|
+
root: path.join(__dirname, '..'),
|
|
11
|
+
pjson: require('../package.json')
|
|
12
|
+
})
|
|
13
|
+
}
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
.catch(require('@oclif/errors/handle'))
|
|
15
|
+
run().then(flush).catch(handle)
|
package/lib/index.d.ts
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { Command
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Runtime?:
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
type IRuntime = 'nodejs' | 'nodejs4.3' | 'nodejs6.10' | 'nodejs8.10' | 'nodejs10.x' | 'nodejs12.x' | 'nodejs14.x' | 'nodejs16.x' | 'nodejs18.x' | 'nodejs20.x' | 'nodejs22.x' | 'python2.7' | 'python3.6' | 'python3.7' | 'python3.8' | 'python3.9' | 'python3.10' | 'python3.11' | 'python3.12' | 'python3.13' | 'java8' | 'java8.al2' | 'java11' | 'java17' | 'java21' | 'dotnetcore1.0' | 'dotnetcore2.0' | 'dotnetcore2.1' | 'dotnetcore3.1' | 'dotnet6' | 'dotnet8' | 'go1.x' | 'ruby2.5' | 'ruby2.7' | 'ruby3.2' | 'ruby3.3' | 'provided' | 'provided.al2' | 'provided.al2023' | string;
|
|
3
|
+
type ISearchQuery = {
|
|
4
|
+
Runtime?: IRuntime;
|
|
5
5
|
name?: string;
|
|
6
6
|
};
|
|
7
7
|
declare class LambdaFunctionSearch extends Command {
|
|
8
8
|
static description: string;
|
|
9
|
-
|
|
10
|
-
private amount;
|
|
11
|
-
private client;
|
|
9
|
+
static examples: string[];
|
|
12
10
|
static flags: {
|
|
13
|
-
help: import("@oclif/
|
|
14
|
-
runtime:
|
|
15
|
-
region:
|
|
16
|
-
profile:
|
|
17
|
-
search:
|
|
18
|
-
showAll: import("@oclif/
|
|
11
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
12
|
+
runtime: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
region: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
search: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
showAll: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
17
|
};
|
|
20
|
-
listAllFunctions
|
|
18
|
+
private listAllFunctions;
|
|
19
|
+
getAllRegionFuncs(query: ISearchQuery, clientConfig: {
|
|
20
|
+
profile?: string;
|
|
21
|
+
}, showAll: boolean): Promise<void>;
|
|
21
22
|
run(): Promise<void>;
|
|
23
|
+
private worker;
|
|
22
24
|
}
|
|
23
25
|
export = LambdaFunctionSearch;
|
package/lib/index.js
CHANGED
|
@@ -1,121 +1,190 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
2
|
+
const tslib_1 = require("tslib");
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
5
|
+
const credential_providers_1 = require("@aws-sdk/credential-providers");
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
function createQueryBuilder(log) {
|
|
8
|
+
const query = {};
|
|
9
|
+
return {
|
|
10
|
+
addRuntime(runtime) {
|
|
11
|
+
log(`${chalk_1.default.green('Search condition')}: Runtime === ${runtime}`);
|
|
12
|
+
query.Runtime = runtime;
|
|
13
|
+
return this;
|
|
14
|
+
},
|
|
15
|
+
addSearchQuery(name) {
|
|
16
|
+
log(`${chalk_1.default.green('Search condition')}: FunctionName contains ${name}`);
|
|
17
|
+
query.name = name;
|
|
18
|
+
return this;
|
|
19
|
+
},
|
|
20
|
+
getQuery() {
|
|
21
|
+
return query;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const regions = [
|
|
26
|
+
'af-south-1',
|
|
27
|
+
'ap-east-1',
|
|
28
|
+
'ap-northeast-1',
|
|
29
|
+
'ap-northeast-2',
|
|
30
|
+
'ap-northeast-3',
|
|
31
|
+
'ap-south-1',
|
|
32
|
+
'ap-south-2',
|
|
33
|
+
'ap-southeast-1',
|
|
34
|
+
'ap-southeast-2',
|
|
35
|
+
'ap-southeast-3',
|
|
36
|
+
'ap-southeast-4',
|
|
37
|
+
'ca-central-1',
|
|
38
|
+
'ca-west-1',
|
|
39
|
+
'eu-central-1',
|
|
40
|
+
'eu-central-2',
|
|
41
|
+
'eu-north-1',
|
|
42
|
+
'eu-south-1',
|
|
43
|
+
'eu-south-2',
|
|
44
|
+
'eu-west-1',
|
|
45
|
+
'eu-west-2',
|
|
46
|
+
'eu-west-3',
|
|
47
|
+
'il-central-1',
|
|
48
|
+
'me-central-1',
|
|
49
|
+
'me-south-1',
|
|
50
|
+
'sa-east-1',
|
|
51
|
+
'us-east-1',
|
|
52
|
+
'us-east-2',
|
|
53
|
+
'us-west-1',
|
|
54
|
+
'us-west-2',
|
|
55
|
+
];
|
|
56
|
+
class LambdaFunctionSearch extends core_1.Command {
|
|
57
|
+
async listAllFunctions(client, query = {}, nextMarker, functions = [], totalAmount = 0) {
|
|
58
|
+
const command = new client_lambda_1.ListFunctionsCommand({
|
|
59
|
+
Marker: nextMarker,
|
|
29
60
|
});
|
|
61
|
+
const { NextMarker, Functions } = await client.send(command);
|
|
62
|
+
const targetFunctions = !Functions
|
|
63
|
+
? []
|
|
64
|
+
: Functions.filter((func) => {
|
|
65
|
+
if (query.name) {
|
|
66
|
+
const reg = new RegExp(query.name);
|
|
67
|
+
if (func.FunctionName && !func.FunctionName.match(reg))
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (query.Runtime)
|
|
71
|
+
return func.Runtime === query.Runtime;
|
|
72
|
+
return true;
|
|
73
|
+
});
|
|
30
74
|
const items = functions.concat(targetFunctions);
|
|
31
|
-
|
|
32
|
-
if (
|
|
33
|
-
return this.listAllFunctions(query, items);
|
|
75
|
+
const amount = totalAmount + (Functions ? Functions.length : 0);
|
|
76
|
+
if (NextMarker) {
|
|
77
|
+
return this.listAllFunctions(client, query, NextMarker, items, amount);
|
|
78
|
+
}
|
|
79
|
+
return { functions: items, amount };
|
|
80
|
+
}
|
|
81
|
+
async getAllRegionFuncs(query, clientConfig, showAll) {
|
|
82
|
+
// Execute sequentially to avoid race conditions with shared state
|
|
83
|
+
for (const region of regions) {
|
|
84
|
+
await this.worker(query, {
|
|
85
|
+
...clientConfig,
|
|
86
|
+
region,
|
|
87
|
+
}, showAll);
|
|
34
88
|
}
|
|
35
|
-
return items;
|
|
36
89
|
}
|
|
37
90
|
async run() {
|
|
38
|
-
const { flags } = this.parse(LambdaFunctionSearch);
|
|
39
|
-
const
|
|
91
|
+
const { flags } = await this.parse(LambdaFunctionSearch);
|
|
92
|
+
const queryBuilder = createQueryBuilder(this.log.bind(this));
|
|
93
|
+
if (flags.runtime)
|
|
94
|
+
queryBuilder.addRuntime(flags.runtime);
|
|
95
|
+
if (flags.search)
|
|
96
|
+
queryBuilder.addSearchQuery(flags.search);
|
|
97
|
+
const clientConfig = {};
|
|
40
98
|
if (!flags.region)
|
|
41
|
-
this.log(chalk_1.default.yellow('warning')
|
|
42
|
-
if (flags.region)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const query = {};
|
|
50
|
-
if (flags.runtime) {
|
|
51
|
-
this.log(`${chalk_1.default.green('Search condition')}: Runtime === ${flags.runtime}`);
|
|
52
|
-
query.Runtime = flags.runtime;
|
|
99
|
+
this.log(`${chalk_1.default.yellow('warning')}: Missing region`);
|
|
100
|
+
if (flags.region) {
|
|
101
|
+
if (flags.region === 'all') {
|
|
102
|
+
if (flags.profile)
|
|
103
|
+
clientConfig.profile = flags.profile;
|
|
104
|
+
return this.getAllRegionFuncs(queryBuilder.getQuery(), clientConfig, flags.showAll);
|
|
105
|
+
}
|
|
106
|
+
clientConfig.region = flags.region;
|
|
53
107
|
}
|
|
54
|
-
if (flags.
|
|
55
|
-
|
|
56
|
-
|
|
108
|
+
if (flags.profile)
|
|
109
|
+
clientConfig.profile = flags.profile;
|
|
110
|
+
return this.worker(queryBuilder.getQuery(), clientConfig, flags.showAll);
|
|
111
|
+
}
|
|
112
|
+
async worker(query, clientConfig, showAll) {
|
|
113
|
+
const config = {};
|
|
114
|
+
if (clientConfig.region)
|
|
115
|
+
config.region = clientConfig.region;
|
|
116
|
+
if (clientConfig.profile) {
|
|
117
|
+
config.credentials = (0, credential_providers_1.fromIni)({ profile: clientConfig.profile });
|
|
57
118
|
}
|
|
119
|
+
const client = new client_lambda_1.LambdaClient(config);
|
|
58
120
|
try {
|
|
59
|
-
const result = await this.listAllFunctions(query);
|
|
60
|
-
this.log(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
121
|
+
const { functions: result, amount } = await this.listAllFunctions(client, query);
|
|
122
|
+
this.log(`=== ${chalk_1.default.green('Matched Functions')}: ${result.length} / ${amount} ===`);
|
|
123
|
+
if (clientConfig.region)
|
|
124
|
+
this.log(`${chalk_1.default.green('Region')} : ${clientConfig.region}`);
|
|
125
|
+
for (const item of result) {
|
|
126
|
+
this.log(item.FunctionName || 'unknown');
|
|
127
|
+
if (showAll)
|
|
65
128
|
console.log(item);
|
|
66
|
-
}
|
|
129
|
+
}
|
|
67
130
|
}
|
|
68
131
|
catch (e) {
|
|
69
|
-
this.error(chalk_1.default.red(e));
|
|
132
|
+
this.error(chalk_1.default.red(String(e)));
|
|
70
133
|
this.exit(1);
|
|
71
134
|
}
|
|
72
135
|
}
|
|
73
136
|
}
|
|
74
137
|
LambdaFunctionSearch.description = 'Search Lambda functions';
|
|
138
|
+
LambdaFunctionSearch.examples = [
|
|
139
|
+
'<%= config.bin %> --region us-east-1',
|
|
140
|
+
'<%= config.bin %> --region all',
|
|
141
|
+
'<%= config.bin %> --region us-east-1 --runtime nodejs20.x',
|
|
142
|
+
'<%= config.bin %> --region us-east-1 --search myfunction',
|
|
143
|
+
];
|
|
75
144
|
LambdaFunctionSearch.flags = {
|
|
76
|
-
help:
|
|
145
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
77
146
|
// runtime
|
|
78
|
-
runtime:
|
|
147
|
+
runtime: core_1.Flags.string({
|
|
79
148
|
char: 'R',
|
|
80
149
|
description: [
|
|
81
150
|
'Lambda runtime',
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
].join(', ')
|
|
99
|
-
].join('\n')
|
|
151
|
+
`Example: ${[
|
|
152
|
+
'nodejs18.x',
|
|
153
|
+
'nodejs20.x',
|
|
154
|
+
'nodejs22.x',
|
|
155
|
+
'python3.11',
|
|
156
|
+
'python3.12',
|
|
157
|
+
'python3.13',
|
|
158
|
+
'java11',
|
|
159
|
+
'java17',
|
|
160
|
+
'java21',
|
|
161
|
+
'dotnet6',
|
|
162
|
+
'dotnet8',
|
|
163
|
+
'ruby3.2',
|
|
164
|
+
'ruby3.3',
|
|
165
|
+
'provided.al2',
|
|
166
|
+
'provided.al2023',
|
|
167
|
+
].join(', ')}`,
|
|
168
|
+
].join('\n'),
|
|
100
169
|
}),
|
|
101
170
|
// [For AWS SDK] region
|
|
102
|
-
region:
|
|
171
|
+
region: core_1.Flags.string({
|
|
103
172
|
char: 'r',
|
|
104
|
-
description: 'region'
|
|
173
|
+
description: 'region, (If you set "all", list all regions)',
|
|
105
174
|
}),
|
|
106
175
|
// [For AWS SDK] profile
|
|
107
|
-
profile:
|
|
176
|
+
profile: core_1.Flags.string({
|
|
108
177
|
char: 'p',
|
|
109
|
-
description: 'AWS CLI profile'
|
|
178
|
+
description: 'AWS CLI profile',
|
|
110
179
|
}),
|
|
111
|
-
search:
|
|
180
|
+
search: core_1.Flags.string({
|
|
112
181
|
char: 's',
|
|
113
|
-
description: 'search by name'
|
|
182
|
+
description: 'search by name',
|
|
114
183
|
}),
|
|
115
|
-
showAll:
|
|
184
|
+
showAll: core_1.Flags.boolean({
|
|
116
185
|
char: 'A',
|
|
117
186
|
description: 'Show all function data',
|
|
118
|
-
default: false
|
|
187
|
+
default: false,
|
|
119
188
|
}),
|
|
120
189
|
};
|
|
121
190
|
module.exports = LambdaFunctionSearch;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lambda-function-search",
|
|
3
3
|
"description": "Search your Lambda functions",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"author": "Hidetaka Okamoto <info@wp-kyoto.net> (https://wp-kyoto.net)",
|
|
6
6
|
"bin": {
|
|
7
7
|
"lambda-function-search": "./bin/run",
|
|
@@ -9,24 +9,21 @@
|
|
|
9
9
|
},
|
|
10
10
|
"bugs": "https://github.com/hideokamoto/lambda-function-search/issues",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@
|
|
13
|
-
"@
|
|
14
|
-
"@oclif/
|
|
15
|
-
"
|
|
16
|
-
"tslib": "^
|
|
12
|
+
"@aws-sdk/client-lambda": "^3.710.0",
|
|
13
|
+
"@aws-sdk/credential-providers": "^3.932.0",
|
|
14
|
+
"@oclif/core": "^4.0.0",
|
|
15
|
+
"chalk": "^4.1.2",
|
|
16
|
+
"tslib": "^2.8.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@
|
|
20
|
-
"@types/
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"ts-node": "^7",
|
|
25
|
-
"tslint": "^5",
|
|
26
|
-
"typescript": "^3.0"
|
|
19
|
+
"@biomejs/biome": "^1.9.4",
|
|
20
|
+
"@types/node": "^18.19.0",
|
|
21
|
+
"np": "^10.0.0",
|
|
22
|
+
"ts-node": "^10.9.2",
|
|
23
|
+
"typescript": "^5.7.3"
|
|
27
24
|
},
|
|
28
25
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
26
|
+
"node": ">=18.0.0"
|
|
30
27
|
},
|
|
31
28
|
"files": [
|
|
32
29
|
"/bin",
|
|
@@ -40,14 +37,28 @@
|
|
|
40
37
|
"license": "MIT",
|
|
41
38
|
"main": "lib/index.js",
|
|
42
39
|
"oclif": {
|
|
43
|
-
"bin": "lambda-function-search"
|
|
40
|
+
"bin": "lambda-function-search",
|
|
41
|
+
"commands": {
|
|
42
|
+
"strategy": "single",
|
|
43
|
+
"target": "./lib/index.js"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/hideokamoto/lambda-function-search.git"
|
|
44
49
|
},
|
|
45
|
-
"repository": "hideokamoto/lambda-function-search",
|
|
46
50
|
"scripts": {
|
|
47
|
-
"
|
|
48
|
-
"prepack": "
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
+
"build": "rm -rf lib && tsc",
|
|
52
|
+
"prepack": "npm run build",
|
|
53
|
+
"lint": "biome lint .",
|
|
54
|
+
"lint:fix": "biome lint --write .",
|
|
55
|
+
"format": "biome format --write .",
|
|
56
|
+
"format:check": "biome format .",
|
|
57
|
+
"check": "biome check .",
|
|
58
|
+
"check:fix": "biome check --write .",
|
|
59
|
+
"posttest": "npm run lint && tsc -p . --noEmit",
|
|
60
|
+
"release": "np",
|
|
61
|
+
"test": "echo \"No tests yet\""
|
|
51
62
|
},
|
|
52
63
|
"types": "lib/index.d.ts"
|
|
53
64
|
}
|