Best Python code snippet using localstack_python
upload.py
Source:upload.py  
...79    log_key = tar_key + '.log'80    name = construct_name(args.ImageName, args.ImageVersion, args.configuration[0])81    desc = args.Description[0]82    print("Processing {}".format(tar_key))83    rsp = ec2.create_fpga_image(84        InputStorageLocation={85            'Bucket': bucket.name,86            'Key': tar_key87        },88        LogsStorageLocation={89            'Bucket': bucket.name,90            'Key': log_key91        },92        Description=desc,93        Name=name,94        DryRun=args.dryrun95    )96    tags = [{'Key':n,'Value':h['commit']} for (n,h) in args.r.items()]97    tags.append({'Key':'Version','Value':args.ImageVersion})...afihelper
Source:afihelper  
...101ec2 = boto3.resource('ec2')102token = uuid.uuid4().hex103description = args.description or 'Created from {} at {}'.format(104    fname, datetime.datetime.now().isoformat())105response = ec2.meta.client.create_fpga_image(106    DryRun=args.dry_run,107    InputStorageLocation={108        'Bucket': args.bucket,109        'Key': fname110    },111    LogsStorageLocation={112        'Bucket': args.bucket,113        'Key': 'logs'114    },115    Description=description,116    Name=args.name,117    ClientToken=token118)119print('FpgaImageGlobalId = {}'.format(response['FpgaImageGlobalId']))...test_create_afi.py
Source:test_create_afi.py  
...76            dcp_tarball = self.get_dcp_tarball(cl)77        78        # Create the AFI79        dcp_key = os.path.join(self.get_cl_s3_dcp_tag(cl, option_tag), basename(dcp_tarball))80        create_afi_response = self.ec2_client().create_fpga_image(InputStorageLocation={'Bucket': self.s3_bucket, 'Key': dcp_key})81        afi = create_afi_response['FpgaImageId']82        agfi = create_afi_response['FpgaImageGlobalId']83        logger.info("afi={}".format(afi))84        logger.info("agfi={}".format(agfi))85        86        # Write IDs to S3 for use by downstream tests87        id_filename = self.get_cl_afi_id_filename(cl)88        id_filename_dir = dirname(id_filename)89        id_filename_key = self.get_cl_s3_afi_tag(cl, option_tag)90        if not os.path.exists(id_filename_dir):91            os.makedirs(id_filename_dir)92        fh = open(id_filename, 'w')93        fh.write("{}\n{}\n".format(afi, agfi))94        fh.close()...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!!
