func ExampleV4Signer() { // Get auth from env vars auth, err := aws.EnvAuth() if err != nil { fmt.Println(err) } // Create a signer with the auth, name of the service, and aws region signer := aws.NewV4Signer(auth, "dynamodb", aws.USEast) // Create a request req, err := http.NewRequest("POST", aws.USEast.DynamoDBEndpoint, strings.NewReader("sample_request")) if err != nil { fmt.Println(err) } // Date or x-amz-date header is required to sign a request req.Header.Add("Date", time.Now().UTC().Format(http.TimeFormat)) // Sign the request signer.Sign(req) // Issue signed request http.DefaultClient.Do(req) }
func (s *AmazonServer) SetUp(c *check.C) { auth, err := aws.EnvAuth() if err != nil { c.Fatal(err.Error()) } s.auth = auth }
func (s *SuiteI) SetUpSuite(c *check.C) { if !*integration { c.Skip("Integration tests not enabled (-i flag)") } auth, err := aws.EnvAuth() if err != nil { c.Fatal(err.Error()) } s.auth = auth }
func (s *LiveSuite) SetUpSuite(c *check.C) { if !Amazon { c.Skip("amazon tests not enabled (-amazon flag)") } auth, err := aws.EnvAuth() if err != nil { c.Fatal(err.Error()) } s.auth = auth }
func setUpAuth(c *check.C) { if !*amazon { c.Skip("Test against amazon not enabled.") } if *local { c.Log("Using local server") dynamodb_region = aws.Region{DynamoDBEndpoint: "http://127.0.0.1:8000"} dynamodb_auth = aws.Auth{AccessKey: "DUMMY_KEY", SecretKey: "DUMMY_SECRET"} } else { c.Log("Using REAL AMAZON SERVER") dynamodb_region = aws.USWest2 auth, err := aws.EnvAuth() if err != nil { c.Fatal(err) } dynamodb_auth = auth } }