/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ using System; using System.Diagnostics; namespace Amazon.Runtime { /// /// A defaults mode determines how certain default configuration options are resolved in the SDK. Based on the provided /// mode, the SDK will vend sensible default values tailored to the specific . /// /// All options above can be configured by users, and the overridden value will take precedence. /// /// Note: for any mode other than , the vended default values /// might change as best practices may evolve. As a result, it is encouraged to perform testing when upgrading the SDK /// if you are using a mode other than . /// /// While the defaults mode is specific to .NET, /// other modes are standardized across all of the AWS SDKs. /// /// The defaults mode can be configured: /// /// When constructing an implementation by setting . /// Globally via the "AWS_DEFAULTS_MODE" environment variable. /// On a configuration profile via the "defaults_mode" profile file property. /// /// public interface IDefaultConfiguration { /// /// Identifies a specific configuration mode. Example legacy, mobile, cross-region, etc /// DefaultConfigurationMode Name { get; } /// /// A retry mode specifies how the SDK attempts retries. /// See https://docs.aws.amazon.com/sdkref/latest/guide/setting-global-retry_mode.html /// RequestRetryMode RetryMode { get; } /// /// Specifies how the SDK determines the AWS service endpoint that it uses to talk to the AWS Security Token Service (AWS STS). /// See https://docs.aws.amazon.com/sdkref/latest/guide/setting-global-sts_regional_endpoints.html /// StsRegionalEndpointsValue StsRegionalEndpoints { get; } /// /// Specifies how the SDK determines the AWS service endpoint that it uses to talk to the Amazon S3 for the us-east-1 region /// S3UsEast1RegionalEndpointValue S3UsEast1RegionalEndpoint { get; } /// /// The amount of time after making an initial connect attempt on a socket, where if the client does not /// receive a completion of the connect handshake, the client gives up and fails the operation. /// TimeSpan? ConnectTimeout { get; } /// /// The maximum amount of time that a TLS handshake is allowed to take from the time the CLIENT HELLO message is sent to /// the client and server have fully negotiated ciphers and exchanged keys /// TimeSpan? TlsNegotiationTimeout { get; } /// /// How long an application will attempt to read the first byte over an established, /// open connection after write request before timing out. /// TimeSpan? TimeToFirstByteTimeout { get; } /// /// This timeout measures the time between when the first byte is sent over an established, /// open connection and when the last byte is received from the service. /// If the response is not received by the timeout, then the request is considered timed out. /// TimeSpan? HttpRequestTimeout { get; } } /// [DebuggerDisplay("{" + nameof(Name) + "}")] public class DefaultConfiguration : IDefaultConfiguration { /// public DefaultConfigurationMode Name { get; set; } /// public RequestRetryMode RetryMode { get; set; } /// public StsRegionalEndpointsValue StsRegionalEndpoints { get; set; } /// public S3UsEast1RegionalEndpointValue S3UsEast1RegionalEndpoint { get; set; } /// public TimeSpan? ConnectTimeout { get; set; } /// public TimeSpan? TlsNegotiationTimeout { get; set; } /// public TimeSpan? TimeToFirstByteTimeout { get; set; } /// public TimeSpan? HttpRequestTimeout { get; set; } } }