####This class allows you to assemble and sign an Amazon Web Services Request. It was rewritten because I didn't like the original api. And the original was trying to do to much networking for my application.
AwsRequest is immutable.
You need Apache Commons Codec in your classpath.
#####Usage:
val base= AwsRequest("HSGHGSHGDHWYIU","your-secret-key")
//base now contains your credentials and can be used to build specific requests
val req1=base.params(Map("Name"->"MyTopic","Action"->"CreateTopic")).toUrl
// Perform request ...
val req2=base.params(Map("Name"->"MyTopic","Action"->"DeleteTopic")).toUrl
//Perform request ...
#####More detailed assembly:
val base= AwsRequest("HSGHGSHGDHWYIU","your-secret-key")
val req1=base.param("Name"->"MyTopic")
.param("Action"->"CreateTopic")
.server("sns.us-east-1.amazonaws.com")
.uri("/")
.toUrl
#####You can also use the constructor to construct the complete request if you prefer.
val req1= new AwsRequest("HSGHGSHGDHWYIU",
"your-secret-key",
Map("Name"->"MyTopic","Action"->"CreateTopic"),
"sns.us-east-1.amazonaws.com").toUrl
#####Or using named parameters:
val req1= new AwsRequest(awsPublicKey="HSGHGSHGDHWYIU",
awsSecretKey="your-secret-key",
params=Map("Name"->"MyTopic","Action"->"CreateTopic"),
server="sns.us-east-1.amazonaws.com").toUrl
#####And you get the case class copy construct for free:
val base= AwsRequest("HSGHGSHGDHWYIU","your-secret-key")
val req1= base.copy(server="sns.us-west-1.amazonaws.com", params=Map("Action"->"DeleteTopic"))
//Perform request
So this is an api experiment as much as anything...
#####Notes
- Setting the same parameter twice will override the first version.
- The SignatureVersion, SignatureMethod and Timestamp are hard coded. If you need to change anything here you'll need to get into the source.