Best Python code snippet using localstack_python
minio_bucket_info.py
Source: minio_bucket_info.py
...219 return client.get_bucket_tags(module.params['bucket'])220 elif module.params['get_bucket_policy']:221 return client.get_bucket_policy(module.params['bucket'])222 elif module.params['get_bucket_notification']:223 _res = client.get_bucket_notification(module.params['bucket'])224 return {225 "cloud_func_config_list": _res.cloud_func_config_list,226 "queue_config_list": _res.queue_config_list,227 "topic_config_list": _res.topic_config_list,228 }229 elif module.params['get_bucket_encryption']:230 _res = client.get_bucket_encryption(module.params['bucket'])231 if _res is not None:232 return {233 "kms_id": _res.rule.kms_master_key_id,234 "sse_algorithm": _res.rule.sse_algorithm,235 "status": "enabled"236 }237 else:...
s3.py
Source: s3.py
1# -*- coding: utf-8 -*-2# Copyright (c) 2014, 2015 Mitch Garnaat3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15import kappa.event_source.base16import logging17LOG = logging.getLogger(__name__)18class S3EventSource(kappa.event_source.base.EventSource):19 def __init__(self, context, config):20 super(S3EventSource, self).__init__(context, config)21 self._s3 = kappa.awsclient.create_client('s3', context.session)22 def _make_notification_id(self, function_name):23 return 'Kappa-%s-notification' % function_name24 def _get_bucket_name(self):25 return self.arn.split(':')[-1]26 def add(self, function):27 notification_spec = {28 'LambdaFunctionConfigurations': [29 {30 'Id': self._make_notification_id(function.name),31 'Events': [e for e in self._config['events']],32 'LambdaFunctionArn': '%s:%s' % (function.arn, function._context.environment),33 }34 ]35 }36 # Add S3 key filters37 if 'key_filters' in self._config:38 filters_spec = { 'Key' : { 'FilterRules' : [] } }39 for filter in self._config['key_filters']:40 if 'type' in filter and 'value' in filter and filter['type'] in ('prefix', 'suffix'):41 rule = { 'Name' : filter['type'], 'Value' : filter['value'] }42 filters_spec['Key']['FilterRules'].append(rule)43 notification_spec['LambdaFunctionConfigurations'][0]['Filter'] = filters_spec44 try:45 response = self._s3.call(46 'put_bucket_notification_configuration',47 Bucket=self._get_bucket_name(),48 NotificationConfiguration=notification_spec)49 LOG.debug(response)50 except Exception as exc:51 LOG.debug(exc.response)52 LOG.exception('Unable to add S3 event source')53 enable = add54 def update(self, function):55 self.add(function)56 def remove(self, function):57 LOG.debug('removing s3 notification')58 response = self._s3.call(59 'get_bucket_notification',60 Bucket=self._get_bucket_name())61 LOG.debug(response)62 if 'CloudFunctionConfiguration' in response:63 fn_arn = response['CloudFunctionConfiguration']['CloudFunction']64 if fn_arn == function.arn:65 del response['CloudFunctionConfiguration']66 del response['ResponseMetadata']67 response = self._s3.call(68 'put_bucket_notification',69 Bucket=self._get_bucket_name(),70 NotificationConfiguration=response)71 LOG.debug(response)72 disable = remove73 def status(self, function):74 LOG.debug('status for s3 notification for %s', function.name)75 response = self._s3.call(76 'get_bucket_notification',77 Bucket=self._get_bucket_name())78 LOG.debug(response)79 if 'CloudFunctionConfiguration' not in response:80 return None81 return {82 'EventSourceArn': response['CloudFunctionConfiguration']['CloudFunction'],83 'State': 'Enabled'...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!