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 = Client.GetBucketMetricsConfiguration(getBucketMetricsConfigurationRequest); 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 MetricsTagPredicate(Tag tag) { this.tag = tag; }
internal static void SerializeTagToXml(XmlWriter xmlWriter, Tag tag) { xmlWriter.WriteStartElement("Tag", ""); if (tag.IsSetKey()) { xmlWriter.WriteElementString("Key", "", S3Transforms.ToXmlStringValue(tag.Key)); } if (tag.IsSetValue()) { xmlWriter.WriteElementString("Value", "", S3Transforms.ToXmlStringValue(tag.Value)); } xmlWriter.WriteEndElement(); }
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 = Client.GetBucketMetricsConfiguration(getBucketMetricsConfigurationRequest); 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 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 = Client.GetBucketAnalyticsConfiguration(getBucketAnalyticsConfigurationRequest); 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 AnalyticsTagPredicate(Tag tag) { this.tag = tag; }