本文整理汇总了TypeScript中aws-sdk.Lambda类的典型用法代码示例。如果您正苦于以下问题:TypeScript Lambda类的具体用法?TypeScript Lambda怎么用?TypeScript Lambda使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Lambda类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: callGraphQl
static async callGraphQl() {
const query = `
query ($shop_id:ID) {
shop_info(shop_id: $shop_id){
shop_id
}
}
`;
const vars = { shop_id: 1 };
const lambda = new AWS.Lambda({ region: 'ap-northeast-2' });
const result = await lambda.invoke({
FunctionName: 'MySampleServiceGraphQl',
Payload: JSON.stringify({ query, operationName: '', variables: vars }),
}).promise();
console.log(result);
}
示例2: getLambdaPolicy
private async getLambdaPolicy() {
return this._awsLambda
.getPolicy({
FunctionName: this._lambdaFunctionName
})
.promise();
}
示例3:
promise.then(() => {
return this._awsLambda
.deleteFunction({
FunctionName: fct.FunctionName,
Qualifier: versions[i].Version
})
.promise();
});
示例4: removeLambdaPermission
private async removeLambdaPermission(sid) {
return this._awsLambda
.removePermission({
FunctionName: this._lambdaFunctionName,
StatementId: sid
})
.promise();
}
示例5: updateLambdaFunction
private async updateLambdaFunction() {
this.stepper("Updating Lambda function");
var params = {
FunctionName: this._lambdaFunctionName,
Publish: true
};
await this.addPackageToUpdateFunction(params);
let fct = await this._awsLambda.updateFunctionCode(params).promise();
await this.cleanVersions(fct);
var updateConfigurationParams = {
MemorySize: this._lambdaMemorySize,
FunctionName: this._lambdaFunctionName,
Handler: this._lambdaHandler,
Role: this._lambdaRole,
Runtime: "nodejs8.10",
Timeout: this._lambdaTimeout,
Description: "Deployed with Webda for API: " + this._restApiName
};
await this._awsLambda
.updateFunctionConfiguration(updateConfigurationParams)
.promise();
}
示例6: Promise
return new Promise((ok, fail) => {
console.log(`Deleting version ${version.Version} of lambda function "${version.FunctionName}"...`);
lambda.deleteFunction({
FunctionName: version.FunctionName,
Qualifier: version.Version
}, (err, result) => {
if (err) {
return fail(err);
}
ok(result);
});
});
示例7: Promise
return new Promise((ok, fail) => {
console.log(`Re-pointing lambda alias "${config.lambdaAlias}" for ${version.FunctionName}...`);
lambda.updateAlias({
FunctionName: version.FunctionName,
Name: config.lambdaAlias,
FunctionVersion: version.Version
}, (err, result) => {
if (err) {
return fail(err);
}
ok(result);
});
});