mirror of
https://github.com/Luzifer/mondash.git
synced 2024-11-14 18:32:42 +00:00
Knut Ahlers
f3c31476b4
* Update dependencies * Improve code quality * Apply linter advices * Add gzip compression to all requests * Rework frontend * Apply bootswatch theme * Hide historic details when not requested * Remove debugging header * Apply auto-migration of meta fields * Fix broken "last update" time * Pre-sort metrics for frontend / API * Add tooltip with absolute time * Some design fixes * Add tooltip with absolute date to last ok * Implement filters * Apply eslint --fix * Remove unused var * Remove remains of old template engine * Update baked in assets * Update Dockerfile for new version Signed-off-by: Knut Ahlers <knut@ahlers.me>
36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
// Package query provides serialization of AWS query requests, and responses.
|
|
package query
|
|
|
|
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go
|
|
|
|
import (
|
|
"net/url"
|
|
|
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
|
"github.com/aws/aws-sdk-go/aws/request"
|
|
"github.com/aws/aws-sdk-go/private/protocol/query/queryutil"
|
|
)
|
|
|
|
// BuildHandler is a named request handler for building query protocol requests
|
|
var BuildHandler = request.NamedHandler{Name: "awssdk.query.Build", Fn: Build}
|
|
|
|
// Build builds a request for an AWS Query service.
|
|
func Build(r *request.Request) {
|
|
body := url.Values{
|
|
"Action": {r.Operation.Name},
|
|
"Version": {r.ClientInfo.APIVersion},
|
|
}
|
|
if err := queryutil.Parse(body, r.Params, false); err != nil {
|
|
r.Error = awserr.New(request.ErrCodeSerialization, "failed encoding Query request", err)
|
|
return
|
|
}
|
|
|
|
if !r.IsPresigned() {
|
|
r.HTTPRequest.Method = "POST"
|
|
r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8")
|
|
r.SetBufferBody([]byte(body.Encode()))
|
|
} else { // This is a pre-signed request
|
|
r.HTTPRequest.Method = "GET"
|
|
r.HTTPRequest.URL.RawQuery = body.Encode()
|
|
}
|
|
}
|