aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Region.cpp
blob: 4b18bf2a2af60a3d2f186eb4e846152b16e993b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/Region.h>
namespace Aws
{
    namespace Region
    {
        Aws::String ComputeSignerRegion(const Aws::String& region)
        {
            if (region == Aws::Region::AWS_GLOBAL)
            {
                return Aws::Region::US_EAST_1;
            }
            else if (region == "s3-external-1")
            {
                return Aws::Region::US_EAST_1;
            }
            else if (region.size() >= 5 && region.compare(0, 5, "fips-") == 0)
            {
                return region.substr(5);
            }
            else if (region.size() >= 5 && region.compare(region.size() - 5, 5, "-fips") == 0)
            {
                return region.substr(0, region.size() - 5);
            }
            else
            {
                return region;
            }
        }
    }
}