How to use import_certificate method in localstack

Best Python code snippet using localstack_python

acm.py

Source:acm.py Github

copy

Full Screen

...133 @AWSRetry.backoff(tries=5, delay=5, backoff=2.0)134 def import_certificate_with_backoff(self, client, certificate, private_key, certificate_chain, arn):135 if certificate_chain:136 if arn:137 ret = client.import_certificate(Certificate=to_bytes(certificate),138 PrivateKey=to_bytes(private_key),139 CertificateChain=to_bytes(certificate_chain),140 CertificateArn=arn)141 else:142 ret = client.import_certificate(Certificate=to_bytes(certificate),143 PrivateKey=to_bytes(private_key),144 CertificateChain=to_bytes(certificate_chain))145 else:146 if arn:147 ret = client.import_certificate(Certificate=to_bytes(certificate),148 PrivateKey=to_bytes(private_key),149 CertificateArn=arn)150 else:151 ret = client.import_certificate(Certificate=to_bytes(certificate),152 PrivateKey=to_bytes(private_key))153 return ret['CertificateArn']154 # Tags are a normal Ansible style dict155 # {'Key':'Value'}156 @AWSRetry.backoff(tries=5, delay=5, backoff=2.0, catch_extra_error_codes=['ResourceNotFoundException', 'RequestInProgressException'])157 def tag_certificate_with_backoff(self, client, arn, tags):158 aws_tags = ansible_dict_to_boto3_tag_list(tags)159 client.add_tags_to_certificate(CertificateArn=arn, Tags=aws_tags)160 def import_certificate(self, client, module, certificate, private_key, arn=None, certificate_chain=None, tags=None):161 original_arn = arn162 # upload cert163 try:164 arn = self.import_certificate_with_backoff(client, certificate, private_key, certificate_chain, arn)165 except (BotoCoreError, ClientError) as e:166 module.fail_json_aws(e, msg="Couldn't upload new certificate")167 if original_arn and (arn != original_arn):168 # I'm not sure whether the API guarentees that the ARN will not change169 # I'm failing just in case.170 # If I'm wrong, I'll catch it in the integration tests.171 module.fail_json(msg="ARN changed with ACM update, from %s to %s" % (original_arn, arn))172 # tag that cert173 try:174 self.tag_certificate_with_backoff(client, arn, tags)...

Full Screen

Full Screen

stock.py

Source:stock.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2##############################################################################3#4# OpenERP, Open Source Management Solution5# Copyright (C) 2013-2014 ZestyBeanz Technologies Pvt Ltd(<http://www.zbeanztech.com>).6#7# This program is free software: you can redistribute it and/or modify8# it under the terms of the GNU Affero General Public License as9# published by the Free Software Foundation, either version 3 of the10# License, or (at your option) any later version.11#12# This program is distributed in the hope that it will be useful,13# but WITHOUT ANY WARRANTY; without even the implied warranty of14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15# GNU Affero General Public License for more details.16#17# You should have received a copy of the GNU Affero General Public License18# along with this program. If not, see <http://www.gnu.org/licenses/>.19#20##############################################################################21from openerp.osv import fields, osv22class stock_move(osv.osv):23 _inherit = 'stock.move'24 _columns = {25 'certificate_id': fields.many2one('product.import.certificate', 'Product Import Certificate'),26 'import_certificate': fields.boolean('Import_Certificate'),27 }28 def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False,29 loc_dest_id=False, partner_id=False):30 value = super(stock_move, self).onchange_product_id(cr, uid, ids, prod_id, loc_id, loc_dest_id, partner_id)31 import_certificate = False32 product = self.pool.get('product.product').browse(cr, uid, prod_id)33 if product.import_certificate:34 import_certificate = True35 result = value['value']36 result.update({'import_certificate' : import_certificate})37 value.update({'value': result})38 return value39stock_move()...

Full Screen

Full Screen

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