public void PutObjectLegalHold(string key, ObjectLockLegalHoldStatus status)
        {
            //Put the legal hold
            var objectLegalHold = new ObjectLockLegalHold();

            objectLegalHold.Status = status;
            var putRequest = new PutObjectLegalHoldRequest
            {
                BucketName   = bucketName,
                LegalHold    = objectLegalHold,
                RequestPayer = RequestPayer.Requester,
                Key          = key
            };

            var putResponse = Client.PutObjectLegalHold(putRequest);

            Assert.AreEqual(true, putResponse.HttpStatusCode == HttpStatusCode.OK);

            //Get the legal hold
            var getRequest = new GetObjectLegalHoldRequest
            {
                BucketName   = bucketName,
                Key          = key,
                RequestPayer = RequestPayer.Requester
            };

            var getResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetObjectLegalHold(getRequest);
                return(res.LegalHold?.Status == status ? res : null);
            });

            Assert.AreEqual(true, getResponse.HttpStatusCode == HttpStatusCode.OK);
            Assert.AreEqual(status, getResponse.LegalHold.Status);
        }
        void TestAccelerateUnsupportedOperations(IAmazonS3 client)
        {
            // List, Put and Delete bucket should hit regional endpoint
            var buckets = client.ListBuckets().Buckets;

            Assert.IsNotNull(buckets);
            var newBucket = UtilityMethods.GenerateName();

            client.PutBucket(newBucket);

            S3TestUtils.WaitForConsistency(() =>
            {
                var result = client.ListBuckets().Buckets.Any(b => b.BucketName.Equals(newBucket, StringComparison.Ordinal));
                return(result ? (bool?)true : null);
            });

            try
            {
                client.DeleteBucket(newBucket);
            }
            catch
            {
                Console.WriteLine($"Failed to clean up new bucket {newBucket}. Ignore leftover bucket.");
            }
        }
Exemple #3
0
        public void BucketMetricsConfigurationsAndFilterTest()
        {
            Tag tag = new Tag()
            {
                Key   = "tagK",
                Value = "tagV"
            };
            List <MetricsFilterPredicate> list = new List <MetricsFilterPredicate>();

            list.Add(new MetricsPrefixPredicate("string"));
            list.Add(new MetricsTagPredicate(tag));
            PutBucketMetricsConfigurationRequest putBucketMetricsConfigurationRequest = new PutBucketMetricsConfigurationRequest()
            {
                BucketName           = bucketName,
                MetricsId            = "configId",
                MetricsConfiguration = new MetricsConfiguration()
                {
                    MetricsId     = "configId",
                    MetricsFilter = new MetricsFilter()
                    {
                        MetricsFilterPredicate = new MetricsAndOperator(list)
                    }
                }
            };
            var putBucketMetricsConfigurationResponse = Client.PutBucketMetricsConfiguration(putBucketMetricsConfigurationRequest);

            GetBucketMetricsConfigurationRequest getBucketMetricsConfigurationRequest = new GetBucketMetricsConfigurationRequest()
            {
                MetricsId  = "configId",
                BucketName = bucketName
            };

            var getBucketMetricsConfigurationResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketMetricsConfiguration(getBucketMetricsConfigurationRequest);
                return(res.MetricsConfiguration?.MetricsId == getBucketMetricsConfigurationRequest.MetricsId ? res : null);
            });

            var getMetricsConfiguration = getBucketMetricsConfigurationResponse.MetricsConfiguration;
            var putMetricsConfiguration = putBucketMetricsConfigurationRequest.MetricsConfiguration;

            Assert.AreEqual(getMetricsConfiguration.MetricsId, putMetricsConfiguration.MetricsId);

            foreach (var predicate in ((MetricsNAryOperator)getMetricsConfiguration.MetricsFilter.MetricsFilterPredicate).Operands)
            {
                if (predicate is MetricsPrefixPredicate)
                {
                    Assert.AreEqual(((MetricsPrefixPredicate)predicate).Prefix, "string");
                }
                else
                {
                    Assert.AreEqual(((MetricsTagPredicate)predicate).Tag.Key, "tagK");
                    Assert.AreEqual(((MetricsTagPredicate)predicate).Tag.Value, "tagV");
                }
            }

            ListBucketMetrics();

            DeleteBucketMetricsAndValidate();
        }
        public void BucketIntelligentTieringConfigurationsPrefixFilterTest()
        {
            var intelligentTieringFilter = new IntelligentTieringFilter()
            {
                IntelligentTieringFilterPredicate = new IntelligentTieringPrefixPredicate("string")
            };

            var putBucketIntelligentTieringConfigurationRequest  = GeneratePutRequest(intelligentTieringId, intelligentTieringFilter);
            var putBucketIntelligentTieringConfigurationResponse = Client.PutBucketIntelligentTieringConfiguration(putBucketIntelligentTieringConfigurationRequest);

            GetBucketIntelligentTieringConfigurationRequest getBucketIntelligentTieringConfigurationRequest = new GetBucketIntelligentTieringConfigurationRequest()
            {
                IntelligentTieringId = intelligentTieringId,
                BucketName           = bucketName
            };

            var getBucketIntelligentTieringConfigurationResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketIntelligentTieringConfiguration(getBucketIntelligentTieringConfigurationRequest);
                return(res.IntelligentTieringConfiguration?.IntelligentTieringId == getBucketIntelligentTieringConfigurationRequest.IntelligentTieringId ? res : null);
            });

            var getConfiguration = getBucketIntelligentTieringConfigurationResponse.IntelligentTieringConfiguration;
            var putConfiguration = putBucketIntelligentTieringConfigurationRequest.IntelligentTieringConfiguration;

            Assert.AreEqual(getConfiguration.IntelligentTieringId, putConfiguration.IntelligentTieringId);
            Assert.AreEqual(((IntelligentTieringPrefixPredicate)getConfiguration.IntelligentTieringFilter.IntelligentTieringFilterPredicate).Prefix, "string");
        }
Exemple #5
0
        public void TagBucket()
        {
            var request = new PutBucketTaggingRequest
            {
                BucketName = bucketName,
                TagSet     = new List <Tag>
                {
                    new Tag
                    {
                        Key   = "TagBucketKey",
                        Value = "TagBucketValue"
                    }
                }
            };

            Client.PutBucketTagging(request);

            var tags = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketTagging(new GetBucketTaggingRequest {
                    BucketName = bucketName
                });
                return(res.TagSet?.FirstOrDefault(x => string.Equals(x.Key, "TagBucketKey")) != null ? res.TagSet : null);
            });

            var tag = tags.FirstOrDefault(x => string.Equals(x.Key, "TagBucketKey"));

            Assert.IsNotNull(tag);
            Assert.AreEqual("TagBucketValue", tag.Value);
        }
Exemple #6
0
        public static void WaitForBucket(IAmazonS3 client, string bucketName, int maxSeconds)
        {
            var sleeper = UtilityMethods.ListSleeper.Create();

            UtilityMethods.WaitUntilSuccess(() => {
                //Check if a bucket exists by trying to put an object in it
                var key = Guid.NewGuid().ToString() + "_existskey";

                var res = client.PutObject(new PutObjectRequest
                {
                    BucketName  = bucketName,
                    Key         = key,
                    ContentBody = "exists..."
                });

                try
                {
                    client.Delete(bucketName, key, null);
                }
                catch
                {
                    Console.WriteLine($"Eventual consistency error: failed to delete key {key} from bucket {bucketName}");
                }

                return(true);
            });

            //Double check the bucket still exists using the DoesBucketExistV2 method
            var exists = S3TestUtils.WaitForConsistency(() =>
            {
                return(AmazonS3Util.DoesS3BucketExistV2(client, bucketName) ? (bool?)true : null);
            });
        }
        public void BucketIntelligentTieringConfigurationsTagFilterTest()
        {
            Tag tag = new Tag()
            {
                Key   = "tagK",
                Value = "tagV"
            };
            var intelligentTieringFilter = new IntelligentTieringFilter()
            {
                IntelligentTieringFilterPredicate = new IntelligentTieringTagPredicate(tag)
            };

            var putBucketIntelligentTieringConfigurationRequest  = GeneratePutRequest(intelligentTieringId, intelligentTieringFilter);
            var putBucketIntelligentTieringConfigurationResponse = Client.PutBucketIntelligentTieringConfiguration(putBucketIntelligentTieringConfigurationRequest);

            GetBucketIntelligentTieringConfigurationRequest getBucketIntelligentTieringConfigurationRequest = new GetBucketIntelligentTieringConfigurationRequest()
            {
                IntelligentTieringId = intelligentTieringId,
                BucketName           = bucketName
            };

            var getBucketIntelligentTieringConfigurationResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketIntelligentTieringConfiguration(getBucketIntelligentTieringConfigurationRequest);
                return(res.IntelligentTieringConfiguration?.IntelligentTieringId == getBucketIntelligentTieringConfigurationRequest.IntelligentTieringId ? res : null);
            });

            var getConfiguration = getBucketIntelligentTieringConfigurationResponse.IntelligentTieringConfiguration;
            var putConfiguration = putBucketIntelligentTieringConfigurationRequest.IntelligentTieringConfiguration;

            Assert.AreEqual(getConfiguration.IntelligentTieringId, putConfiguration.IntelligentTieringId);
            Assert.AreEqual(((IntelligentTieringTagPredicate)getConfiguration.IntelligentTieringFilter.IntelligentTieringFilterPredicate).Tag.Key, "tagK");
            Assert.AreEqual(((IntelligentTieringTagPredicate)getConfiguration.IntelligentTieringFilter.IntelligentTieringFilterPredicate).Tag.Value, "tagV");
        }
        public void TestVersionBucketName()
        {
            var count = 5;

            for (int i = 0; i < count; i++)
            {
                Client.PutObject(new PutObjectRequest
                {
                    BucketName  = bucketName,
                    Key         = key,
                    ContentBody = content
                });
            }

            var response = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.ListVersions(bucketName);
                return(res.Versions?.Count == count ? res : null);
            });

            var versions = response.Versions;

            Assert.AreEqual(count, versions.Count);

            foreach (var version in versions)
            {
                Assert.AreEqual(bucketName, version.BucketName);
                Assert.AreEqual(key, version.Key);
            }
        }
        public void BucketAnalyticsConfigurationsPrefixFilterTest()
        {
            PutBucketAnalyticsConfigurationRequest putBucketAnalyticsConfigurationRequest = new PutBucketAnalyticsConfigurationRequest()
            {
                BucketName             = bucketName,
                AnalyticsId            = "configId",
                AnalyticsConfiguration = new AnalyticsConfiguration()
                {
                    AnalyticsFilter = new AnalyticsFilter()
                    {
                        AnalyticsFilterPredicate = new AnalyticsPrefixPredicate("string")
                    },
                    AnalyticsId          = "configId",
                    StorageClassAnalysis = new StorageClassAnalysis()
                    {
                        DataExport = new StorageClassAnalysisDataExport()
                        {
                            OutputSchemaVersion = StorageClassAnalysisSchemaVersion.V_1,
                            Destination         = new AnalyticsExportDestination()
                            {
                                S3BucketDestination = new AnalyticsS3BucketDestination()
                                {
                                    Format          = AnalyticsS3ExportFileFormat.CSV,
                                    BucketAccountId = "599169622985",
                                    Prefix          = "string",
                                    BucketName      = "arn:aws:s3:::" + bucketName
                                }
                            }
                        }
                    }
                }
            };
            var putBucketAnalyticsConfigurationResponse = Client.PutBucketAnalyticsConfiguration(putBucketAnalyticsConfigurationRequest);

            GetBucketAnalyticsConfigurationRequest getBucketAnalyticsConfigurationRequest = new GetBucketAnalyticsConfigurationRequest()
            {
                BucketName  = bucketName,
                AnalyticsId = "configId"
            };

            var getBucketAnalyticsConfigurationResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketAnalyticsConfiguration(getBucketAnalyticsConfigurationRequest);
                return(res.AnalyticsConfiguration?.AnalyticsId == putBucketAnalyticsConfigurationRequest.AnalyticsConfiguration.AnalyticsId ? res : null);
            });

            var getAnalyticsConfiguration = getBucketAnalyticsConfigurationResponse.AnalyticsConfiguration;
            var putAnalyticsConfiguration = putBucketAnalyticsConfigurationRequest.AnalyticsConfiguration;

            Assert.AreEqual(((AnalyticsPrefixPredicate)getAnalyticsConfiguration.AnalyticsFilter.AnalyticsFilterPredicate).Prefix, "string");

            GetBucketAnalyticsValidation(getAnalyticsConfiguration, putAnalyticsConfiguration);


            ListBucketAnalytics();

            DeleteAnalyticsBucketAndValidate();
        }
        public void SetTopicConfigurationTests()
        {
            var s3Config = new AmazonS3Config();

            using (var s3Client = new AmazonS3Client(s3Config))
                using (var snsClient = new AmazonSimpleNotificationServiceClient())
                {
                    var snsCreateResponse = snsClient.CreateTopic("events-test-" + DateTime.Now.Ticks);
                    var bucketName        = S3TestUtils.CreateBucketWithWait(s3Client);

                    try
                    {
                        snsClient.AuthorizeS3ToPublish(snsCreateResponse.TopicArn, bucketName);

                        PutBucketNotificationRequest putRequest = new PutBucketNotificationRequest
                        {
                            BucketName          = bucketName,
                            TopicConfigurations = new List <TopicConfiguration>
                            {
                                new TopicConfiguration
                                {
                                    Id     = "the-topic-test",
                                    Topic  = snsCreateResponse.TopicArn,
                                    Events = new List <EventType> {
                                        EventType.ObjectCreatedPut
                                    }
                                }
                            }
                        };

                        s3Client.PutBucketNotification(putRequest);

                        var getResponse = S3TestUtils.WaitForConsistency(() =>
                        {
                            var res = s3Client.GetBucketNotification(bucketName);
                            return(res.TopicConfigurations?.Count > 0 && res.TopicConfigurations[0].Id == "the-topic-test" ? res : null);
                        });

                        Assert.AreEqual(1, getResponse.TopicConfigurations.Count);
                        Assert.AreEqual(1, getResponse.TopicConfigurations[0].Events.Count);
                        Assert.AreEqual(EventType.ObjectCreatedPut, getResponse.TopicConfigurations[0].Events[0]);

#pragma warning disable 618
                        Assert.AreEqual("s3:ObjectCreated:Put", getResponse.TopicConfigurations[0].Event);
#pragma warning restore 618
                        Assert.AreEqual("the-topic-test", getResponse.TopicConfigurations[0].Id);
                        Assert.AreEqual(snsCreateResponse.TopicArn, getResponse.TopicConfigurations[0].Topic);
                    }
                    finally
                    {
                        snsClient.DeleteTopic(snsCreateResponse.TopicArn);
                        AmazonS3Util.DeleteS3BucketWithObjects(s3Client, bucketName);
                    }
                }
        }
 private void WaitForEnabledVersioning(IAmazonS3 client, string bucketName)
 {
     S3TestUtils.WaitForConsistency(() =>
     {
         var res = client.GetBucketVersioning(new GetBucketVersioningRequest
         {
             BucketName = bucketName
         });
         return(res.VersioningConfig?.Status == VersionStatus.Enabled ? res : null);
     });
 }
        public void BucketIntelligentTieringConfigurationsAndFilterTest()
        {
            Tag tag = new Tag()
            {
                Key   = "tagK",
                Value = "tagV"
            };
            List <IntelligentTieringFilterPredicate> list = new List <IntelligentTieringFilterPredicate>();

            list.Add(new IntelligentTieringPrefixPredicate("string"));
            list.Add(new IntelligentTieringTagPredicate(tag));

            var intelligentTieringFilter = new IntelligentTieringFilter()
            {
                IntelligentTieringFilterPredicate = new IntelligentTieringAndOperator(list)
            };
            var putBucketIntelligentTieringConfigurationRequest  = GeneratePutRequest(intelligentTieringId, intelligentTieringFilter);
            var putBucketIntelligentTieringConfigurationResponse = Client.PutBucketIntelligentTieringConfiguration(putBucketIntelligentTieringConfigurationRequest);

            GetBucketIntelligentTieringConfigurationRequest getBucketIntelligentTieringConfigurationRequest = new GetBucketIntelligentTieringConfigurationRequest()
            {
                IntelligentTieringId = intelligentTieringId,
                BucketName           = bucketName
            };

            var getBucketIntelligentTieringConfigurationResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketIntelligentTieringConfiguration(getBucketIntelligentTieringConfigurationRequest);
                return(res.IntelligentTieringConfiguration?.IntelligentTieringId == getBucketIntelligentTieringConfigurationRequest.IntelligentTieringId ? res : null);
            });

            var getConfiguration = getBucketIntelligentTieringConfigurationResponse.IntelligentTieringConfiguration;
            var putConfiguration = putBucketIntelligentTieringConfigurationRequest.IntelligentTieringConfiguration;

            Assert.AreEqual(getConfiguration.IntelligentTieringId, putConfiguration.IntelligentTieringId);

            foreach (var predicate in ((IntelligentTieringNAryOperator)getConfiguration.IntelligentTieringFilter.IntelligentTieringFilterPredicate).Operands)
            {
                if (predicate is IntelligentTieringPrefixPredicate)
                {
                    Assert.AreEqual(((IntelligentTieringPrefixPredicate)predicate).Prefix, "string");
                }
                else if (predicate is IntelligentTieringTagPredicate)
                {
                    Assert.AreEqual(((IntelligentTieringTagPredicate)predicate).Tag.Key, "tagK");
                    Assert.AreEqual(((IntelligentTieringTagPredicate)predicate).Tag.Value, "tagV");
                }
            }
        }
        public void BucketMetricssConfigurationsTagFilterTest()
        {
            Tag tag = new Tag()
            {
                Key   = "tagK",
                Value = "tagV"
            };
            PutBucketMetricsConfigurationRequest putBucketMetricsConfigurationRequest = new PutBucketMetricsConfigurationRequest()
            {
                BucketName           = bucketName,
                MetricsId            = "configId",
                MetricsConfiguration = new MetricsConfiguration()
                {
                    MetricsId     = "configId",
                    MetricsFilter = new MetricsFilter()
                    {
                        MetricsFilterPredicate = new MetricsTagPredicate(tag)
                    }
                }
            };
            var putBucketMetricsConfigurationResponse = Client.PutBucketMetricsConfiguration(putBucketMetricsConfigurationRequest);

            GetBucketMetricsConfigurationRequest getBucketMetricsConfigurationRequest = new GetBucketMetricsConfigurationRequest()
            {
                MetricsId  = "configId",
                BucketName = bucketName
            };

            var getBucketMetricsConfigurationResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketMetricsConfiguration(getBucketMetricsConfigurationRequest);
                return(res.MetricsConfiguration?.MetricsId == getBucketMetricsConfigurationRequest.MetricsId ? res : null);
            });

            var getMetricsConfiguration = getBucketMetricsConfigurationResponse.MetricsConfiguration;
            var putMetricsConfiguration = putBucketMetricsConfigurationRequest.MetricsConfiguration;

            Assert.AreEqual(getMetricsConfiguration.MetricsId, putMetricsConfiguration.MetricsId);
            Assert.AreEqual(((MetricsTagPredicate)getMetricsConfiguration.MetricsFilter.MetricsFilterPredicate).Tag.Key, "tagK");
            Assert.AreEqual(((MetricsTagPredicate)getMetricsConfiguration.MetricsFilter.MetricsFilterPredicate).Tag.Value, "tagV");

            ListBucketMetrics();

            DeleteBucketMetricsAndValidate();
        }
        public void BucketIntelligentTieringConfigurationsTieringListTest()
        {
            var intelligentTieringFilter = new IntelligentTieringFilter()
            {
                IntelligentTieringFilterPredicate = new IntelligentTieringPrefixPredicate("string")
            };

            var tiering = new Tiering()
            {
                Days       = 180,
                AccessTier = IntelligentTieringAccessTier.DEEP_ARCHIVE_ACCESS
            };

            var putBucketIntelligentTieringConfigurationRequest = GeneratePutRequest(intelligentTieringId, intelligentTieringFilter);

            putBucketIntelligentTieringConfigurationRequest.IntelligentTieringConfiguration.Tierings.Add(tiering);
            var putBucketIntelligentTieringConfigurationResponse = Client.PutBucketIntelligentTieringConfiguration(putBucketIntelligentTieringConfigurationRequest);

            GetBucketIntelligentTieringConfigurationRequest getBucketIntelligentTieringConfigurationRequest = new GetBucketIntelligentTieringConfigurationRequest()
            {
                IntelligentTieringId = intelligentTieringId,
                BucketName           = bucketName
            };

            var getBucketIntelligentTieringConfigurationResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketIntelligentTieringConfiguration(getBucketIntelligentTieringConfigurationRequest);
                return(res.IntelligentTieringConfiguration?.IntelligentTieringId == getBucketIntelligentTieringConfigurationRequest.IntelligentTieringId ? res : null);
            });

            var getConfiguration = getBucketIntelligentTieringConfigurationResponse.IntelligentTieringConfiguration;
            var putConfiguration = putBucketIntelligentTieringConfigurationRequest.IntelligentTieringConfiguration;

            Assert.AreEqual(getConfiguration.IntelligentTieringId, putConfiguration.IntelligentTieringId);
            Assert.AreEqual(getConfiguration.Status, putConfiguration.Status);

            Assert.AreEqual(getConfiguration.Tierings.Count, putConfiguration.Tierings.Count);
            for (int i = 0; i < getConfiguration.Tierings.Count; i++)
            {
                var tiering_get = getConfiguration.Tierings[i];
                var tiering_put = putConfiguration.Tierings[i];
                Assert.AreEqual(tiering_get.Days, tiering_put.Days);
                Assert.AreEqual(tiering_get.AccessTier, tiering_put.AccessTier);
            }
        }
        public static void Initialize(TestContext tc)
        {
            bucketName = S3TestUtils.CreateBucketWithWait(Client);
            Client.PutBucketVersioning(new PutBucketVersioningRequest
            {
                BucketName       = bucketName,
                VersioningConfig = new S3BucketVersioningConfig
                {
                    Status = VersionStatus.Enabled
                }
            });

            S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketVersioning(new GetBucketVersioningRequest
                {
                    BucketName = bucketName
                });
                return(res.VersioningConfig?.Status == VersionStatus.Enabled ? res : null);
            });
        }
Exemple #16
0
        private void EnableBucketVersioning()
        {
            Client.PutBucketVersioning(new PutBucketVersioningRequest
            {
                BucketName       = bucketName,
                VersioningConfig = new S3BucketVersioningConfig
                {
                    Status = VersionStatus.Enabled
                }
            });

            //Wait for versioning to be set on the bucket or multiple PutObject with the same key may not add a new version
            S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketVersioning(new GetBucketVersioningRequest
                {
                    BucketName = bucketName
                });
                return(res.VersioningConfig?.Status == VersionStatus.Enabled ? res : null);
            });
        }
        public void BucketMetricsConfigurationAccessPointArnFilterTest()
        {
            PutBucketMetricsConfigurationRequest putBucketMetricsConfigurationRequest = new PutBucketMetricsConfigurationRequest()
            {
                BucketName           = bucketName,
                MetricsId            = "configId",
                MetricsConfiguration = new MetricsConfiguration()
                {
                    MetricsId     = "configId",
                    MetricsFilter = new MetricsFilter()
                    {
                        MetricsFilterPredicate = new MetricsAccessPointArnPredicate(accessPointArn)
                    }
                }
            };
            var putBucketMetricsConfigurationResponse = Client.PutBucketMetricsConfiguration(putBucketMetricsConfigurationRequest);

            GetBucketMetricsConfigurationRequest getBucketMetricsConfigurationRequest = new GetBucketMetricsConfigurationRequest()
            {
                MetricsId  = "configId",
                BucketName = bucketName
            };

            var getBucketMetricsConfigurationResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketMetricsConfiguration(getBucketMetricsConfigurationRequest);
                return(res.MetricsConfiguration?.MetricsId == getBucketMetricsConfigurationRequest.MetricsId ? res : null);
            });

            var getMetricsConfiguration = getBucketMetricsConfigurationResponse.MetricsConfiguration;
            var putMetricsConfiguration = putBucketMetricsConfigurationRequest.MetricsConfiguration;

            Assert.AreEqual(getMetricsConfiguration.MetricsId, putMetricsConfiguration.MetricsId);
            Assert.AreEqual(((MetricsAccessPointArnPredicate)getMetricsConfiguration.MetricsFilter.MetricsFilterPredicate).AccessPointArn, accessPointArn);


            ListBucketMetrics();

            DeleteBucketMetricsAndValidate();
        }
        public PutObjectLockConfigurationResponse AddObjectLockConfiguration()
        {
            var objectLockConfiguration = new ObjectLockConfiguration();

            objectLockConfiguration.ObjectLockEnabled = ObjectLockEnabled.Enabled;
            objectLockConfiguration.Rule = new ObjectLockRule
            {
                DefaultRetention = new DefaultRetention
                {
                    Days = 1,
                    Mode = ObjectLockRetentionMode.Governance
                }
            };

            var putRequest = new PutObjectLockConfigurationRequest
            {
                BucketName              = bucketName,
                RequestPayer            = RequestPayer.Requester,
                ObjectLockConfiguration = objectLockConfiguration
            };

            var putResponse = Client.PutObjectLockConfiguration(putRequest);

            Assert.AreEqual(true, putResponse.HttpStatusCode == HttpStatusCode.OK);

            //Make sure the object lock has been enabled
            var getRequest = new GetObjectLockConfigurationRequest()
            {
                BucketName = bucketName
            };
            var getResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetObjectLockConfiguration(getRequest);
                return(res.ObjectLockConfiguration?.ObjectLockEnabled == ObjectLockEnabled.Enabled ? res : null);
            });

            return(putResponse);
        }
        private GetPublicAccessBlockResponse Call_GetPublicAccessBlock(IAmazonS3 client, string bucketName, PublicAccessBlockConfiguration expectedConfiguration)
        {
            var getRequest = new GetPublicAccessBlockRequest
            {
                BucketName = bucketName
            };

            if (expectedConfiguration == null)
            {
                //If expectedConfiguration is null then we want GetPublicAccessBlock to throw an exception because the configuration was removed.
                //Wait until the configuration was removed / until an exception is thrown.
                UtilityMethods.WaitUntilException(() =>
                {
                    client.GetPublicAccessBlock(getRequest);
                });

                Assert.Fail("An expected exception was not thrown");
            }

            var getResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = client.GetPublicAccessBlock(getRequest);

                return(res.HttpStatusCode == HttpStatusCode.OK &&
                       expectedConfiguration.BlockPublicAcls == res.PublicAccessBlockConfiguration.BlockPublicAcls &&
                       expectedConfiguration.BlockPublicPolicy == res.PublicAccessBlockConfiguration.BlockPublicPolicy &&
                       expectedConfiguration.IgnorePublicAcls == res.PublicAccessBlockConfiguration.IgnorePublicAcls &&
                       expectedConfiguration.RestrictPublicBuckets == res.PublicAccessBlockConfiguration.RestrictPublicBuckets ? res : null);
            });

            Assert.AreEqual(expectedConfiguration.BlockPublicAcls, getResponse.PublicAccessBlockConfiguration.BlockPublicAcls);
            Assert.AreEqual(expectedConfiguration.BlockPublicPolicy, getResponse.PublicAccessBlockConfiguration.BlockPublicPolicy);
            Assert.AreEqual(expectedConfiguration.IgnorePublicAcls, getResponse.PublicAccessBlockConfiguration.IgnorePublicAcls);
            Assert.AreEqual(expectedConfiguration.RestrictPublicBuckets, getResponse.PublicAccessBlockConfiguration.RestrictPublicBuckets);
            return(getResponse);
        }
        public static void Initialize(TestContext a)
        {
            s3Client   = new AmazonS3Client(TestRegionEndpoint);
            bucketName = S3TestUtils.CreateBucketWithWait(s3Client);
            BucketAccelerateStatus bucketStatus = null;

            s3Client.PutBucketAccelerateConfiguration(new PutBucketAccelerateConfigurationRequest
            {
                BucketName = bucketName,
                AccelerateConfiguration = new AccelerateConfiguration
                {
                    Status = BucketAccelerateStatus.Enabled
                }
            });

            var response = S3TestUtils.WaitForConsistency(() =>
            {
                var res = s3Client.GetBucketAccelerateConfiguration(bucketName);
                return(res.Status == BucketAccelerateStatus.Enabled ? res : null);
            });

            bucketStatus = response.Status;
            Assert.AreEqual(BucketAccelerateStatus.Enabled, bucketStatus);
        }
Exemple #21
0
        public void TestGetBucketPolicyStatus_IsNotPublic()
        {
            //Set the bucket policy to not public
            var putRequest = new PutBucketPolicyRequest
            {
                BucketName = bucketName,
                Policy     = string.Format(@"{{
                              ""Version"":""2012-10-17"",                                 
                              ""Statement"":[
                                {{
                                  ""Sid"":""AddPerm"",
                                  ""Effect"":""Deny"",
                                  ""Principal"": ""*"",
                                  ""Action"":[""s3:GetObject""],
                                  ""Resource"":[""arn:aws:s3:::{0}/*""]
                                }}
                              ]
                            }}", bucketName)
            };

            Client.PutBucketPolicy(putRequest);

            //Get the policy status on the bucket
            GetBucketPolicyStatusRequest getRequest = new GetBucketPolicyStatusRequest
            {
                BucketName = bucketName
            };

            var getResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketPolicyStatus(getRequest);
                return(res.PolicyStatus?.IsPublic == false ? res : null);
            });

            Assert.AreEqual(false, getResponse.PolicyStatus.IsPublic);
        }
        private void TestReplicationConfigurationForPrefix(string prefix)
        {
            var bucketName   = UtilityMethods.GenerateName();
            var storageClass = S3StorageClass.ReducedRedundancy;
            var euBucketName = "eu" + UtilityMethods.GenerateName();
            var euS3         = new AmazonS3Client(Amazon.RegionEndpoint.EUWest1);

            euS3.PutBucket(euBucketName);
            Client.PutBucket(bucketName);

            S3TestUtils.WaitForBucket(euS3, euBucketName);
            S3TestUtils.WaitForBucket(Client, bucketName);

            euS3.PutBucketVersioning(new PutBucketVersioningRequest
            {
                BucketName       = euBucketName,
                VersioningConfig = new S3BucketVersioningConfig
                {
                    Status = VersionStatus.Enabled
                }
            });

            Client.PutBucketVersioning(new PutBucketVersioningRequest
            {
                BucketName       = bucketName,
                VersioningConfig = new S3BucketVersioningConfig
                {
                    Status = VersionStatus.Enabled
                }
            });

            WaitForEnabledVersioning(euS3, euBucketName);
            WaitForEnabledVersioning(Client, bucketName);

            var roleArn = "arn:aws:iam::pikc123456:role/abcdef";
            var destinationBucketArn = "arn:aws:s3:::" + euBucketName;

            try
            {
                Client.PutBucketReplication(new PutBucketReplicationRequest {
                    BucketName    = bucketName,
                    Configuration = new ReplicationConfiguration
                    {
                        Role  = roleArn,
                        Rules =
                        {
                            new ReplicationRule
                            {
                                Id          = UtilityMethods.GenerateName(),
                                Prefix      = prefix,
                                Status      = ReplicationRuleStatus.Enabled,
                                Destination = new ReplicationDestination
                                {
                                    BucketArn    = destinationBucketArn,
                                    StorageClass = storageClass
                                }
                            }
                        }
                    }
                });

                var config = S3TestUtils.WaitForConsistency(() =>
                {
                    var res = Client.GetBucketReplication(new GetBucketReplicationRequest
                    {
                        BucketName = bucketName
                    });
                    return(res.Configuration?.Role == roleArn ? res.Configuration : null);
                });

                Assert.IsNotNull(config);
                Assert.IsNotNull(config.Role);
                Assert.AreEqual(roleArn, config.Role);
                Assert.IsNotNull(config.Rules);
                Assert.AreEqual(1, config.Rules.Count);

                var rule = config.Rules.First();

                Assert.IsNotNull(rule);
                Assert.IsNotNull(rule.Id);
                Assert.IsNotNull(rule.Prefix);
                if (string.IsNullOrEmpty(prefix))
                {
                    Assert.AreEqual(string.Empty, rule.Prefix);
                }
                else
                {
                    Assert.AreEqual(prefix, rule.Prefix);
                }
                Assert.AreEqual(destinationBucketArn, rule.Destination.BucketArn);
                Assert.AreEqual(storageClass, rule.Destination.StorageClass);

                Client.PutObject(new PutObjectRequest {
                    BucketName  = bucketName,
                    ContentBody = "foo",
                    Key         = "foo-123"
                });

                var status = Client.GetObjectMetadata(new GetObjectMetadataRequest {
                    BucketName = bucketName,
                    Key        = "foo-123"
                }).ReplicationStatus;

                Assert.IsNotNull(status);

                Client.DeleteBucketReplication(new DeleteBucketReplicationRequest {
                    BucketName = bucketName
                });

                var noconfig = S3TestUtils.WaitForConsistency(() =>
                {
                    var res = Client.GetBucketReplication(new GetBucketReplicationRequest
                    {
                        BucketName = bucketName
                    });
                    return(res.Configuration?.Rules.Any() == false ? res.Configuration : null);
                });

                Assert.IsFalse(noconfig.Rules.Any());
            }
            finally
            {
                AmazonS3Util.DeleteS3BucketWithObjects(euS3, euBucketName);
                AmazonS3Util.DeleteS3BucketWithObjects(Client, bucketName);
            }
        }
        public void BucketAnalyticsConfigurationsAndFilterTest()
        {
            Tag tag = new Tag()
            {
                Key   = "tagK",
                Value = "tagV"
            };
            List <AnalyticsFilterPredicate> list = new List <AnalyticsFilterPredicate>();

            list.Add(new AnalyticsPrefixPredicate("string"));
            list.Add(new AnalyticsTagPredicate(tag));
            PutBucketAnalyticsConfigurationRequest putBucketAnalyticsConfigurationRequest = new PutBucketAnalyticsConfigurationRequest()
            {
                BucketName             = bucketName,
                AnalyticsId            = "configId",
                AnalyticsConfiguration = new AnalyticsConfiguration()
                {
                    AnalyticsFilter = new AnalyticsFilter()
                    {
                        AnalyticsFilterPredicate = new AnalyticsAndOperator(list)
                    },
                    AnalyticsId          = "configId",
                    StorageClassAnalysis = new StorageClassAnalysis()
                    {
                        DataExport = new StorageClassAnalysisDataExport()
                        {
                            OutputSchemaVersion = StorageClassAnalysisSchemaVersion.V_1,
                            Destination         = new AnalyticsExportDestination()
                            {
                                S3BucketDestination = new AnalyticsS3BucketDestination()
                                {
                                    Format          = AnalyticsS3ExportFileFormat.CSV,
                                    BucketAccountId = "599169622985",
                                    Prefix          = "string",
                                    BucketName      = "arn:aws:s3:::" + bucketName
                                }
                            }
                        }
                    }
                }
            };
            var putBucketAnalyticsConfigurationResponse = Client.PutBucketAnalyticsConfiguration(putBucketAnalyticsConfigurationRequest);

            GetBucketAnalyticsConfigurationRequest getBucketAnalyticsConfigurationRequest = new GetBucketAnalyticsConfigurationRequest()
            {
                BucketName  = bucketName,
                AnalyticsId = "configId"
            };

            var getBucketAnalyticsConfigurationResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketAnalyticsConfiguration(getBucketAnalyticsConfigurationRequest);
                return(res.AnalyticsConfiguration?.AnalyticsId == putBucketAnalyticsConfigurationRequest.AnalyticsConfiguration.AnalyticsId ? res : null);
            });

            var getAnalyticsConfiguration = getBucketAnalyticsConfigurationResponse.AnalyticsConfiguration;
            var putAnalyticsConfiguration = putBucketAnalyticsConfigurationRequest.AnalyticsConfiguration;

            foreach (var predicate in ((AnalyticsNAryOperator)getAnalyticsConfiguration.AnalyticsFilter.AnalyticsFilterPredicate).Operands)
            {
                if (predicate is AnalyticsPrefixPredicate)
                {
                    Assert.AreEqual(((AnalyticsPrefixPredicate)predicate).Prefix, "string");
                }
                else
                {
                    Assert.AreEqual(((AnalyticsTagPredicate)predicate).Tag.Key, "tagK");
                    Assert.AreEqual(((AnalyticsTagPredicate)predicate).Tag.Value, "tagV");
                }
            }

            GetBucketAnalyticsValidation(getAnalyticsConfiguration, putAnalyticsConfiguration);

            ListBucketAnalytics();

            DeleteAnalyticsBucketAndValidate();
        }
        public void SetQueueConfigurationTests()
        {
            var filterRule = new FilterRule("Prefix", "test/");
            var s3Config   = new AmazonS3Config();

            using (var s3Client = new AmazonS3Client(s3Config))
                using (var sqsClient = new AmazonSQSClient())
                    using (var stsClient = new AmazonSecurityTokenServiceClient())
                    {
                        var createResponse = sqsClient.CreateQueue("events-test-" + DateTime.Now.Ticks);
                        var bucketName     = S3TestUtils.CreateBucketWithWait(s3Client);

                        try
                        {
                            var queueArn = sqsClient.AuthorizeS3ToSendMessage(createResponse.QueueUrl, bucketName);

                            PutBucketNotificationRequest putRequest = new PutBucketNotificationRequest
                            {
                                BucketName          = bucketName,
                                QueueConfigurations = new List <QueueConfiguration>
                                {
                                    new QueueConfiguration
                                    {
                                        Id     = "the-queue-test",
                                        Queue  = queueArn,
                                        Events = { EventType.ObjectCreatedPut },
                                        Filter = new Filter
                                        {
                                            S3KeyFilter = new S3KeyFilter
                                            {
                                                FilterRules = new List <FilterRule>
                                                {
                                                    filterRule
                                                }
                                            }
                                        }
                                    }
                                }
                            };

                            s3Client.PutBucketNotification(putRequest);

                            var getResponse = S3TestUtils.WaitForConsistency(() =>
                            {
                                var res = s3Client.GetBucketNotification(bucketName);
                                return(res.QueueConfigurations?.Count > 0 && res.QueueConfigurations[0].Id == "the-queue-test" ? res : null);
                            });

                            var getAttributeResponse = sqsClient.GetQueueAttributes(new GetQueueAttributesRequest
                            {
                                QueueUrl       = createResponse.QueueUrl,
                                AttributeNames = new List <string> {
                                    "All"
                                }
                            });

                            var policy     = Policy.FromJson(getAttributeResponse.Policy);
                            var conditions = policy.Statements[0].Conditions;
                            Assert.AreEqual(2, conditions.Count);

                            var accountCondition = conditions.FirstOrDefault(x => string.Equals(x.ConditionKey, ConditionFactory.SOURCE_ACCOUNT_KEY));
                            Assert.IsNotNull(accountCondition);
                            Assert.AreEqual(ConditionFactory.StringComparisonType.StringEquals.ToString(), accountCondition.Type);
                            Assert.AreEqual(12, accountCondition.Values[0].Length);

                            var currentAccountId = stsClient.GetCallerIdentity(new GetCallerIdentityRequest()).Account;
                            Assert.AreEqual(currentAccountId, accountCondition.Values[0]);


                            Assert.AreEqual(1, getResponse.QueueConfigurations.Count);
                            Assert.AreEqual(1, getResponse.QueueConfigurations[0].Events.Count);
                            Assert.AreEqual(EventType.ObjectCreatedPut, getResponse.QueueConfigurations[0].Events[0]);

                            Assert.IsNotNull(getResponse.QueueConfigurations[0].Filter);
                            Assert.IsNotNull(getResponse.QueueConfigurations[0].Filter.S3KeyFilter);
                            Assert.IsNotNull(getResponse.QueueConfigurations[0].Filter.S3KeyFilter.FilterRules);
                            Assert.AreEqual(1, getResponse.QueueConfigurations[0].Filter.S3KeyFilter.FilterRules.Count);
                            Assert.AreEqual(filterRule.Name, getResponse.QueueConfigurations[0].Filter.S3KeyFilter.FilterRules[0].Name);
                            Assert.AreEqual(filterRule.Value, getResponse.QueueConfigurations[0].Filter.S3KeyFilter.FilterRules[0].Value);

                            Assert.AreEqual("the-queue-test", getResponse.QueueConfigurations[0].Id);
                            Assert.AreEqual(queueArn, getResponse.QueueConfigurations[0].Queue);

                            // Purge queue to remove test message sent configuration was setup.
                            sqsClient.PurgeQueue(createResponse.QueueUrl);
                            //We must wait 60 seconds or the next message being sent to the queue could be deleted while the queue is being purged.
                            Thread.Sleep(TimeSpan.FromSeconds(60));

                            var putObjectRequest = new PutObjectRequest
                            {
                                BucketName  = bucketName,
                                Key         = "test/data.txt",
                                ContentBody = "Important Data"
                            };

                            s3Client.PutObject(putObjectRequest);

                            string messageBody = null;
                            for (int i = 0; i < 5 && messageBody == null; i++)
                            {
                                var receiveResponse = sqsClient.ReceiveMessage(new ReceiveMessageRequest {
                                    QueueUrl = createResponse.QueueUrl, WaitTimeSeconds = 20
                                });
                                if (receiveResponse.Messages.Count != 0)
                                {
                                    messageBody = receiveResponse.Messages[0].Body;
                                }
                            }


                            var evnt = S3EventNotification.ParseJson(messageBody);

                            Assert.AreEqual(1, evnt.Records.Count);
                            Assert.AreEqual(putObjectRequest.BucketName, evnt.Records[0].S3.Bucket.Name);
                            Assert.AreEqual(putObjectRequest.Key, evnt.Records[0].S3.Object.Key);
                            Assert.AreEqual(putObjectRequest.ContentBody.Length, evnt.Records[0].S3.Object.Size);
                            Assert.IsNotNull(evnt.Records[0].S3.Object.Sequencer);
                        }
                        finally
                        {
                            sqsClient.DeleteQueue(createResponse.QueueUrl);
                            AmazonS3Util.DeleteS3BucketWithObjects(s3Client, bucketName);
                        }
                    }
        }
        public void SetTopicConfigurationTests()
        {
            var s3Config = new AmazonS3Config();

            using (var s3Client = new AmazonS3Client(s3Config))
                using (var snsClient = new AmazonSimpleNotificationServiceClient())
                    using (var stsClient = new AmazonSecurityTokenServiceClient())
                    {
                        var snsCreateResponse = snsClient.CreateTopic("events-test-" + DateTime.Now.Ticks);
                        var bucketName        = S3TestUtils.CreateBucketWithWait(s3Client);

                        try
                        {
                            snsClient.AuthorizeS3ToPublish(snsCreateResponse.TopicArn, bucketName);

                            PutBucketNotificationRequest putRequest = new PutBucketNotificationRequest
                            {
                                BucketName          = bucketName,
                                TopicConfigurations = new List <TopicConfiguration>
                                {
                                    new TopicConfiguration
                                    {
                                        Id     = "the-topic-test",
                                        Topic  = snsCreateResponse.TopicArn,
                                        Events = new List <EventType> {
                                            EventType.ObjectCreatedPut
                                        }
                                    }
                                }
                            };

                            s3Client.PutBucketNotification(putRequest);

                            var getResponse = S3TestUtils.WaitForConsistency(() =>
                            {
                                var res = s3Client.GetBucketNotification(bucketName);
                                return(res.TopicConfigurations?.Count > 0 && res.TopicConfigurations[0].Id == "the-topic-test" ? res : null);
                            });

                            var getAttributeResponse = snsClient.GetTopicAttributes(new GetTopicAttributesRequest
                            {
                                TopicArn = snsCreateResponse.TopicArn
                            });

                            var policy = Policy.FromJson(getAttributeResponse.Attributes["Policy"]);

                            // SNS topics already have a default statement. We need to evaluate the second statement that the SDK appended.
                            var conditions = policy.Statements[1].Conditions;
                            Assert.AreEqual(2, conditions.Count);

                            var accountCondition = conditions.FirstOrDefault(x => string.Equals(x.ConditionKey, ConditionFactory.SOURCE_ACCOUNT_KEY));
                            Assert.IsNotNull(accountCondition);
                            Assert.AreEqual(ConditionFactory.StringComparisonType.StringEquals.ToString(), accountCondition.Type);
                            Assert.AreEqual(12, accountCondition.Values[0].Length);

                            var currentAccountId = stsClient.GetCallerIdentity(new GetCallerIdentityRequest()).Account;
                            Assert.AreEqual(currentAccountId, accountCondition.Values[0]);

                            Assert.AreEqual(1, getResponse.TopicConfigurations.Count);
                            Assert.AreEqual(1, getResponse.TopicConfigurations[0].Events.Count);
                            Assert.AreEqual(EventType.ObjectCreatedPut, getResponse.TopicConfigurations[0].Events[0]);

#pragma warning disable 618
                            Assert.AreEqual("s3:ObjectCreated:Put", getResponse.TopicConfigurations[0].Event);
#pragma warning restore 618
                            Assert.AreEqual("the-topic-test", getResponse.TopicConfigurations[0].Id);
                            Assert.AreEqual(snsCreateResponse.TopicArn, getResponse.TopicConfigurations[0].Topic);
                        }
                        finally
                        {
                            snsClient.DeleteTopic(snsCreateResponse.TopicArn);
                            AmazonS3Util.DeleteS3BucketWithObjects(s3Client, bucketName);
                        }
                    }
        }
        public void BucketInventoryConfigurationsAndFilterTest()
        {
            PutBucketInventoryConfigurationRequest putBucketInventoryConfigurationRequest = new PutBucketInventoryConfigurationRequest()
            {
                BucketName             = bucketName,
                InventoryId            = "configId",
                InventoryConfiguration = new InventoryConfiguration
                {
                    Destination = new InventoryDestination
                    {
                        S3BucketDestination = new InventoryS3BucketDestination
                        {
                            AccountId       = "599169622985",
                            BucketName      = "arn:aws:s3:::" + bucketName,
                            InventoryFormat = InventoryFormat.CSV,
                            Prefix          = "prefix"
                        }
                    },
                    IsEnabled       = true,
                    InventoryFilter = new InventoryFilter()
                    {
                        InventoryFilterPredicate = new InventoryPrefixPredicate("string")
                    },
                    InventoryId             = "configId",
                    IncludedObjectVersions  = InventoryIncludedObjectVersions.All,
                    InventoryOptionalFields = new List <InventoryOptionalField> {
                        InventoryOptionalField.Size,
                        InventoryOptionalField.LastModifiedDate,
                        InventoryOptionalField.StorageClass,
                        InventoryOptionalField.ETag,
                        InventoryOptionalField.IsMultipartUploaded,
                        InventoryOptionalField.ReplicationStatus,
                        InventoryOptionalField.EncryptionStatus,
                        InventoryOptionalField.ObjectLockRetainUntilDate,
                        InventoryOptionalField.ObjectLockMode,
                        InventoryOptionalField.ObjectLockLegalHoldStatus,
                    },
                    Schedule = new InventorySchedule
                    {
                        Frequency = InventoryFrequency.Daily
                    }
                }
            };
            var putBucketInventoryConfigurationResponse = Client.PutBucketInventoryConfiguration(putBucketInventoryConfigurationRequest);

            GetBucketInventoryConfigurationRequest getBucketInventoryConfigurationRequest = new GetBucketInventoryConfigurationRequest()
            {
                BucketName  = bucketName,
                InventoryId = "configId"
            };

            var getBucketInventoryConfigurationResponse = S3TestUtils.WaitForConsistency(() =>
            {
                var res = Client.GetBucketInventoryConfiguration(getBucketInventoryConfigurationRequest);
                return(res.InventoryConfiguration?.InventoryId == putBucketInventoryConfigurationRequest.InventoryConfiguration.InventoryId ? res : null);
            });

            var getInventoryConfiguration = getBucketInventoryConfigurationResponse.InventoryConfiguration;
            var putInventoryConfiguration = putBucketInventoryConfigurationRequest.InventoryConfiguration;

            GetBucketInventoryAndValidate(getInventoryConfiguration, putInventoryConfiguration);

            ListBucketInventory();

            DeleteInventoryAndValidate();
        }