func populateLocationConstraint(r *aws.Request) { if r.ParamsFilled() && r.Config.Region != "us-east-1" { in := r.Params.(*CreateBucketInput) if in.CreateBucketConfiguration == nil { r.Params = awsutil.CopyOf(r.Params) in = r.Params.(*CreateBucketInput) in.CreateBucketConfiguration = &CreateBucketConfiguration{ LocationConstraint: &r.Config.Region, } } } }
func fillPresignedURL(r *aws.Request) { if !r.ParamsFilled() { return } params := r.Params.(*CopySnapshotInput) // Stop if PresignedURL/DestinationRegion is set if params.PresignedURL != nil || params.DestinationRegion != nil { return } // First generate a copy of parameters r.Params = awsutil.CopyOf(r.Params) params = r.Params.(*CopySnapshotInput) // Set destination region. Avoids infinite handler loop. // Also needed to sign sub-request. params.DestinationRegion = &r.Service.Config.Region // Create a new client pointing at source region. // We will use this to presign the CopySnapshot request against // the source region config := r.Service.Config.Copy() config.Endpoint = "" config.Region = *params.SourceRegion client := New(&config) // Presign a CopySnapshot request with modified params req, _ := client.CopySnapshotRequest(params) url, err := req.Presign(300 * time.Second) // 5 minutes should be enough. if err != nil { // bubble error back up to original request r.Error = err } // We have our URL, set it on params params.PresignedURL = &url }