Amazon.S3.AmazonS3Client.GetBucketLocation C# (CSharp) Метод

GetBucketLocation() публичный Метод

Returns the region the bucket resides in.
public GetBucketLocation ( GetBucketLocationRequest request ) : GetBucketLocationResponse
request GetBucketLocationRequest Container for the necessary parameters to execute the GetBucketLocation service method.
Результат GetBucketLocationResponse
        public GetBucketLocationResponse GetBucketLocation(GetBucketLocationRequest request)
        {
            var marshaller = new GetBucketLocationRequestMarshaller();
            var unmarshaller = GetBucketLocationResponseUnmarshaller.Instance;

            return Invoke<GetBucketLocationRequest,GetBucketLocationResponse>(request, marshaller, unmarshaller);
        }

Same methods

AmazonS3Client::GetBucketLocation ( string bucketName ) : GetBucketLocationResponse

Usage Example

Пример #1
0
        public void TestLocation()
        {
            foreach (var location in new S3Region[] { S3Region.USW1, S3Region.EUC1 })
            {
                string bucketName = null;
                var region = RegionEndpoint.GetBySystemName(location.Value);

                using (var client = new AmazonS3Client(region))
                {
                    try
                    {
                        bucketName = UtilityMethods.SDK_TEST_PREFIX + DateTime.Now.Ticks;

                        client.PutBucket(new PutBucketRequest
                        {
                            BucketName = bucketName,
                            BucketRegion = location
                        });

                        var returnedLocation = client.GetBucketLocation(new GetBucketLocationRequest
                        {
                            BucketName = bucketName
                        }).Location;

                        Assert.AreEqual(location, returnedLocation);
                    }
                    finally
                    {
                        if (bucketName != null)
                            AmazonS3Util.DeleteS3BucketWithObjects(client, bucketName);
                    }
                }
            }
        }
All Usage Examples Of Amazon.S3.AmazonS3Client::GetBucketLocation
AmazonS3Client