本文整理匯總了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);
});
});