コード例 #1
0
        public static void Setup(TestContext context)
        {
            _bucketName = S3TestUtils.CreateBucketWithWait(Client);
            _mrapName   = UtilityMethods.SDK_TEST_PREFIX + DateTime.Now.Ticks;

            // Look up the account ID for the credentials being used to run the tests
            _accountId = new AmazonSecurityTokenServiceClient().GetCallerIdentity(new GetCallerIdentityRequest()).Account;

            var request = new CreateMultiRegionAccessPointRequest
            {
                AccountId = _accountId,
                Details   = new CreateMultiRegionAccessPointInput
                {
                    Name    = _mrapName,
                    Regions = new List <Region>
                    {
                        new Region
                        {
                            Bucket = _bucketName
                        }
                    }
                }
            };

            // All MRAP control plane requests must go to us-west-2 per
            // https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html
            var mrapAlias = S3TestUtils.CreateMRAPWithWait(new AmazonS3ControlClient(RegionEndpoint.USWest2), request);

            _mrapArn = $"arn:aws:s3::{_accountId}:accesspoint/{mrapAlias}";
        }