Documentation
¶
Index ¶
- func AddInputMiddleware(stack *middleware.Stack, options InputMiddlewareOptions) (err error)deprecated
- func AddOutputMiddleware(stack *middleware.Stack, options OutputMiddlewareOptions) error
- func AlgorithmChecksumLength(v Algorithm) (int, error)
- func AlgorithmHTTPHeader(v Algorithm) string
- func GetComputedInputChecksums(m middleware.Metadata) (map[string]string, bool)
- func GetOutputValidationAlgorithmsUsed(m middleware.Metadata) ([]string, bool)
- func NewAlgorithmHash(v Algorithm) (hash.Hash, error)
- func RemoveInputMiddleware(stack *middleware.Stack)
- func RemoveOutputMiddleware(stack *middleware.Stack)
- func SetComputedInputChecksums(m *middleware.Metadata, vs map[string]string)
- func SetOutputValidationAlgorithmsUsed(m *middleware.Metadata, vs []string)
- type AddInputChecksumTrailer
- type Algorithm
- type ComputeInputPayloadChecksum
- type InputMiddlewareOptions
- type OutputMiddlewareOptions
- type RequestChecksumMetricsTracking
- type ResponseChecksumMetricsTracking
- type SetupInputContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddInputMiddleware
deprecated
func AddInputMiddleware(stack *middleware.Stack, options InputMiddlewareOptions) (err error)
AddInputMiddleware adds the middleware for performing checksum computing of request payloads, and checksum validation of response payloads.
Deprecated: This internal-only runtime API is frozen. Do not call or modify it in new code. Checksum-enabled service operations now generate this middleware setup code inline per #2507.
func AddOutputMiddleware ¶
func AddOutputMiddleware(stack *middleware.Stack, options OutputMiddlewareOptions) error
AddOutputMiddleware adds the middleware for validating response payload's checksum.
func AlgorithmChecksumLength ¶
AlgorithmChecksumLength returns the length of the algorithm's checksum in bytes. If the algorithm is not known, an error is returned.
func AlgorithmHTTPHeader ¶
AlgorithmHTTPHeader returns the HTTP header for the algorithm's hash.
func GetComputedInputChecksums ¶
func GetComputedInputChecksums(m middleware.Metadata) (map[string]string, bool)
GetComputedInputChecksums returns the map of checksum algorithm to their computed value stored in the middleware Metadata. Returns false if no values were stored in the Metadata.
func GetOutputValidationAlgorithmsUsed ¶
func GetOutputValidationAlgorithmsUsed(m middleware.Metadata) ([]string, bool)
GetOutputValidationAlgorithmsUsed returns the checksum algorithms used stored in the middleware Metadata. Returns false if no algorithms were stored in the Metadata.
func NewAlgorithmHash ¶
NewAlgorithmHash returns a hash.Hash for the checksum algorithm. Error is returned if the algorithm is unknown.
func RemoveInputMiddleware ¶
func RemoveInputMiddleware(stack *middleware.Stack)
RemoveInputMiddleware Removes the compute input payload checksum middleware handlers from the stack.
func RemoveOutputMiddleware ¶
func RemoveOutputMiddleware(stack *middleware.Stack)
RemoveOutputMiddleware Removes the compute input payload checksum middleware handlers from the stack.
func SetComputedInputChecksums ¶
func SetComputedInputChecksums(m *middleware.Metadata, vs map[string]string)
SetComputedInputChecksums stores the map of checksum algorithm to their computed value in the middleware Metadata. Overwrites any values that currently exist in the metadata.
func SetOutputValidationAlgorithmsUsed ¶
func SetOutputValidationAlgorithmsUsed(m *middleware.Metadata, vs []string)
SetOutputValidationAlgorithmsUsed stores the checksum algorithms used in the middleware Metadata.
Types ¶
type AddInputChecksumTrailer ¶ added in v1.5.2
type AddInputChecksumTrailer struct { EnableTrailingChecksum bool EnableComputePayloadHash bool EnableDecodedContentLengthHeader bool }
AddInputChecksumTrailer adds HTTP checksum when
- Is HTTPS, not HTTP
- A checksum was specified via the Input
- Trailing checksums are supported.
func (*AddInputChecksumTrailer) HandleFinalize ¶ added in v1.5.2
func (m *AddInputChecksumTrailer) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, metadata middleware.Metadata, err error, )
HandleFinalize wraps the request body to write the trailing checksum.
func (*AddInputChecksumTrailer) ID ¶ added in v1.5.2
func (*AddInputChecksumTrailer) ID() string
ID identifies this middleware.
type Algorithm ¶
type Algorithm string
Algorithm represents the checksum algorithms supported
const ( // AlgorithmCRC32C represents CRC32C hash algorithm AlgorithmCRC32C Algorithm = "CRC32C" // AlgorithmCRC32 represents CRC32 hash algorithm AlgorithmCRC32 Algorithm = "CRC32" // AlgorithmSHA1 represents SHA1 hash algorithm AlgorithmSHA1 Algorithm = "SHA1" // AlgorithmSHA256 represents SHA256 hash algorithm AlgorithmSHA256 Algorithm = "SHA256" // AlgorithmCRC64NVME represents CRC64NVME hash algorithm AlgorithmCRC64NVME Algorithm = "CRC64NVME" )
Enumeration values for supported checksum Algorithms.
func FilterSupportedAlgorithms ¶
FilterSupportedAlgorithms filters the set of algorithms, returning a slice of algorithms that are supported.
func ParseAlgorithm ¶
ParseAlgorithm attempts to parse the provided value into a checksum algorithm, matching without case. Returns the algorithm matched, or an error if the algorithm wasn't matched.
type ComputeInputPayloadChecksum ¶ added in v1.5.2
type ComputeInputPayloadChecksum struct { // Enables support for wrapping the serialized input payload with a // content-encoding: aws-check wrapper, and including a trailer for the // algorithm's checksum value. // // The checksum will not be computed, nor added as trailing checksum, if // the Algorithm's header is already set on the request. EnableTrailingChecksum bool // Enables support for computing the SHA256 checksum of input payloads // along with the algorithm specified checksum. Prevents downstream // middleware handlers (computePayloadSHA256) re-reading the payload. // // The SHA256 payload hash will only be used for computed for requests // that are not TLS, or do not enable trailing checksums. // // The SHA256 payload hash will not be computed, if the Algorithm's header // is already set on the request. EnableComputePayloadHash bool // Enables support for setting the aws-chunked decoded content length // header for the decoded length of the underlying stream. Will only be set // when used with trailing checksums, and aws-chunked content-encoding. EnableDecodedContentLengthHeader bool // contains filtered or unexported fields }
ComputeInputPayloadChecksum middleware computes payload checksum
func (*ComputeInputPayloadChecksum) HandleFinalize ¶ added in v1.5.2
func (m *ComputeInputPayloadChecksum) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, metadata middleware.Metadata, err error, )
HandleFinalize handles computing the payload's checksum, in the following cases:
- Is HTTP, not HTTPS
- RequireChecksum is true, and no checksums were specified via the Input
- Trailing checksums are not supported
The build handler must be inserted in the stack before ContentPayloadHash and after ComputeContentLength.
func (*ComputeInputPayloadChecksum) ID ¶ added in v1.5.2
func (m *ComputeInputPayloadChecksum) ID() string
ID provides the middleware's identifier.
type InputMiddlewareOptions ¶
type InputMiddlewareOptions struct { // GetAlgorithm is a function to get the checksum algorithm of the // input payload from the input parameters. // // Given the input parameter value, the function must return the algorithm // and true, or false if no algorithm is specified. GetAlgorithm func(interface{}) (string, bool) // RequireChecksum indicates whether operation model forces middleware to compute the input payload's checksum. // If RequireChecksum is set to true, checksum will be calculated and RequestChecksumCalculation will be ignored, // otherwise RequestChecksumCalculation will be used to indicate if checksum will be calculated RequireChecksum bool // RequestChecksumCalculation is the user config to opt-in/out request checksum calculation. If RequireChecksum is // set to true, checksum will be calculated and this field will be ignored, otherwise // RequestChecksumCalculation will be used to indicate if checksum will be calculated RequestChecksumCalculation aws.RequestChecksumCalculation // Enables support for wrapping the serialized input payload with a // content-encoding: aws-check wrapper, and including a trailer for the // algorithm's checksum value. // // The checksum will not be computed, nor added as trailing checksum, if // the Algorithm's header is already set on the request. EnableTrailingChecksum bool // Enables support for computing the SHA256 checksum of input payloads // along with the algorithm specified checksum. Prevents downstream // middleware handlers (computePayloadSHA256) re-reading the payload. // // The SHA256 payload checksum will only be used for computed for requests // that are not TLS, or do not enable trailing checksums. // // The SHA256 payload hash will not be computed, if the Algorithm's header // is already set on the request. EnableComputeSHA256PayloadHash bool // Enables support for setting the aws-chunked decoded content length // header for the decoded length of the underlying stream. Will only be set // when used with trailing checksums, and aws-chunked content-encoding. EnableDecodedContentLengthHeader bool }
InputMiddlewareOptions provides the options for the request checksum middleware setup.
type OutputMiddlewareOptions ¶
type OutputMiddlewareOptions struct { // GetValidationMode is a function to get the checksum validation // mode of the output payload from the input parameters. // // Given the input parameter value, the function must return the validation // mode and true, or false if no mode is specified. GetValidationMode func(interface{}) (string, bool) // SetValidationMode is a function to set the checksum validation mode of input parameters SetValidationMode func(interface{}, string) // ResponseChecksumValidation is the user config to opt-in/out response checksum validation ResponseChecksumValidation aws.ResponseChecksumValidation // The set of checksum algorithms that should be used for response payload // checksum validation. The algorithm(s) used will be a union of the // output's returned algorithms and this set. // // Only the first algorithm in the union is currently used. ValidationAlgorithms []string // If set the middleware will ignore output multipart checksums. Otherwise // a checksum format error will be returned by the middleware. IgnoreMultipartValidation bool // When set the middleware will log when output does not have checksum or // algorithm to validate. LogValidationSkipped bool // When set the middleware will log when the output contains a multipart // checksum that was, skipped and not validated. LogMultipartValidationSkipped bool }
OutputMiddlewareOptions provides options for configuring output checksum validation middleware.
type RequestChecksumMetricsTracking ¶ added in v1.5.0
type RequestChecksumMetricsTracking struct { RequestChecksumCalculation aws.RequestChecksumCalculation UserAgent *awsmiddleware.RequestUserAgent }
RequestChecksumMetricsTracking is the middleware to track operation request's checksum usage
func (*RequestChecksumMetricsTracking) HandleBuild ¶ added in v1.5.0
func (m *RequestChecksumMetricsTracking) HandleBuild( ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler, ) ( out middleware.BuildOutput, metadata middleware.Metadata, err error, )
HandleBuild checks request checksum config and checksum value sent and sends corresponding feature id to user agent
func (*RequestChecksumMetricsTracking) ID ¶ added in v1.5.0
func (m *RequestChecksumMetricsTracking) ID() string
ID provides the middleware identifier
type ResponseChecksumMetricsTracking ¶ added in v1.5.0
type ResponseChecksumMetricsTracking struct { ResponseChecksumValidation aws.ResponseChecksumValidation UserAgent *awsmiddleware.RequestUserAgent }
ResponseChecksumMetricsTracking is the middleware to track operation response's checksum usage
func (*ResponseChecksumMetricsTracking) HandleBuild ¶ added in v1.5.0
func (m *ResponseChecksumMetricsTracking) HandleBuild( ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler, ) ( out middleware.BuildOutput, metadata middleware.Metadata, err error, )
HandleBuild checks the response checksum config and sends corresponding feature id to user agent
func (*ResponseChecksumMetricsTracking) ID ¶ added in v1.5.0
func (m *ResponseChecksumMetricsTracking) ID() string
ID provides the middleware identifier
type SetupInputContext ¶ added in v1.5.2
type SetupInputContext struct { // GetAlgorithm is a function to get the checksum algorithm of the // input payload from the input parameters. // // Given the input parameter value, the function must return the algorithm // and true, or false if no algorithm is specified. GetAlgorithm func(interface{}) (string, bool) // RequireChecksum indicates whether operation model forces middleware to compute the input payload's checksum. // If RequireChecksum is set to true, checksum will be calculated and RequestChecksumCalculation will be ignored, // otherwise RequestChecksumCalculation will be used to indicate if checksum will be calculated RequireChecksum bool // RequestChecksumCalculation is the user config to opt-in/out request checksum calculation. If RequireChecksum is // set to true, checksum will be calculated and this field will be ignored, otherwise // RequestChecksumCalculation will be used to indicate if checksum will be calculated RequestChecksumCalculation aws.RequestChecksumCalculation }
SetupInputContext is the initial middleware that looks up the input used to configure checksum behavior. This middleware must be executed before input validation step or any other checksum middleware.
func (*SetupInputContext) HandleInitialize ¶ added in v1.5.2
func (m *SetupInputContext) HandleInitialize( ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler, ) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, )
HandleInitialize initialization middleware that setups up the checksum context based on the input parameters provided in the stack.
func (*SetupInputContext) ID ¶ added in v1.5.2
func (m *SetupInputContext) ID() string
ID for the middleware