Пример #1
0
        public void CreateBucketWithInvalidType()
        {
            var invalidType = new Bucket()
            {
                AccountId = creds.AccountId,
                BucketName = "TestBucketWithInvalidType",
                BucketType = "invalidType"
            };

            request = new CreateBucketRequest(invalidType);
            try
            {
                client.CreateBucket(request);
            }

            catch (BadRequestException ex)
            {
                Assert.AreEqual("invalidType is not a valid value.  Valid values are: allPublic, allPrivate, snapshot", ex.Message);
            }
        }
Пример #2
0
 public Bucket CreateBucket(CreateBucketRequest request)
 {
     //B2 Support #178651, following REST best practices, b2_create_bucket should be accessed via POST, b2_list_buckets by GET.
     var response = client.Post<Bucket>(request);
     return response;
 }
Пример #3
0
        public Bucket CreateBucket(string bucketName, bool privateBucket = true)
        {
            var createBucketRequest = new CreateBucketRequest()
            {
                AccountId = CurrentToken.AccountID,
                BucketName = bucketName,
                BucketType = privateBucket ? "allPrivate" : "allPublic"
            };

            return CreateBucket(createBucketRequest);
        }