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

Add hardware type and linode label fields to volume struct #604

Merged
merged 6 commits into from
Dec 4, 2024

Conversation

zliang-akamai
Copy link
Member

📝 Description

This is to add missing fields in Volume struct.

✔️ How to Test

Automated Testing

make fixtures ARGS="-run TestVolume"    

Manual Testing

package main

import (
	"context"
	"fmt"
	"log"
	"net/http"
	"os"

	"github.com/linode/linodego"
	"golang.org/x/oauth2"
)

func main() {
	apiKey, ok := os.LookupEnv("LINODE_TOKEN")
	if !ok {
		log.Fatal("Could not find LINODE_TOKEN, please assert it is set.")
	}
	tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: apiKey})

	oauth2Client := &http.Client{
		Transport: &oauth2.Transport{
			Source: tokenSource,
		},
	}

	linodeClient := linodego.NewClient(oauth2Client)
	linodeClient.SetDebug(true)

	l, _ := linodeClient.CreateInstance(
		context.Background(),
		linodego.InstanceCreateOptions{
			Region: "us-mia",
			Type: "g6-nanode-1",
			Image: "linode/ubuntu24.04",
			RootPass: "unsafe-password-please-replace",
		},
	)

	
	v, _ := linodeClient.CreateVolume(
		context.Background(),
		linodego.VolumeCreateOptions{
			Label: "mytestvolume",
			Region: "us-mia",
			Size: 20,
			LinodeID: l.ID,
		},
	)

	fmt.Println(v.HardwareType, v.LinodeLabel)

	linodeClient.DeleteInstance(context.Background(), l.ID)
	linodeClient.DeleteVolume(context.Background(), v.ID)
}

@zliang-akamai zliang-akamai added the new-feature for new features in the changelog. label Nov 5, 2024
@zliang-akamai zliang-akamai requested a review from a team as a code owner November 5, 2024 07:40
@zliang-akamai zliang-akamai requested review from ykim-akamai and yec-akamai and removed request for a team November 5, 2024 07:40
Copy link
Contributor

@ykim-akamai ykim-akamai left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Can you update test case and fixtures?

@zliang-akamai zliang-akamai force-pushed the zhiwei/volume-api-parity branch from 1d414b8 to 45b354f Compare November 28, 2024 06:01
Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Nice work, thank you for adding the tests!

@zliang-akamai zliang-akamai merged commit 7212ba9 into linode:main Dec 4, 2024
7 checks passed
@zliang-akamai zliang-akamai deleted the zhiwei/volume-api-parity branch December 4, 2024 12:07
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.

3 participants