How to use describe_export_image_tasks method in localstack

Best Python code snippet using localstack_python

poll_ami_status.py

Source:poll_ami_status.py Github

copy

Full Screen

...57 raise ValueError(msg)58 ami_state = ami_response['Images'][0]['State']59 # aws only allows 1 active vmdk export task at a time60 # make sure there are no active exports before proceeding61 export_response = ec2_client.describe_export_image_tasks(62 Filters=[63 {64 'Name': 'task-state',65 'Values': [66 'active',67 'deleting'68 ]69 }70 ]71 )72 logger.debug("export_response")73 logger.debug(export_response)74 active_vmdk_export_tasks = False75 if len(export_response['ExportImageTasks']) > 0:...

Full Screen

Full Screen

vmdkexportcompleted_function.py

Source:vmdkexportcompleted_function.py Github

copy

Full Screen

...19 export_image_task_id = event["export_image_task_id"]20 logger.debug(f"export_image_task_id = {export_image_task_id}")21 # check if the ami export is in the completed state22 ec2_client = boto3.client('ec2')23 response = ec2_client.describe_export_image_tasks(24 ExportImageTaskIds=[25 export_image_task_id26 ]27 )28 logger.info(f"Checking if AMI export is in completed state")29 30 # return a NOT_COMPLETED state if the ami export is not completed31 vdmk_export_status = "NOT_COMPLETED"32 if len(response['ExportImageTasks']) > 0:33 for export_task in response['ExportImageTasks']:34 if export_task['ExportImageTaskId'] == export_image_task_id:35 logger.info(f"Got task id match: {export_task['ExportImageTaskId']}")36 vdmk_export_status = str(export_task['Status']).upper()37 logger.info(f"Current AMI export state: {vdmk_export_status}")...

Full Screen

Full Screen

export_image_task.py

Source:export_image_task.py Github

copy

Full Screen

1from typing import Optional, List, Dict2from exasol_script_languages_developer_sandbox.lib.aws_access.common import get_value_safe3class ExportImageTask:4 """5 Simplifies access to objects returned from:6 https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_export_image_tasks7 """8 def __init__(self, aws_object):9 self._aws_object = aws_object10 @property11 def id(self) -> str:12 return self._aws_object["ExportImageTaskId"]13 @property14 def description(self) -> str:15 return self._aws_object["Description"]16 @property17 def status(self) -> str:18 return self._aws_object["Status"]19 @property20 def status_message(self) -> str:21 return get_value_safe("StatusMessage", self._aws_object)22 @property23 def progress(self) -> str:24 return get_value_safe("Progress", self._aws_object)25 @property26 def s3_bucket(self):27 return self._aws_object["S3ExportLocation"]["S3Bucket"]28 @property29 def s3_prefix(self) -> str:30 return self._aws_object["S3ExportLocation"]["S3Prefix"]31 @property32 def is_active(self) -> bool:33 return self.status == "active"34 @property35 def is_completed(self) -> bool:36 return self.status == "completed"37 @property38 def tags(self) -> Optional[List[Dict[str, str]]]:39 if "Tags" in self._aws_object:...

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