Table of Contents

Class DefaultRequest

Namespace
Amazon.Runtime.Internal
Assembly
AWSSDK.Core.dll

Default implementation of the IRequest interface.

This class is only intended for internal use inside the AWS client libraries. Callers shouldn't ever interact directly with objects of this class.

public class DefaultRequest : IRequest
Inheritance
DefaultRequest
Implements
Inherited Members
Extension Methods

Constructors

DefaultRequest(AmazonWebServiceRequest, string)

Constructs a new DefaultRequest with the specified service name and the original, user facing request object.

public DefaultRequest(AmazonWebServiceRequest request, string serviceName)

Parameters

request AmazonWebServiceRequest

The orignal request that is being wrapped

serviceName string

The service name

Properties

AWS4SignerResult

If using AWS4 signing protocol, contains the resultant parts of the signature that we may need to make use of if we elect to do a chunked encoding upload.

public AWS4SigningResult AWS4SignerResult { get; set; }

Property Value

AWS4SigningResult

AWS4aSignerResult

If using SigV4a signing protocol, contains the resultant parts of the signature that we may need to make use of if we elect to do a chunked encoding upload.

public AWS4aSigningResult AWS4aSignerResult { get; set; }

Property Value

AWS4aSigningResult

AlternateEndpoint

Alternate endpoint to use for this request, if any.

public RegionEndpoint AlternateEndpoint { get; set; }

Property Value

RegionEndpoint

AuthenticationRegion

The authentication region to use for the request. Set from Config.AuthenticationRegion.

public string AuthenticationRegion { get; set; }

Property Value

string

CanonicalResource

public string CanonicalResource { get; set; }

Property Value

string

CanonicalResourcePrefix

Used for Amazon S3 requests where the bucket name is removed from the marshalled resource path into the host header. To comply with AWS2 signature calculation, we need to recover the bucket name and include it in the resource canonicalization, which we do using this field.

public string CanonicalResourcePrefix { get; set; }

Property Value

string

Content

Gets and Sets the content for this request.

public byte[] Content { get; set; }

Property Value

byte[]

ContentStream

Gets and sets the content stream.

public Stream ContentStream { get; set; }

Property Value

Stream

DeterminedSigningRegion

The region in which the service request was signed.

public string DeterminedSigningRegion { get; set; }

Property Value

string

DisablePayloadSigning

WARNING: Setting DisablePayloadSigning to true disables the SigV4 payload signing data integrity check on this request.

If using SigV4, the DisablePayloadSigning flag controls if the payload should be signed on a request by request basis. By default this flag is null which will use the default client behavior. The default client behavior is to sign the payload. When DisablePayloadSigning is true, the request will be signed with an UNSIGNED-PAYLOAD value. Setting DisablePayloadSigning to true requires that the request is sent over a HTTPS connection.

Under certain circumstances, such as uploading to S3 while using MD5 hashing, it may be desireable to use UNSIGNED-PAYLOAD to decrease signing CPU usage. This flag only applies to Amazon S3 PutObject and UploadPart requests.

MD5Stream, SigV4 payload signing, and HTTPS each provide some data integrity verification. If DisableMD5Stream is true and DisablePayloadSigning is true, then the possibility of data corruption is completely dependant on HTTPS being the only remaining source of data integrity verification.

public bool? DisablePayloadSigning { get; set; }

Property Value

bool?

Endpoint

Gets and Sets the endpoint for this request.

public Uri Endpoint { get; set; }

Property Value

Uri

Headers

Returns a dictionary of the headers included in this request.

public IDictionary<string, string> Headers { get; }

Property Value

IDictionary<string, string>

HostPrefix

Host prefix value to prepend to the endpoint for this request, if any.

public string HostPrefix { get; set; }

Property Value

string

HttpMethod

Gets and sets the type of http request to make, whether it should be POST,GET or DELETE

public string HttpMethod { get; set; }

Property Value

string

MarshallerVersion

Gets and Sets the version number for the marshaller used to create this request. The version number is used to support backward compatible changes that would otherwise be breaking changes when a newer core is used with an older service assembly. Versions: 1 - Legacy version (no longer supported) 2 - Default version. Support for path segments

public int MarshallerVersion { get; set; }

Property Value

int

OriginalRequest

Returns the original, user facing request object which this internal request object is representing.

public AmazonWebServiceRequest OriginalRequest { get; }

Property Value

AmazonWebServiceRequest

OriginalStreamPosition

Gets and sets the original stream position. If ContentStream is null or does not support seek, this propery should be equal to -1.

public long OriginalStreamPosition { get; set; }

Property Value

long

OverrideSigningServiceName

If the request needs to be signed with a different service name than the client config AuthenticationServiceName, set it here to override the result of DetermineService in AWS4Signer

public string OverrideSigningServiceName { get; set; }

Property Value

string

ParameterCollection

Collection of parameters included in this request.

public ParameterCollection ParameterCollection { get; }

Property Value

ParameterCollection

Parameters

Returns a dictionary of the parameters included in this request.

public IDictionary<string, string> Parameters { get; }

Property Value

IDictionary<string, string>

PathResources

Returns the path resources that should be used within the resource path. This is used for services where path keys can contain '/' characters, making string-splitting of a resource path potentially hazardous.

public IDictionary<string, string> PathResources { get; }

Property Value

IDictionary<string, string>

RequestName

The name of the request

public string RequestName { get; }

Property Value

string

ResourcePath

Gets and Sets the resource path added on to the endpoint.

public string ResourcePath { get; set; }

Property Value

string

SelectedChecksum

The checksum algorithm that was selected to validate this request's integrity

public CoreChecksumAlgorithm SelectedChecksum { get; set; }

Property Value

CoreChecksumAlgorithm

ServiceName

The name of the service to which this request is being sent.

public string ServiceName { get; }

Property Value

string

SetContentFromParameters

Flag that signals that Content was and should be set from the Parameters collection.

public bool SetContentFromParameters { get; set; }

Property Value

bool

SignatureVersion

Specifies which signature version shall be used for the current request.

public SignatureVersion SignatureVersion { get; set; }

Property Value

SignatureVersion

SubResources

Returns the subresources that should be appended to the resource path. This is used primarily for Amazon S3, where object keys can contain '?' characters, making string-splitting of a resource path potentially hazardous.

public IDictionary<string, string> SubResources { get; }

Property Value

IDictionary<string, string>

Suppress404Exceptions

Gets and sets the Suppress404Exceptions property. If true then 404s return back from AWS will not cause an exception and an empty response object will be returned.

public bool Suppress404Exceptions { get; set; }

Property Value

bool

TrailingHeaders

Returns a dictionary of the trailing headers included after this request's content.

public IDictionary<string, string> TrailingHeaders { get; }

Property Value

IDictionary<string, string>

UseChunkEncoding

Determine whether to use a chunked encoding upload for the request (applies to Amazon S3 PutObject and UploadPart requests only). If DisablePayloadSigning is true, UseChunkEncoding will be automatically set to false.

public bool UseChunkEncoding { get; set; }

Property Value

bool

UseDoubleEncoding

Determine whether to use double encoding for request's signer. Propagated from the endpoint's authSchemes. Default value is "true". Currently only S3 and S3 Control will disable double encoding.

public bool UseDoubleEncoding { get; set; }

Property Value

bool

UseQueryString

Gets and sets a flag that indicates whether the request is sent as a query string instead of the request body.

public bool UseQueryString { get; set; }

Property Value

bool

UseSigV4

This flag specifies if SigV4 is required for the current request. Returns true if the request will use SigV4. Setting it to false will use SigV2.

[Obsolete("UseSigV4 is deprecated. Use SignatureVersion directly instead.")]
public bool UseSigV4 { get; set; }

Property Value

bool

Methods

AddPathResource(string, string)

Adds a new entry to the PathResources collection for the request

public void AddPathResource(string key, string value)

Parameters

key string

The name of the pathresource with potential greedy syntax: {key+}

value string

Value of the entry

AddSubResource(string)

Adds a new null entry to the SubResources collection for the request

public void AddSubResource(string subResource)

Parameters

subResource string

The name of the subresource

AddSubResource(string, string)

Adds a new entry to the SubResources collection for the request

public void AddSubResource(string subResource, string value)

Parameters

subResource string

The name of the subresource

value string

Value of the entry

ComputeContentStreamHash()

Computes the SHA 256 hash of the content stream. If the stream is not seekable, it searches the parent stream hierarchy to find a seekable stream prior to computation. Once computed, the hash is cached for future use. If a suitable stream cannot be found to use, null is returned.

public string ComputeContentStreamHash()

Returns

string

GetHeaderValue(string)

Gets the header value from the request.

public string GetHeaderValue(string headerName)

Parameters

headerName string

Returns

string

HasRequestBody()

Returns true if the request has a body, else false.

public bool HasRequestBody()

Returns

bool

Returns true if the request has a body, else false.

IsRequestStreamRewindable()

Checks if the request stream can be rewinded.

public bool IsRequestStreamRewindable()

Returns

bool

Returns true if the request stream can be rewinded , else false.

MayContainRequestBody()

Returns true if the request can contain a request body, else false.

public bool MayContainRequestBody()

Returns

bool

Returns true if the currect request can contain a request body, else false.