그래서이 람다 함수를 만들었고 그 함수에서 나는 dynamoDB의 사용자 테이블에 사용자를 생성하는 if 문을 만들었습니다. 어떻게하면 안드로이드에서 내 람다 함수의 if 문이라고 부를 수 있을까요? 내가 AWS 및 새로운 오전안드로이드에서 람다 함수를 호출하는 방법은 무엇입니까?
public interface MyInterface {
/**
* Invoke lambda function "echo". The function name is the method name
*/
@LambdaFunction
String user(String userEmail);
/**
* Invoke lambda function "echo". The functionName in the annotation
* overrides the default which is the method name
*/
@LambdaFunction(functionName = "myUserAPiFxnName")
void noUser(NameInfo nameInfo);
}
을 : 여기
내 람다 함수exports.handler = function(event, context)
{
console.log('stageA');
console.log(JSON.stringify(event, null, ' '));
var responseCode = 200;
var userTableName = "usersTable";
var requestBody = event.body;
var pathParams = event.path;
var httpMethod = event.httpMethod; // HTTP Method (e.g., POST, GET, HEAD)
//User parameters
var displayName;
var email;
var fbUserID;
var firstName;
var folders;
var lastName;
var origin;
var profileImageRef;
var level;
var username;
var birthdate;
var experience;
var folder;
if (pathParams == "/user/createByEmail" && httpMethod == "POST")
{
console.log('create by email action');
requestBody = JSON.parse(requestBody);
//Set variables
firstName = requestBody.firstName;
lastName = requestBody.lastName;
email = requestBody.email;
username = requestBody.username;
experience = "0";
birthdate = requestBody.birthdate;
dynamodb.putItem(
{
"TableName": userTableName,
"Item" :
{
"displayName":{"S": username},
"email":{"S": email},
"firstName" : {"S" : firstName},
"folderNames" : {"M" : {
"My Cards": {"N": "0" }
} },
//"folders" : {"M" : {"My Cards": {}}},
"lastName" : {"S" : lastName},
"experience" : {"N" : experience},
"username": {"S": username},
"birthdate": {"S": birthdate}
}
},
function(err, data)
{ if (err) {
console.log(err);
context.done(err);
} else {
var response =
{
statusCode: responseCode,
headers:
{
"x-custom-header" : "custom header value"
},
body: JSON.stringify(username)
};
console.log('great success: %j',data);
context.succeed(response);
}
});
}
그리고 안드로이드에, 난 함수를 내 람다 호출하는 AsyncTask를 호출 할 것이다 인터페이스를 만든 것입니다 람다, 그리고 정말로 당신의 가이드에 대한 희망. 나는이 편지를 쓰고 있는지 잘 모르겠다. 누군가가 단계별로 명확한 방법을 가지고 있기를 희망한다.
건배!
저에게 javascript처럼 보입니다. 아니 람다 함수 –
람다에서 당신은 자바, 자바 스크립트, 파이썬을 사용할 수 있습니다 – TheQ
함수를 작성하는 자바 스크립트를 사용하고 지금 생각해. NET을, 또는 다른 건 당신이 50mb 페이로드에 맞출 수 있고 그 중 하나에서 실행 (루비, 가서 , etc는 zip에 포함되어 실행될 수 있습니다.) –