I got some CRUD operations for my user. I want my URI to be /user/{id} and make the VERB decide what method to use, eg. post and put. In my cloudformation template file my resources looks like this:
"UpdateUser" : {
"Type" : "AWS::Serverless::Function",
"Properties": {
"Handler": "AWSServerless::AWSServerless.UserFunctions::UpdateUserAsync",
"Runtime": "dotnetcore1.0",
"CodeUri": "",
"Description": "Function to update a user",
"MemorySize": 128,
"Timeout": 30,
"Role": null,
"Policies": [ "AWSLambdaFullAccess" ],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "/user/{id}",
"Method": "PUT"
}
}
}
}
},
"GetUser" : {
"Type" : "AWS::Serverless::Function",
"Properties": {
"Handler": "AWSServerless::AWSServerless.UserFunctions::GetUserAsync",
"Runtime": "dotnetcore1.0",
"CodeUri": "",
"Description": "Function to get a single user",
"MemorySize": 128,
"Timeout": 30,
"Role": null,
"Policies": [ "AWSLambdaFullAccess" ],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "/user/{Id}",
"Method": "GET"
}
}
}
}
}
That will give me this error: "Unable to create resource at path '/user/{id}': A sibling ({Id}) of this resource already has a variable path part -- only one is allowed".
Is it possible to make them unique by the Method/Verb? Or what solution is best..? To have /user/ as my path and send my id in the object, use a querystring or make the path to something like this "/user/update/{id}" "/user/get/{id}"?