Skip to content

new: Support available for AccountAvailability#491

Merged
yec-akamai merged 2 commits intomainfrom
TPT-2815/support-available
Apr 17, 2024
Merged

new: Support available for AccountAvailability#491
yec-akamai merged 2 commits intomainfrom
TPT-2815/support-available

Conversation

@yec-akamai
Copy link
Contributor

📝 Description

AccountAvailability now returns both available and unavailable resources in a region.

✔️ How to Test

make testunit
make testint

This change currently is only available in Alpha. The production release is scheduled in the next week.

To test against alpha, you'll need to set up the dev url and api token.

export LINODE_URL=https://api.dev.linode.com/
export LINODE_API_VERSION=v4beta
export LINODE_TOKEN=...
  1. In a sandbox environment, run the following code block
import (
	"context"
	"fmt"
	"os"

	"github.com/linode/linodego"
)

func main() {
	client := linodego.NewClient(nil)
	client.SetToken(os.Getenv("LINODE_TOKEN"))

	availabilities, err := client.ListAccountAvailabilities(context.Background(), &linodego.ListOptions{})
	if err != nil {
		panic(err)
	}

	if len(availabilities) > 0 {
		fmt.Printf("region: %v, available: %v, unavailable: %v \n", availabilities[0].Region, availabilities[0].Available, availabilities[0].Unavailable)

		availability, err := client.GetAccountAvailability(context.Background(), availabilities[0].Region)
		if err != nil {
			panic(err)
		}

		fmt.Printf("region: %v, available: %v, unavailable: %v", availability.Region, availability.Available, availability.Unavailable)
	}
}
  1. Observe that no error is raised and the two availability info printed are identical.

@yec-akamai yec-akamai added new-feature for new features in the changelog. do-not-merge PRs that should not be merged until the commented issue is resolved labels Apr 12, 2024
@yec-akamai yec-akamai requested a review from a team as a code owner April 12, 2024 18:02
@yec-akamai yec-akamai requested review from jriddle-linode and lgarber-akamai and removed request for a team April 12, 2024 18:02
Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

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

Works well for me when using the manual testing steps locally, nice work!

@zliang-akamai
Copy link
Member

@yec-akamai Everything looks good! Let's do a fixtures regenerate make ARGS="-run TestAccountAvailability" fixtures to fix the automated tests.

@zliang-akamai zliang-akamai self-requested a review April 16, 2024 19:37
@yec-akamai yec-akamai removed the do-not-merge PRs that should not be merged until the commented issue is resolved label Apr 16, 2024
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.

Works perfectly, nice work!

@yec-akamai yec-akamai merged commit be75a51 into main Apr 17, 2024
@yec-akamai yec-akamai deleted the TPT-2815/support-available branch April 17, 2024 17:06
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