-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(aws): update spec #2473
feat(aws): update spec #2473
Conversation
Overviewsrc/aws/rds-data.ts:Info:src/aws/pricing.ts:Info:src/aws/pcs.ts:Info:src/aws/ds-data.ts:Info:src/aws/resource-groups.ts:Info:src/aws/timestream-influxdb.ts:Info:src/aws/supplychain.ts:Info:URLs:
src/aws/customer-profiles.ts:Info:src/aws/codeartifact.ts:Info:src/aws/cloudtrail.ts:Info:src/aws/bedrock-agent.ts:Info:src/aws/fsx.ts:Info:src/aws/verifiedpermissions.ts:Info:src/aws/securityhub.ts:Info:src/aws/organizations.ts:Info:URLs:
src/aws/sesv2.ts:Info:src/aws/lambda.ts:Info:Single Functions:custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-layer-versions",
["--layer-name"],
"LayerVersions",
"Version"
);
} postProcess: function (out, tokens) {
try {
const accountId = JSON.parse(out)["Account"];
return [{ name: accountId }, { name: "*" }];
} catch (error) {
console.error(error);
}
return [];
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"get-layer-version-policy",
["--layer-name", "--version-number"],
"RevisionId"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"get-policy",
["--function-name"],
"RevisionId"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"get-function",
["--function-name"],
"Configuration",
"RevisionId"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-aliases",
["--function-name"],
"Aliases",
"Name"
);
} custom: async function (tokens, executeShellCommand) {
try {
const idx = tokens.indexOf("--function-name");
const args = [
"lambda",
"list-versions-by-function",
"--function-name",
tokens[idx + 1],
];
const { stdout } = await executeShellCommand({
command: "aws",
args,
});
const list = JSON.parse(stdout)["Versions"];
return list
.filter((elm) => elm.Version !== "$LATEST")
.map((elm) => {
const version = elm["Version"];
return {
insertValue: version,
name: version,
displayName: `version: ${version}`,
icon: "fig://icon?type=aws",
};
});
} catch (e) {
console.log(e);
}
return [];
} custom: async function (tokens, executeShellCommand) {
return listCustomSIDGenerator(tokens, executeShellCommand, "get-policy", [
"--function-name",
]);
} custom: async function (tokens, executeShellCommand) {
return listCustomSIDGenerator(
tokens,
executeShellCommand,
"get-layer-version-policy",
["--layer-name", "--version-number"]
);
} custom: async function (tokens, executeShellCommand) {
// Getting sqs queues is implemented, although it has a huge performance toll.
// It seems Fig rejects long-running promises after a time.
// I am currently investigating if this is the case.
// const result = await Promise.all([
// getResultList(tokens, executeShellCommand, "aws sqs list-queues", "QueueUrls"),
// getResultList(tokens, executeShellCommand, "aws kinesis list-streams", "StreamNames")
// ]);
// const objects = result.flat().map((elm) => {
// if (elm.includes("sqs")) {
// return ({
// command: `aws sqs get-queue-attributes --queue-url ${elm} --attribute-names QueueArn`,
// parentKey: "Attributes",
// childKey: "QueueArn",
// })
// }
// return ({
// command: `aws kinesis describe-stream --stream-name ${elm}`,
// parentKey: "StreamDescription",
// childKey: "StreamARN",
// })
// });
return MultiSuggestionsGenerator(tokens, executeShellCommand, [
{
command: ["dynamodbstreams", "list-streams"],
parentKey: "Streams",
childKey: "StreamArn",
},
{
command: ["kafka", "list-clusters"],
parentKey: "ClusterInfoList",
childKey: "ClusterArn",
},
//...objects,
]);
} custom: async function (tokens, executeShellCommand) {
// Getting sqs queues is implemented, although it has a huge performance toll.
// It seems Fig rejects long-running promises after a time.
// I am currently investigating if this is the case.
// const out = await executeShellCommand("aws sqs list-queues");
// const list = JSON.parse(out)["QueueUrls"];
// const sqsObjects = list.map((url) => ({
// command: `aws sqs get-queue-attributes --queue-url ${url} --attribute-names QueueArn`,
// parentKey: "Attributes",
// childKey: "QueueArn",
// }));
return MultiSuggestionsGenerator(tokens, executeShellCommand, [
{
command: ["sns", "list-topics"],
parentKey: "Topics",
childKey: "TopicArn",
},
{
command: ["events", "list-event-buses"],
parentKey: "EventBuses",
childKey: "Arn",
},
{
command: ["lambda", "list-functions"],
parentKey: "Functions",
childKey: "FunctionArn",
},
// ...sqsObjects,
]);
} postProcess: function (out) {
return postPrecessGenerator(out, "Roles", "RoleName");
} postProcess: function (out) {
return postPrecessGenerator(out, "Keys", "KeyArn");
} postProcess: function (out) {
return postPrecessGenerator(out, "Layers", "LayerArn");
} postProcess: function (out) {
try {
const list = JSON.parse(out)["Layers"];
return list.map((elm) => {
return {
name: elm["LatestMatchingVersion"]["LayerVersionArn"],
icon: "fig://icon?type=aws",
};
});
} catch (e) {
console.log(e);
}
return [];
} postProcess: function (out) {
try {
const list = JSON.parse(out)["FileSystems"];
return list.map((elm) => {
const name = ("FileSystemArn" ? elm["FileSystemArn"] : elm) as string;
return {
name: `Arn=${name},LocalMountPath=/mnt/`,
icon: "fig://icon?type=aws",
};
});
} catch (e) {
console.log(e);
}
return [];
} postProcess: function (out) {
return postPrecessGenerator(
out,
"CodeSigningConfigs",
"CodeSigningConfigArn"
);
} postProcess: function (out) {
return postPrecessGenerator(out, "EventSourceMappings", "UUID");
} postProcess: function (out) {
return postPrecessGenerator(out, "Functions", "CodeSha256");
} postProcess: function (out, tokens) {
try {
return out.split("\n").map((line) => {
const parts = line.split(/\s+/);
// sub prefix
if (!parts.length) {
return [];
}
return {
name: parts[parts.length - 1],
};
}) as Fig.Suggestion[];
} catch (error) {
console.error(error);
}
return [];
} custom: async function (tokens, executeShellCommand) {
try {
const idx = tokens.indexOf("--s3-bucket");
const args = [
"s3",
"ls",
`${_prefixS3}${tokens[idx + 1]}`,
"--recursive",
"--page-size",
"1000",
];
const { stdout } = await executeShellCommand({
command: "aws",
args,
});
if (stdout == "") {
return [];
}
if (stdout.trim() === _prefixS3) {
return [
{
name: _prefixS3,
insertValue: _prefixS3,
},
];
}
return stdout.split("\n").map((line) => {
const parts = line.split(/\s+/);
// sub prefix
if (!parts.length) {
return [];
}
return {
name: parts[parts.length - 1],
};
}) as Fig.Suggestion[];
} catch (error) {
console.error(error);
}
return [];
} custom: async function (tokens, executeShellCommand) {
try {
const bucketIdx = tokens.indexOf("--s3-bucket");
const objectIdx = tokens.indexOf("--s3-key");
const args = [
"s3api",
"list-object-versions",
"--bucket",
tokens[bucketIdx + 1],
"--prefix",
tokens[objectIdx + 1],
];
const { stdout } = await executeShellCommand({
command: "aws",
args,
});
if (stdout == "") {
return [];
}
if (stdout.trim() === _prefixS3) {
return [
{
name: _prefixS3,
insertValue: _prefixS3,
},
];
}
const list = JSON.parse(stdout)["Versions"];
return list
.filter((elm) => elm["VersionId"] !== "null")
.map((elm) => {
return {
name: elm["VersionId"],
icon: "fig://icon?type=aws",
};
});
} catch (e) {
console.log(e);
}
return [];
} URLs:
src/aws/quicksight.ts:Info:URLs:
src/aws.ts:Info:Single Functions:postProcess: function (out) {
if (out.trim() == "") {
return [];
}
return out.split("\n").map((line) => ({
name: line,
icon: "👤",
}));
} URLs:
src/aws/connect.ts:Info:src/aws/sagemaker.ts:Info:URLs:
src/aws/rds.ts:Info: |
Hello @withfig-bot,
Please add a 👍 as a reaction to this comment to show that you read this. |
Automated PR for latest AWS CLI release by https://github.com/withfig/aws-cli-plugin