Bumps the aws-sdk-go-v2 group with 3 updates in the / directory: [github.com/aws/aws-sdk-go-v2/config](https://github.com/aws/aws-sdk-go-v2), [github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue](https://github.com/aws/aws-sdk-go-v2) and [github.com/aws/aws-sdk-go-v2/service/kinesis](https://github.com/aws/aws-sdk-go-v2). Updates `github.com/aws/aws-sdk-go-v2/config` from 1.27.43 to 1.28.9 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/config/v1.27.43...config/v1.28.9) Updates `github.com/aws/aws-sdk-go-v2/credentials` from 1.17.41 to 1.17.50 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/credentials/v1.17.41...credentials/v1.17.50) Updates `github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue` from 1.15.12 to 1.15.25 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/config/v1.15.12...service/kinesis/v1.15.25) Updates `github.com/aws/aws-sdk-go-v2/service/dynamodb` from 1.36.2 to 1.39.2 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/iam/v1.36.2...service/ivs/v1.39.2) Updates `github.com/aws/aws-sdk-go-v2/service/kinesis` from 1.32.2 to 1.32.10 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.32.2...service/kinesis/v1.32.10) Updates `github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream` from 1.6.6 to 1.6.7 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/rum/v1.6.6...service/rum/v1.6.7) Updates `github.com/aws/aws-sdk-go-v2/feature/ec2/imds` from 1.16.17 to 1.16.23 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/ram/v1.16.17...service/ram/v1.16.23) Updates `github.com/aws/aws-sdk-go-v2/internal/configsources` from 1.3.21 to 1.3.27 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/internal/ini/v1.3.21...internal/ini/v1.3.27) Updates `github.com/aws/aws-sdk-go-v2/internal/endpoints/v2` from 2.6.21 to 2.6.27 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/internal/endpoints/v2.6.21...internal/endpoints/v2.6.27) Updates `github.com/aws/aws-sdk-go-v2/service/dynamodbstreams` from 1.24.2 to 1.24.12 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/service/fsx/v1.24.12/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/pi/v1.24.2...service/fsx/v1.24.12) Updates `github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding` from 1.12.0 to 1.12.1 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.12.0...service/m2/v1.12.1) Updates `github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery` from 1.10.2 to 1.10.8 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/config/v1.10.2...service/m2/v1.10.8) Updates `github.com/aws/aws-sdk-go-v2/service/internal/presigned-url` from 1.12.2 to 1.12.8 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/m2/v1.12.2...service/fis/v1.12.8) Updates `github.com/aws/aws-sdk-go-v2/service/sso` from 1.24.2 to 1.24.9 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/service/fsx/v1.24.9/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/pi/v1.24.2...service/fsx/v1.24.9) Updates `github.com/aws/aws-sdk-go-v2/service/ssooidc` from 1.28.2 to 1.28.8 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/config/v1.28.2...config/v1.28.8) Updates `github.com/aws/aws-sdk-go-v2/service/sts` from 1.32.2 to 1.33.5 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.32.2...service/sts/v1.33.5) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2/config dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/credentials dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/service/dynamodb dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/service/kinesis dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream dependency-type: indirect update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/feature/ec2/imds dependency-type: indirect update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/internal/configsources dependency-type: indirect update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 dependency-type: indirect update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/service/dynamodbstreams dependency-type: indirect update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding dependency-type: indirect update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery dependency-type: indirect update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/service/internal/presigned-url dependency-type: indirect update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/service/sso dependency-type: indirect update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/service/ssooidc dependency-type: indirect update-type: version-update:semver-patch dependency-group: aws-sdk-go-v2 - dependency-name: github.com/aws/aws-sdk-go-v2/service/sts dependency-type: indirect update-type: version-update:semver-minor dependency-group: aws-sdk-go-v2 ... Signed-off-by: dependabot[bot] <support@github.com>
108 lines
2.4 KiB
Go
108 lines
2.4 KiB
Go
package httpbinding
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
)
|
|
|
|
const (
|
|
uriTokenStart = '{'
|
|
uriTokenStop = '}'
|
|
uriTokenSkip = '+'
|
|
)
|
|
|
|
func bufCap(b []byte, n int) []byte {
|
|
if cap(b) < n {
|
|
return make([]byte, 0, n)
|
|
}
|
|
|
|
return b[0:0]
|
|
}
|
|
|
|
// replacePathElement replaces a single element in the path []byte.
|
|
// Escape is used to control whether the value will be escaped using Amazon path escape style.
|
|
func replacePathElement(path, fieldBuf []byte, key, val string, escape bool) ([]byte, []byte, error) {
|
|
// search for "{<key>}". If not found, search for the greedy version "{<key>+}". If none are found, return error
|
|
fieldBuf = bufCap(fieldBuf, len(key)+2) // { <key> }
|
|
fieldBuf = append(fieldBuf, uriTokenStart)
|
|
fieldBuf = append(fieldBuf, key...)
|
|
fieldBuf = append(fieldBuf, uriTokenStop)
|
|
|
|
start := bytes.Index(path, fieldBuf)
|
|
encodeSep := true
|
|
if start < 0 {
|
|
fieldBuf = bufCap(fieldBuf, len(key)+3) // { <key> [+] }
|
|
fieldBuf = append(fieldBuf, uriTokenStart)
|
|
fieldBuf = append(fieldBuf, key...)
|
|
fieldBuf = append(fieldBuf, uriTokenSkip)
|
|
fieldBuf = append(fieldBuf, uriTokenStop)
|
|
|
|
start = bytes.Index(path, fieldBuf)
|
|
if start < 0 {
|
|
return path, fieldBuf, fmt.Errorf("invalid path index, start=%d. %s", start, path)
|
|
}
|
|
encodeSep = false
|
|
}
|
|
end := start + len(fieldBuf)
|
|
|
|
if escape {
|
|
val = EscapePath(val, encodeSep)
|
|
}
|
|
|
|
fieldBuf = bufCap(fieldBuf, len(val))
|
|
fieldBuf = append(fieldBuf, val...)
|
|
|
|
keyLen := end - start
|
|
valLen := len(fieldBuf)
|
|
|
|
if keyLen == valLen {
|
|
copy(path[start:], fieldBuf)
|
|
return path, fieldBuf, nil
|
|
}
|
|
|
|
newLen := len(path) + (valLen - keyLen)
|
|
if len(path) < newLen {
|
|
path = path[:cap(path)]
|
|
}
|
|
if cap(path) < newLen {
|
|
newURI := make([]byte, newLen)
|
|
copy(newURI, path)
|
|
path = newURI
|
|
}
|
|
|
|
// shift
|
|
copy(path[start+valLen:], path[end:])
|
|
path = path[:newLen]
|
|
copy(path[start:], fieldBuf)
|
|
|
|
return path, fieldBuf, nil
|
|
}
|
|
|
|
// EscapePath escapes part of a URL path in Amazon style.
|
|
func EscapePath(path string, encodeSep bool) string {
|
|
var buf bytes.Buffer
|
|
for i := 0; i < len(path); i++ {
|
|
c := path[i]
|
|
if noEscape[c] || (c == '/' && !encodeSep) {
|
|
buf.WriteByte(c)
|
|
} else {
|
|
fmt.Fprintf(&buf, "%%%02X", c)
|
|
}
|
|
}
|
|
return buf.String()
|
|
}
|
|
|
|
var noEscape [256]bool
|
|
|
|
func init() {
|
|
for i := 0; i < len(noEscape); i++ {
|
|
// AWS expects every character except these to be escaped
|
|
noEscape[i] = (i >= 'A' && i <= 'Z') ||
|
|
(i >= 'a' && i <= 'z') ||
|
|
(i >= '0' && i <= '9') ||
|
|
i == '-' ||
|
|
i == '.' ||
|
|
i == '_' ||
|
|
i == '~'
|
|
}
|
|
}
|