Skip to content

new: Allow defining interfaces on Instance creation - #372

Merged
yec-akamai merged 2 commits into
devfrom
TPT-2506/allow-interfaces-on-instance-creation
Feb 26, 2024
Merged

new: Allow defining interfaces on Instance creation#372
yec-akamai merged 2 commits into
devfrom
TPT-2506/allow-interfaces-on-instance-creation

Conversation

@yec-akamai

@yec-akamai yec-akamai commented Feb 22, 2024

Copy link
Copy Markdown
Contributor

📝 Description

We allow user to explicitly pass a list of interfaces as ConfigInterface class or a dict when creating a Linode instance.

Addressed issue #350

✔️ How to Test

Unit test:
tox

Integration test:
make TEST_CASE=test_create_linode_with_interfaces testint

Manual test

  1. In a sandbox environment, run the following code:
from linode_api4 import LinodeClient
from linode_api4.objects import ConfigInterface

    client = LinodeClient(os.getenv("LINODE_TOKEN"))
    
    linode_instance, password = client.linode.instance_create(
        "g6-nanode-1",
        "us-east",
        label="test-instance",
        image="linode/debian10",
        interfaces=[
            {"purpose": "public"},
            ConfigInterface(
                purpose="vlan", label="cool-vlan", ipam_address="10.0.0.4/32"
            ),
        ],
    )
    
    print(linode_instance.configs[0].interfaces[0].purpose)
  1. Observe the first interface's purpose is printed out correctly.

@yec-akamai
yec-akamai requested a review from a team as a code owner February 22, 2024 21:09
@yec-akamai
yec-akamai requested review from lgarber-akamai and ykim-akamai and removed request for a team February 22, 2024 21:09
Comment thread linode_api4/groups/linode.py Outdated

@lgarber-akamai lgarber-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unit tests and manual test steps are working locally, great work!

@zliang-akamai zliang-akamai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tests passed, LGTM!

@yec-akamai
yec-akamai merged commit 10ad316 into dev Feb 26, 2024
@yec-akamai
yec-akamai deleted the TPT-2506/allow-interfaces-on-instance-creation branch February 26, 2024 17:21
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

Successfully merging this pull request may close these issues.

3 participants