Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Image status as argument in list_images service #36

Open
greyhoundforty opened this issue May 18, 2022 · 1 comment
Open

Support Image status as argument in list_images service #36

greyhoundforty opened this issue May 18, 2022 · 1 comment

Comments

@greyhoundforty
Copy link

greyhoundforty commented May 18, 2022

Currently when using the SDK to list the available compute images in a given VPC region you get back a list of both available and deprecated images. While I can add the visibility option to only return Public or Private it would be handy to also have an argument for the status of images.

Code

vpcService = VpcV1(
    authenticator=authenticator,
    version=version_date
    )

vpcServiceRegion = 'https://' + os.environ.get('VPC_REGION') + '.iaas.cloud.ibm.com/v1'
vpcService.set_service_url(vpcServiceRegion)

getVpcImages = vpcService.list_images().get_result()
for image in getVpcImages['images']:
    print(image['status'])

Result

main ✗ $ python3 testing/get-ubuntu-images.py                                                                                                                                                                                

available
available
available
available
available
available
available
available
deprecated
available
available
available
available
available
available
available
available
available
available
available
available
available
available
deprecated
deprecated
deprecated
deprecated
deprecated
deprecated
deprecated
deprecated
deprecated
deprecated
deprecated
deprecated
deprecated

Given that the API only returns a limit of 100 images per call, it is on the end user to loop through all of the images using pagination and then filter based on status. Allowing something like this would make it easier to just deal with images that can actually be deployed:

getVpcImages = vpcService.list_images(status=available).get_result()
@astha-jain
Copy link
Member

This is a feature enhancement request being looked at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants