How to use put_bucket_inventory_configuration method in localstack

Best Python code snippet using localstack_python

test_bucket_inventory.py

Source: test_bucket_inventory.py Github

copy

Full Screen

...48 included_object_versions=INVENTORY_INCLUDED_OBJECT_VERSIONS_ALL,49 inventory_filter=InventoryFilter(prefix="obj-prefix"),50 optional_fields=optional_fields,51 inventory_destination=InventoryDestination(bucket_destination=bucket_destination))52 self.bucket1.put_bucket_inventory_configuration(inventory_configuration);53 result = self.bucket1.get_bucket_inventory_configuration(inventory_id = inventory_id);54 self.assertEquals(inventory_id, result.inventory_id)55 self.assertEquals(True, result.is_enabled)56 self.assertEquals(INVENTORY_FREQUENCY_WEEKLY, result.inventory_schedule.frequency)57 self.assertEquals(INVENTORY_INCLUDED_OBJECT_VERSIONS_ALL, result.included_object_versions)58 self.assertEquals("obj-prefix", result.inventory_filter.prefix)59 self.assertEquals(len(optional_fields), len(result.optional_fields))60 ret_bucket_destin = result.inventory_destination.bucket_destination61 self.assertEquals(OSS_INVENTORY_BUCKET_DESTINATION_ACCOUNT, ret_bucket_destin.account_id)62 self.assertEquals(OSS_INVENTORY_BUCKET_DESTINATION_ARN, ret_bucket_destin.role_arn)63 self.assertEquals(dest_bucket_name, ret_bucket_destin.bucket)64 self.assertEquals(INVENTORY_FORMAT_CSV, ret_bucket_destin.inventory_format)65 self.assertEquals("destination-prefix", ret_bucket_destin.prefix)66 self.assertIsNone(ret_bucket_destin.sse_kms_encryption)67 self.assertIsNotNone(ret_bucket_destin.sse_oss_encryption)68 self.bucket1.delete_bucket_inventory_configuration(inventory_id)69 dest_bucket.delete_bucket()70 def test_error_bucket_encryption(self):71 # both encryption set.72 self.assertRaises(oss2.exceptions.ClientError, InventoryBucketDestination,73 account_id=OSS_INVENTORY_BUCKET_DESTINATION_ACCOUNT, 74 role_arn=OSS_INVENTORY_BUCKET_DESTINATION_ARN,75 bucket="test-bucket-name",76 inventory_format=INVENTORY_FORMAT_CSV,77 prefix="test-",78 sse_kms_encryption = InventoryServerSideEncryptionKMS("test-kms-id"),79 sse_oss_encryption=InventoryServerSideEncryptionOSS()) 80 def test_list_few_bucket_inventory(self):81 auth = oss2.Auth(OSS_ID, OSS_SECRET)82 dest_bucket_name = OSS_BUCKET + "-test-inventory-dest"83 dest_bucket = oss2.Bucket(auth, self.endpoint, dest_bucket_name)84 dest_bucket.create_bucket()85 inventory_id_prefix = "test-id-"86 for index in range(0, 3):87 inventory_id = inventory_id_prefix + str(index)88 optional_fields = [FIELD_SIZE, FIELD_LAST_MODIFIED_DATE, FIELD_STORAG_CLASS,89 FIELD_ETAG, FIELD_IS_MULTIPART_UPLOADED, FIELD_ENCRYPTION_STATUS]90 bucket_destination = InventoryBucketDestination(91 account_id=OSS_INVENTORY_BUCKET_DESTINATION_ACCOUNT, 92 role_arn=OSS_INVENTORY_BUCKET_DESTINATION_ARN,93 bucket=dest_bucket_name,94 inventory_format=INVENTORY_FORMAT_CSV,95 prefix="destination-prefix",96 sse_kms_encryption=InventoryServerSideEncryptionKMS("test-kms-id"))97 inventory_configuration = InventoryConfiguration(98 inventory_id=inventory_id,99 is_enabled=True, 100 inventory_schedule=InventorySchedule(frequency=INVENTORY_FREQUENCY_DAILY),101 included_object_versions=INVENTORY_INCLUDED_OBJECT_VERSIONS_CURRENT,102 inventory_filter=InventoryFilter(prefix="obj-prefix"),103 optional_fields=optional_fields,104 inventory_destination=InventoryDestination(bucket_destination=bucket_destination))105 self.bucket1.put_bucket_inventory_configuration(inventory_configuration);106 107 # test with param empty108 result = self.bucket1.list_bucket_inventory_configurations('')109 self.assertEquals(3, len(result.inventory_configurations))110 self.assertEquals(False, result.is_truncated)111 self.assertEquals(None, result.continuaiton_token)112 self.assertEquals(None, result.next_continuation_token)113 # test with param None114 result = self.bucket1.list_bucket_inventory_configurations()115 self.assertEquals(3, len(result.inventory_configurations))116 self.assertEquals(False, result.is_truncated)117 self.assertEquals(None, result.continuaiton_token)118 self.assertEquals(None, result.next_continuation_token)119 dest_bucket.delete_bucket()120 def test_list_lot_bucket_inventory(self):121 auth = oss2.Auth(OSS_ID, OSS_SECRET)122 dest_bucket_name = OSS_BUCKET + "-test-inventory-dest"123 dest_bucket = oss2.Bucket(auth, self.endpoint, dest_bucket_name)124 dest_bucket.create_bucket()125 inventory_id_prefix = "test-id-"126 for index in range(0, 120):127 inventory_id = inventory_id_prefix + str(index)128 optional_fields = [FIELD_SIZE, FIELD_LAST_MODIFIED_DATE, FIELD_STORAG_CLASS,129 FIELD_ETAG, FIELD_IS_MULTIPART_UPLOADED, FIELD_ENCRYPTION_STATUS]130 bucket_destination = InventoryBucketDestination(131 account_id=OSS_INVENTORY_BUCKET_DESTINATION_ACCOUNT, 132 role_arn=OSS_INVENTORY_BUCKET_DESTINATION_ARN,133 bucket=dest_bucket_name,134 inventory_format=INVENTORY_FORMAT_CSV,135 prefix="destination-prefix",136 sse_kms_encryption=InventoryServerSideEncryptionKMS("test-kms-id"))137 inventory_configuration = InventoryConfiguration(138 inventory_id=inventory_id,139 is_enabled=True, 140 inventory_schedule=InventorySchedule(frequency=INVENTORY_FREQUENCY_DAILY),141 included_object_versions=INVENTORY_INCLUDED_OBJECT_VERSIONS_CURRENT,142 inventory_filter=InventoryFilter(prefix="obj-prefix"),143 optional_fields=optional_fields,144 inventory_destination=InventoryDestination(bucket_destination=bucket_destination))145 self.bucket1.put_bucket_inventory_configuration(inventory_configuration);146 result = self.bucket1.list_bucket_inventory_configurations()147 self.assertEquals(100, len(result.inventory_configurations))148 self.assertEquals(True, result.is_truncated)149 self.assertEquals(None, result.continuaiton_token)150 self.assertIsNotNone(result.next_continuation_token)151 next_continuation_token = result.next_continuation_token152 result = self.bucket1.list_bucket_inventory_configurations(next_continuation_token)153 self.assertEquals(20, len(result.inventory_configurations))154 self.assertEquals(False, result.is_truncated)155 self.assertEquals(next_continuation_token, result.continuaiton_token)156 self.assertEquals(None, result.next_continuation_token)157 dest_bucket.delete_bucket()158 def test_list_none_inventory(self):159 self.assertRaises(oss2.exceptions.NoSuchInventory, self.bucket1.list_bucket_inventory_configurations)...

Full Screen

Full Screen

bucket_put_inventory.py

Source: bucket_put_inventory.py Github

copy

Full Screen

...26import boto327if __name__ == "__main__":28 client = boto3.client('s3')29 bucketname = "us-west-2.nag"30 inventory_config = client.put_bucket_inventory_configuration(Bucket=bucketname, InventoryConfiguration=config, Id="nag")...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

A Reconsideration of Software Testing Metrics

There is just one area where each member of the software testing community has a distinct point of view! Metrics! This contentious issue sparks intense disputes, and most conversations finish with no definitive conclusion. It covers a wide range of topics: How can testing efforts be measured? What is the most effective technique to assess effectiveness? Which of the many components should be quantified? How can we measure the quality of our testing performance, among other things?

How To Run Cypress Tests In Azure DevOps Pipeline

When software developers took years to create and introduce new products to the market is long gone. Users (or consumers) today are more eager to use their favorite applications with the latest bells and whistles. However, users today don’t have the patience to work around bugs, errors, and design flaws. People have less self-control, and if your product or application doesn’t make life easier for users, they’ll leave for a better solution.

The Art of Testing the Untestable

It’s strange to hear someone declare, “This can’t be tested.” In reply, I contend that everything can be tested. However, one must be pleased with the outcome of testing, which might include failure, financial loss, or personal injury. Could anything be tested when a claim is made with this understanding?

Test Managers in Agile – Creating the Right Culture for Your SQA Team

I was once asked at a testing summit, “How do you manage a QA team using scrum?” After some consideration, I realized it would make a good article, so here I am. Understand that the idea behind developing software in a scrum environment is for development teams to self-organize.

Two-phase Model-based Testing

Most test automation tools just do test execution automation. Without test design involved in the whole test automation process, the test cases remain ad hoc and detect only simple bugs. This solution is just automation without real testing. In addition, test execution automation is very inefficient.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful