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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

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?

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