AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

This class defines utilities and constants that can be used by all the client libraries of the SDK.

Inheritance Hierarchy

System.Object
  Amazon.Util.AWSSDKUtils

Namespace: Amazon.Util
Assembly: AWSSDK.Core.dll
Version: 3.x.y.z

Syntax

C#
public static class AWSSDKUtils

The AWSSDKUtils type exposes the following members

Properties

NameTypeDescription
Public Property Static Property CorrectedUtcNow System.DateTime

Returns DateTime.UtcNow + ManualClockCorrection when Amazon.AWSConfigs.ManualClockCorrection is set. This value should be used instead of DateTime.UtcNow to factor in manual clock correction

Public Property Static Property FormattedCurrentTimestampGMT System.String

Formats the current date as a GMT timestamp

Public Property Static Property FormattedCurrentTimestampISO8601 System.String

Formats the current date as ISO 8601 timestamp

Public Property Static Property FormattedCurrentTimestampRFC822 System.String

Formats the current date as ISO 8601 timestamp

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.5 or higher. For .NET 3.5 the SDK follows the standard naming convention of BeginMethodName and EndMethodName to indicate asynchronous operations - these method pairs are not shown in the table below.

NameDescription
Public Method Static Method BytesToHexString(Byte[])

Convert bytes to a hex string

Public Method Static Method CanonicalizeResourcePath(Uri, string)

Returns the canonicalized resource path for the service endpoint with single URL encoded path segments.

Public Method Static Method CanonicalizeResourcePath(Uri, string, bool)

Returns the canonicalized resource path for the service endpoint

Public Method Static Method CanonicalizeResourcePath(Uri, string, bool, IDictionary<String, String>, int)

Returns the canonicalized resource path for the service endpoint

Public Method Static Method CanonicalizeResourcePathV2(Uri, string, bool, IDictionary<String, String>)

Returns the canonicalized resource path for the service endpoint.

Public Method Static Method CompressSpaces(string)

Utility method that accepts a string and replaces white spaces with a space.

Public Method Static Method ConvertDateTimetoMilliseconds(DateTime)
Public Method Static Method ConvertFromUnixEpochMilliseconds(Int64)

Utility method for converting Unix epoch milliseconds to DateTime structure.

Public Method Static Method ConvertFromUnixEpochSeconds(int)

Utility method for converting Unix epoch seconds to DateTime structure.

Public Method Static Method ConvertTimeSpanToMilliseconds(TimeSpan)
Public Method Static Method ConvertToUnixEpochMilliSeconds(DateTime)
Public Method Static Method ConvertToUnixEpochSeconds(DateTime)
Public Method Static Method ConvertToUnixEpochSecondsDouble(DateTime)
Public Method Static Method ConvertToUnixEpochSecondsString(DateTime)
Public Method Static Method CopyStream(Stream, Stream)

Utility method for copy the contents of the source stream to the destination stream.

Public Method Static Method CopyStream(Stream, Stream, int)

Utility method for copy the contents of the source stream to the destination stream.

Public Method Static Method DetermineRegion(string)

Attempt to infer the region for a service request based on the endpoint

Public Method Static Method DetermineService(string)

Attempt to infer the service name for a request (in short form, eg 'iam') from the service endpoint.

Public Method Static Method DownloadStringContent(Uri)
Public Method Static Method DownloadStringContent(Uri, TimeSpan)
Public Method Static Method DownloadStringContent(Uri, IWebProxy)
Public Method Static Method DownloadStringContent(Uri, TimeSpan, IWebProxy)
Public Method Static Method ExecuteHttpRequest(Uri, string, string, TimeSpan, IWebProxy, IDictionary<String, String>)

Executes an HTTP request and returns the response as a string. This method throws WebException and HttpRequestException. In the event HttpRequestException is thrown the StatusCode is sent as user defined data on the exception under the key "StatusCode".

Public Method Static Method ForceCanonicalPathAndQuery(Uri)
Public Method Static Method GenerateChecksumForBytes(Byte[], bool)

Generates an MD5 Digest for the given byte array

Public Method Static Method GenerateChecksumForContent(string, bool)

Generates an MD5 Digest for the string-based content

Public Method Static Method GenerateMD5ChecksumForStream(Stream)

Generates an MD5 Digest for the stream specified

Public Method Static Method GenerateMemoryStreamFromString(string)

Utility method for converting a string to a MemoryStream.

Public Method Static Method GetExtension(string)

Returns an extension of a path. This has the same behavior as System.IO.Path.GetExtension, but does not check the path for invalid characters.

Public Method Static Method GetFormattedTimestampISO8601(int)

Gets the ISO8601 formatted timestamp that is minutesFromNow in the future.

Public Method Static Method GetFormattedTimestampRFC822(int)

Gets the RFC822 formatted timestamp that is minutesFromNow in the future.

Public Method Static Method GetRequestPayloadBytes(IRequest, Nullable<Boolean>)

Returns the request parameters in the form of a query string.

Public Method Static Method GetTimeSpanInTicks(DateTime)
Public Method Static Method HasBidiControlCharacters(string)

Returns true if the string has any bidirectional control characters.

Public Method Static Method HexStringToBytes(string)

Convert a hex string to bytes

Public Method Static Method InvokeInBackground(EventHandler<T>, T, object)

Calls a specific EventHandler in a background thread

Public Method Static Method IsAbsolutePath(string)

Determines whether the given string is an absolute path to a root.

Public Method Static Method IsPropertySet(object, string)

This method allows to check whether a property of an object returned by a service call is set. This method is needed to discriminate whether a field is not set (not present in the service response) or if it is set to the default value for its type. Using this method is not required for nullable properties (non-ValueType and Nullable) because they will be simply set to null when not included in the service response. This method can also be used on objects used as part of service requests. This method doesn't support objects that are part of the S3 service model.

Public Method Static Method Join(List<String>)

Returns a new string created by joining each of the strings in the specified list together, with a comma between them.

Public Method Static Method JoinResourcePathSegments(IEnumerable<String>, bool)

Joins all path segments with the / character and encodes each segment before joining.

Public Method Static Method JoinResourcePathSegmentsV2(IEnumerable<String>)

Joins all path segments with the / character and encodes each segment before joining

Public Method Static Method OpenStream(Uri)
Public Method Static Method OpenStream(Uri, IWebProxy)
Public Method Static Method ParseQueryParameters(string)

Parses a query string of a URL and returns the parameters as a string-to-string dictionary.

Public Method Static Method PreserveStackTrace(Exception)

This method is used preserve the stacktrace used from clients that support async calls. This make sure that exceptions thrown during EndXXX methods has the orignal stacktrace that happen in the background thread.

Public Method Static Method ProtectEncodedSlashUrlEncode(string, bool)

URL encodes a string per the specified RFC with the exception of preserving the encoding of previously encoded slashes. If the path property is specified, the accepted path characters {/+:} are not encoded.

Public Method Static Method ResolveResourcePath(string, IDictionary<String, String>)

Takes a patterned resource path and resolves it using the key/value path resources into a segmented encoded URL.

Public Method Static Method ResolveResourcePath(string, IDictionary<String, String>, bool)

Takes a patterned resource path and resolves it using the key/value path resources into a segmented encoded URL.

Public Method Static Method ResolveResourcePathV2(string, IDictionary<String, String>)

Takes a patterned resource path and resolves it using the key/value path resources into a segmented encoded URL.

Public Method Static Method RunProcess(ProcessStartInfo)

Runs a process with the below input parameters.

Public Method Static Method RunProcessAsync(ProcessStartInfo)
Public Method Static Method Sleep(TimeSpan)
Public Method Static Method Sleep(int)
Public Method Static Method SplitResourcePathIntoSegments(string, IDictionary<String, String>)

Splits the resourcePath at / into segments then resolves any keys with the path resource values. Greedy key values will be split into multiple segments at each /.

Public Method Static Method ToHex(Byte[], bool)

Helper function to format a byte array into string

Public Method Static Method UrlEncode(string, bool)

URL encodes a string per RFC3986. If the path property is specified, the accepted path characters {/+:} are not encoded.

Public Method Static Method UrlEncode(int, string, bool)

URL encodes a string per the specified RFC. If the path property is specified, the accepted path characters {/+:} are not encoded.

Fields

NameTypeDescription
Field Static Field DefaultBufferSize System.Int32
Field Static Field DefaultProgressUpdateInterval System.Int64
Field Static Field EPOCH_START System.DateTime
Field Static Field GMTDateFormat System.String

The GMT Date Format string. Used when parsing date objects

Field Static Field ISO8601BasicDateFormat System.String

The ISO8601 basic date format. Used during AWS4 signature computation.

Field Static Field ISO8601BasicDateTimeFormat System.String

The ISO8601 Basic date/time format string. Used when parsing date objects

Field Static Field ISO8601DateFormat System.String

The ISO8601Date Format string. Used when parsing date objects

Field Static Field ISO8601DateFormatNoMS System.String

The ISO8601Date Format string. Used when parsing date objects

Field Static Field ISO8601WithUTCOffset System.String

Represents the ISO8601 basic date/time format with a UTC offset

Field Static Field RFC822DateFormat System.String

The RFC822Date Format string. Used when parsing date objects

Field Static Field UrlEncodedContent System.String

The string representing Url Encoded Content in HTTP requests

Field Static Field UserAgentHeader System.String

The user agent string header

Field Static Field ValidTraceIdHeaderValueCharacters System.String

The set of characters which are not to be encoded as part of the X-Amzn-Trace-Id header values

Field Static Field ValidUrlCharacters System.String

The Set of accepted and valid Url characters per RFC3986. Characters outside of this set will be encoded.

Field Static Field ValidUrlCharactersRFC1738 System.String

The Set of accepted and valid Url characters per RFC1738. Characters outside of this set will be encoded.

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5