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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

new: Support Image Gen2 functionalities #428

Open
wants to merge 7 commits into
base: proj/image-gen2
Choose a base branch
from

Conversation

yec-akamai
Copy link
Contributor

@yec-akamai yec-akamai commented Jun 24, 2024

馃摑 Description

Support the new image fields, including tags, total_size, regions. Support image replication.

鉁旓笍 How to Test

Unite test:

make testunit

Before running the integration test, you'll need to set up these environment variables:

export LINODE_API_URL=https://.../v4
export LINODE_API_CA=$PWD/cacert.pem
export LINODE_TOKEN=...

Integration test:

make testint TEST_SUITE=linode_client
make testint TEST_SUITE=image TEST_CASE=test_image_create_upload
make testint TEST_SUITE=image TEST_CASE=test_get_image

# replication is not functional yet
# make testint TEST_SUITE=image TEST_CASE=test_image_replication

Manual Test

  1. In a sandbox environment, run the following to create an image with tags:
import os
from linode_api4 import LinodeClient

client = LinodeClient(
        os.getenv("LINODE_TOKEN"),
        base_url="https://.../v4",
        ca_path=".../CA.pem",
)
    
linode, _ = client.linode.instance_create(
    "g6-nanode-1",
    "us-east",
    label="test-image-gen2",
    image="linode/alpine3.19",
)

image = client.image_create(
    disk=linode.disks[0].id, label="image-gen-2", description="Test", tags=["test", "image-gen2"]
)

print(image.tags)
print(image.total_size)
# regions is expected to be empty here since it's not properly functional yet
print(image.regions)

linode.delete()
image.delete()
  1. Observe that new fields tags, total_size, and regions are populated.

@yec-akamai yec-akamai requested a review from a team as a code owner June 24, 2024 20:13
@yec-akamai yec-akamai requested review from zliang-akamai and ykim-1 and removed request for a team June 24, 2024 20:13
@yec-akamai yec-akamai added the new-feature for new features in the changelog. label Jun 26, 2024
label: str,
region: str,
file: BinaryIO,
description: str = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: str = None,
description: Optional[str] = None,

Same rule actually applied to str as well, lol

Copy link
Member

@zliang-akamai zliang-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great, and it's tested. Nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature for new features in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants