Skip to content
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

Use the SDK V3 Style #794

Merged
merged 3 commits into from
Aug 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions schedule_handler.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
var AWS = require('aws-sdk');
import { ECSClient, RunTaskCommand } from "@aws-sdk/client-ecs";

var util = require('util');

exports.handler = function(input, context) {
console.log(util.inspect(input, {showHidden: false, depth: null}))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
exports.handler = function(input, context) {
exports.handler = async function(input, context) {

Since there's an await down below, we'll need this to be async.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Thanks

console.log(context)

var ecs = new AWS.ECS();
var ecs = new ECSClient();
var params = {
cluster: input.cluster,
taskDefinition: input.task_family,
Expand All @@ -20,8 +21,9 @@ exports.handler = function(input, context) {
}

console.log(util.inspect(params, {depth: null}))
ecs.runTask(params, function(err, data) {
console.log(util.inspect(err, {depth: null}))
console.log(util.inspect(data, {depth: null}))
})

const command = new RunTaskCommand(params);
const response = await ecs.send(command);

console.log(util.inspect(response, {depth: null}))
}
Loading