本文整理汇总了C#中IAmazonS3.PutBucket方法的典型用法代码示例。如果您正苦于以下问题:C# IAmazonS3.PutBucket方法的具体用法?C# IAmazonS3.PutBucket怎么用?C# IAmazonS3.PutBucket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAmazonS3
的用法示例。
在下文中一共展示了IAmazonS3.PutBucket方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateABucket
static void CreateABucket(IAmazonS3 client, string bucketName)
{
PutBucketRequest putRequest1 = new PutBucketRequest
{
BucketName = bucketName,
UseClientRegion = true
};
PutBucketResponse response1 = client.PutBucket(putRequest1);
}
示例2: CreateBucket
public bool CreateBucket(string userID)
{
bool retval = false;
using (client = Amazon.AWSClientFactory.CreateAmazonS3Client(RegionEndpoint.APSoutheast1))
{
try
{
//create bucket
PutBucketRequest request = new PutBucketRequest();
request.BucketName = userID;
request.BucketRegion = S3Region.APS1;
request.CannedACL = S3CannedACL.PublicRead;
PutBucketResponse res;
res = client.PutBucket(request);
retval = true;
}
catch (AmazonS3Exception amazonS3Exception)
{
throw amazonS3Exception;
}
}
return retval;
}
示例3: CreateBucket
public static string CreateBucket(IAmazonS3 s3Client)
{
string bucketName = UtilityMethods.SDK_TEST_PREFIX + DateTime.Now.Ticks;
s3Client.PutBucket(new PutBucketRequest { BucketName = bucketName });
return bucketName;
}